fuel_core_chain_config/
genesis.rs1use fuel_core_storage::MerkleRoot;
2use fuel_core_types::{
3 blockchain::consensus::Genesis,
4 fuel_crypto::Hasher,
5};
6
7pub trait GenesisCommitment {
10 fn root(&self) -> anyhow::Result<MerkleRoot>;
12}
13
14impl GenesisCommitment for Genesis {
15 fn root(&self) -> anyhow::Result<MerkleRoot> {
16 let genesis_hash = *Hasher::default()
17 .chain(self.chain_config_hash)
18 .chain(self.coins_root)
19 .chain(self.contracts_root)
20 .chain(self.messages_root)
21 .chain(self.transactions_root)
22 .finalize();
23
24 Ok(genesis_hash)
25 }
26}