Skip to content

Conversation

@KolbyML
Copy link
Member

@KolbyML KolbyML commented Dec 3, 2025

resolves NIT-4157

The premise is we should check if a transaction is valid, before we send it when possible.

We already check the MaxTxDataSize in ValidateTransaction(), so we should do it for ValidateExpressLaneTx() as well.

I am using uint64, as I don't think we should use int as it

  • varies in size depending on the platform
  • the parameter can't be negative

The sequencer takes length of msg.Transaction.MarshalBinary() for its internal size check, I am surprised it doesn't use .Size(), that is why I must do the same here.

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
2187 4 2183 0
View the top 3 failed tests by shortest run time
TestVersion40
Stack Traces | 5.670s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
=== PAUSE TestVersion40
=== CONT  TestVersion40
    precompile_inclusion_test.go:94: goroutine 492068 [running]:
        runtime/debug.Stack()
        	/opt/hostedtoolcache/go/1.25.4/x64/src/runtime/debug/stack.go:26 +0x5e
        github.com/offchainlabs/nitro/util/testhelpers.RequireImpl({0x40ee4d0, 0xc067578c40}, {0x40abbe0, 0xc0a097a240}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/util/testhelpers/testhelpers.go:29 +0x55
        github.com/offchainlabs/nitro/system_tests.Require(0xc067578c40, {0x40abbe0, 0xc0a097a240}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/system_tests/common_test.go:1901 +0x5d
        github.com/offchainlabs/nitro/system_tests.testPrecompiles(0xc067578c40, 0x28, {0xc094623df8, 0x5, 0x39?})
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:94 +0x371
        github.com/offchainlabs/nitro/system_tests.TestVersion40(0xc067578c40?)
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:71 +0x64b
        testing.tRunner(0xc067578c40, 0x3d2fe70)
        	/opt/hostedtoolcache/go/1.25.4/x64/src/testing/testing.go:1934 +0xea
        created by testing.(*T).Run in goroutine 1
        	/opt/hostedtoolcache/go/1.25.4/x64/src/testing/testing.go:1997 +0x465
        
    precompile_inclusion_test.go:94: �[31;1m [] execution aborted (timeout = 5s) �[0;0m
--- FAIL: TestVersion40 (5.67s)
TestTimeboostExpressLaneTransactionHandling
Stack Traces | 29.870s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
DEBUG[12-10|00:38:00.220] Dereferenced trie from memory database   nodes=16  size=3.32KiB   time="41.738µs"  gcnodes=709  gcsize=134.76KiB  gctime=1.774218ms  livenodes=239   livesize=47.93KiB
DEBUG[12-10|00:38:00.220] Dereferenced trie from memory database   nodes=16  size=3.25KiB   time="57.117µs"  gcnodes=725  gcsize=138.02KiB  gctime=1.831205ms  livenodes=223   livesize=44.67KiB
DEBUG[12-10|00:38:00.220] Dereferenced trie from memory database   nodes=16  size=3.24KiB   time="39.704µs"  gcnodes=741  gcsize=141.26KiB  gctime=1.870769ms  livenodes=207   livesize=41.43KiB
DEBUG[12-10|00:38:00.220] Dereferenced trie from memory database   nodes=17  size=3.35KiB   time="42.89µs"   gcnodes=758  gcsize=144.61KiB  gctime=1.913539ms  livenodes=190   livesize=38.08KiB
DEBUG[12-10|00:38:00.220] Dereferenced trie from memory database   nodes=16  size=3.21KiB   time="41.027µs"  gcnodes=774  gcsize=147.82KiB  gctime=1.954406ms  livenodes=174   livesize=34.87KiB
DEBUG[12-10|00:38:00.220] Dereferenced trie from memory database   nodes=16  size=3.25KiB   time="36.528µs"  gcnodes=790  gcsize=151.07KiB  gctime=1.990803ms  livenodes=158   livesize=31.62KiB
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=16  size=3.25KiB   time="43.29µs"   gcnodes=806  gcsize=154.32KiB  gctime=2.033973ms  livenodes=142   livesize=28.37KiB
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=24  size=4.62KiB   time="61.164µs"  gcnodes=830  gcsize=158.95KiB  gctime=2.095007ms  livenodes=118   livesize=23.74KiB
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=18  size=3.59KiB   time="42.119µs"  gcnodes=848  gcsize=162.54KiB  gctime=2.136995ms  livenodes=100   livesize=20.15KiB
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=19  size=3.60KiB   time="48.961µs"  gcnodes=867  gcsize=166.13KiB  gctime=2.185816ms  livenodes=81    livesize=16.56KiB
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=16  size=3.25KiB   time="43.872µs"  gcnodes=883  gcsize=169.39KiB  gctime=2.229568ms  livenodes=65    livesize=13.30KiB
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=16  size=3.25KiB   time="57.608µs"  gcnodes=899  gcsize=172.64KiB  gctime=2.287005ms  livenodes=49    livesize=10.05KiB
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=16  size=3.38KiB   time="36.929µs"  gcnodes=915  gcsize=176.02KiB  gctime=2.323763ms  livenodes=33    livesize=6.67KiB
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=17  size=3.38KiB   time="42.52µs"   gcnodes=932  gcsize=179.40KiB  gctime=2.366163ms  livenodes=16    livesize=3.29KiB
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=16  size=3.29KiB   time="34.164µs"  gcnodes=948  gcsize=182.69KiB  gctime=2.400156ms  livenodes=0     livesize=0.00B
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=0   size=0.00B     time=231ns       gcnodes=948  gcsize=182.69KiB  gctime=2.400267ms  livenodes=0     livesize=0.00B
DEBUG[12-10|00:38:00.221] Dereferenced trie from memory database   nodes=0   size=0.00B     time=210ns       gcnodes=948  gcsize=182.69KiB  gctime=2.400367ms  livenodes=0     livesize=0.00B
INFO [12-10|00:38:00.222] Blockchain stopped
TRACE[12-10|00:38:00.222] P2P networking is spinning down
--- FAIL: TestTimeboostExpressLaneTransactionHandling (29.87s)
TestTimeboostTxsTimeoutByBlock
Stack Traces | 40.800s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=16  size=3.35KiB   time="41.758µs"  gcnodes=840  gcsize=161.23KiB  gctime=2.235736ms  livenodes=243   livesize=48.79KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=17  size=3.35KiB   time="46.056µs"  gcnodes=857  gcsize=164.58KiB  gctime=2.281672ms  livenodes=226   livesize=45.43KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=16  size=3.25KiB   time="41.618µs"  gcnodes=873  gcsize=167.84KiB  gctime=2.32319ms   livenodes=210   livesize=42.18KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=16  size=3.25KiB   time="39.955µs"  gcnodes=889  gcsize=171.09KiB  gctime=2.363004ms  livenodes=194   livesize=38.93KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=16  size=3.38KiB   time="37.721µs"  gcnodes=905  gcsize=174.47KiB  gctime=2.400614ms  livenodes=178   livesize=35.55KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=17  size=3.38KiB   time="39.093µs"  gcnodes=922  gcsize=177.85KiB  gctime=2.439587ms  livenodes=161   livesize=32.16KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=16  size=3.29KiB   time="38.642µs"  gcnodes=938  gcsize=181.14KiB  gctime=2.478119ms  livenodes=145   livesize=28.88KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=24  size=4.59KiB   time="56.055µs"  gcnodes=962  gcsize=185.73KiB  gctime=2.534074ms  livenodes=121   livesize=24.29KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=18  size=3.56KiB   time="53.431µs"  gcnodes=980  gcsize=189.29KiB  gctime=2.587384ms  livenodes=103   livesize=20.73KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=18  size=3.53KiB   time="50.705µs"  gcnodes=998  gcsize=192.82KiB  gctime=2.637979ms  livenodes=85    livesize=17.20KiB
DEBUG[12-10|00:37:05.413] Dereferenced trie from memory database   nodes=17  size=3.40KiB   time="41.407µs"  gcnodes=1015 gcsize=196.22KiB  gctime=2.679276ms  livenodes=68    livesize=13.80KiB
DEBUG[12-10|00:37:05.414] Dereferenced trie from memory database   nodes=17  size=3.52KiB   time="41.207µs"  gcnodes=1032 gcsize=199.74KiB  gctime=2.720383ms  livenodes=51    livesize=10.28KiB
DEBUG[12-10|00:37:05.414] Dereferenced trie from memory database   nodes=16  size=3.24KiB   time="40.596µs"  gcnodes=1048 gcsize=202.98KiB  gctime=2.760879ms  livenodes=35    livesize=7.04KiB
DEBUG[12-10|00:37:05.414] Dereferenced trie from memory database   nodes=19  size=3.63KiB   time="49.262µs"  gcnodes=1067 gcsize=206.61KiB  gctime=2.810021ms  livenodes=16    livesize=3.41KiB
DEBUG[12-10|00:37:05.414] Dereferenced trie from memory database   nodes=16  size=3.41KiB   time="46.657µs"  gcnodes=1083 gcsize=210.02KiB  gctime=2.856578ms  livenodes=0     livesize=0.00B
DEBUG[12-10|00:37:05.414] Dereferenced trie from memory database   nodes=0   size=0.00B     time=211ns       gcnodes=1083 gcsize=210.02KiB  gctime=2.856659ms  livenodes=0     livesize=0.00B
DEBUG[12-10|00:37:05.414] Dereferenced trie from memory database   nodes=0   size=0.00B     time=170ns       gcnodes=1083 gcsize=210.02KiB  gctime=2.856719ms  livenodes=0     livesize=0.00B
INFO [12-10|00:37:05.414] Blockchain stopped
TRACE[12-10|00:37:05.414] P2P networking is spinning down
--- FAIL: TestTimeboostTxsTimeoutByBlock (40.80s)

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

@KolbyML KolbyML marked this pull request as draft December 3, 2025 20:56
@KolbyML KolbyML force-pushed the NIT-4157 branch 3 times, most recently from 4559510 to 1715b85 Compare December 4, 2025 20:38
@KolbyML KolbyML marked this pull request as ready for review December 4, 2025 21:13
}

func (c *ExpressLaneProxyConfig) Validate() error {
if c.MaxTxDataSize > arbostypes.MaxL2MessageSize-50000 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 50k is a magic number and will have issues if we specify a config smaller than it, maybe we can either abstract it as constant or move it to the other side of the inequality? Also add the values to the error format string

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I attempted to resolve the concern, let me know what you think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the way you fixed it looks good, but I'd love to have a short comment above the constant why do we use 50'000 - I have no idea what this number represents actually 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea as well, I added a comment with the details of when this change was added

@KolbyML KolbyML assigned rauljordan and unassigned pmikolajczyk41 Dec 4, 2025
@KolbyML KolbyML requested a review from rauljordan December 4, 2025 23:38
pmikolajczyk41
pmikolajczyk41 previously approved these changes Dec 5, 2025
Copy link
Member

@pmikolajczyk41 pmikolajczyk41 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I have some minor questions, I'm happy with the current code, so an approval from my side ✅

Copy link
Contributor

@ganeshvanahalli ganeshvanahalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do already have MaxTxSize check in the sequencer right?

if queueItem.txSize > config.MaxTxDataSize {
// This tx is too large
queueItem.returnResult(txpool.ErrOversizedData)
continue
}

@KolbyML
Copy link
Member Author

KolbyML commented Dec 5, 2025

We do already have MaxTxSize check in the sequencer right?

if queueItem.txSize > config.MaxTxDataSize {
// This tx is too large
queueItem.returnResult(txpool.ErrOversizedData)
continue
}

We do check for this in the sequencer, we should fail transactions before they reach the sequencer when possible.

pmikolajczyk41
pmikolajczyk41 previously approved these changes Dec 5, 2025
rauljordan
rauljordan previously approved these changes Dec 5, 2025
@rauljordan rauljordan enabled auto-merge December 5, 2025 17:28
ganeshvanahalli
ganeshvanahalli previously approved these changes Dec 6, 2025
@KolbyML
Copy link
Member Author

KolbyML commented Dec 10, 2025

@joshuacolvin0 helped show me Transaction.Size() and len(MarshalBinary) are the same thing. I updated the sequencer to use .Size(), along with the validation check I added.

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.

6 participants