MCPcopy Create free account
hub / github.com/base/base / state_root

Method state_root

crates/proof/executor/src/db/mod.rs:105–121  ·  view source on GitHub ↗

Applies a [`BundleState`] changeset to the [`TrieNode`] and recomputes the state root hash. ## Takes - `bundle`: The [`BundleState`] changeset to apply to the trie DB. ## Returns - `Ok(B256)`: The new state root hash of the trie DB. - `Err(_)`: If the state root hash could not be computed.

(&mut self, bundle: &BundleState)

Source from the content-addressed store, hash-verified

103 /// - `Ok(B256)`: The new state root hash of the trie DB.
104 /// - `Err(_)`: If the state root hash could not be computed.
105 pub fn state_root(&mut self, bundle: &BundleState) -> TrieDBResult<B256> {
106 debug!(target: "client_executor", "Recomputing state root");
107
108 // Update the accounts in the trie with the changeset.
109 self.update_accounts(bundle)?;
110
111 // Recompute the root hash of the trie.
112 let root = self.root_node.blind();
113
114 debug!(
115 target: "client_executor",
116 "Recomputed state root: {root}",
117 );
118
119 // Extract the new state root from the root node.
120 Ok(root)
121 }
122
123 /// Fetches the [`TrieAccount`] of an account from the trie DB.
124 ///

Calls 2

blindMethod · 0.80
update_accountsMethod · 0.45