Skip to content

Commit

Permalink
fix: Remove worker related functionality
Browse files Browse the repository at this point in the history
Since the storage providers will handle their own worker addresses it is
not needed to include the worker addresses in the pallet implementation.
  • Loading branch information
aidan46 committed May 30, 2024
1 parent b8f96d5 commit 6ca40cf
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions pallets/storage-provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,10 @@ pub mod pallet {
MinerCreated {
owner: T::AccountId,
},
ChangeWorkerAddressRequested {
miner: T::MinerAccountId,
new_worker: T::WorkerAddress,
},
PeerIdChanged {
miner: T::MinerAccountId,
peer_id: PeerId,
},
WorkerAddressChanged {
miner: T::MinerAccountId,
new_worker: T::WorkerAddress,
},
OwnerAddressChanged {
miner: T::MinerAccountId,
new_owner: T::AccountId,
Expand All @@ -98,7 +90,6 @@ pub mod pallet {
pub fn create_miner(
origin: OriginFor<T>,
owner: T::AccountId,
_worker: T::WorkerAddress,
_peer_id: PeerId,
) -> DispatchResultWithPostInfo {
// Check that the extrinsic was signed and get the signer.
Expand All @@ -112,28 +103,6 @@ pub mod pallet {
todo!()
}

/// Request to change a worker address for a given miner
#[pallet::call_index(1)]
pub fn change_worker_address(
origin: OriginFor<T>,
miner: T::MinerAccountId,
new_worker: T::WorkerAddress,
) -> DispatchResultWithPostInfo {
// Check that the extrinsic was signed and get the signer.
let _who = ensure_signed(origin)?;

// Get miner info from `Miners` with `who` value
// let miner_info = Miners::<T>::try_get(&miner);

// Ensure who is the owner of the miner
// ensure!(who == miner_info.owner)

// Flag miner as worker address change

Self::deposit_event(Event::ChangeWorkerAddressRequested { miner, new_worker });
todo!()
}

/// Update PeerId associated with a given miner.
#[pallet::call_index(2)]
pub fn change_peer_id(
Expand All @@ -156,27 +125,6 @@ pub mod pallet {
todo!()
}

/// Confirms the change of the worker address initiated by `change_worker_address`
#[pallet::call_index(3)]
pub fn confirm_change_worker_address(
origin: OriginFor<T>,
_miner: T::MinerAccountId,
) -> DispatchResultWithPostInfo {
// Check that the extrinsic was signed and get the signer.
let _who = ensure_signed(origin)?;

// Get miner info from `Miners` with `who` value
// let miner_info = Miners::<T>::try_get(&miner);

// Ensure who is the owner of the miner
// ensure!(who == miner_info.owner)

// Change worker address and extract `new_worker` for event emitted.

// Self::deposit_event(Event::WorkerAddressChanged { miner, new_worker });
todo!()
}

// This function updates the owner address to the given `new_owner` for the given `miner`
#[pallet::call_index(4)]
pub fn change_owner_address(
Expand Down

0 comments on commit 6ca40cf

Please sign in to comment.