1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use fuel_core_interfaces::{
common::prelude::{
Hasher,
MerkleRoot,
},
model::Genesis,
};
pub trait GenesisCommitment {
fn root(&mut self) -> anyhow::Result<MerkleRoot>;
}
impl GenesisCommitment for Genesis {
fn root(&mut self) -> anyhow::Result<MerkleRoot> {
let genesis_hash = *Hasher::default()
.chain(self.chain_config_hash)
.chain(self.coins_root)
.chain(self.contracts_root)
.chain(self.messages_root)
.finalize();
Ok(genesis_hash)
}
}