-
Notifications
You must be signed in to change notification settings - Fork 42
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(node): skip power scale if not collateral based #1149
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -4,15 +4,16 @@ | |||
use anyhow::{anyhow, Context}; | ||||
use fendermint_crypto::PublicKey; | ||||
use fvm_shared::address::Address; | ||||
use fvm_shared::econ::TokenAmount; | ||||
use ipc_provider::config::subnet::{EVMSubnet, SubnetConfig}; | ||||
use ipc_provider::IpcProvider; | ||||
use std::path::PathBuf; | ||||
|
||||
use fendermint_vm_actor_interface::eam::EthAddress; | ||||
use fendermint_vm_core::{chainid, Timestamp}; | ||||
use fendermint_vm_genesis::{ | ||||
ipc, Account, Actor, ActorMeta, Collateral, Genesis, Multisig, PermissionMode, SignerAddr, | ||||
Validator, ValidatorKey, | ||||
ipc, Account, Actor, ActorMeta, Collateral, Genesis, Multisig, PermissionMode, PowerScale, | ||||
SignerAddr, Validator, ValidatorKey, | ||||
}; | ||||
use fendermint_vm_interpreter::genesis::{GenesisAppState, GenesisBuilder}; | ||||
|
||||
|
@@ -21,6 +22,8 @@ use crate::options::genesis::*; | |||
|
||||
use super::key::read_public_key; | ||||
|
||||
const DEFAULT_POWER_SCALE: PowerScale = 3; | ||||
|
||||
cmd! { | ||||
GenesisArgs(self) { | ||||
let genesis_file = self.genesis_file.clone(); | ||||
|
@@ -329,6 +332,15 @@ async fn new_genesis_from_parent( | |||
|
||||
let genesis_info = parent_provider.get_genesis_info(&args.subnet_id).await?; | ||||
|
||||
let power_scale = if matches!( | ||||
genesis_info.permission_mode, | ||||
ipc_api::subnet::PermissionMode::Collateral | ||||
) { | ||||
args.power_scale.unwrap_or(DEFAULT_POWER_SCALE) | ||||
} else { | ||||
TokenAmount::DECIMALS as PowerScale | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cryptoAtwill shouldn't this be 1? We want X federated power to translate directly into X weight, right? Having 18 here would force users to append 18 zeroes to whatever power they actually want to see in the subnet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's a subtraction here: ipc/fendermint/vm/genesis/src/lib.rs Line 129 in d881a2e
|
||||
}; | ||||
|
||||
// get gateway genesis | ||||
let ipc_params = ipc::IpcParams { | ||||
gateway: ipc::GatewayParams { | ||||
|
@@ -347,7 +359,7 @@ async fn new_genesis_from_parent( | |||
chain_name: args.subnet_id.to_string(), | ||||
network_version: args.network_version, | ||||
base_fee: args.base_fee.clone(), | ||||
power_scale: args.power_scale, | ||||
power_scale, | ||||
validators: Vec::new(), | ||||
accounts: Vec::new(), | ||||
eam_permission_mode: PermissionMode::Unrestricted, | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this be the value we put in set-federated-power? that would be great if so!