-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add mint_with_json #8
base: master
Are you sure you want to change the base?
Conversation
This uses JSON serialization rather than borsh, which is significantly easier to use from a browser with near-api-js, including providing much better error messaging
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. @nearmax was there a reason to use borsh or to use json serailize, we seem to have a mixed of them in rainbow-bridge-rs contracts
Also, as all changes before, please don't forget to increase version in package.json :D |
Note: I would rather change If someone wants to modify the main |
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.
JSON serialization of data-heavy objects is very expensive, it might even dominate the cost of the contract for proofs constructed from real headers from Ropsten of Eth Mainnet. We prefer using borsh for this very reason when we are passing headers, proofs and other data-heavy arguments. Alsol the way JSON serializes byte arrays is an array of integers, which is very expensive to parse. CC @Kouprin I don't think it is a good idea to pass it with JSON. Overall, for changes that are suspected to change the gas cost it is recommended to try the contract on the real NEAR node with real data, e.g. proofs from headers on Ropsten or Mainnet.
Am I right is affects user experience significantly? More precisely:
I'd suggest to discuss having both Borsh and JSON ser/deser. Three cons:
|
This uses JSON serialization rather than borsh, which is significantly easier to use from a browser with near-api-js, including providing much better error messaging