Skip to content

Conversation

@ganeshvanahalli
Copy link
Contributor

This PR implements accumulating of L2 messages in every mel state by introducing two new fields-

MsgRoot                 => Merkle root of the Merkle tree of all the messages extracted by MEL
MessageMerklePartials   => Merkle partials of the Merkle tree of all the messages extracted by MEL

We also introduce MessageReader struct in melreplay package that will be use by the unified replay binary to read L2 messages from preimages

Resolves NIT-3522

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 0% with 172 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.27%. Comparing base (3a25bb0) to head (16a60d7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4258      +/-   ##
==========================================
- Coverage   32.94%   29.27%   -3.67%     
==========================================
  Files         471      474       +3     
  Lines       56610    56688      +78     
==========================================
- Hits        18648    16597    -2051     
- Misses      34713    37094    +2381     
+ Partials     3249     2997     -252     

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
3923 3 3920 0
View the top 3 failed tests by shortest run time
TestBroadcasterSendsCachedMessagesOnClientConnect
Stack Traces | -0.000s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [01-26|07:20:27.852] Feed connected                           feedServerVersion=2 chainId=8744 requestedSeqNum=2
    broadcastclient_test.go:774: client 1 received second message: {1 {0xc0002fee40 0} <nil> [101 51 64 132 204 151 247 186 138 50 43 21 37 47 175 242 79 134 24 70 178 249 251 99 226 214 98 192 127 139 86 58 107 208 234 45 106 154 249 145 95 135 199 6 93 66 175 139 115 243 86 179 75 244 24 64 152 101 101 60 166 238 42 2 0] [] 0}
    broadcastclient_test.go:774: client 0 received second message: {0 {0xc000494f00 0} <nil> [123 212 6 160 96 224 70 26 69 55 124 254 121 111 215 8 253 37 134 113 232 63 10 66 113 114 55 197 91 54 129 133 99 58 42 105 49 94 205 86 195 159 147 184 221 188 173 69 252 254 235 123 224 74 20 55 48 147 135 90 24 89 117 173 0] [] 0}
ERROR[01-26|07:20:28.042] Server connection timed out without receiving data url=ws://127.0.0.1:40577/ err="read tcp4 127.0.0.1:53478->127.0.0.1:40577: i/o timeout"
INFO [01-26|07:20:28.043] First reconnection attempt, skipping backoff url=ws://127.0.0.1:40577/
INFO [01-26|07:20:28.043] connecting to arbitrum inbox message broadcaster url=ws://127.0.0.1:40577/
INFO [01-26|07:20:28.043] Feed connected                           feedServerVersion=2 chainId=8742 requestedSeqNum=0
ERROR[01-26|07:20:28.054] Server connection timed out without receiving data url=ws://127.0.0.1:35077/ err="read tcp4 127.0.0.1:47890->127.0.0.1:35077: i/o timeout"
INFO [01-26|07:20:28.054] First reconnection attempt, skipping backoff url=ws://127.0.0.1:35077/
INFO [01-26|07:20:28.054] connecting to arbitrum inbox message broadcaster url=ws://127.0.0.1:35077/
ERROR[01-26|07:20:28.244] Server connection timed out without receiving data url=ws://127.0.0.1:40577/ err="read tcp4 127.0.0.1:53492->127.0.0.1:40577: i/o timeout"
INFO [01-26|07:20:28.244] First reconnection attempt, skipping backoff url=ws://127.0.0.1:40577/
INFO [01-26|07:20:28.244] connecting to arbitrum inbox message broadcaster url=ws://127.0.0.1:40577/
INFO [01-26|07:20:28.244] Feed connected                           feedServerVersion=2 chainId=8742 requestedSeqNum=0
ERROR[01-26|07:20:28.445] Server connection timed out without receiving data url=ws://127.0.0.1:40577/ err="read tcp4 127.0.0.1:53504->127.0.0.1:40577: i/o timeout"
INFO [01-26|07:20:28.445] First reconnection attempt, skipping backoff url=ws://127.0.0.1:40577/
INFO [01-26|07:20:28.445] connecting to arbitrum inbox message broadcaster url=ws://127.0.0.1:40577/
INFO [01-26|07:20:28.446] Feed connected                           feedServerVersion=2 chainId=8742 requestedSeqNum=0
ERROR[01-26|07:20:28.646] Server connection timed out without receiving data url=ws://127.0.0.1:40577/ err="read tcp4 127.0.0.1:53518->127.0.0.1:40577: i/o timeout"
INFO [01-26|07:20:28.646] First reconnection attempt, skipping backoff url=ws://127.0.0.1:40577/
TestSequencerPriceAdjustsFrom25Gwei
Stack Traces | 22.510s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [01-26|07:33:17.850] Chain head was updated                   number=5   hash=2f8b29..72d947 root=407e53..9abc9b elapsed="362.109µs"
INFO [01-26|07:33:17.856] Submitted contract creation              hash=0x0ddfe5250b1b74d92f95db89f81466643b74ce02f040d082ecf1f09229d6a325 from=0x57Ff0F473737a1c161bfF9efDF016F7991585088 nonce=21   contract=0x5E6d7135B0a5F12bF935A83B7d5b5e4a8BFf112d value=0
INFO [01-26|07:33:17.858] Starting work on payload                 id=0x03fa9b6824971708
INFO [01-26|07:33:17.859] Updated payload                          id=0x03fa9b6824971708 number=25  hash=429507..d6609a txs=1   withdrawals=0 gas=3,088,290  fees=3.08829e-06    root=aed14d..b71044 elapsed="849.643µs"
INFO [01-26|07:33:17.859] Stopping work on payload                 id=0x03fa9b6824971708 reason=delivery
INFO [01-26|07:33:17.860] Imported new potential chain segment     number=25  hash=429507..d6609a blocks=1  txs=1   mgas=3.088  elapsed=1.216ms      mgasps=2538.370 triediffs=90.14KiB   triedirty=0.00B
INFO [01-26|07:33:17.861] Chain head was updated                   number=25  hash=429507..d6609a root=aed14d..b71044 elapsed="307.537µs"
INFO [01-26|07:33:17.878] Submitted transaction                    hash=0x4262da1cdd0bc434676ac17ecc89cceaef3910c0fa62d976aa817ed2a4d2e3a7 from=0x26E554a8acF9003b83495c7f45F06edCB803d4e3 nonce=42   recipient=0x0C709F340F0BB2e361229e345B7e26999d0969Ab value=340,282,366,920,938,463,463,374,607,431,768,211,456
INFO [01-26|07:33:17.893] InboxTracker                             sequencerBatchCount=5   messageCount=6    l1Block=35  l1Timestamp=2026-01-26T07:33:17+0000
INFO [01-26|07:33:17.898] Submitted transaction                    hash=0xb5e8d40fc12fe980a55e08550a6941df75812577755c3e64a001463668926452 from=0x26E554a8acF9003b83495c7f45F06edCB803d4e3 nonce=6    recipient=0x0000000000000000000000000000000000000071 value=1,000,000,000,000,000,000
�[90mTime to activate hostio-test: 249.272133ms�[0;0m
INFO [01-26|07:33:17.902] InboxTracker                             sequencerBatchCount=17  messageCount=41   l1Block=46  l1Timestamp=2026-01-26T07:33:17+0000
INFO [01-26|07:33:17.904] Submitted transaction                    hash=0xcda12a443567eb36c98bf156618367cc7a1c464c9b8e915f5a4914fbc9db3bae from=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23 nonce=4    recipient=0xD0df7e8CfAc6dD6444d8c91FcBB7a87C15B776ea value=0
INFO [01-26|07:33:17.904] DataPoster sent transaction              nonce=4    hash=cda12a..db3bae feeCap=17,187,573,830 tipCap=50,000,000    blobFeeCap=<nil> gas=721,339
INFO [01-26|07:33:17.904] BatchPoster: batch sent                  sequenceNumber=5   from=6    to=7    prevDelayed=1   currentDelayed=1   totalSegments=3  numBlobs=0
INFO [01-26|07:33:17.905] Starting work on payload                 id=0x0325cbb9096dc530
INFO [01-26|07:33:17.906] Submitted contract creation              hash=0xd8bc7246b6bfae04fa810bb28f6dcfdda1dff054b6a5eb383b20a9901e8336c6 from=0x26E554a8acF9003b83495c7f45F06edCB803d4e3 nonce=7    contract=0x52AefB40754517B3A0A1672b01DC2930a7851444 value=0
INFO [01-26|07:33:17.907] Updated payload                          id=0x0325cbb9096dc530 number=36  hash=5885f2..7d14d9 txs=1   withdrawals=0 gas=704,580    fees=3.5229e-05     root=8a8d25..b8d4d4 elapsed=1.223ms
INFO [01-26|07:33:17.907] Stopping work on payload                 id=0x0325cbb9096dc530 reason=delivery
INFO [01-26|07:33:17.909] Imported new potential chain segment     number=36  hash=5885f2..7d14d9 blocks=1  txs=1   mgas=0.705  elapsed=1.700ms      mgasps=414.267  triediffs=184.50KiB  triedirty=0.00B
TestFastConfirmationWithSafe
Stack Traces | 48.320s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [01-26|07:33:40.419] Stopping work on payload                 id=0x037ce7d98fc9927d reason=delivery
INFO [01-26|07:33:40.420] Imported new potential chain segment     number=334 hash=6512bf..9551fe blocks=1  txs=1   mgas=0.021 elapsed=1.502ms     mgasps=13.977   triediffs=679.21KiB triedirty=150.03KiB
INFO [01-26|07:33:40.421] Chain head was updated                   number=334 hash=6512bf..9551fe root=953c44..824727 elapsed="113.48µs"
INFO [01-26|07:33:40.421] Persisted dirty state to disk            size=651.15KiB elapsed=17.382ms
INFO [01-26|07:33:40.421] Starting work on payload                 id=0x03397ff1ee69e7bf
INFO [01-26|07:33:40.422] Blockchain stopped
INFO [01-26|07:33:40.421] Updated payload                          id=0x03065d405ae0a299 number=71  hash=29ee5b..9acdff txs=1   withdrawals=0 gas=21000     fees=0.002099709926 root=029122..ae7bc4 elapsed=1.726ms
INFO [01-26|07:33:40.422] Stopping work on payload                 id=0x03065d405ae0a299 reason=delivery
INFO [01-26|07:33:40.423] Updated payload                          id=0x03397ff1ee69e7bf number=388 hash=c02e55..523290 txs=1   withdrawals=0 gas=21000     fees=0.0021         root=480ffb..e6bc0e elapsed=1.281ms
INFO [01-26|07:33:40.423] Imported new potential chain segment     number=71  hash=29ee5b..9acdff blocks=1  txs=1   mgas=0.021 elapsed=1.309ms     mgasps=16.033   triediffs=317.63KiB triedirty=0.00B
INFO [01-26|07:33:40.423] Chain head was updated                   number=71  hash=29ee5b..9acdff root=029122..ae7bc4 elapsed="76.472µs"
INFO [01-26|07:33:40.424] New Key                                  name=Faucet              Address=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A
INFO [01-26|07:33:40.424] Stopping work on payload                 id=0x03397ff1ee69e7bf reason=delivery
INFO [01-26|07:33:40.424] New Key                                  name=RollupOwner         Address=0x57Ff0F473737a1c161bfF9efDF016F7991585088
--- FAIL: TestFastConfirmationWithSafe (48.32s)
INFO [01-26|07:33:40.424] New Key                                  name=Sequencer           Address=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23
INFO [01-26|07:33:40.424] New Key                                  name=Validator           Address=0x83FFCFaCE2Fb0E1286686815503608A16EF41e47
INFO [01-26|07:33:40.424] New Key                                  name=User                Address=0x7E23C8862920797d81916d62c274dd9217113e28
INFO [01-26|07:33:40.425] Allocated trie memory caches             clean=154.00MiB dirty=256.00MiB
INFO [01-26|07:33:40.425] State schema set to default              scheme=path

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

@ganeshvanahalli ganeshvanahalli marked this pull request as draft January 20, 2026 17:31
rauljordan
rauljordan previously approved these changes Jan 20, 2026
Copy link
Contributor

@rauljordan rauljordan left a comment

Choose a reason for hiding this comment

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

This looks really good to me so far, no need to keep in draft IMO

Base automatically changed from mel-txandreceipt-fetcher to master January 21, 2026 03:51
@ganeshvanahalli ganeshvanahalli dismissed rauljordan’s stale review January 21, 2026 03:51

The base branch was changed.

@ganeshvanahalli ganeshvanahalli marked this pull request as ready for review January 21, 2026 09:31
rauljordan
rauljordan previously approved these changes Jan 22, 2026
@rauljordan rauljordan assigned eljobe and unassigned rauljordan Jan 22, 2026
@rauljordan rauljordan dismissed their stale review January 22, 2026 15:03

Realized that some issues will happen with the current code because we changed delayed msg hashes

@rauljordan rauljordan assigned ganeshvanahalli and unassigned eljobe Jan 22, 2026
crypto.Keccak256(m.Message.L2msg),
)
return crypto.Keccak256Hash(hash)
encoded, err := rlp.EncodeToBytes(m.WithMELRelevantFields())
Copy link
Contributor

Choose a reason for hiding this comment

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

@ganeshvanahalli won't this break existing code? We want to eventually merge to master and cannot break existing logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hash() method is only used by MEL code currently, the rest of the codebase (tracker, reader etc..) uses AfterInboxAcc method

@tsahee tsahee marked this pull request as draft January 28, 2026 16:29
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.

4 participants