nervosnetwork / polyjuice-provider

Godwoken-Polyjuice compatible providers for ethereum library
https://www.npmjs.com/org/polyjuice-provider
8 stars 14 forks source link

Incorrect "bytes" ABI parameter processing by polyjuice provider results in "param is null" #88

Closed e00dan closed 2 years ago

e00dan commented 2 years ago

Problem

Polyjuice provider transforms ABI parameter of type "bytes" and value "0x" to null. This results in error "TypeError: param is null".

Debug info

The method is GnosisSafe.execTransaction.

Arguments passed to Solidity method:

[ "0xD173313A51f8fc37BcF67569b463abd89d81844f", "100000000", "0x", 0, "0", "0", "0", "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", "0x000000000000000000000000D173313A51f8fc37BcF67569b463abd89d81844f000000000000000000000000000000000000000000000000000000000000000001" ]

ABI items and decoded data values JSON (after transformation by Polyjuice Provider):

"{\"abi_item\":{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"enum Enum.Operation\",\"name\":\"operation\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"safeTxGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasPrice\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"gasToken\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"refundReceiver\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"signatures\",\"type\":\"bytes\"}],\"name\":\"execTransaction\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\",\"payable\":true,\"signature\":\"0x6a761202\"},\"decodedDataValues\":[\"0x8016dcd1af7c8cceda53e4d2d2cd4e2924e245b6\",\"100000000\",null,\"0\",\"0\",\"0\",\"0\",\"0x0000000000000000000000000000000000000000\",\"0x0000000000000000000000000000000000000000\",\"0x000000000000000000000000d173313a51f8fc37bcf67569b463abd89d81844f000000000000000000000000000000000000000000000000000000000000000001\"]}"

Package version: @polyjuice-provider/web3@0.1.3

Before: image image

After: image image

cc @RetricSu