Skip to content

Wrong encoding of bytes[] type #586

Closed
@WalterLinares

Description

When calling a method with bytes[] as input web3j doesnt encode this parameter correctly and ethereum doesnt decode propertly. For example this array:

["1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555"]

should encode as:
0000000000000000000000000000000000000000000000000000000000000002
0000000000000000000000000000000000000000000000000000000000000040
00000000000000000000000000000000000000000000000000000000000000A0
000000000000000000000000000000000000000000000000000000000000002C
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000003C
55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555500000000

but is being encoded as:
0000000000000000000000000000000000000000000000000000000000000002
000000000000000000000000000000000000000000000000000000000000002C
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000003C
55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555500000000

notice that the offset of the start of the bytes is missing (40,A0)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions