Skip to content

cw20-ics20 incorrectly encodes ack_success. #759

@0xekez

Description

@0xekez

The ICS 20 spec imagines the ACK success type to be JSON encoding of "binary 0x01 base64 encoded". They then suggest this to be the string "AQ==".

The ics20 implementation seems to do the JSON encoding of the ASCII character '1' (ASCII codepoint 49) wrapped in an enum.

fn ack_success() -> Binary {
let res = Ics20Ack::Result(b"1".into());
to_binary(&res).unwrap()
}

The result is that ack_success yields [123, 34, 114, 101, 115, 117, 108, 116, 34, 58, 34, 77, 81, 61, 61, 34, 125], whereas (I think) it ought to yield [34, 65, 81, 61, 61, 34]. The expected output is an array of bytes corresponding to ASCII character codes of AQ== surrounded by quotation marks (ASCII codepoint 34).

Metadata

Metadata

Assignees

No one assigned

    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