Skip to content

Add regression tests for arbitrum classic database#4465

Open
joshuacolvin0 wants to merge 6 commits intomasterfrom
classicdb-tests
Open

Add regression tests for arbitrum classic database#4465
joshuacolvin0 wants to merge 6 commits intomasterfrom
classicdb-tests

Conversation

@joshuacolvin0
Copy link
Member

@joshuacolvin0 joshuacolvin0 commented Mar 5, 2026

Refactors the logic for opening the classic-msg database into a dedicated OpenClassicOutboxFromStack function. This centralizes database initialization, error handling, and the UnfinishedConversionCheck, improving code clarity and reusability.

Adds comprehensive unit and system tests to:

  • Verify correct message retrieval across various tree sizes and boundary conditions.
  • Confirm the off-by-one indexing fix.
  • Ensure the classic-msg database can be correctly opened and its data retrieved after closing and reopening with production settings.
  • Test the behavior when the database does not exist.

Addresses minor off-by-one error in ClassicOutboxRetriever.GetMsg that would simply cause a different error which would report an error message unrelated to actual error.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

joshuacolvin0 and others added 2 commits March 4, 2026 16:59
Extract OpenClassicOutboxFromStack from CreateExecutionNode so the
classic-msg database open logic is independently testable.
Fix GetMsg bounds check from `merkleSize < index` to `merkleSize <= index`
so one-past-the-end indices get a clear error instead of falling through
to merkle traversal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add unit tests for ClassicOutboxRetriever covering merkle tree traversal,
boundary indices, error paths, and the NoFreezer database reopen flow.
Add system tests verifying OpenClassicOutboxFromStack with a real on-disk
database and graceful handling of missing databases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

❌ 6 Tests Failed:

