add reorg, sequence delayed messages functionality#131
add reorg, sequence delayed messages functionality#131tanishqjasoria wants to merge 39 commits intomainfrom
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds reorg and sequence delayed message functionality to the Arbitrum module, enabling blockchain reorganization and processing of delayed messages from L1.
Key changes:
- Adds reorg functionality to handle blockchain reorganizations with message reprocessing
- Implements sequence delayed message processing for L1-originated delayed messages
- Introduces message parsing utilities for round-trip transaction encoding/decoding
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Nethermind.Arbitrum/Modules/IArbitrumRpcModule.cs | Adds interface definitions for Reorg and SequenceDelayedMessage RPC methods |
| src/Nethermind.Arbitrum/Modules/ArbitrumRpcModule.cs | Implements reorg and delayed message sequencing with event handling and message reprocessing |
| src/Nethermind.Arbitrum/Exceptions/ArbitrumBlockProductionException.cs | New exception class for block production errors with error codes |
| src/Nethermind.Arbitrum/Data/Transactions/NitroL2MessageParser.cs | Adds transaction-to-message parsing for round-trip message construction |
| src/Nethermind.Arbitrum/Data/DigestMessageParameters.cs | Defines parameter classes for reorg and delayed message operations |
| src/Nethermind.Arbitrum.Test/Rpc/SequenceDelayedMessagesTests.cs | Test suite for delayed message sequencing functionality |
| src/Nethermind.Arbitrum.Test/Rpc/DigestMessage/NitroL2MessageParserTests.cs | Tests for round-trip message parsing functionality |
| src/Nethermind.Arbitrum.Test/Rpc/ArbitrumFullSimulationRunTests.cs | Removes TODO comment from existing test |
src/Nethermind.Arbitrum/Exceptions/ArbitrumBlockProductionException.cs
Outdated
Show resolved
Hide resolved
…ption.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
AnkushinDaniil
left a comment
There was a problem hiding this comment.
There is some commented code that can possibly be removed.
Good job!
| (ulong)_decoder.GetLength(tx, RlpBehaviors.SkipTypedWrapping) + 1); | ||
| stream.Write(sizeBuf); | ||
| stream.WriteByte((byte)ArbitrumL2MessageKind.SignedTx); | ||
| _decoder.Encode(stream, tx, RlpBehaviors.SkipTypedWrapping); |
There was a problem hiding this comment.
It seems that it doesn't filter failed transactions as Nitro does
There was a problem hiding this comment.
yes, we dont have hooks implemented yet
was planning to discuss this today
| private static readonly TxDecoder _decoder; | ||
| static NitroL2MessageParser() | ||
| { | ||
| TxDecoder decoder = TxDecoder.Instance; |
There was a problem hiding this comment.
Can we use a safer private, isolated decoder?
There was a problem hiding this comment.
that needed a change in nethermind and that is why i did it this way.
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (49.51%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #131 +/- ##
==========================================
- Coverage 83.93% 83.72% -0.22%
==========================================
Files 89 90 +1
Lines 5123 5314 +191
Branches 726 762 +36
==========================================
+ Hits 4300 4449 +149
- Misses 823 865 +42
... and 7 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
wurdum
left a comment
There was a problem hiding this comment.
From PR description it's not clear whether it's finished PR and what is ommitted here. Lack of tests for reorg, unused vars and lots of todos hints there are more work to finish, but it's not communicated.
Also, we need to refactor ArbitrumRpcModule to remove blockchain logic from it. It should be responsible only for RPC transport specific concerns. Let's introduce something like ArbitrumBlockchain, ArbitrumFacade, ArbitrumApi, etc. and move block production, reorg, etc. logic there. That could be a separate PR.
src/Nethermind.Arbitrum/Data/Transactions/NitroL2MessageParser.cs
Outdated
Show resolved
Hide resolved
| /// <summary> | ||
| /// Notifies that a resequencing (reorg) operation is about to start. | ||
| /// </summary> | ||
| public event EventHandler<ResequenceOperationNotifier>? ResequenceOperationStarting; |
There was a problem hiding this comment.
What's the purpose of this event? Is it being used?
| ResultWrapper<MessageResult> msgResult; | ||
| try | ||
| { | ||
| Block? block = await ProduceBlockWhileLockedAsync(parameters.Message, headBlockHeader.Number + 1, headBlockHeader); |
There was a problem hiding this comment.
Can we make ProduceBlockWhileLockedAsync return ResultWrapper to avoid magic exceptions?
| } | ||
|
|
||
| [Test] | ||
| public static void Parse_RoundTrip_EthLegacy_ParsesCorrectly() |
There was a problem hiding this comment.
Test name doesn't follow the convention.
| } | ||
|
|
||
| [Test] | ||
| public static void Parse_RoundTrip_DynamicFeeTx_ParsesCorrectly() |
There was a problem hiding this comment.
Test name doesn't follow the convention.
| } | ||
|
|
||
| [Test] | ||
| public static void Parse_RoundTrip_EthLegacyAndDynamicFeeTx_ParsesCorrectly() |
There was a problem hiding this comment.
Test name doesn't follow the convention.
|
replaced by #172 |
No description provided.