Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
update review
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAtwill committed Oct 9, 2023
1 parent 1a739db commit 9e3756e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions ipc/cli/src/commands/subnet/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use std::str::FromStr;
use crate::commands::get_ipc_provider;
use crate::{f64_to_token_amount, CommandLineHandler, GlobalArguments};

const DEFAULT_ACTIVE_VALIDATORS: u16 = 100;

/// The command to create a new subnet actor.
pub struct CreateSubnet;

Expand All @@ -36,7 +38,7 @@ impl CreateSubnet {
arguments.min_validators,
f64_to_token_amount(arguments.min_validator_stake)?,
arguments.bottomup_check_period,
arguments.active_validators_limit,
arguments.active_validators_limit.unwrap_or(DEFAULT_ACTIVE_VALIDATORS),
)
.await?;

Expand Down Expand Up @@ -79,5 +81,5 @@ pub struct CreateSubnetArgs {
#[arg(long, help = "The bottom up checkpoint period in number of blocks")]
pub bottomup_check_period: ChainEpoch,
#[arg(long, help = "The max number of active validators in subnet")]
pub active_validators_limit: u16,
pub active_validators_limit: Option<u16>,
}
9 changes: 4 additions & 5 deletions ipc/cli/src/commands/subnet/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ impl CommandLineHandler for JoinSubnet {
Some(address) => Some(Address::from_str(address)?),
None => None,
};
let metadata =
base64::engine::general_purpose::STANDARD_NO_PAD.decode(&arguments.metadata)?;
let public_key = hex::decode(&arguments.public_key)?;
provider
.join_subnet(
subnet,
from,
f64_to_token_amount(arguments.collateral)?,
metadata,
public_key,
)
.await
}
Expand All @@ -53,6 +52,6 @@ pub struct JoinSubnetArgs {
help = "The collateral to stake in the subnet (in whole FIL units)"
)]
pub collateral: f64,
#[arg(long, short, help = "The validator's metadata, base64 encoded")]
pub metadata: String,
#[arg(long, short, help = "The validator's metadata, hex encoded")]
pub public_key: String,
}
4 changes: 2 additions & 2 deletions ipc/provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ impl IpcProvider {
subnet: SubnetID,
from: Option<Address>,
collateral: TokenAmount,
metadata: Vec<u8>,
public_key: Vec<u8>,
) -> anyhow::Result<()> {
let parent = subnet.parent().ok_or_else(|| anyhow!("no parent found"))?;
let conn = match self.connection(&parent) {
Expand All @@ -274,7 +274,7 @@ impl IpcProvider {
let sender = self.check_sender(subnet_config, from)?;

conn.manager()
.join_subnet(subnet, sender, collateral, metadata)
.join_subnet(subnet, sender, collateral, public_key)
.await
}

Expand Down

0 comments on commit 9e3756e

Please sign in to comment.