Skip to content

Combined encoding of address[] and uint8[] and other types is giving corrupted(incorrect result) result #69

@DerXanRam

Description

@DerXanRam

the function calling is

getPoolInfoBatchAsString(address[],uint8[])

the encoded data are

pool addresses: 0xe6b4903642b4a1637d7b411d009af5c91617860c,0x12d59b7849989f677a2d67fcf21b3d2e28291da6,0x2c7fe80e727408751b086d5e2f257ab20cd97f69,0x68f940fb79e216faafbc96a6701b11b44f5255c2,0x8da0d9418e74c8523cc189be07589a788a1c49e7,0xe3b3aa98faa70bf098ea5e75e11193de95ab7cda,0x9950c1f3754fb8a3ebbaf24b8573cafc7474c00f,0xafecdd2fc04f0939d7b6835529677608470c063d,0xc4081a370585681e265ec9efb84143549469e77e


pool versions: 1,0,0,1,0,0,1,1,0

the correct call data is

000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000009000000000000000000000000e6b4903642b4a1637d7b411d009af5c91617860c00000000000000000000000012d59b7849989f677a2d67fcf21b3d2e28291da60000000000000000000000002c7fe80e727408751b086d5e2f257ab20cd97f6900000000000000000000000068f940fb79e216faafbc96a6701b11b44f5255c20000000000000000000000008da0d9418e74c8523cc189be07589a788a1c49e7000000000000000000000000e3b3aa98faa70bf098ea5e75e11193de95ab7cda0000000000000000000000009950c1f3754fb8a3ebbaf24b8573cafc7474c00f000000000000000000000000afecdd2fc04f0939d7b6835529677608470c063d000000000000000000000000c4081a370585681e265ec9efb84143549469e77e0000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000

libethc generating is

000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000009000000000000000000000000e6b4903642b4a1637d7b411d009af5c91617860c00000000000000000000000012d59b7849989f677a2d67fcf21b3d2e28291da60000000000000000000000002c7fe80e727408751b086d5e2f257ab20cd97f6900000000000000000000000068f940fb79e216faafbc96a6701b11b44f5255c20000000000000000000000008da0d9418e74c8523cc189be07589a788a1c49e7000000000000000000000000e3b3aa98faa70bf098ea5e75e11193de95ab7cda0000000000000000000000009950c1f3754fb8a3ebbaf24b8573cafc7474c00f000000000000000000000000afecdd2fc04f0939d7b6835529677608470c063d000000000000000000000000c4081a370585681e265ec9efb84143549469e77e0000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000

the code

struct eth_abi abi = {};
char *fn = strdup(function.c_str());
size_t hexlen;
eth_abi_init(&abi, ETH_ABI_ENCODE);
eth_abi_call(&abi, &fn, NULL);

eth_abi_array(&abi, NULL); // array beign
     eth_abi_address(&abi, "0xe6b4903642b4a1637d7b411d009af5c91617860c");
     eth_abi_address(&abi, "0x12d59b7849989f677a2d67fcf21b3d2e28291da6");
     eth_abi_address(&abi, "0x2c7fe80e727408751b086d5e2f257ab20cd97f69");
     eth_abi_address(&abi, "0x68f940fb79e216faafbc96a6701b11b44f5255c2");
     eth_abi_address(&abi, "0x8da0d9418e74c8523cc189be07589a788a1c49e7");
     eth_abi_address(&abi, "0xe3b3aa98faa70bf098ea5e75e11193de95ab7cda");
     eth_abi_address(&abi, "0x9950c1f3754fb8a3ebbaf24b8573cafc7474c00f");
     eth_abi_address(&abi, "0xafecdd2fc04f0939d7b6835529677608470c063d");
     eth_abi_address(&abi, "0xc4081a370585681e265ec9efb84143549469e77e");
eth_abi_array_end(&abi); // array end

eth_abi_array(&abi, NULL); // array beign
     eth_abi_uint8(&abi, 1);
     eth_abi_uint8(&abi, 0);
     eth_abi_uint8(&abi, 0);
     eth_abi_uint8(&abi, 1);
     eth_abi_uint8(&abi, 0);
     eth_abi_uint8(&abi, 0);
     eth_abi_uint8(&abi, 1);
     eth_abi_uint8(&abi, 1);
     eth_abi_uint8(&abi, 0);
eth_abi_array_end(&abi); // array end
eth_abi_call_end(&abi);
eth_abi_to_hex(&abi, &hex, &hexlen)
string data(hex);

if you can please check your change by doing regression test to check the new change doesn't affect other functionalities. I know you are very busy and and took you the whole week to response. I check my email every single day, all day for your response and i don't say anything to not nag you. 🙏

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