-
Notifications
You must be signed in to change notification settings - Fork 684
Add MaxTxSize check to ValidateExpressLaneTx() #4105
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
base: master
Are you sure you want to change the base?
Conversation
❌ 4 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
4559510 to
1715b85
Compare
cmd/el-proxy/config.go
Outdated
| } | ||
|
|
||
| func (c *ExpressLaneProxyConfig) Validate() error { | ||
| if c.MaxTxDataSize > arbostypes.MaxL2MessageSize-50000 { |
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.
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
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.
I attempted to resolve the concern, let me know what you think
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.
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 😅
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.
I have no idea as well, I added a comment with the details of when this change was added
pmikolajczyk41
left a comment
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.
Although I have some minor questions, I'm happy with the current code, so an approval from my side ✅
ganeshvanahalli
left a comment
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.
We do already have MaxTxSize check in the sequencer right?
nitro/execution/gethexec/sequencer.go
Lines 1295 to 1299 in 6837a8f
| 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. |
d4cb495
|
@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. |
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 forValidateExpressLaneTx()as well.I am using uint64, as I don't think we should use
intas itThe 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.