Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoding of optional null values should not return null #113

Open
aaroncox opened this issue Feb 10, 2025 · 0 comments
Open

Decoding of optional null values should not return null #113

aaroncox opened this issue Feb 10, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@aaroncox
Copy link
Member

aaroncox commented Feb 10, 2025

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.

@aaroncox aaroncox added the bug Something isn't working label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant