Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

encode_packed produces wrong output #2257

@krisbitney

Description

@krisbitney

Version
2.0.0

Platform
Darwin (mac os) M1 apple cpu

Description
the abi.encode_packed function does not produce the output described in the Solidity spec.

A negative i16 -1 seems to be interpreted by ethers-rs as a uint256.

types: [ "int16", "uint48" ]
values: [ "-1", "12" ]
ethers-js: "0xffff00000000000c"
ethers-rs: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0c"

Another example where the packages disagree:

types: [ "uint256", "uint256" ]
values: [ "8", "16" ]
ethers-js: "0x00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000010"
ethers-rs: "0x0810"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions