mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
Negative numbers not properly converted in ABI encoding
When converting a negative number e.g., -2, the resulting ABI encoding should look as follows: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe However, since the check of the type is for an uint instead of an int, it results in the following ABI encoding: 0101010101010101010101010101010101010101010101010101010101010102
This commit is contained in:
parent
a269a713d6
commit
22c5f01950
1 changed files with 1 additions and 1 deletions
|
|
@ -96,7 +96,7 @@ func packNum(value reflect.Value, to byte) []byte {
|
|||
return S2S256(int64(value.Uint()))
|
||||
}
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
if to == UintTy {
|
||||
if to == IntTy {
|
||||
return U2U256(uint64(value.Int()))
|
||||
} else {
|
||||
return S2S256(value.Int())
|
||||
|
|
|
|||
Loading…
Reference in a new issue