Fix: Serialize non deserializable object#1978
Closed
shargon wants to merge 5 commits intoneo-project:masterfrom
Closed
Fix: Serialize non deserializable object#1978shargon wants to merge 5 commits intoneo-project:masterfrom
shargon wants to merge 5 commits intoneo-project:masterfrom
Conversation
erikzhang
reviewed
Sep 30, 2020
erikzhang
reviewed
Sep 30, 2020
| } | ||
|
|
||
| private static void Serialize(StackItem item, BinaryWriter writer, uint maxSize) | ||
| private static void Serialize(StackItem item, BinaryWriter writer, uint maxSize, uint maxArraySize, uint maxItemSize) |
Member
There was a problem hiding this comment.
Why add maxArraySize and maxItemSize? If the item exceeds the limit, it cannot be pushed onto the stack.
Member
Author
There was a problem hiding this comment.
This method it's shared with https://github.com/neo-project/neo/pull/1978/files#diff-03213bc090127a83f7aa1132e8e516e0R25 and it will be managed by the native contract not by neo-vm, so we can have different limmits
Member
There was a problem hiding this comment.
Then we should limit in native contracts.
Qiao-Jin
reviewed
Oct 14, 2020
| { | ||
| BigInteger bi => bi.ToByteArrayStandard(), | ||
| IInteroperable interoperable => BinarySerializer.Serialize(interoperable.ToStackItem(null), 4096), | ||
| IInteroperable interoperable => BinarySerializer.Serialize(interoperable.ToStackItem(null), 4096, 16, 34), |
Contributor
There was a problem hiding this comment.
Maybe 16 and 34 can be defined as some static fields instead of hard code.
Contributor
This file contains hidden or 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
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.
GasRecordto use enumerators, because otherwise we can overflow the limits, whatever it is