-
Notifications
You must be signed in to change notification settings - Fork 32
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
add check for l2batchdata limit #691
add check for l2batchdata limit #691
Conversation
Quality Gate passedIssues Measures |
@@ -421,3 +422,45 @@ func checkForBadBatch( | |||
|
|||
return false, nil | |||
} | |||
|
|||
var ( | |||
LIMIT_128_KB = uint64(128 * 1024) |
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 can keep this as a constant 128_000. This is the limit in the smart contract for batchL2Data rather than "real" kb
|
||
bdc.bytes = append(bdc.bytes, newBytes...) | ||
return false | ||
} |
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 we can simplify this quite a bit and avoid some of the code calling this function. We only care about the size of the batchL2Data and we know every changeL2Block transaction is always 9 bytes so we can just keep a track of the number of blocks and append blockCount * 9
to the transaction bytes, which sadly does need to be fully calculated
bytes []byte | ||
} | ||
|
||
func NewBlockDataChecker() *BlockDataChecker { |
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.
Maybe BatchDataSizeChecker rather than mentioning blocks?
No description provided.