-
Notifications
You must be signed in to change notification settings - Fork 12
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
Remove ContainerStorable.EncodeAsElement #354
Remove ContainerStorable.EncodeAsElement #354
Conversation
Currently, EncodeAsElement is used to encode inlined array and map, while Encode is used to encode standalone array and map. This commit simplifies encoding API by using Encode() to encode both inlined/standalone array/map.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## feature/array-map-inlining #354 +/- ##
==============================================================
+ Coverage 62.53% 62.57% +0.03%
==============================================================
Files 15 15
Lines 10612 10599 -13
==============================================================
- Hits 6636 6632 -4
+ Misses 3024 3017 -7
+ Partials 952 950 -2
☔ View full report in Codecov by Sentry. |
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.
Nice!
Is this fixing the case we ran into on Friday in Cadence, the encoding of SomeStorable
was triggering Encode
instead of EncodeAsElement
?
If so, could you please add a test for it?
encode.go
Outdated
Writer: w, | ||
CBOR: streamEncoder, | ||
encMode: encMode, | ||
inlinedExtraData: newInlinedExtraData(), |
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 this be created lazily, if needed?
This was the simplification I mentioned in Friday's meeting as being in progress. It was annoying to have both functions but there were bigger fish to fry. Will look into adding tests, etc. to this PR after resolving urgent edge case I found on Sunday (related to |
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.
Looks good to me.
This commit makes StorableSlab.Encode() return error if it contains inlined array or inlined map.
UPDATE: I made changes to Cadence with commit onflow/cadence@aa087cf and it has more detailed description in the commit message. Given this, I will add tests for |
Updates #292
Currently, EncodeAsElement is used to encode inlined array and map, while Encode is used to encode standalone array and map.
This PR simplifies encoding API by using Encode() to encode both inlined/standalone array/map.
This helps simplify Cadence integration at onflow/cadence#2882.
main
branchFiles changed
in the Github PR explorer