Skip to content

Upgradable parameter and result serialization of code #77

@mooori

Description

@mooori

Upgradable::up_stage_code uses borsh parameter serialization:

https://github.com/aurora-is-near/near-plugins/blob/c043add4c2a0810872c4326a55c5162bccd3f4ee/near-plugins-derive/src/upgradable.rs#L33

However, this isn’t documented:

https://github.com/aurora-is-near/near-plugins/blob/1cf0aa61e38d3b02803642983795c927598375ba/near-plugins/src/upgradable.rs#L56-L58

So most likely users will assume default json parameter serialization and then wonder why deserialization fails when calling up_stage_code in a transaction.


Either we should document this or change up_stage_code to use json serialization. If I remember correctly, this is the only method provided by near-plugins which does not use json parameter serialization. Even if less efficient, perhaps we should switch to json here for a consistent and intuitive API?

Edit: Another advantage of json is that it allows using near-cli to stage code, which is problematic with borsh as described here (section up_stage_code).

cc @birchmd

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions