mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add new crate op-beacon-core (#7848)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -3,7 +3,10 @@
|
||||
use reth_consensus::ConsensusError;
|
||||
use reth_interfaces::RethResult;
|
||||
use reth_primitives::{
|
||||
constants::eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK},
|
||||
constants::{
|
||||
eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK},
|
||||
MAXIMUM_EXTRA_DATA_SIZE,
|
||||
},
|
||||
BlockNumber, ChainSpec, GotExpected, Hardfork, Header, InvalidTransactionError, SealedBlock,
|
||||
SealedHeader, Transaction, TransactionSignedEcRecovered, TxEip1559, TxEip2930, TxEip4844,
|
||||
TxLegacy,
|
||||
@ -321,6 +324,18 @@ pub fn validate_4844_header_standalone(header: &SealedHeader) -> Result<(), Cons
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Validates the header's extradata according to the beacon consensus rules.
|
||||
///
|
||||
/// From yellow paper: extraData: An arbitrary byte array containing data relevant to this block.
|
||||
/// This must be 32 bytes or fewer; formally Hx.
|
||||
pub fn validate_header_extradata(header: &Header) -> Result<(), ConsensusError> {
|
||||
if header.extra_data.len() > MAXIMUM_EXTRA_DATA_SIZE {
|
||||
Err(ConsensusError::ExtraDataExceedsMax { len: header.extra_data.len() })
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user