chore(deps): bump alloy-trie 0.7 (#11362)

Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
This commit is contained in:
DaniPopes
2024-10-15 12:53:34 +02:00
committed by GitHub
parent 39f0ab4116
commit 3cb4bf266d
6 changed files with 39 additions and 30 deletions

View File

@ -1,5 +1,5 @@
use crate::TrieMask;
use alloy_trie::{hash_builder::HashBuilderValue, HashBuilder};
use alloy_trie::{hash_builder::HashBuilderValue, nodes::RlpNode, HashBuilder};
use bytes::Buf;
use nybbles::Nibbles;
use reth_codecs::Compact;
@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
/// The hash builder state for storing in the database.
/// Check the `reth-trie` crate for more info on hash builder.
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
#[cfg_attr(
feature = "arbitrary",
derive(arbitrary::Arbitrary),
@ -16,10 +16,10 @@ use serde::{Deserialize, Serialize};
pub struct HashBuilderState {
/// The current key.
pub key: Vec<u8>,
/// The builder stack.
pub stack: Vec<Vec<u8>>,
/// The current node value.
pub value: HashBuilderValue,
/// The builder stack.
pub stack: Vec<RlpNode>,
/// Group masks.
pub groups: Vec<TrieMask>,
@ -112,7 +112,7 @@ impl Compact for HashBuilderState {
let mut stack = Vec::with_capacity(stack_len);
for _ in 0..stack_len {
let item_len = buf.get_u16() as usize;
stack.push(Vec::from(&buf[..item_len]));
stack.push(RlpNode::from_raw(&buf[..item_len]).unwrap());
buf.advance(item_len);
}
@ -154,7 +154,7 @@ mod tests {
#[test]
fn hash_builder_state_regression() {
let mut state = HashBuilderState::default();
state.stack.push(vec![]);
state.stack.push(Default::default());
let mut buf = vec![];
let len = state.clone().to_compact(&mut buf);
let (decoded, _) = HashBuilderState::from_compact(&buf, len);

View File

@ -1,5 +1,3 @@
use std::collections::BTreeMap;
use crate::{
hashed_cursor::{HashedCursor, HashedCursorFactory},
prefix_set::TriePrefixSetsMut,
@ -19,6 +17,7 @@ use reth_primitives::constants::EMPTY_ROOT_HASH;
use reth_trie_common::{
BranchNode, HashBuilder, Nibbles, StorageMultiProof, TrieAccount, TrieNode, CHILD_INDEX_RANGE,
};
use std::collections::BTreeMap;
/// State transition witness for the trie.
#[derive(Debug)]
@ -229,7 +228,10 @@ where
TrieNode::Leaf(leaf) => {
next_path.extend_from_slice(&leaf.key);
if next_path != key {
trie_nodes.insert(next_path.clone(), Either::Right(leaf.value.clone()));
trie_nodes.insert(
next_path.clone(),
Either::Right(leaf.value.as_slice().to_vec()),
);
}
}
TrieNode::EmptyRoot => {