pub struct Chainspec {
pub protocol_config: ProtocolConfig,
pub network_config: NetworkConfig,
pub core_config: CoreConfig,
pub highway_config: HighwayConfig,
pub transaction_config: TransactionConfig,
pub wasm_config: WasmConfig,
pub system_costs_config: SystemConfig,
pub vacancy_config: VacancyConfig,
pub storage_costs: StorageCosts,
}std only.Expand description
A collection of configuration settings describing the state of the system at genesis and after upgrades to basic system functionality occurring after genesis.
Fields§
§protocol_config: ProtocolConfigProtocol config.
network_config: NetworkConfigNetwork config.
core_config: CoreConfigCore config.
highway_config: HighwayConfigHighway config.
transaction_config: TransactionConfigTransaction Config.
wasm_config: WasmConfigWasm config.
system_costs_config: SystemConfigSystem costs config.
vacancy_config: VacancyConfigVacancy behavior config
storage_costs: StorageCostsStorage costs.
Implementations§
Source§impl Chainspec
impl Chainspec
Sourcepub fn name_hash(&self) -> ChainNameDigest
pub fn name_hash(&self) -> ChainNameDigest
Returns the hash of the chainspec’s name.
Sourcepub fn try_hash(&self) -> Result<Digest, String>
pub fn try_hash(&self) -> Result<Digest, String>
Serializes self and hashes the resulting bytes, if able.
Sourcepub fn protocol_version(&self) -> ProtocolVersion
pub fn protocol_version(&self) -> ProtocolVersion
Returns the protocol version of the chainspec.
Sourcepub fn hard_reset_to_start_of_era(&self) -> Option<EraId>
pub fn hard_reset_to_start_of_era(&self) -> Option<EraId>
Returns the era ID of where we should reset back to. This means stored blocks in that and subsequent eras are deleted from storage.
Sourcepub fn upgrade_config_from_parts(
&self,
pre_state_hash: Digest,
current_protocol_version: ProtocolVersion,
era_id: EraId,
chainspec_raw_bytes: Arc<ChainspecRawBytes>,
) -> Result<ProtocolUpgradeConfig, String>
pub fn upgrade_config_from_parts( &self, pre_state_hash: Digest, current_protocol_version: ProtocolVersion, era_id: EraId, chainspec_raw_bytes: Arc<ChainspecRawBytes>, ) -> Result<ProtocolUpgradeConfig, String>
Creates an upgrade config instance from parts.
Sourcepub fn balance_holds_epoch(&self, timestamp: Timestamp) -> u64
pub fn balance_holds_epoch(&self, timestamp: Timestamp) -> u64
Returns balance hold epoch based upon configured hold interval, calculated from the imputed timestamp.
Sourcepub fn is_supported(&self, lane: u8) -> bool
pub fn is_supported(&self, lane: u8) -> bool
Is the given transaction lane supported.
Sourcepub fn get_max_serialized_length_by_category(&self, lane: u8) -> u64
pub fn get_max_serialized_length_by_category(&self, lane: u8) -> u64
Returns the max serialized for the given category.
Sourcepub fn get_max_args_length_by_category(&self, lane: u8) -> u64
pub fn get_max_args_length_by_category(&self, lane: u8) -> u64
Returns the max args length for the given category.
Sourcepub fn get_max_gas_limit_by_category(&self, lane: u8) -> u64
pub fn get_max_gas_limit_by_category(&self, lane: u8) -> u64
Returns the max gas limit for the given category.
Sourcepub fn get_max_transaction_count_by_category(&self, lane: u8) -> u64
pub fn get_max_transaction_count_by_category(&self, lane: u8) -> u64
Returns the max transaction count for the given category.
Source§impl Chainspec
impl Chainspec
Sourcepub fn random(rng: &mut TestRng) -> Self
Available on crate feature testing only.
pub fn random(rng: &mut TestRng) -> Self
testing only.Generates a random instance using a TestRng.
Sourcepub fn with_chain_name(&mut self, chain_name: String) -> &mut Self
Available on crate feature testing only.
pub fn with_chain_name(&mut self, chain_name: String) -> &mut Self
testing only.Set the chain name;
Sourcepub fn with_max_associated_keys(
&mut self,
max_associated_keys: u32,
) -> &mut Self
Available on crate feature testing only.
pub fn with_max_associated_keys( &mut self, max_associated_keys: u32, ) -> &mut Self
testing only.Set max associated keys.
Sourcepub fn with_pricing_handling(
&mut self,
pricing_handling: PricingHandling,
) -> &mut Self
Available on crate feature testing only.
pub fn with_pricing_handling( &mut self, pricing_handling: PricingHandling, ) -> &mut Self
testing only.Set pricing handling.
Sourcepub fn with_allow_prepaid(&mut self, allow_prepaid: bool) -> &mut Self
Available on crate feature testing only.
pub fn with_allow_prepaid(&mut self, allow_prepaid: bool) -> &mut Self
testing only.Set allow prepaid.
Sourcepub fn with_block_gas_limit(&mut self, block_gas_limit: u64) -> &mut Self
Available on crate feature testing only.
pub fn with_block_gas_limit(&mut self, block_gas_limit: u64) -> &mut Self
testing only.Set block gas limit.
Sourcepub fn with_vm_casper_v2(&mut self, vm_casper_v2: bool) -> &mut Self
Available on crate feature testing only.
pub fn with_vm_casper_v2(&mut self, vm_casper_v2: bool) -> &mut Self
testing only.Set vm2 casper wasm.
Trait Implementations§
Source§impl DataSize for Chainspec
impl DataSize for Chainspec
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§impl From<&Chainspec> for GenesisConfig
impl From<&Chainspec> for GenesisConfig
Source§impl ToBytes for Chainspec
impl ToBytes for Chainspec
Source§fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), Error>
fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), Error>
&self into a mutable writer.Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8> which would be returned from a successful call to
to_bytes() or into_bytes(). The data is not actually serialized, so this call is
relatively cheap.impl Eq for Chainspec
impl StructuralPartialEq for Chainspec
Auto Trait Implementations§
impl !Freeze for Chainspec
impl RefUnwindSafe for Chainspec
impl Send for Chainspec
impl Sync for Chainspec
impl Unpin for Chainspec
impl UnwindSafe for Chainspec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more