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

SolidityPack negative int equal positive (PaddedBigBytes) #108

Open
b1674927 opened this issue Dec 6, 2023 · 0 comments
Open

SolidityPack negative int equal positive (PaddedBigBytes) #108

b1674927 opened this issue Dec 6, 2023 · 0 comments

Comments

@b1674927
Copy link

b1674927 commented Dec 6, 2023

github.com/0xsequence/ethkit v1.22.4

SolidityPack seems to not consider negative signs:

entry1, err := ethcoder.SolidityPackHex([]string{"int32"}, []interface{}{int32(-42)})
entry2, err := ethcoder.SolidityPackHex([]string{"int32"}, []interface{}{int32(42)})
fmt.Println(entry1)
fmt.Println(entry2)
// entry1 == entry2

yields 0x0000002a, 0x0000002a

Other integer-types seem to show the same issue.

comparing to ethers/utils/solidity.ts:

let v1 = ethers.utils.solidityPack(["int32"], [-42]);
let v2 = ethers.utils.solidityPack(["int32"], [42]);
console.log(v1);
console.log(v2);

yields 0xffffffd6, 0x0000002a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant