feat(op): timestamp below bedrock (#7768)

This commit is contained in:
Emilia Hane
2024-04-25 14:23:51 +02:00
committed by GitHub
parent c7008deef8
commit f6e68e28eb
3 changed files with 17 additions and 10 deletions

1
Cargo.lock generated
View File

@@ -7156,7 +7156,6 @@ dependencies = [
"byteorder",
"bytes",
"c-kzg",
"cfg-if",
"clap",
"criterion",
"derive_more",

View File

@@ -51,7 +51,6 @@ tempfile = { workspace = true, optional = true }
thiserror.workspace = true
zstd = { version = "0.13", features = ["experimental"], optional = true }
roaring = "0.10.2"
cfg-if = "1.0.0"
# `test-utils` feature
hash-db = { version = "~0.15", optional = true }

View File

@@ -776,6 +776,17 @@ impl SealedHeader {
}
// timestamp in past check
#[cfg(feature = "optimism")]
if chain_spec.is_bedrock_active_at_block(self.header.number) &&
self.header.is_timestamp_in_past(parent.timestamp)
{
return Err(HeaderValidationError::TimestampIsInPast {
parent_timestamp: parent.timestamp,
timestamp: self.timestamp,
})
}
#[cfg(not(feature = "optimism"))]
if self.header.is_timestamp_in_past(parent.timestamp) {
return Err(HeaderValidationError::TimestampIsInPast {
parent_timestamp: parent.timestamp,
@@ -786,16 +797,14 @@ impl SealedHeader {
// TODO Check difficulty increment between parent and self
// Ace age did increment it by some formula that we need to follow.
cfg_if::cfg_if! {
if #[cfg(feature = "optimism")] {
// On Optimism, the gas limit can adjust instantly, so we skip this check
// if the optimism feature is enabled in the chain spec.
if !chain_spec.is_optimism() {
self.validate_gas_limit(parent, chain_spec)?;
}
} else {
if cfg!(feature = "optimism") {
// On Optimism, the gas limit can adjust instantly, so we skip this check
// if the optimism feature is enabled in the chain spec.
if !chain_spec.is_optimism() {
self.validate_gas_limit(parent, chain_spec)?;
}
} else {
self.validate_gas_limit(parent, chain_spec)?;
}
// EIP-1559 check base fee