From dc44107c75e4d4c6af8a02d4663a62321deb83e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Wed, 25 Jun 2025 16:09:17 +0200 Subject: [PATCH 1/3] feat(feynman): ensure that transition block timestamp is exact --- eth/api.go | 5 ----- miner/scroll_worker.go | 10 +++++++++- params/version.go | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/eth/api.go b/eth/api.go index cac47bce5258..0752a3cb158c 100644 --- a/eth/api.go +++ b/eth/api.go @@ -362,11 +362,6 @@ func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateles // Collect storage locations that prover needs but sequencer might not touch necessarily statedb.GetState(rcfg.L2MessageQueueAddress, rcfg.WithdrawTrieRootSlot) - // Note: scroll-revm detects the Feynman transition block using this storage slot, - // since it does not have access to the parent block timestamp. We need to make - // sure that this is always present in the execution witness. - statedb.GetState(rcfg.L1GasPriceOracleAddress, rcfg.IsFeynmanSlot) - receipts, _, usedGas, err := blockchain.Processor().Process(block, statedb, *blockchain.GetVMConfig()) if err != nil { return nil, fmt.Errorf("failed to process block %d: %w", block.Number(), err) diff --git a/miner/scroll_worker.go b/miner/scroll_worker.go index 56b458e4d5a7..746a10073d69 100644 --- a/miner/scroll_worker.go +++ b/miner/scroll_worker.go @@ -510,9 +510,17 @@ func (w *worker) newWork(now time.Time, parent *types.Block, reorging bool, reor header.Coinbase = common.Address{} header.Nonce = types.BlockNonce{} } else { + var timeOverride *uint64 + if w.chainConfig.IsFeynmanTransitionBlock(header.Time, parent.Time()) { + // current candidate timestamp suggests that this block is the Feynman transition block, + // we forcibly set timestamp to the exact upgrade timestamp. + timeOverride = new(uint64) + *timeOverride = *w.chainConfig.FeynmanTime // IsFeynmanTransitionBlock guarantees that this is not nil + } + prepareStart := time.Now() // Note: this call will set header.Time, among other fields. - if err := w.engine.Prepare(w.chain, header, nil); err != nil { + if err := w.engine.Prepare(w.chain, header, timeOverride); err != nil { return fmt.Errorf("failed to prepare header for mining: %w", err) } prepareTimer.UpdateSince(prepareStart) diff --git a/params/version.go b/params/version.go index 13fa655ad50b..6b1ffd3c7b35 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 8 // Minor version component of the current release - VersionPatch = 58 // Patch version component of the current release + VersionPatch = 59 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string ) From 8ae5924ccd5e5ff06ffadf7838e5f051cd3d31ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Wed, 25 Jun 2025 16:22:53 +0200 Subject: [PATCH 2/3] re-add witness --- eth/api.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eth/api.go b/eth/api.go index 0752a3cb158c..64eaf9795675 100644 --- a/eth/api.go +++ b/eth/api.go @@ -362,6 +362,12 @@ func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateles // Collect storage locations that prover needs but sequencer might not touch necessarily statedb.GetState(rcfg.L2MessageQueueAddress, rcfg.WithdrawTrieRootSlot) + // Note: scroll-revm detects the Feynman transition block using the block + // timestamp, but since there might be multiple blocks with the same timestamp, + // it also needs this value to avoid applying the state update multiple times. + // So we need to make sure that this is always present in the execution witness. + statedb.GetState(rcfg.L1GasPriceOracleAddress, rcfg.IsFeynmanSlot) + receipts, _, usedGas, err := blockchain.Processor().Process(block, statedb, *blockchain.GetVMConfig()) if err != nil { return nil, fmt.Errorf("failed to process block %d: %w", block.Number(), err) From 2941470eb624e0774e8905b0096cd0afe4549875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Wed, 25 Jun 2025 16:23:34 +0200 Subject: [PATCH 3/3] typo --- eth/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/api.go b/eth/api.go index 64eaf9795675..3ea53fed4107 100644 --- a/eth/api.go +++ b/eth/api.go @@ -362,7 +362,7 @@ func generateWitness(blockchain *core.BlockChain, block *types.Block) (*stateles // Collect storage locations that prover needs but sequencer might not touch necessarily statedb.GetState(rcfg.L2MessageQueueAddress, rcfg.WithdrawTrieRootSlot) - // Note: scroll-revm detects the Feynman transition block using the block + // Note: scroll-reth detects the Feynman transition block using the block // timestamp, but since there might be multiple blocks with the same timestamp, // it also needs this value to avoid applying the state update multiple times. // So we need to make sure that this is always present in the execution witness.