Skip to content

Latest commit

 

History

History
143 lines (77 loc) · 4.64 KB

ConsensusStrategy.md

File metadata and controls

143 lines (77 loc) · 4.64 KB

Module 0x1::ConsensusStrategy

The module provides the information of current consensus strategy.

Struct ConsensusStrategy

ConsensusStrategy data.

struct ConsensusStrategy has copy, drop, store
Fields
value: u8
Value of strategy

Function initialize

Publish the chain ID under the genesis account

public fun initialize(account: &signer, consensus_strategy: u8)
Implementation
public fun initialize(account: &signer, consensus_strategy: u8) {
    Timestamp::assert_genesis();
    CoreAddresses::assert_genesis_address(account);
    let cap = Config::publish_new_config_with_capability<ConsensusStrategy>(
        account,
        ConsensusStrategy { value:consensus_strategy }
    );
    //destroy the cap, so ConsensusStrategy can not been change.
    Config::destroy_modify_config_capability(cap);
}
Specification

Function get

Return the consensus strategy type of this chain

public fun get(): u8
Implementation
Specification

Module Specification

pragma verify = false;
pragma aborts_if_is_strict = true;