-
Notifications
You must be signed in to change notification settings - Fork 79
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
Rework maps #818
Merged
Merged
Rework maps #818
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes #809. Basically, there are three alternative approaches to fixing it: * allowing both []byte and string for ByteArrayType value minimal invasion into existing code, but ugly as hell and will probably backfire at some point * storing string values in ByteArrayType incurs quite a number of type conversions (and associated data copying), though note that these values are not changed usually, so dynamic properties of []byte are almost irrelevant here * storing only []byte values in ByteArrayType makes it impossible to use them as map keys which can be solved in several ways: - via an interface (Marshalable) which is good, but makes testing and comparing values in general harder, because of keys mismatch - using serialized Parameter as a key (in a string) which will need some additional marshaling/unmarshaling - converting MapType from map to a slice of key-value pairs not a bad idea as we don't use this map as a map really, the type itself is all about input/output for real VM types and this approach is also a bit closer to JSON representation of the Map
golangcibot
reviewed
Apr 1, 2020
Codecov Report
@@ Coverage Diff @@
## master #818 +/- ##
==========================================
+ Coverage 67.65% 67.66% +<.01%
==========================================
Files 141 141
Lines 13205 13165 -40
==========================================
- Hits 8934 8908 -26
+ Misses 3859 3849 -10
+ Partials 412 408 -4
Continue to review full report at Codecov.
|
Which makes iterating over map stable which is important for serialization and and even fixes occasional test failures. We use the same ordering here as NEO 3.0 uses, but it should also be fine for NEO 2.0 because it has no defined order.
roman-khimov
force-pushed
the
rework-maps
branch
from
April 1, 2020 16:34
5859a9c
to
2d0ad30
Compare
fyrchik
approved these changes
Apr 1, 2020
AnnaShaleva
approved these changes
Apr 1, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
#809 and unstable map serialization (neo-project/neo#1513).
Solution
This patchset allows us to proceed with mainnet dump up to #817.