Struct GenesisConfig

Source
pub struct GenesisConfig {
Show 39 fields pub avg_hidden_validator_seats_per_shard: Vec<u64>, pub block_producer_kickout_threshold: u8, pub chain_id: String, pub chunk_producer_assignment_changes_limit: u64, pub chunk_producer_kickout_threshold: u8, pub chunk_validator_only_kickout_threshold: u8, pub dynamic_resharding: bool, pub epoch_length: u64, pub fishermen_threshold: String, pub gas_limit: u64, pub gas_price_adjustment_rate: [i32; 2], pub genesis_height: u64, pub genesis_time: DateTime<Utc>, pub max_gas_price: String, pub max_inflation_rate: [i32; 2], pub max_kickout_stake_perc: u8, pub min_gas_price: String, pub minimum_stake_divisor: u64, pub minimum_stake_ratio: [i32; 2], pub minimum_validators_per_shard: u64, pub num_block_producer_seats: u64, pub num_block_producer_seats_per_shard: Vec<u64>, pub num_blocks_per_year: u64, pub num_chunk_only_producer_seats: u64, pub num_chunk_producer_seats: u64, pub num_chunk_validator_seats: u64, pub online_max_threshold: [i32; 2], pub online_min_threshold: [i32; 2], pub protocol_reward_rate: [i32; 2], pub protocol_treasury_account: AccountId, pub protocol_upgrade_stake_threshold: [i32; 2], pub protocol_version: u32, pub shard_layout: ShardLayout, pub shuffle_shard_assignment_for_chunk_producers: bool, pub target_validator_mandates_per_shard: u64, pub total_supply: String, pub transaction_validity_period: u64, pub use_production_config: bool, pub validators: Vec<AccountInfo>,
}
Expand description

GenesisConfig

