-
Notifications
You must be signed in to change notification settings - Fork 3
add reorg, sequence delayed messages functionality #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
86bc18e
use block header and add tests
tanishqjasoria 459a8bf
try somthing
tanishqjasoria 7f50c55
final changes
tanishqjasoria 221a69c
Merge branch 'main' into tanishq/fix/digest-message
tanishqjasoria 11a108c
remove reorg test
tanishqjasoria 9a81581
remove unused stuuf
tanishqjasoria f2cc003
update name
tanishqjasoria 054c4b9
revert change
tanishqjasoria 1415076
address comments and add mutex
tanishqjasoria 76f59a9
whitespace
tanishqjasoria 89c6614
Apply suggestion from @Copilot
tanishqjasoria 71a3833
fix logs
tanishqjasoria d1f3615
add parameters
tanishqjasoria 990fa03
Add reorg functions
tanishqjasoria 436d69e
Refac
tanishqjasoria d7873e5
Add reorg sequencing skelton
tanishqjasoria b8f435b
Add reverse parser
tanishqjasoria e6bd6dd
complete function implementations
tanishqjasoria aed052d
Refactor
tanishqjasoria 931c86d
more changes
tanishqjasoria ffa4ab5
add another function
tanishqjasoria 12e4c35
fix decoer
tanishqjasoria d745432
fix encoder and tests
tanishqjasoria df1439b
fix
tanishqjasoria e0a1153
Merge branch 'main' into tanishq/feat/reorg-new
tanishqjasoria 0098e13
Rearrange public/private
tanishqjasoria cb8b98c
refactor
tanishqjasoria 0e8f511
add tests
tanishqjasoria 65adaf4
refac
tanishqjasoria 456ccb3
another refactor
tanishqjasoria 3887843
format
tanishqjasoria 27932b9
refac
tanishqjasoria 78a1755
Update src/Nethermind.Arbitrum/Exceptions/ArbitrumBlockProductionExce…
tanishqjasoria 7ef0648
fix issues
tanishqjasoria dda695b
inside namespace
tanishqjasoria e326f74
fix issue
tanishqjasoria bbf8546
fix issues
tanishqjasoria e9b54ab
Merge remote-tracking branch 'origin/main' into tanishq/feat/reorg-new
tanishqjasoria 702f759
fix issues and refac
tanishqjasoria File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| using Nethermind.Arbitrum.Test.Infrastructure; | ||
| using Nethermind.Core; | ||
| using Nethermind.Core.Crypto; | ||
| using Nethermind.Core.Extensions; | ||
| using Nethermind.Int256; | ||
| using Nethermind.Specs.ChainSpecStyle; | ||
| using Nethermind.Specs.Test.ChainSpecStyle; | ||
|
|
@@ -167,6 +168,102 @@ public static void Parse_L2Message_DynamicFeeTx_ParsesCorrectly() | |
| }, o => o.ForTransaction()); | ||
| } | ||
|
|
||
| [Test] | ||
| public static void Parse_RoundTrip_EthLegacy_ParsesCorrectly() | ||
| { | ||
| L1IncomingMessage message = new( | ||
| new L1IncomingMessageHeader( | ||
| ArbitrumL1MessageKind.L2Message, | ||
| new Address("0xDD6Bd74674C356345DB88c354491C7d3173c6806"), | ||
| 117, | ||
| 1745999206, | ||
| new Hash256("0x0000000000000000000000000000000000000000000000000000000000000002"), | ||
| 295), | ||
| Convert.FromBase64String("BPilgIUXSHboAIMBhqCAgLhTYEWAYA5gADmAYADzUP5//////////////////////////////////////////+A2AWAAgWAggjeANYKCNPWAFRVgOVeBgv1bgIJSUFBQYBRgDPMboCIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIioCIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIi"), | ||
| null); | ||
|
|
||
| Transaction transaction = NitroL2MessageParser.ParseTransactions(message, ChainId, new()).Single(); | ||
|
|
||
| transaction.Should().BeEquivalentTo(new Transaction | ||
| { | ||
| Type = TxType.Legacy, | ||
| Nonce = 0, | ||
| GasPrice = 100000000000, | ||
| GasLimit = 100000, | ||
| To = null, | ||
| Value = 0, | ||
| Data = Convert.FromHexString( | ||
| "604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3"), | ||
| Signature = new( | ||
| UInt256.Parse("15438945231642159389809464667825054380435997955418741871927677867721750618658"), | ||
| UInt256.Parse("15438945231642159389809464667825054380435997955418741871927677867721750618658"), | ||
| 27) | ||
| }, o => o.ForTransaction()); | ||
|
|
||
| L1IncomingMessage? parsedMessage = NitroL2MessageParser.ParseMessageFromTransactions(message.Header, [transaction]); | ||
| parsedMessage.Should().NotBeNull(); | ||
| parsedMessage!.L2Msg.Should().BeEquivalentTo(message.L2Msg); | ||
| } | ||
|
|
||
| [Test] | ||
| public static void Parse_RoundTrip_DynamicFeeTx_ParsesCorrectly() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test name doesn't follow the convention. |
||
| { | ||
| L1IncomingMessage message = new( | ||
| new L1IncomingMessageHeader( | ||
| ArbitrumL1MessageKind.L2Message, | ||
| new Address("0xA4b000000000000000000073657175656e636572"), | ||
| 166, | ||
| 1745999257, | ||
| null, | ||
| 8), | ||
| Convert.FromBase64String("BAL4doMGSrqAhFloLwCEZVPxAIJSCJReFJfdHwjIey2P4j6aq2wd6DPZJ4kFa8deLWMQAACAwICgTJ7ERDhsUJoSmXYhVhdHIN5YgHJ2PBS1e9YImp0iAfmgTkKAGg0ukQ/BHPiMnbTpFqIuHlSBgQff7dPFFlMlhP4="), | ||
| null); | ||
|
|
||
| Transaction transaction = NitroL2MessageParser.ParseTransactions(message, ChainId, new()).Single(); | ||
|
|
||
| transaction.Should().BeEquivalentTo(new Transaction | ||
| { | ||
| ChainId = 412346, | ||
| Type = TxType.EIP1559, | ||
| Nonce = 0, | ||
| GasPrice = 1500000000, // DynamicFeeTx.GasTipCap | ||
| DecodedMaxFeePerGas = 1700000000, // DynamicFeeTx.GasFeeCap | ||
| GasLimit = 21000, | ||
| To = new("0x5E1497dD1f08C87b2d8FE23e9AAB6c1De833D927"), | ||
| Value = UInt256.Parse("100000000000000000000"), | ||
| Data = Array.Empty<byte>(), | ||
| Signature = new( | ||
| UInt256.Parse("34656292910065621035852780818211523586495092995652367972786234253091016933881"), | ||
| UInt256.Parse("35397898221649370395961710411641180996206548691370223704696374300050614224126"), | ||
| 27) | ||
| }, o => o.ForTransaction()); | ||
|
|
||
| L1IncomingMessage? parsedMessage = NitroL2MessageParser.ParseMessageFromTransactions(message.Header, [transaction]); | ||
| parsedMessage.Should().NotBeNull(); | ||
| parsedMessage!.L2Msg.Should().BeEquivalentTo(message.L2Msg); | ||
| } | ||
|
|
||
| [Test] | ||
| public static void Parse_RoundTrip_EthLegacyAndDynamicFeeTx_ParsesCorrectly() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test name doesn't follow the convention. |
||
| { | ||
| L1IncomingMessage message = new( | ||
| new L1IncomingMessageHeader( | ||
| ArbitrumL1MessageKind.L2Message, | ||
| new Address("0xA4b000000000000000000073657175656e636572"), | ||
| 166, | ||
| 1745999257, | ||
| null, | ||
| 8), | ||
| Convert.FromBase64String("AwAAAAAAAAB6BAL4doMGSrqAhFloLwCEZVPxAIJSCJReFJfdHwjIey2P4j6aq2wd6DPZJ4kFa8deLWMQAACAwICgTJ7ERDhsUJoSmXYhVhdHIN5YgHJ2PBS1e9YImp0iAfmgTkKAGg0ukQ/BHPiMnbTpFqIuHlSBgQff7dPFFlMlhP4AAAAAAAAAqAT4pYCFF0h26ACDAYaggIC4U2BFgGAOYAA5gGAA81D+f//////////////////////////////////////////gNgFgAIFgIII3gDWCgjT1gBUVYDlXgYL9W4CCUlBQUGAUYAzzG6AiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIqAiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIg=="), | ||
| null); | ||
|
|
||
| IReadOnlyList<Transaction> transactions = NitroL2MessageParser.ParseTransactions(message, ChainId, new()); | ||
|
|
||
| L1IncomingMessage? parsedMessage = NitroL2MessageParser.ParseMessageFromTransactions(message.Header, transactions); | ||
| parsedMessage.Should().NotBeNull(); | ||
| parsedMessage!.L2Msg.Should().BeEquivalentTo(message.L2Msg); | ||
| } | ||
|
|
||
| [TestCase("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGgR1aviFI7lPAdVIV32myYW5VIVTtxYTy77YI0r5OtTqBq17j1Lv4FmDlUUIb5DT9toNVdVxepdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAA", Description = "With extra data")] | ||
| [TestCase("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGgR1aviFI7lPAdVIV32myYW5VIVTtxYTy77YI0r5OtTqBq17j1Lv4FmDlUUIb5DT9toNVdVxepdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACA==", Description = "Without extra data")] | ||
| public static void Parse_BatchPostingReport_ParsesCorrectly(string l2Msg) | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test name doesn't follow the convention.