-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
A-dbRelated to the databaseRelated to the databaseA-trieRelated to Merkle Patricia Trie implementationRelated to Merkle Patricia Trie implementationC-enhancementNew feature or requestNew feature or requestD-good-first-issueNice and easy! A great choice to get startedNice and easy! A great choice to get started
Description
Describe the feature
Right now DatabaseStorageProof has an associated TX type and takes &'a Self::TX on every method:
reth/crates/trie/db/src/proof.rs
Lines 84 to 104 in ca862ab
| /// Extends [`StorageProof`] with operations specific for working with a database transaction. | |
| pub trait DatabaseStorageProof<'a, TX> { | |
| /// Create a new [`StorageProof`] from database transaction and account address. | |
| fn from_tx(tx: &'a TX, address: Address) -> Self; | |
| /// Generates the storage proof for target slot based on [`TrieInput`]. | |
| fn overlay_storage_proof( | |
| tx: &'a TX, | |
| address: Address, | |
| slot: B256, | |
| storage: HashedStorage, | |
| ) -> Result<reth_trie::StorageProof, StateProofError>; | |
| /// Generates the storage multiproof for target slots based on [`TrieInput`]. | |
| fn overlay_storage_multiproof( | |
| tx: &'a TX, | |
| address: Address, | |
| slots: &[B256], | |
| storage: HashedStorage, | |
| ) -> Result<StorageMultiProof, StateProofError>; | |
| } |
This is not necessary, instead we can make this into a regular trait that is stateful and takes &self. For example it would look like:
/// Extends [`StorageProof`] with operations specific for working with a database transaction.
pub trait DatabaseStorageProof {
/// Generates the storage proof for target slot based on [`TrieInput`].
fn overlay_storage_proof(
&self,
address: Address,
slot: B256,
storage: HashedStorage,
) -> Result<reth_trie::StorageProof, StateProofError>;
/// Generates the storage multiproof for target slots based on [`TrieInput`].
fn overlay_storage_multiproof(
&self,
address: Address,
slots: &[B256],
storage: HashedStorage,
) -> Result<StorageMultiProof, StateProofError>;
}And the implementers can have a from_tx method on the struct itself
Additional context
No response
Metadata
Metadata
Assignees
Labels
A-dbRelated to the databaseRelated to the databaseA-trieRelated to Merkle Patricia Trie implementationRelated to Merkle Patricia Trie implementationC-enhancementNew feature or requestNew feature or requestD-good-first-issueNice and easy! A great choice to get startedNice and easy! A great choice to get started
Type
Projects
Status
Next Up