Open joowon-byun opened 1 year ago
@winnie-byun any news on this? I think it's a highly important problem
@sc0Vu ping on this
@sc0Vu
@inmarelibero, hello! have you find a solution for this? have same issue :(
You need concat function encode and params encode, like this
$function_encode = $ethabi->encodeFunctionSignature('stringAbiTest(string[])')
stringAbiTest(string[]) 6312d9e2
intAbiTest(uint256[]) 44c6a750
Problem
I found out web3.php is unable to encodeParams for
string[]
. To be more specific, it is unable to encode for an array of dynamic type. You can see that the php result is much shorter. (I splitted lines for readability)encodeParameters result from go (klaytn) :
encodeParameters result from php :
How to reproduce
How to reproduce in go (Klaytn) : (Klaytn's ABI mechanism is exactly the same with Ethereum's)
How to reproduce in php:
Where it went wrong
In go code, if the element type of an array is dynamic type, an offset is added to the abi. However, there is no such logic in web3p. (It can encode for static types such as
int256[]
, but it cannot encode for dynamic types such asstring[]
.)Klaytn, Eth code :
web3.php code :