feat: enable OP hardforks in DEV chainspec (#7787)

This commit is contained in:
Federico Gimenez
2024-04-22 11:58:19 +02:00
committed by GitHub
parent 612cfcbc9c
commit c0926ba10e
2 changed files with 9 additions and 9 deletions

View File

@ -56,7 +56,6 @@ where
// so that we will accept txs into the pool before the first block // so that we will accept txs into the pool before the first block
if block.number == 0 { if block.number == 0 {
this.block_info.timestamp.store(block.timestamp, Ordering::Relaxed); this.block_info.timestamp.store(block.timestamp, Ordering::Relaxed);
*this.block_info.l1_block_info.write() = Some(Default::default())
} else { } else {
this.update_l1_block_info(&block); this.update_l1_block_info(&block);
} }
@ -77,7 +76,7 @@ where
fn update_l1_block_info(&self, block: &Block) { fn update_l1_block_info(&self, block: &Block) {
self.block_info.timestamp.store(block.timestamp, Ordering::Relaxed); self.block_info.timestamp.store(block.timestamp, Ordering::Relaxed);
if let Ok(cost_addition) = reth_revm::optimism::extract_l1_info(block) { if let Ok(cost_addition) = reth_revm::optimism::extract_l1_info(block) {
*self.block_info.l1_block_info.write() = Some(cost_addition); *self.block_info.l1_block_info.write() = cost_addition;
} }
} }
@ -109,12 +108,7 @@ where
propagate, propagate,
} = outcome } = outcome
{ {
let Some(l1_block_info) = self.block_info.l1_block_info.read().clone() else { let l1_block_info = self.block_info.l1_block_info.read().clone();
return TransactionValidationOutcome::Error(
*valid_tx.hash(),
"L1BlockInfoError".into(),
)
};
let mut encoded = Vec::new(); let mut encoded = Vec::new();
valid_tx.transaction().to_recovered_transaction().encode_enveloped(&mut encoded); valid_tx.transaction().to_recovered_transaction().encode_enveloped(&mut encoded);
@ -199,7 +193,7 @@ where
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct OpL1BlockInfo { pub struct OpL1BlockInfo {
/// The current L1 block info. /// The current L1 block info.
l1_block_info: RwLock<Option<L1BlockInfo>>, l1_block_info: RwLock<L1BlockInfo>,
/// Current block timestamp. /// Current block timestamp.
timestamp: AtomicU64, timestamp: AtomicU64,
} }

View File

@ -243,6 +243,12 @@ pub static DEV: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
), ),
(Hardfork::Shanghai, ForkCondition::Timestamp(0)), (Hardfork::Shanghai, ForkCondition::Timestamp(0)),
(Hardfork::Cancun, ForkCondition::Timestamp(0)), (Hardfork::Cancun, ForkCondition::Timestamp(0)),
#[cfg(feature = "optimism")]
(Hardfork::Regolith, ForkCondition::Timestamp(0)),
#[cfg(feature = "optimism")]
(Hardfork::Bedrock, ForkCondition::Block(0)),
#[cfg(feature = "optimism")]
(Hardfork::Ecotone, ForkCondition::Timestamp(0)),
]), ]),
base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()), base_fee_params: BaseFeeParamsKind::Constant(BaseFeeParams::ethereum()),
deposit_contract: None, // TODO: do we even have? deposit_contract: None, // TODO: do we even have?