anton-rs / kona

A suite of `no_std` components for the OP Stack state transition function and L2 chain derivation.
https://anton-rs.github.io/kona
MIT License
135 stars 45 forks source link

feat(TrieProvider): Abstract TrieNode retrieval #787

Closed hashcashier closed 1 week ago

hashcashier commented 1 week ago

This PR refactors the TrieProvider to change the the method for fetching trie node data into one that provides TrieNode instances instead of raw rlp-encoded bytes: Before

fn trie_node_preimage(&self, key: B256) -> Result<Bytes, Self::Error>;

After

fn trie_node_by_hash(&self, key: B256) -> Result<TrieNode, Self::Error>;

This allows TrieProvider implementations to abstract away the details of how the required instance can be created and authenticated (i.e. through RLP decoding pre-image oracle answers on-demand or otherwise). This is useful for providing entire trees as query answers, instead of single nodes with blinded children.

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 94.1%. Comparing base (71e35a7) to head (92e52fb). Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/mpt/src/node.rs 75.0% 1 Missing :warning:
Additional details and impacted files

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.