JSON schema
{
 "type": "object",
 "required": [
   "avg_hidden_validator_seats_per_shard",
   "block_producer_kickout_threshold",
   "chain_id",
   "chunk_producer_kickout_threshold",
   "dynamic_resharding",
   "epoch_length",
   "fishermen_threshold",
   "gas_limit",
   "gas_price_adjustment_rate",
   "genesis_height",
   "genesis_time",
   "max_gas_price",
   "max_inflation_rate",
   "min_gas_price",
   "num_block_producer_seats",
   "num_block_producer_seats_per_shard",
   "num_blocks_per_year",
   "protocol_reward_rate",
   "protocol_treasury_account",
   "protocol_version",
   "total_supply",
   "transaction_validity_period",
   "validators"
 ],
 "properties": {
   "avg_hidden_validator_seats_per_shard": {
     "description": "Expected number of hidden validators per shard.",
     "type": "array",
     "items": {
       "type": "integer",
       "format": "uint64",
       "minimum": 0.0
     }
   },
   "block_producer_kickout_threshold": {
     "description": "Threshold for kicking out block producers, between 0 and 100.",
     "type": "integer",
     "format": "uint8",
     "maximum": 255.0,
     "minimum": 0.0
   },
   "chain_id": {
     "description": "ID of the blockchain. This must be unique for every blockchain.\nIf your testnet blockchains do not have unique chain IDs, you will have a bad time.",
     "type": "string"
   },
   "chunk_producer_assignment_changes_limit": {
     "description": "Limits the number of shard changes in chunk producer assignments,\nif algorithm is able to choose assignment with better balance of\nnumber of chunk producers for shards.",
     "default": 5,
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "chunk_producer_kickout_threshold": {
     "description": "Threshold for kicking out chunk producers, between 0 and 100.",
     "type": "integer",
     "format": "uint8",
     "maximum": 255.0,
     "minimum": 0.0
   },
   "chunk_validator_only_kickout_threshold": {
     "description": "Threshold for kicking out nodes which are only chunk validators, between 0 and 100.",
     "default": 80,
     "type": "integer",
     "format": "uint8",
     "maximum": 255.0,
     "minimum": 0.0
   },
   "dynamic_resharding": {
     "description": "Enable dynamic re-sharding.",
     "type": "boolean"
   },
   "epoch_length": {
     "description": "Epoch length counted in block heights.",
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "fishermen_threshold": {
     "description": "Fishermen stake threshold.",
     "type": "string"
   },
   "gas_limit": {
     "description": "Initial gas limit.",
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "gas_price_adjustment_rate": {
     "description": "Gas price adjustment rate",
     "type": "array",
     "items": {
       "type": "integer",
       "format": "int32"
     },
     "maxItems": 2,
     "minItems": 2
   },
   "genesis_height": {
     "description": "Height of genesis block.",
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "genesis_time": {
     "description": "Official time of blockchain start.",
     "type": "string",
     "format": "date-time"
   },
   "max_gas_price": {
     "type": "string"
   },
   "max_inflation_rate": {
     "description": "Maximum inflation on the total supply every epoch.",
     "type": "array",
     "items": {
       "type": "integer",
       "format": "int32"
     },
     "maxItems": 2,
     "minItems": 2
   },
   "max_kickout_stake_perc": {
     "description": "Max stake percentage of the validators we will kick out.",
     "default": 100,
     "type": "integer",
     "format": "uint8",
     "maximum": 255.0,
     "minimum": 0.0
   },
   "min_gas_price": {
     "description": "Minimum gas price. It is also the initial gas price.",
     "type": "string"
   },
   "minimum_stake_divisor": {
     "description": "The minimum stake required for staking is last seat price divided by this number.",
     "default": 10,
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "minimum_stake_ratio": {
     "description": "The lowest ratio s/s_total any block producer can have.\nSee <https://github.com/near/NEPs/pull/167> for details",
     "default": [
       1,
       6250
     ],
     "type": "array",
     "items": {
       "type": "integer",
       "format": "int32"
     },
     "maxItems": 2,
     "minItems": 2
   },
   "minimum_validators_per_shard": {
     "description": "The minimum number of validators each shard must have",
     "default": 1,
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "num_block_producer_seats": {
     "description": "Number of block producer seats at genesis.",
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "num_block_producer_seats_per_shard": {
     "description": "Defines number of shards and number of block producer seats per each shard at genesis.\nNote: not used with protocol_feature_chunk_only_producers -- replaced by minimum_validators_per_shard\nNote: not used before as all block producers produce chunks for all shards",
     "type": "array",
     "items": {
       "type": "integer",
       "format": "uint64",
       "minimum": 0.0
     }
   },
   "num_blocks_per_year": {
     "description": "Expected number of blocks per year",
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "num_chunk_only_producer_seats": {
     "description": "Deprecated.",
     "default": 300,
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "num_chunk_producer_seats": {
     "description": "Number of chunk producers.\nDon't mess it up with chunk-only producers feature which is deprecated.",
     "default": 100,
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "num_chunk_validator_seats": {
     "default": 300,
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "online_max_threshold": {
     "description": "Online maximum threshold above which validator gets full reward.",
     "default": [
       99,
       100
     ],
     "type": "array",
     "items": {
       "type": "integer",
       "format": "int32"
     },
     "maxItems": 2,
     "minItems": 2
   },
   "online_min_threshold": {
     "description": "Online minimum threshold below which validator doesn't receive reward.",
     "default": [
       9,
       10
     ],
     "type": "array",
     "items": {
       "type": "integer",
       "format": "int32"
     },
     "maxItems": 2,
     "minItems": 2
   },
   "protocol_reward_rate": {
     "description": "Protocol treasury rate",
     "type": "array",
     "items": {
       "type": "integer",
       "format": "int32"
     },
     "maxItems": 2,
     "minItems": 2
   },
   "protocol_treasury_account": {
     "description": "Protocol treasury account",
     "allOf": [
       {
         "$ref": "#/components/schemas/AccountId"
       }
     ]
   },
   "protocol_upgrade_stake_threshold": {
     "description": "Threshold of stake that needs to indicate that they ready for upgrade.",
     "default": [
       4,
       5
     ],
     "type": "array",
     "items": {
       "type": "integer",
       "format": "int32"
     },
     "maxItems": 2,
     "minItems": 2
   },
   "protocol_version": {
     "description": "Protocol version that this genesis works with.",
     "type": "integer",
     "format": "uint32",
     "minimum": 0.0
   },
   "shard_layout": {
     "description": "Layout information regarding how to split accounts to shards",
     "default": {
       "V2": {
         "boundary_accounts": [],
         "id_to_index_map": {
           "0": 0
         },
         "index_to_id_map": {
           "0": 0
         },
         "shard_ids": [
           0
         ],
         "shards_parent_map": null,
         "shards_split_map": null,
         "version": 0
       }
     },
     "allOf": [
       {
         "$ref": "#/components/schemas/ShardLayout"
       }
     ]
   },
   "shuffle_shard_assignment_for_chunk_producers": {
     "description": "If true, shuffle the chunk producers across shards. In other words, if\nthe shard assignments were `[S_0, S_1, S_2, S_3]` where `S_i` represents\nthe set of chunk producers for shard `i`, if this flag were true, the\nshard assignments might become, for example, `[S_2, S_0, S_3, S_1]`.",
     "default": false,
     "type": "boolean"
   },
   "target_validator_mandates_per_shard": {
     "description": "Number of target chunk validator mandates for each shard.",
     "default": 68,
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "total_supply": {
     "description": "Total supply of tokens at genesis.",
     "type": "string"
   },
   "transaction_validity_period": {
     "description": "Number of blocks for which a given transaction is valid",
     "type": "integer",
     "format": "uint64",
     "minimum": 0.0
   },
   "use_production_config": {
     "description": "This is only for test purposes. We hard code some configs for mainnet and testnet\nin AllEpochConfig, and we want to have a way to test that code path. This flag is for that.\nIf set to true, the node will use the same config override path as mainnet and testnet.",
     "default": false,
     "type": "boolean"
   },
   "validators": {
     "description": "List of initial validators.",
     "type": "array",
     "items": {
       "$ref": "#/components/schemas/AccountInfo"
     }
   }
 }
}

Fields§

§avg_hidden_validator_seats_per_shard: Vec<u64>

Expected number of hidden validators per shard.

§block_producer_kickout_threshold: u8

Threshold for kicking out block producers, between 0 and 100.

§chain_id: String

ID of the blockchain. This must be unique for every blockchain. If your testnet blockchains do not have unique chain IDs, you will have a bad time.

§chunk_producer_assignment_changes_limit: u64

Limits the number of shard changes in chunk producer assignments, if algorithm is able to choose assignment with better balance of number of chunk producers for shards.

§chunk_producer_kickout_threshold: u8

Threshold for kicking out chunk producers, between 0 and 100.

§chunk_validator_only_kickout_threshold: u8

Threshold for kicking out nodes which are only chunk validators, between 0 and 100.

§dynamic_resharding: bool

Enable dynamic re-sharding.

§epoch_length: u64

Epoch length counted in block heights.

§fishermen_threshold: String

Fishermen stake threshold.

§gas_limit: u64

Initial gas limit.

§gas_price_adjustment_rate: [i32; 2]

Gas price adjustment rate

§genesis_height: u64

Height of genesis block.

§genesis_time: DateTime<Utc>

Official time of blockchain start.

§max_gas_price: String§max_inflation_rate: [i32; 2]

Maximum inflation on the total supply every epoch.

§max_kickout_stake_perc: u8

Max stake percentage of the validators we will kick out.

§min_gas_price: String

Minimum gas price. It is also the initial gas price.

§minimum_stake_divisor: u64

The minimum stake required for staking is last seat price divided by this number.

§minimum_stake_ratio: [i32; 2]

The lowest ratio s/s_total any block producer can have. See https://github.com/near/NEPs/pull/167 for details

§minimum_validators_per_shard: u64

The minimum number of validators each shard must have

§num_block_producer_seats: u64

Number of block producer seats at genesis.

§num_block_producer_seats_per_shard: Vec<u64>

Defines number of shards and number of block producer seats per each shard at genesis. Note: not used with protocol_feature_chunk_only_producers – replaced by minimum_validators_per_shard Note: not used before as all block producers produce chunks for all shards

§num_blocks_per_year: u64

Expected number of blocks per year

§num_chunk_only_producer_seats: u64

Deprecated.

§num_chunk_producer_seats: u64

Number of chunk producers. Don’t mess it up with chunk-only producers feature which is deprecated.

§num_chunk_validator_seats: u64§online_max_threshold: [i32; 2]

Online maximum threshold above which validator gets full reward.

§online_min_threshold: [i32; 2]

Online minimum threshold below which validator doesn’t receive reward.

§protocol_reward_rate: [i32; 2]

Protocol treasury rate

§protocol_treasury_account: AccountId

Protocol treasury account

§protocol_upgrade_stake_threshold: [i32; 2]

Threshold of stake that needs to indicate that they ready for upgrade.

§protocol_version: u32

Protocol version that this genesis works with.

§shard_layout: ShardLayout

Layout information regarding how to split accounts to shards

§shuffle_shard_assignment_for_chunk_producers: bool

If true, shuffle the chunk producers across shards. In other words, if the shard assignments were [S_0, S_1, S_2, S_3] where S_i represents the set of chunk producers for shard i, if this flag were true, the shard assignments might become, for example, [S_2, S_0, S_3, S_1].

§target_validator_mandates_per_shard: u64

Number of target chunk validator mandates for each shard.

§total_supply: String

Total supply of tokens at genesis.

§transaction_validity_period: u64

Number of blocks for which a given transaction is valid

§use_production_config: bool

This is only for test purposes. We hard code some configs for mainnet and testnet in AllEpochConfig, and we want to have a way to test that code path. This flag is for that. If set to true, the node will use the same config override path as mainnet and testnet.

§validators: Vec<AccountInfo>

List of initial validators.

Trait Implementations§

Source§

impl Clone for GenesisConfig

Source§

fn clone(&self) -> GenesisConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GenesisConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for GenesisConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&GenesisConfig> for GenesisConfig

Source§

fn from(value: &GenesisConfig) -> Self

Converts to this type from the input type.
Source§

impl Serialize for GenesisConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,