Tests completed Failed Passed Skipped
4266 6 4260 0
View the top 3 failed tests by shortest run time
TestManageTransactionFilterers
Stack Traces | 2.410s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [03-05|03:04:15.298] Started log indexer
INFO [03-05|03:04:15.298] Starting peer-to-peer node               instance=test-stack-name/linux-amd64/go1.25.7
WARN [03-05|03:04:15.298] P2P server will be useless, neither dialing nor listening
INFO [03-05|03:04:15.305] InboxTracker                             sequencerBatchCount=2 messageCount=2 l1Block=29 l1Timestamp=2026-03-05T03:04:14+0000
INFO [03-05|03:04:15.306] InboxTracker                             sequencerBatchCount=2 messageCount=2 l1Block=29 l1Timestamp=2026-03-05T03:04:14+0000
INFO [03-05|03:04:15.306] Ethereum protocol stopped
INFO [03-05|03:04:15.307] Transaction pool stopped
INFO [03-05|03:04:15.307] Persisting dirty state                   head=30 root=acc47e..7c09b7 layers=30
INFO [03-05|03:04:15.307] Submitted transaction                    hash=0x9f203e6e9ee1b5b7bcce15a317a7e8efaca9f8f88b18d4d85ef97b6c51e89e7d from=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23 nonce=1  recipient=0x564991bd991932D399A3bddA2Bc025de321019FC value=0
INFO [03-05|03:04:15.308] Starting work on payload                 id=0x03d82d0c22cc327e
INFO [03-05|03:04:15.308] Read serialized chain config from init message json="{\"chainId\":412347,\"homesteadBlock\":0,\"daoForkSupport\":true,\"eip150Block\":0,\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0,\"berlinBlock\":0,\"londonBlock\":0,\"depositContractAddress\":\"0x0000000000000000000000000000000000000000\",\"clique\":{\"period\":0,\"epoch\":0},\"arbitrum\":{\"EnableArbOS\":true,\"AllowDebugPrecompiles\":true,\"DataAvailabilityCommittee\":true,\"InitialArbOSVersion\":32,\"InitialChainOwner\":\"0x0000000000000000000000000000000000000000\",\"GenesisBlockNum\":0}}"
INFO [03-05|03:04:15.308] DataPoster sent transaction              nonce=1  hash=9f203e..e89e7d feeCap=13,084,270,890 tipCap=50,000,000 blobFeeCap=&lt;nil&gt; gas=155,981
INFO [03-05|03:04:15.309] BatchPoster: batch sent                  sequenceNumber=2 from=2 to=3 prevDelayed=1 currentDelayed=1 totalSegments=3 numBlobs=0
WARN [03-05|03:04:15.308] Sequencer ReadFromTxQueueTimeout is higher than MaxBlockSpeed ReadFromTxQueueTimeout=1s MaxBlockSpeed=10ms
INFO [03-05|03:04:15.309] Updated payload                          id=0x03d82d0c22cc327e number=38 hash=f834dc..dd1b09 txs=1 withdrawals=0 gas=143,673    fees=7.18365e-06    root=d9021e..70bd50 elapsed=1.267ms
INFO [03-05|03:04:15.309] created block                            l2Block=1 l2BlockHash=34477a..8ee865
INFO [03-05|03:04:15.310] Persisted dirty state to disk            size=139.41KiB elapsed=2.801ms
INFO [03-05|03:04:15.310] Blockchain stopped
INFO [03-05|03:04:15.310] Stopping work on payload                 id=0x03d82d0c22cc327e reason=delivery
--- FAIL: TestManageTransactionFilterers (2.41s)
TestVersion30
Stack Traces | 5.350s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
    precompile_inclusion_test.go:94: �[31;1m [] execution aborted (timeout = 5s) �[0;0m
INFO [03-05|03:04:18.916] Stopping work on payload                 id=0x036d1c0c25df12be reason=delivery
INFO [03-05|03:04:18.916] Imported new potential chain segment     number=76 hash=a481aa..f4c3ac blocks=1  txs=0  mgas=0.000  elapsed=1.085ms     mgasps=0.000    triediffs=382.08KiB triedirty=0.00B
INFO [03-05|03:04:18.917] Chain head was updated                   number=76 hash=a481aa..f4c3ac root=080f94..38e717 elapsed="56.937µs"
INFO [03-05|03:04:18.917] Writing cached state to disk             block=1  hash=1c5b43..0aadeb root=8448b4..050cee
INFO [03-05|03:04:18.917] Writing cached state to disk             block=1  hash=6cf8be..2a0e72 root=d45d64..4e7811
INFO [03-05|03:04:18.917] Persisted trie from memory database      nodes=23  flushnodes=0 size=3.61KiB   flushsize=0.00B time="206.076µs" flushtime=0s gcnodes=0 gcsize=0.00B gctime="1.432µs"  livenodes=0   livesize=0.00B
INFO [03-05|03:04:18.918] Writing cached state to disk             block=1  hash=6cf8be..2a0e72 root=d45d64..4e7811
INFO [03-05|03:04:18.918] Persisted trie from memory database      nodes=0   flushnodes=0 size=0.00B     flushsize=0.00B time="2.224µs"   flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s         livenodes=0   livesize=0.00B
INFO [03-05|03:04:18.918] Writing snapshot state to disk           root=28fb26..40a768
INFO [03-05|03:04:18.918] Persisted trie from memory database      nodes=0   flushnodes=0 size=0.00B     flushsize=0.00B time="1.533µs"   flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s         livenodes=0   livesize=0.00B
INFO [03-05|03:04:18.918] Blockchain stopped
INFO [03-05|03:04:18.917] Persisted trie from memory database      nodes=20  flushnodes=0 size=3.26KiB   flushsize=0.00B time="91.11µs"   flushtime=0s gcnodes=0 gcsize=0.00B gctime="2.996µs"  livenodes=0   livesize=0.00B
INFO [03-05|03:04:18.918] Writing cached state to disk             block=1  hash=1c5b43..0aadeb root=8448b4..050cee
INFO [03-05|03:04:18.918] Persisted trie from memory database      nodes=0   flushnodes=0 size=0.00B     flushsize=0.00B time="1.984µs"   flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s         livenodes=0   livesize=0.00B
INFO [03-05|03:04:18.918] Writing snapshot state to disk           root=6b754c..7398ca
INFO [03-05|03:04:18.918] Persisted trie from memory database      nodes=0   flushnodes=0 size=0.00B     flushsize=0.00B time=832ns       flushtime=0s gcnodes=0 gcsize=0.00B gctime=0s         livenodes=0   livesize=0.00B
INFO [03-05|03:04:18.919] Blockchain stopped
INFO [03-05|03:04:18.919] Submitted transaction                    hash=0xaa6585de17d266526f3162d5b9fe5d8216fdc489d62c4cbb29986cc5e06a8099 from=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A nonce=35 recipient=0x7E23C8862920797d81916d62c274dd9217113e28 value=1,000,000,000,000
--- FAIL: TestVersion30 (5.35s)
TestVersion40
Stack Traces | 5.410s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
        runtime/debug.Stack()
        	/opt/hostedtoolcache/go/1.25.7/x64/src/runtime/debug/stack.go:26 +0x5e
        github.com/offchainlabs/nitro/util/testhelpers.RequireImpl({0x40f1b90, 0xc064f73500}, {0x40ae3e0, 0xc0898293b0}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/util/testhelpers/testhelpers.go:29 +0x55
        github.com/offchainlabs/nitro/system_tests.Require(0xc064f73500, {0x40ae3e0, 0xc0898293b0}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/system_tests/common_test.go:2075 +0x5d
        github.com/offchainlabs/nitro/system_tests.testPrecompiles(0xc064f73500, 0x28, {0xc148e87df8, 0x5, 0x39?})
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:94 +0x371
        github.com/offchainlabs/nitro/system_tests.TestVersion40(0xc064f73500?)
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:71 +0x64b
        testing.tRunner(0xc064f73500, 0x3d288a8)
        	/opt/hostedtoolcache/go/1.25.7/x64/src/testing/testing.go:1934 +0xea
        created by testing.(*T).Run in goroutine 1
        	/opt/hostedtoolcache/go/1.25.7/x64/src/testing/testing.go:1997 +0x465
        
    precompile_inclusion_test.go:94: �[31;1m [] execution aborted (timeout = 5s) �[0;0m
INFO [03-05|03:04:18.915] Updated payload                          id=0x036d1c0c25df12be number=76 hash=a481aa..f4c3ac txs=0  withdrawals=0 gas=0          fees=0              root=080f94..38e717 elapsed="412.572µs"
WARN [03-05|03:04:18.915] error applying transaction               tx="{\"type\":\"0x2\",\"chainId\":\"0x64aba\",\"nonce\":\"0xa\",\"to\":\"0x43ed718ca2678b0fe216344cb6efbb6ea95f7f9a\",\"gas\":\"0x7532\",\"gasPrice\":\"0x0\",\"maxPriorityFeePerGas\":\"0xbebc200\",\"maxFeePerGas\":\"0xbebc200\",\"value\":\"0x45655841975740320\",\"input\":\"0x\",\"accessList\":[],\"v\":\"0x0\",\"r\":\"0x36981391b7f4ac0783f0e2906f733f9d2a91ebdbcbba7dee61605f6afa888fb3\",\"s\":\"0x7ed92558f2eb1961d179e726076b338309afe311e588d6a68c53c11da2435eec\",\"yParity\":\"0x0\",\"hash\":\"0xe01e18dfb57c83a37b57f8a9eac8274cdef455ec7c60f3e7873693bc1e16b687\"}" err="nonce too high: address 0x4c0f1daf08315d0238cb794e2Ae2B0cBEDbaC2ea, tx: 10 state: 0"
WARN [03-05|03:04:18.915] Served eth_call                          reqid=12  duration=5.169308385s err="execution aborted (timeout = 5s)"
--- FAIL: TestVersion40 (5.41s)

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

@joshuacolvin0 joshuacolvin0 changed the title Fixes Classic Outbox indexing and refactors access Add regression tests for arbitrum classic database Mar 5, 2026
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

❌ Patch coverage is 0% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.79%. Comparing base (b9b3864) to head (1a2b72e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4465      +/-   ##
==========================================
+ Coverage   32.72%   32.79%   +0.06%     
==========================================
  Files         493      494       +1     
  Lines       58290    58327      +37     
==========================================
+ Hits        19076    19128      +52     
+ Misses      35868    35867       -1     
+ Partials     3346     3332      -14     

joshuacolvin0 and others added 3 commits March 4, 2026 18:29
Extract shared BuildClassicMerkleTree and WriteClassicBatchHeader into
classicMessage_testhelpers.go, removing duplicate implementations from
both classicMessage_test.go and classic_msg_test.go. Remove redundant
TestClassicMsgDatabaseReopen (covered by system test
TestOpenClassicOutboxFromStack).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… computation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevents leaking an open database handle (file locks, descriptors)
when the conversion check fails in OpenClassicOutboxFromStack.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.

2 participants