Skip to content

Decoding of optional null values should not return null #113

@aaroncox

Description

@aaroncox

An action (like eosio.msig::approve) containing an optional field (like proposal_hash) when decoded will return a null value as the value. This field should be omitted entirely.

Example action data for eosio.msig::approve

{
    proposer: 'foo',
    proposal_name: 'bar',
    level: {
        actor: 'baz',
        permission: 'active',
    },
}

Encoding this action will result in a proper encoded hex value - but when decoding the action again, it will result in a different action structure:

{
    proposer: 'foo',
    proposal_name: 'bar',
    level: {
        actor: 'baz',
        permission: 'active',
    },
    proposal_hash: null
}

This causes problems with the wharfkit/wallet-plugin-cleos representation of the transaction, since when you submit the above action as a cleos command, cleos will reject it with null being an invalid value.

The serializer in this instance, when decoding an action, will need to omit proposal_hash from the JSON-like representation of the action, instead of including it and setting it to a null value.

At this point I am unsure if omitting the field during decoding will break anything else, so some research is going to be required to determine the best course of action here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions