Skip to content

Enable transitioning of node to using MEL when previously ran with Inbox Reader-Tracker#4597

Open
ganeshvanahalli wants to merge 4 commits intoreplace-readerandtracker-with-messageextractorfrom
node-transition-to-mel
Open

Enable transitioning of node to using MEL when previously ran with Inbox Reader-Tracker#4597
ganeshvanahalli wants to merge 4 commits intoreplace-readerandtracker-with-messageextractorfrom
node-transition-to-mel

Conversation

@ganeshvanahalli
Copy link
Copy Markdown
Contributor

@ganeshvanahalli ganeshvanahalli commented Apr 2, 2026

This PR enables a nitro node to transition to using message extraction code in place of the current inbox reader and tracker code. MEL is considered to be consensus active if the state's version > 0, hence a node can turn MEL ON with version = 0 and use it just for processing without having to use it for consensus, validation etc...

When MEL is first enabled on the node, we first detect an appropriate finalized parent chain block from whom a batch has been READ, we then appropriately fill in the MEL state fields and create an Initial MEL state. From here on, the node will use MEL for processing parent chain blocks and the node will not be allowed to restart the old way i.e using inbox reader and tracker code.

Testing Done

I successfully ran an arb-sepolia node from scratch upto ~300k blocks using inbox reader and tracker code - shut it down - and successfully restarted with MEL turned on and saw the node continue catchup in an expected way.

Resolves NIT-4209

@ganeshvanahalli ganeshvanahalli marked this pull request as ready for review April 2, 2026 21:41
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 9.22509% with 246 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.00%. Comparing base (20adca8) to head (20ee29c).
⚠️ Report is 1 commits behind head on replace-readerandtracker-with-messageextractor.

Additional details and impacted files
@@                                Coverage Diff                                 @@
##           replace-readerandtracker-with-messageextractor    #4597      +/-   ##
==================================================================================
- Coverage                                           34.56%   34.00%   -0.56%     
==================================================================================
  Files                                                 494      495       +1     
  Lines                                               58938    59162     +224     
==================================================================================
- Hits                                                20369    20120     -249     
- Misses                                              34985    35509     +524     
+ Partials                                             3584     3533      -51     

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

❌ 13 Tests Failed:

Tests completed Failed Passed Skipped
4714 13 4701 0
View the top 3 failed tests by shortest run time
TestPruningDBSizeReduction
Stack Traces | 0.000s run time
=== RUN   TestPruningDBSizeReduction
--- FAIL: TestPruningDBSizeReduction (0.00s)
TestMELMigrationFromLegacyNode
Stack Traces | 1.000s run time
=== RUN   TestMELMigrationFromLegacyNode
=== PAUSE TestMELMigrationFromLegacyNode
=== CONT  TestMELMigrationFromLegacyNode
    common_test.go:785: BuildL1 deployConfig: DeployBold=true, DeployReferenceDAContracts=false
    message_extraction_layer_test.go:828: sequencer batch was not posted
--- FAIL: TestMELMigrationFromLegacyNode (1.00s)
TestParentChainEthConfigForkTransition
Stack Traces | 5.970s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [04-03|21:04:37.200] Transaction pool stopped
INFO [04-03|21:04:37.200] Stopping work on payload                 id=0x03966f8623998971 reason=delivery
INFO [04-03|21:04:37.200] Persisting dirty state                   head=29  root=4b2fa2..38b664 layers=29
INFO [04-03|21:04:37.200] Updated payload                          id=0x03df44050769ca2d number=47   hash=e33c4a..e92807 txs=1  withdrawals=0 gas=21000      fees=0.002092996848 root=0ac928..1d57d0 elapsed=7.726ms
INFO [04-03|21:04:37.200] Submitted transaction                    hash=0x0105e6501f194e62e5b6ac6889cf160e39d96a62b90e7e9a43c2e4a9806f30b0 from=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A nonce=1757 recipient=0x0C709F340F0BB2e361229e345B7e26999d0969Ab value=1
INFO [04-03|21:04:37.200] Imported new potential chain segment     number=32   hash=a5b096..9bde14 blocks=1  txs=1  mgas=0.021  elapsed="993.247µs"  mgasps=21.143   triediffs=161.46KiB  triedirty=0.00B
INFO [04-03|21:04:37.200] Chain head was updated                   number=32   hash=a5b096..9bde14 root=40b7c0..f80306 elapsed="64.951µs"
INFO [04-03|21:04:37.200] Stopping work on payload                 id=0x03edac92cd41f9ea reason=delivery
INFO [04-03|21:04:37.200] Stopping work on payload                 id=0x03df44050769ca2d reason=delivery
INFO [04-03|21:04:37.201] Imported new potential chain segment     number=47   hash=e33c4a..e92807 blocks=1  txs=1  mgas=0.021  elapsed=1.002ms      mgasps=20.941   triediffs=224.92KiB  triedirty=0.00B
INFO [04-03|21:04:37.201] Chain head was updated                   number=47   hash=e33c4a..e92807 root=0ac928..1d57d0 elapsed="64.761µs"
INFO [04-03|21:04:37.203] ExecutionEngine: Added DelayedMessages   msgIdx=259  delayedMsgIdx=69  block-header="&{ParentHash:0x2c60c2f98c243272a95964892e295fb0a0ee6ee96f3716149db9701e4752f59f UncleHash:0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 Coinbase:0x8f34C8862920797D81916D62C274Dd9217114F39 Root:0x680100ded46030213acbae850a546e9b333fc99286f53aedd1b3a3df9e602caf TxHash:0x78c64356fae7cb6e07bb55f1b39e1f720b7614b1e4b18806ab1397692d04b022 ReceiptHash:0x3b5e9d084dc4a770cd470167568601342aebe33d876f98f0a981f27700234cec Bloom:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Difficulty:+1 Number:+259 GasLimit:1125899906842624 GasUsed:21000 Time:1775250398 Extra:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] MixDigest:0x0000000000000000000000000000009800000000000000330000000000000000 Nonce:[0 0 0 0 0 0 0 70] BaseFee:+100000000 WithdrawalsHash:<nil> BlobGasUsed:<nil> ExcessBlobGas:<nil> ParentBeaconRoot:<nil> RequestsHash:<nil>}"
INFO [04-03|21:04:37.203] DelayedSequencer: Sequenced              msgnum=13 startpos=57
INFO [04-03|21:04:37.205] Starting work on payload                 id=0x0327474a9df29a0e
INFO [04-03|21:04:37.205] Imported new potential chain segment     number=162  hash=6c361f..ef8e61 blocks=1  txs=1  mgas=0.021  elapsed=12.031ms     mgasps=1.745    triediffs=647.53KiB  triedirty=52.85KiB
INFO [04-03|21:04:37.205] Updated payload                          id=0x0327474a9df29a0e number=48   hash=4b7707..22fee6 txs=0  withdrawals=0 gas=0          fees=0              root=fe581b..0fcf9c elapsed="332.03µs"
INFO [04-03|21:04:37.205] Persisted dirty state to disk            size=139.14KiB elapsed=5.350ms
INFO [04-03|21:04:37.206] Blockchain stopped
INFO [04-03|21:04:37.205] Chain head was updated                   number=162  hash=6c361f..ef8e61 root=5f2eff..b7414b elapsed="66.725µs"
--- FAIL: TestParentChainEthConfigForkTransition (5.97s)

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

//
// Batch count, msg count, and delayed read are derived from legacy batch metadata.
// The MEL inbox accumulator is reconstructed for any unread delayed messages.
func CreateInitialMELStateFromLegacyDB(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really nice function! Great job on putting it together

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants