Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): set-federated-power: use correct signer middleware. #813

Merged
merged 2 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ipc/cli/src/commands/subnet/set_federated_power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 7 additions & 9 deletions ipc/provider/src/manager/evm/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ethers::core::types::Address> = 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<ethers::core::types::Bytes> = 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<ethers::core::types::U256> = 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?;
Expand Down
Loading