Skip to content

test: ArbSysParserTests#163

Merged
svlachakis merged 9 commits into
hudem1/feat/precompile/arb-sysfrom
arbsysparser-tests
Aug 25, 2025
Merged

test: ArbSysParserTests#163
svlachakis merged 9 commits into
hudem1/feat/precompile/arb-sysfrom
arbsysparser-tests

Conversation

@svlachakis

@svlachakis svlachakis commented Aug 23, 2025

Copy link
Copy Markdown
Collaborator

Fixes Resolve #166

Note

The base is hudem1/feat/precompile/arb-sys

Important

These PRs need to be merged in order for the tests to pass:
#154
#9180

@svlachakis svlachakis marked this pull request as ready for review August 23, 2025 10:33
Comment thread src/Nethermind.Arbitrum/Precompiles/ArbitrumPrecompileExecutionContext.cs Outdated
Comment thread src/Nethermind.Arbitrum/Precompiles/Parser/ArbSysParser.cs Outdated
Comment thread src/Nethermind.Arbitrum/Precompiles/Parser/ArbSysParser.cs Outdated
Comment thread src/Nethermind.Arbitrum/Precompiles/Parser/ArbSysParser.cs Outdated
@svlachakis svlachakis requested a review from hudem1 August 23, 2025 13:06
Comment thread src/Nethermind.Arbitrum/Precompiles/ArbSys.cs Outdated
@svlachakis svlachakis changed the title ArbSysParserTests test: ArbSysParserTests Aug 23, 2025

@hudem1 hudem1 left a comment

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.

Wow, lots of comprehensive tests!

Just some general comments:

  • Just for info, in some tests, you test some different edge cases for the underlying ArbSys function being called but it's not really necessary because @AnkushinDaniil's PR already tests all the edge cases. So for the parser test file, you can focus on testing its internal functions (parsing/serializing mechanisms). If the parsing/serializing worked as expected then we can usually verify only 1 successful execution by asserting the returned serialized value. Otherwise, we can assert it threw an EndOfStreamException / or other potential exception. But it doesn't hurt to have more tests if you already wrote them. I'm just trying to explain how I see the purpose of this parser test file :)

  • You can simplify tests like i mentioned in some comments where you can directly compare the serialized returned value byte[], instead of parsing it to some other type UInt256 for example. It helps make the tests a bit shorter.

  • If you could also order the tests in the same order as the ArbSysParser's functions being tested, it would really help to follow, no need to search etc :)

  • I believe using TestCase could really help simplify and lighten tests avoiding setting up inputs/expectations logic.

  • I feel like some tests could be divided to test only 1 concept/thing, for example when you have several for loops in tests.

Comment thread src/Nethermind.Arbitrum/Precompiles/ArbSys.cs
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated

@wurdum wurdum left a comment

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.

👍

Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
@svlachakis svlachakis requested a review from hudem1 August 23, 2025 20:19
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated
Comment thread src/Nethermind.Arbitrum.Test/Precompiles/Parser/ArbSysParserTests.cs Outdated

@hudem1 hudem1 left a comment

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.

I think the tests now look really clean and concise !!
It's really easy to follow and understand what is being tested !
And I think the file really fulfills its purpose of testing the parsing/serializing mechanism only.
Looks really nice, great job!

@svlachakis svlachakis linked an issue Aug 25, 2025 that may be closed by this pull request

@hudem1 hudem1 left a comment

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.

LGTM :)

@svlachakis svlachakis merged commit 5750bce into hudem1/feat/precompile/arb-sys Aug 25, 2025
3 of 5 checks passed
@svlachakis svlachakis deleted the arbsysparser-tests branch August 25, 2025 10:23
hudem1 added a commit that referenced this pull request Aug 26, 2025
* feat: First version of incomplete implementation

* feat: Implementation finished

* fix: Make BurnBalance public

* fix: InverseAddressAliasOffset fix

* refactor: Move ArbSysMetadata code to ArbSys

* clean: Remove console logs

* fix: Use correct types for ArbSysL2ToL1Tx and ArbSysL2ToL1Transaction structs

* fix: The value passed to WithdrawEth and SendTxToL1 is the solidity msg.value

* fix: DecodeEvent now does not assume non-indexed params as last

* quick fix: use BigInteger instead of UInt256 as value can be negative

* fix: Return SendRoot from DigestMessage instead of Hash256.Zero

* refactor(send-hash): Reuse ArbosStorage.CalculateHash instead of creating a new same one

* chore: Use explicit types

* refactor: Rename KeccakHashWithCost to ComputeKeccakHash

* refactor: Add explicit comment

* chore: Add context when throwing exception

* chore: Ternary if convention style

* test: ArbSysParserTests (#163)

* Tests & few changes

* feat: Use latest version of feature/arbitrum-setup for NMC submodule with StateStack

* refactor: Use existing helper

* test: add `ArbSys` precompile tests (#162)

* fix: Revert unintentional changes when merging test PR

* fix: Forgotten merge conflict changes

* fix: Code format

* fix: Remove local-only changes

* fix: Code format

---------

Co-authored-by: Stavros Vlachakis <89769224+svlachakis@users.noreply.github.com>
Co-authored-by: Daniil Ankushin <ankushin.daniil42@gmail.com>
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.

test: add for ArbSysParser

3 participants