-
Notifications
You must be signed in to change notification settings - Fork 654
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
feat: adjust witness size limits #11511
Conversation
8075dda
to
2d23a4e
Compare
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.
Verifying, we have both MAX_COMPRESSED_STATE_WITNESS_SIZE
and MAX_RAW_STATE_WITNESS_SIZE
to take into account decoding size bomb thingi issue?
@shreyan-gupta only |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #11511 +/- ##
==========================================
+ Coverage 71.35% 71.41% +0.05%
==========================================
Files 787 788 +1
Lines 159385 159881 +496
Branches 159385 159881 +496
==========================================
+ Hits 113734 114178 +444
Misses 40734 40734
- Partials 4917 4969 +52
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
pub const MAX_COMPRESSED_STATE_WITNESS_SIZE: ByteSize = ByteSize::mib(32); | ||
|
||
/// Represents max allowed size of the raw (not compressed) state witness, | ||
/// corresponds to the size of borsh-serialized ChunkStateWitness. |
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.
nit. I think MAX_UNCOMPRESSED_STATE_WITNESS_SIZE could be clearer. or maybe MAX_STATE_WITNESS_SIZE? "raw" is ambiguous.
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.
agree, done in f91fc2c
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.
Can we even reduce it further like 16M and 32M respectively? maybe experiment with it later, do not want to block this one as it also clarifies the constant names etc.
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.
LGTM, with all the limits we don't expect the witness to be larger than 16MB, so 32MB should give us a safe margin.
I would leave it at 32/64, it's safer this way. There might be some weird case where the witness gets above 16MB and with 16MB limit the network would stall. 32MB is safer, and doesn't really hurt. |
@tayfunelmas Yes, I think we could reduce it further. For that we would need to carefully consider all current size limits in place (storage proof, transactions, current WIP with receipts). Currently selected values still have a lot of margin to be on the safe side, but I want to merge it ASAP to replace the current limit of 512MiB with something more reasonable. |
The `MAX_COMPRESSED_STATE_WITNESS_SIZE` has been set to 32 MiB in #11511. Back then it was a reasonable choice, but since then we increased some of the runtime parameters, which increased the worst case witness size by ~17MiB. (#11582, #11629). I'd feel safer with a larger limit on the compressed witness size.
The `MAX_COMPRESSED_STATE_WITNESS_SIZE` has been set to 32 MiB in #11511. Back then it was a reasonable choice, but since then we increased some of the runtime parameters, which increased the worst case witness size by ~17MiB. (#11582, #11629). I'd feel safer with a larger limit on the compressed witness size.
This PR includes the following: