mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: implement EIP-7685 (#8424)
Co-authored-by: Oliver Nordbjerg <onbjerg@users.noreply.github.com> Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -4,9 +4,10 @@ use crate::{
|
||||
constants::EMPTY_OMMER_ROOT_HASH,
|
||||
keccak256,
|
||||
trie::{HashBuilder, Nibbles, TrieAccount},
|
||||
Address, Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, TransactionSigned, Withdrawal,
|
||||
B256, U256,
|
||||
Address, Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Request, TransactionSigned,
|
||||
Withdrawal, B256, U256,
|
||||
};
|
||||
use alloy_eips::eip7685::Encodable7685;
|
||||
use alloy_rlp::Encodable;
|
||||
use itertools::Itertools;
|
||||
|
||||
@ -69,6 +70,13 @@ pub fn calculate_receipt_root(receipts: &[ReceiptWithBloom]) -> B256 {
|
||||
ordered_trie_root_with_encoder(receipts, |r, buf| r.encode_inner(buf, false))
|
||||
}
|
||||
|
||||
/// Calculate [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) requests root.
|
||||
///
|
||||
/// NOTE: The requests are encoded as `id + request`
|
||||
pub fn calculate_requests_root(requests: &[Request]) -> B256 {
|
||||
ordered_trie_root_with_encoder(requests, |item, buf| item.encode_7685(buf))
|
||||
}
|
||||
|
||||
/// Calculates the receipt root for a header.
|
||||
#[cfg(feature = "optimism")]
|
||||
pub fn calculate_receipt_root_optimism(
|
||||
|
||||
Reference in New Issue
Block a user