From 960b546d9c64fb29669718366015dc52214fd374 Mon Sep 17 00:00:00 2001 From: raulk Date: Sun, 17 Mar 2024 17:21:00 +0000 Subject: [PATCH 1/2] fix(cli): set-federated-power: use correct signer middleware. --- .../src/commands/subnet/set_federated_power.rs | 5 ++++- ipc/provider/src/manager/evm/manager.rs | 16 +++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ipc/cli/src/commands/subnet/set_federated_power.rs b/ipc/cli/src/commands/subnet/set_federated_power.rs index 529cba7ea..ef28687f4 100644 --- a/ipc/cli/src/commands/subnet/set_federated_power.rs +++ b/ipc/cli/src/commands/subnet/set_federated_power.rs @@ -53,7 +53,10 @@ impl CommandLineHandler for crate::commands::subnet::SetFederatedPower { } #[derive(Debug, Args)] -#[command(name = "stake", about = "Set federated power for validators")] +#[command( + name = "set-federated-power", + about = "Set federated power for validators" +)] pub struct SetFederatedPowerArgs { #[arg(long, help = "The address to sign and pay for this transaction.")] pub from: String, diff --git a/ipc/provider/src/manager/evm/manager.rs b/ipc/provider/src/manager/evm/manager.rs index 04d5e9578..f628e1ae7 100644 --- a/ipc/provider/src/manager/evm/manager.rs +++ b/ipc/provider/src/manager/evm/manager.rs @@ -810,32 +810,30 @@ impl SubnetManager for EthSubnetManager { let address = contract_address_from_subnet(subnet)?; log::info!("interacting with evm subnet contract: {address:}"); - let contract = subnet_actor_manager_facet::SubnetActorManagerFacet::new( - address, - Arc::new(self.ipc_contract_info.provider.clone()), - ); + let signer = Arc::new(self.get_signer(&from)?); + let contract = + subnet_actor_manager_facet::SubnetActorManagerFacet::new(address, signer.clone()); let addresses: Vec = validators .iter() .map(|validator_address| payload_to_evm_address(validator_address.payload()).unwrap()) .collect(); - log::debug!("converted addresses {:?}:", addresses); + log::debug!("converted addresses: {:?}", addresses); let pubkeys: Vec = public_keys .iter() .map(|key| ethers::core::types::Bytes::from(key.clone())) .collect(); - log::debug!("converted pubkeys {:?}:", pubkeys); + log::debug!("converted pubkeys: {:?}", pubkeys); let power_u256: Vec = federated_power .iter() .map(|power| ethers::core::types::U256::from(*power)) .collect(); - log::debug!("converted power {:?}:", power_u256); + log::debug!("converted power: {:?}", power_u256); - log::debug!("from address {:?}:", from); + log::debug!("from address: {:?}", from); - let signer = Arc::new(self.get_signer(from)?); let call = contract.set_federated_power(addresses, pubkeys, power_u256); let txn = call_with_premium_estimation(signer, call).await?; let pending_tx = txn.send().await?; From dfafdc05f8f9ef5e3d49f5348fe9a07c1fb659f8 Mon Sep 17 00:00:00 2001 From: raulk Date: Sun, 17 Mar 2024 18:19:21 +0000 Subject: [PATCH 2/2] fix clippy. --- ipc/provider/src/manager/evm/manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/provider/src/manager/evm/manager.rs b/ipc/provider/src/manager/evm/manager.rs index f628e1ae7..d659f4de2 100644 --- a/ipc/provider/src/manager/evm/manager.rs +++ b/ipc/provider/src/manager/evm/manager.rs @@ -810,7 +810,7 @@ impl SubnetManager for EthSubnetManager { let address = contract_address_from_subnet(subnet)?; log::info!("interacting with evm subnet contract: {address:}"); - let signer = Arc::new(self.get_signer(&from)?); + let signer = Arc::new(self.get_signer(from)?); let contract = subnet_actor_manager_facet::SubnetActorManagerFacet::new(address, signer.clone());