Fix/serde zkapp uri token symbol string parsing#190
Closed
jk89 wants to merge 2 commits intoRaspberry-Devs:mainfrom
Closed
Fix/serde zkapp uri token symbol string parsing#190jk89 wants to merge 2 commits intoRaspberry-Devs:mainfrom
jk89 wants to merge 2 commits intoRaspberry-Devs:mainfrom
Conversation
…o parse when set to JSON strings as produced by o1js, because the derived serde on Vec<u8> expects a JSON byte array instead. Added test for the real deploy-v0.0.4-unsigned.json fixture which fails to parse due to the zkappUri string field, a minimal reproduction for zkappUri as a string, a test proving the incorrect 32-character ZkappUri length limit rejects real URLs, and a minimal reproduction for tokenSymbol as a string. All four tests currently fail documenting the limitation.
…ol to accept JSON strings as produced by o1js, removed the incorrect 32-character ZkappUri length limit, and fixed from_str_network to surface actual serde errors instead of swallowing them. Resolves all four failing tests from the previous commit.
Member
|
Closed, see #192 for the updated PR |
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.
Summary
ZkappUri and TokenSymbol fields fail to parse when set to JSON strings as produced by o1js, because the derived serde on
Vec<u8>expects a JSON byte array (e.g.[77,79,67,75]) instead of a plain string (e.g."MOCK"). Additionally, ZkappUri had an incorrect 32-character length limit that rejected real URLs, andfrom_str_networksilently swallowed parse errors behind a generic "Unknown transaction type" message.Structure
This PR contains two commits designed to be reviewed in sequence:
0219014test: Adds four failing tests that document the issue — a real deploy-v0.0.4 fixture that fails to parse, minimal reproductions for zkappUri and tokenSymbol as strings, and a test proving the 32-char limit rejects valid URLs. Checkout this commit and runcargo test -p mina-tx --libto see the failures.f04d8b6fix: Adds custom string-based serde impls for both types, removes the 32-char limit, and surfaces actual parse errors infrom_str_network. Checkout this commit and runcargo test -p mina-tx --libto see all tests pass.