Skip to content
Closed
Show file tree
Hide file tree
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 Jul 30, 2025
459a8bf
try somthing
tanishqjasoria Jul 31, 2025
7f50c55
final changes
tanishqjasoria Aug 4, 2025
221a69c
Merge branch 'main' into tanishq/fix/digest-message
tanishqjasoria Aug 4, 2025
11a108c
remove reorg test
tanishqjasoria Aug 4, 2025
9a81581
remove unused stuuf
tanishqjasoria Aug 4, 2025
f2cc003
update name
tanishqjasoria Aug 4, 2025
054c4b9
revert change
tanishqjasoria Aug 4, 2025
1415076
address comments and add mutex
tanishqjasoria Aug 4, 2025
76f59a9
whitespace
tanishqjasoria Aug 4, 2025
89c6614
Apply suggestion from @Copilot
tanishqjasoria Aug 4, 2025
71a3833
fix logs
tanishqjasoria Aug 4, 2025
d1f3615
add parameters
tanishqjasoria Aug 4, 2025
990fa03
Add reorg functions
tanishqjasoria Aug 4, 2025
436d69e
Refac
tanishqjasoria Aug 4, 2025
d7873e5
Add reorg sequencing skelton
tanishqjasoria Aug 5, 2025
b8f435b
Add reverse parser
tanishqjasoria Aug 6, 2025
e6bd6dd
complete function implementations
tanishqjasoria Aug 6, 2025
aed052d
Refactor
tanishqjasoria Aug 6, 2025
931c86d
more changes
tanishqjasoria Aug 6, 2025
ffa4ab5
add another function
tanishqjasoria Aug 6, 2025
12e4c35
fix decoer
tanishqjasoria Aug 8, 2025
d745432
fix encoder and tests
tanishqjasoria Aug 8, 2025
df1439b
fix
tanishqjasoria Aug 8, 2025
e0a1153
Merge branch 'main' into tanishq/feat/reorg-new
tanishqjasoria Aug 11, 2025
0098e13
Rearrange public/private
tanishqjasoria Aug 11, 2025
cb8b98c
refactor
tanishqjasoria Aug 11, 2025
0e8f511
add tests
tanishqjasoria Aug 11, 2025
65adaf4
refac
tanishqjasoria Aug 11, 2025
456ccb3
another refactor
tanishqjasoria Aug 11, 2025
3887843
format
tanishqjasoria Aug 11, 2025
27932b9
refac
tanishqjasoria Aug 11, 2025
78a1755
Update src/Nethermind.Arbitrum/Exceptions/ArbitrumBlockProductionExce…
tanishqjasoria Aug 11, 2025
7ef0648
fix issues
tanishqjasoria Aug 11, 2025
dda695b
inside namespace
tanishqjasoria Aug 12, 2025
e326f74
fix issue
tanishqjasoria Aug 12, 2025
bbf8546
fix issues
tanishqjasoria Aug 15, 2025
e9b54ab
Merge remote-tracking branch 'origin/main' into tanishq/feat/reorg-new
tanishqjasoria Aug 26, 2025
702f759
fix issues and refac
tanishqjasoria Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,16 @@ public Task<ResultWrapper<MessageResult>> DigestMessage(DigestMessageParameters
return rpc.DigestMessage(parameters);
}

public Task<ResultWrapper<MessageResult[]>> Reorg(ReorgParameters parameters)
{
return rpc.Reorg(parameters);
}

public Task<ResultWrapper<MessageResult>> SequenceDelayedMessage(SequenceDelayedMessageParameters parameters)
{
return rpc.SequenceDelayedMessage(parameters);
}

public Task<ResultWrapper<MessageResult>> ResultAtPos(ulong messageIndex)
{
return rpc.ResultAtPos(messageIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public async Task FullRpcSequenceFromLog_ExecutesAllCallsSuccessfully()
Hash256 lastBlockHash = initResult.Data.BlockHash;
for (int i = 0; i < 8; i++)
{

ResultWrapper<MessageResult> digestResult = await chain.ArbitrumRpcModule.DigestMessage(_messages[i]);
digestResult.Result.ResultType.Should().Be(ResultType.Success,
$"DigestMessage {i + 1} should succeed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -167,6 +168,102 @@ public static void Parse_L2Message_DynamicFeeTx_ParsesCorrectly()
}, o => o.ForTransaction());
}

[Test]
public static void Parse_RoundTrip_EthLegacy_ParsesCorrectly()
Copy link
Copy Markdown
Collaborator

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.

{
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()
Copy link
Copy Markdown
Collaborator

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.

{
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()
Copy link
Copy Markdown
Collaborator

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.

{
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)
Expand Down
Loading
Loading