Skip to content

abi: ABI functions don't respect function selector prefixes #67

@mhw0

Description

@mhw0

the function test(address[])
and addresses passed to the function is parameter is [0x10ed43c718714eb63d5aa57b78b54704e256024e,0x13f4ea83d0bd40e75c8222255bc855a974568dd4]

the encoded form
0xd57498ea0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000010ed43c718714eb63d5aa57b78b54704e256024e00000000000000000000000013f4ea83d0bd40e75c8222255bc855a974568dd4

i use the following code to decode the ABI function inputs

struct eth_abi abi = {};
char *fn = strdup(func.c_str()), *hex;
eth_abi_from_hex(&abi, input, data.length());
eth_abi_call(&abi, &fn, NULL)
eth_abi_array(&abi, &arrlen); // array beign
                    std::cout<<"array length: "<<arrlen<<" \n";
                    char *val[arrlen];
                    for (int j = 0; j < arrlen; j++)
                    {
                        eth_abi_address(&abi, &val[j]);
                        string a(val[j]);
                        result.push_back("0x" + a);
                    }
                    eth_abi_array_end(&abi); // array end
                    arrlen = 0;
eth_abi_call_end(&abi)

output is

array length: 0

Originally posted by @DerXanRam in #66

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions