Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 17 additions & 4 deletions crates/consensus/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,29 @@ pub const EIP1559_ELASTICITY_MULTIPLIER: u64 = 2;
/// Configuration for consensus
#[derive(Debug, Clone)]
pub struct Config {
/// EIP-1559 hard fork number
/// Spurious dragon ethereum update block.
pub spurious_dragon_hard_fork_block: BlockNumber,
/// EIP-2728 hard fork number.
pub berlin_hard_fork_block: BlockNumber,
/// EIP-1559 hard fork number.
pub london_hard_fork_block: BlockNumber,
/// The Merge/Paris hard fork block number
/// The Merge/Paris hard fork block number.
pub paris_hard_fork_block: BlockNumber,
/// Blockchain identifier introduced in EIP-155: Simple replay attack protection
/// Blockchain identifier introduced in EIP-155: Simple replay attack protection.
pub chain_id: u64,
/// Merge terminal total dificulty after the paris hardfork got activated.
pub merge_terminal_total_difficulty: u128,
}

impl Default for Config {
fn default() -> Self {
Self { london_hard_fork_block: 12965000, paris_hard_fork_block: 15537394, chain_id: 1 }
Self {
spurious_dragon_hard_fork_block: 2675000,
berlin_hard_fork_block: 12244000,
london_hard_fork_block: 12965000,
paris_hard_fork_block: 15537394,
merge_terminal_total_difficulty: 58750000000000000000000,
chain_id: 1,
}
}
}
13 changes: 8 additions & 5 deletions crates/consensus/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ impl Consensus for EthConsensus {

fn validate_header(&self, header: &SealedHeader, parent: &SealedHeader) -> Result<(), Error> {
verification::validate_header_standalone(header, &self.config)?;
verification::validate_header_regarding_parent(parent, header, &self.config)
verification::validate_header_regarding_parent(parent, header, &self.config)?;

// TODO Consensus checks for:
// * mix_hash & nonce PoW stuf
// * extra_data
if header.number < self.config.paris_hard_fork_block {
// TODO Consensus checks for old blocks:
// * difficulty, mix_hash & nonce aka PoW stuff
// low priority as syncing is done in reverse order
}
Ok(())
}

fn pre_validate_block(&self, block: &BlockLocked) -> Result<(), Error> {
verification::validate_block_standalone(block, false)
verification::validate_block_standalone(block)
}
}
Loading