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

IPC-304: add permissioned flag for new contract version #412

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion Cargo.lock

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

6 changes: 6 additions & 0 deletions ipc/cli/src/commands/subnet/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ impl CreateSubnet {
.active_validators_limit
.unwrap_or(DEFAULT_ACTIVE_VALIDATORS),
f64_to_token_amount(arguments.min_cross_msg_fee)?,
arguments.permissioned,
)
.await?;

Expand Down Expand Up @@ -96,4 +97,9 @@ pub struct CreateSubnetArgs {
help = "Minimum fee for cross-net messages in subnet (in whole FIL)"
)]
pub min_cross_msg_fee: f64,
#[arg(
long,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the conversion to long will be done automatically by the CLI library we use, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This long what specifies is that the cli will only expect the long form of the flag name i.e. --permissioned not the short version which would be -p.

help = "Deploy static network where validators can't join in a permissionless manner"
)]
pub permissioned: bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should where be a default value false/0 or do you want devs to explicitly decide it? (if so we'd need to update create subnet flows in docs too)

Copy link
Contributor Author

@adlrocha adlrocha Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for bool flags is already false. It will only be set to true if someone passes explicitly the flag.

}
4 changes: 3 additions & 1 deletion ipc/provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ impl IpcProvider {
bottomup_check_period: ChainEpoch,
active_validators_limit: u16,
min_cross_msg_fee: TokenAmount,
permissioned: bool,
) -> anyhow::Result<Address> {
let conn = match self.connection(&parent) {
None => return Err(anyhow!("target parent subnet not found")),
Expand All @@ -251,12 +252,13 @@ impl IpcProvider {
let constructor_params = ConstructParams {
parent,
ipc_gateway_addr: subnet_config.gateway_addr(),
consensus: ConsensusType::Mir,
consensus: ConsensusType::Fendermint,
min_validators,
min_validator_stake,
bottomup_check_period,
active_validators_limit,
min_cross_msg_fee,
permissioned,
};

conn.manager()
Expand Down
1 change: 1 addition & 0 deletions ipc/provider/src/manager/evm/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ impl SubnetManager for EthSubnetManager {
active_validators_limit: params.active_validators_limit,
power_scale: 3,
min_cross_msg_fee: ethers::types::U256::from(min_cross_msg_fee),
permissioned: params.permissioned,
};

log::info!("creating subnet on evm with params: {params:?}");
Expand Down
8 changes: 2 additions & 6 deletions ipc/sdk/src/subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@ pub struct ConstructParams {
pub bottomup_check_period: ChainEpoch,
pub active_validators_limit: u16,
pub min_cross_msg_fee: TokenAmount,
pub permissioned: bool,
}

/// Consensus types supported by hierarchical consensus
#[derive(PartialEq, Eq, Clone, Copy, Debug, Deserialize_repr, Serialize_repr)]
#[repr(u64)]
pub enum ConsensusType {
Mir,
}

#[derive(Clone, Debug, Serialize_tuple, Deserialize_tuple, PartialEq, Eq)]
pub struct JoinParams {
pub validator_net_addr: String,
Fendermint,
}
Loading