-
Notifications
You must be signed in to change notification settings - Fork 115
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
go/storage/mkvs: Use cbor.UnmarshalTrusted for internal metadata #2800
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2800 +/- ##
==========================================
+ Coverage 61.78% 61.98% +0.20%
==========================================
Files 386 386
Lines 37198 37204 +6
==========================================
+ Hits 22981 23060 +79
+ Misses 11184 11093 -91
- Partials 3033 3051 +18
Continue to review full report at Codecov.
|
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.
Would it make sense adding a test case to cbor_test.go
? hm, i guess it's already tested in the upstream lib, maybe a test case for the storage code that would fail with old code.
Yeah we don't currently have CBOR tests as those are well tested upstream. We could add some basic API tests for CBOR. But for the database case the problem is that we would need to generate huge data sets (e.g., trees with more than 132k updated nodes) to trigger this which would probably slow tests down. I'll try and see how that would look like. |
Ok, it's not that bad, 132k elements takes 2 seconds to process, commit and finalize (locally, probably more on CI?) so we can leave this test in. |
233e9c9
to
25d1672
Compare
The new method relaxes some decoding restrictions for cases where the inputs are trusted (e.g., because they are known to be generated by the local node itself).
25d1672
to
ffa4115
Compare
// requested by using the UnmarshalTrusted method. | ||
decOptionsTrusted = cbor.DecOptions{ | ||
MaxArrayElements: 134217728, // Maximum allowed. | ||
MaxMapPairs: 134217728, // Maximum allowed. |
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.
what are the defaults for these on the untrusted decOptions
?
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 default is 131072. Maybe we should consider making this explicit and/or even changing it (e.g., lowering it) for untrusted settings?
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.
eh, maybe a comment if anything
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.
@kostko hello. I have an issue with calling StateToGenesis beacon api: rpc error: code = Internal desc = grpc: failed to unmarshal the received message cbor: exceeded max number of key-value pairs 131072 for CBOR map
at block 7188323
. How I can explicitly call UnmarshalTrusted method at this point?
No description provided.