ABI decoding of string[] as bytes[] using libethc is giving corrupted result
the abi data returned from the function is
0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000b33078656431633862366238623036316662623031333936323830623834316438666331653034366632312c302c50616e63616b65204c50732c3078356231663837346430623063356565313761343935636262373061623862663634313037613362642c3078653965376365613364656463613539383437383062616663353939626436396164643038376435362c42696e617279582c424e582c31382c4255534420546f6b656e2c425553442c31382c32350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b83078326338633834336632386235313738633638346430386134386662623331373161326337356433312c302c50616e63616b65204c50732c3078613032366164326365646131366361356663323866643363373266393965326333333263386132362c3078626234636462396362643336623031626431636261656266326465303864393137336263303935632c5843414420546f6b656e2c584341442c31382c5772617070656420424e422c57424e422c31382c32350000000000000000
the function is
getPoolInfoBatch(address[],uint8[])
returns
string[]
the correct decoded result using python
[
"0xed1c8b6b8b061fbb01396280b841d8fc1e046f21,0,Pancake LPs,0x5b1f874d0b0c5ee17a495cbb70ab8bf64107a3bd,0xe9e7cea3dedca5984780bafc599bd69add087d56,BinaryX,BNX,18,BUSD Token,BUSD,18,25",
"0x2c8c43f28b5178c684d08a48fbb3171a2c75d31,0,Pancake LPs,0xa026ad2ceda16ca5fc28fd3c72f99e2c332c8a26,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,XCAD Token,XCAD,18,Wrapped BNB,WBNB,18,25"
]
the decode result from libethc
decoded[0]: 0xed1c8b6b8b061fbb01396280b841d8fc1e046f21,0,Pancake LPs,0x5b1f874d0b0c5ee17a495cbb70ab8bf64107a3bd,0xe9e7cea3dedca5984780bafc599bd69add087d56,BinaryX,BNX,18,BUSD Token,BUSD,18,25
decoded[1]: 71a2c75d31,0,Pancake LPs,0xa026ad2ceda16ca5fc28fd3c72f99e2c332c8a26,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,XCAD Token,XCAD,18,Wrapped BNB,WBNB,18,25�Z��!
` ��[
the problem is on the second element.
the code i use is
std::string decoded1,decoded2;
uint64_t arrlen;
eth_abi_array(&abi, &arrlen); // array beign
uint8_t *val0,*val1;
size_t len;
eth_abi_bytes(&abi, &val0, &len);
char *final = (char *)val;
string decoded;
for (int i = 0; i < len; i++)
{
decoded += final[i];
}
eth_abi_bytes(&abi, &val1, &len);
char *final = (char *)val;
string decoded;
for (int i = 0; i < len; i++)
{
decoded += final[i];
}
eth_abi_array_end(&abi);
please help
Hi @DerXanRam, thanks for opening the issue. I'll take a look.
ok. Thanks. and wellcome back 😄
sorry. but, does this problem has a temporary solution?
I can't fix the issue until we refactor all the ABI functions. Sorry, you have to wait a bit.
I can't fix the issue until we refactor all the ABI functions. Sorry, you have to wait a bit.
Ok....I will wait
how are you man? any update?
Hello @DerXanRam I'm great, what about you?
Sorry for the delay, very busy lately. I'll have plenty of free time this weekend to work on the project. Also, planning releasing the v2.0 of the library soon.
Back to your issue, are those "��[" characters random? I can see that the output of this library is almost identical to the python one. Feels like there is an issue with the output. It's either overflowing or returning invalid len
Hello @DerXanRam I'm great, what about you?
Sorry for the delay, very busy lately. I'll have plenty of free time this weekend to work on the project. Also, planning releasing the v2.0 of the library soon.
Back to your issue, are those "��[" characters random? I can see that the output of this library is almost identical to the python one. Feels like there is an issue with the output. It's either overflowing or returning invalid
len
I can share the python code currently i am using to decode ... it is working.
def decode_string_array(hex_data: str):
if hex_data.startswith("0x"):
hex_data = remove_0x_prefix(hex_data)
try:
byte_data = bytes.fromhex(hex_data)
except ValueError:
raise ValueError("Invalid hex input")
decoded = decode_abi(['string[]'], byte_data)
return decoded[0]
May be u are decoding in python as bytes[] . The return type from the contract method is string[] . I use bytes[] because libethc doesn't have string encoding/decoding.
Could you check the values of arrlen and two lens?
Could you check the values of
arrlenand twolens?
arrlen: 2
len[0]: 179
len[1]: 184
0xed1c8b6b8b061fbb01396280b841d8fc1e046f21,0,Pancake LPs,0x5b1f874d0b0c5ee17a495cbb70ab8bf64107a3bd,0xe9e7cea3dedca5984780bafc599bd69add087d56,BinaryX,BNX,18,BUSD Token,BUSD,18,25
71a2c75d31,0,Pancake LPs,0xa026ad2ceda16ca5fc28fd3c72f99e2c332c8a26,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,XCAD Token,XCAD,18,Wrapped BNB,WBNB,18,251���@�]
Could you check the values of
arrlenand twolens?arrlen: 2 len[0]: 179 len[1]: 184 0xed1c8b6b8b061fbb01396280b841d8fc1e046f21,0,Pancake LPs,0x5b1f874d0b0c5ee17a495cbb70ab8bf64107a3bd,0xe9e7cea3dedca5984780bafc599bd69add087d56,BinaryX,BNX,18,BUSD Token,BUSD,18,25 71a2c75d31,0,Pancake LPs,0xa026ad2ceda16ca5fc28fd3c72f99e2c332c8a26,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,XCAD Token,XCAD,18,Wrapped BNB,WBNB,18,251���@�]
Issue with the ABI offset calculation. Fixing it.
Could you check the values of
arrlenand twolens?arrlen: 2 len[0]: 179 len[1]: 184 0xed1c8b6b8b061fbb01396280b841d8fc1e046f21,0,Pancake LPs,0x5b1f874d0b0c5ee17a495cbb70ab8bf64107a3bd,0xe9e7cea3dedca5984780bafc599bd69add087d56,BinaryX,BNX,18,BUSD Token,BUSD,18,25 71a2c75d31,0,Pancake LPs,0xa026ad2ceda16ca5fc28fd3c72f99e2c332c8a26,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c,XCAD Token,XCAD,18,Wrapped BNB,WBNB,18,251���@�]Issue with the ABI offset calculation. Fixing it.
hello bro.any new update?
hello bro. is there a new update?
Hi @DerXanRam Sorry for the delay. Had to rewrite the whole ABI encoder/decoder because of the bug in the code.
Releasing soon 🚀
Slightly changed the API. Could you please install the dev branch and test with this code:
struct eth_abi abi={0};
size_t len0, len1;
uint8_t bytes[256];
eth_abi_from_hex(&abi,
"0000000000000000000000000000000000000000000000000000000000000020"
"0000000000000000000000000000000000000000000000000000000000000002"
"0000000000000000000000000000000000000000000000000000000000000040"
"0000000000000000000000000000000000000000000000000000000000000120"
"00000000000000000000000000000000000000000000000000000000000000b3"
"3078656431633862366238623036316662623031333936323830623834316438"
"666331653034366632312c302c50616e63616b65204c50732c30783562316638"
"3734643062306335656531376134393563626237306162386266363431303761"
"3362642c30786539653763656133646564636135393834373830626166633539"
"39626436396164643038376435362c42696e617279582c424e582c31382c4255"
"534420546f6b656e2c425553442c31382c323500000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000b8"
"3078326338633834336632386235313738633638346430386134386662623331"
"373161326337356433312c302c50616e63616b65204c50732c30786130323661"
"6432636564613136636135666332386664336337326639396532633333326338"
"6132362c30786262346364623963626433366230316264316362616562663264"
"65303864393137336263303935632c5843414420546f6b656e2c584341442c31"
"382c5772617070656420424e422c57424e422c31382c32350000000000000000", -1);
eth_abi_array(&abi, &len0);
eth_abi_bytes(&abi, &bytes, &len1);
eth_abi_array_end(&abi);
// should print: 0xed1c8b6b8b061fbb01396280b841d8fc1e046f21,0,Pancake LPs,0x5b1f874d0b0c5ee17a495cbb70ab8bf64107a3bd,0xe9e7cea3dedca5984780bafc599bd69add087d56,BinaryX,BNX,18,BUSD Token,BUSD,18,25
printf("%.*s\n", len1, (char*)b);
Slightly changed the API. Could you please install the
devbranch and test with this code:struct eth_abi abi={0}; size_t len0, len1; uint8_t bytes[256];
eth_abi_from_hex(&abi, "0000000000000000000000000000000000000000000000000000000000000020" "0000000000000000000000000000000000000000000000000000000000000002" "0000000000000000000000000000000000000000000000000000000000000040" "0000000000000000000000000000000000000000000000000000000000000120" "00000000000000000000000000000000000000000000000000000000000000b3" "3078656431633862366238623036316662623031333936323830623834316438" "666331653034366632312c302c50616e63616b65204c50732c30783562316638" "3734643062306335656531376134393563626237306162386266363431303761" "3362642c30786539653763656133646564636135393834373830626166633539" "39626436396164643038376435362c42696e617279582c424e582c31382c4255" "534420546f6b656e2c425553442c31382c323500000000000000000000000000" "00000000000000000000000000000000000000000000000000000000000000b8" "3078326338633834336632386235313738633638346430386134386662623331" "373161326337356433312c302c50616e63616b65204c50732c30786130323661" "6432636564613136636135666332386664336337326639396532633333326338" "6132362c30786262346364623963626433366230316264316362616562663264" "65303864393137336263303935632c5843414420546f6b656e2c584341442c31" "382c5772617070656420424e422c57424e422c31382c32350000000000000000", -1);
eth_abi_array(&abi, &len0); eth_abi_bytes(&abi, &bytes, &len1); eth_abi_array_end(&abi);
// should print: 0xed1c8b6b8b061fbb01396280b841d8fc1e046f21,0,Pancake LPs,0x5b1f874d0b0c5ee17a495cbb70ab8bf64107a3bd,0xe9e7cea3dedca5984780bafc599bd69add087d56,BinaryX,BNX,18,BUSD Token,BUSD,18,25 printf("%.s\n", len1, (char)b);
Testing .....
when i was installing the new fix, it says
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- ethc: build type: Debug
-- ethc: SECP256K1_INCLUDE_DIRS: /usr/include/
-- ethc: SECP256K1_LINK_LIBRARIES: /usr/lib/x86_64-linux-gnu/libsecp256k1.so
-- ethc: GMP_INCLUDE_DIRS: /usr/include/x86_64-linux-gnu/
-- ethc: GMP_LINK_LIBRARIES: /usr/lib/x86_64-linux-gnu/libgmp.so
-- ethc: generating libethc.pc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xanxad/Downloads/libethc-dev 2.0/libethc-dev/build
[ 6%] Building C object libkeccak/CMakeFiles/keccak.dir/KeccakHash.c.o
[ 12%] Building C object libkeccak/CMakeFiles/keccak.dir/KeccakSponge.c.o
[ 18%] Building C object libkeccak/CMakeFiles/keccak.dir/KeccakP-1600-compact64.c.o
[ 25%] Linking C static library libkeccak.a
[ 25%] Built target keccak
[ 31%] Building C object CMakeFiles/ethc.dir/src/abi.c.o
/home/xanxad/Downloads/libethc-dev 2.0/libethc-dev/src/abi.c: In function ‘eth_abi_call’:
/home/xanxad/Downloads/libethc-dev 2.0/libethc-dev/src/abi.c:304:66: error: ‘%02x’ directive output truncated writing 2 bytes into a region of size 1 [-Werror=format-truncation=]
304 | nprintf(*func, ETH_ABI_FUNCTION_SELECTOR_SIZE + 1, "%02x%02x%02x%02x", keccak[0], keccak[1], keccak[2], keccak[3]);
| ^~~~
/home/xanxad/Downloads/libethc-dev 2.0/libethc-dev/src/abi.c:304:5: note: ‘snprintf’ output 9 bytes into a destination of size 5
304 | snprintf(*func, ETH_ABI_FUNCTION_SELECTOR_SIZE + 1, "%02x%02x%02x%02x", keccak[0], keccak[1], keccak[2], keccak[3]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/xanxad/Downloads/libethc-dev 2.0/libethc-dev/src/abi.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-sometimes-uninitialized’ may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/ethc.dir/build.make:76: CMakeFiles/ethc.dir/src/abi.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/ethc.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
[sudo] password for xanxad:
Consolidate compiler generated dependencies of target keccak
[ 25%] Built target keccak
Consolidate compiler generated dependencies of target ethc
[ 31%] Building C object CMakeFiles/ethc.dir/src/abi.c.o
/home/xanxad/Downloads/libethc-dev 2.0/libethc-dev/src/abi.c: In function ‘eth_abi_call’:
/home/xanxad/Downloads/libethc-dev 2.0/libethc-dev/src/abi.c:304:66: error: ‘%02x’ directive output truncated writing 2 bytes into a region of size 1 [-Werror=format-truncation=]
304 | snprintf(*func, ETH_ABI_FUNCTION_SELECTOR_SIZE + 1, "%02x%02x%02x%02x", keccak[0], keccak[1], keccak[2], keccak[3]);
| ^~~~
/home/xanxad/Downloads/libethc-dev 2.0/libethc-dev/src/abi.c:304:5: note: ‘snprintf’ output 9 bytes into a destination of size 5
304 | snprintf(*func, ETH_ABI_FUNCTION_SELECTOR_SIZE + 1, "%02x%02x%02x%02x", keccak[0], keccak[1], keccak[2], keccak[3]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/xanxad/Downloads/libethc-dev 2.0/libethc-dev/src/abi.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-sometimes-uninitialized’ may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/ethc.dir/build.make:76: CMakeFiles/ethc.dir/src/abi.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/ethc.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
can you please try one more time? updated the code
i try many thing to fix, but their are 2 errors.
error: ‘eth_abi_free’ was not declared in this scope; did you mean ‘eth_abi_mode’?
974 | ok(eth_abi_free(&abi))
after i commented out eth_abi_free(&abi), the program failed to compile and show the following error
Consolidate compiler generated dependencies of target
............
...............
.......................
.............................
`ABI::EncodeABI(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >)':
undefined reference to `eth_abi_mpint'
/usr/bin/ld: eth_evm_abi.cpp:(.text+0x216b): undefined reference to `eth_abi_mpint'
/usr/bin/ld: eth_evm_abi.cpp:(.text+0x2262): undefined reference to `eth_abi_mpint'
.....
........
................
.......................
`ABI::DecodeABIOutput(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
eth_evm_abi.cpp:(.text+0x3e31): undefined reference to `eth_abi_mpint'
/usr/bin/ld: eth_evm_abi.cpp:(.text+0x3f4a): undefined reference to `eth_abi_mpint'
...........
..........................
....................................
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/Dex.dir/build.make:377: Dex] Error 1
make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/Dex.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
i do many things including clearing all traces of previous installation from my computer
I would really suggest waiting for the release because I changed some APIs and the dev branch is not stable, especially if your project is related to finance.
eth_abi_free is removed because ABI functions used to allocate heap memory, now we use stack memory as it's more "cheap" and the result ABI functions produce is predictable. You can safely remove this but don't forget to initialize eth_abi with 0 by doing struct eth_abi={0}
eth_abi_mpint I removed this by mistake. Will be added.
I am using your library since 2023 on my test and realtime projects within the constraints. Thanks for that bro🙏. And i will take necessary measures on my live projects, but i would love to experiment the new features on my test and ongoing projects because they are very useful to me and i need them desperately. Please keep pushing codes on dev branch until you release on main branch🙏.
Thanks, appreciate it a lot. I will invest more time in this project and there are many new features coming soon. Stay tuned!
Hello bro. Any progress on deleted function eth_abi_mpint?
hello @DerXanRam. We'll get rid of libgmp and use libtommath instead. It's more lightweight and we won't have problems with license. Working on it right now.
Hi @DerXanRam. Giving a feedback. eth_abi_mpint is back (cd809fe130fc514b0df2911352a3a26936d6ef2f)
You'll have to change your code to use libtommath.
Also, added build option to statically link all the dependencies so you don't have to install them separately. Just pass ETHC_TOMMATH_STATIC=ON and ETHC_SECP256K1_STATIC=ON:
mkdir build && cmake -DETHC_TOMMATH_STATIC=ON -DETHC_SECP256K1_STATIC=ON ..
EDIT: don't forget to update submodules first
Hi @DerXanRam. Giving a feedback.
eth_abi_mpintis back (cd809fe130fc514b0df2911352a3a26936d6ef2f)You'll have to change your code to use libtommath.
Also, added build option to statically link all the dependencies so you don't have to install them separately. Just pass
ETHC_TOMMATH_STATIC=ONandETHC_SECP256K1_STATIC=ON:mkdir build && cmake -DETHC_TOMMATH_STATIC=ON -DETHC_SECP256K1_STATIC=ON ..EDIT: don't forget to update submodules first
Testing ....
i installed the new update using
git clone https://github.com/mhw0/libethc
cd libethc
mkdir build
cd build
git submodule init && git submodule update
cmake -DETHC_TOMMATH_STATIC=ON -DETHC_SECP256K1_STATIC=ON ..
make
sudo make install
however, it shows API depreciation error related to libtommath
[ 0%] Building C object libkeccak/CMakeFiles/keccak.dir/KeccakHash.c.o
[ 1%] Building C object libkeccak/CMakeFiles/keccak.dir/KeccakSponge.c.o
[ 1%] Building C object libkeccak/CMakeFiles/keccak.dir/KeccakP-1600-compact64.c.o
[ 2%] Linking C static library libkeccak.a
[ 2%] Built target keccak
[ 2%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_cutoffs.c.o
[ 3%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_deprecated.c.o
[ 3%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_2expt.c.o
[ 4%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_abs.c.o
[ 4%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_add.c.o
[ 5%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_add_d.c.o
[ 6%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_addmod.c.o
[ 6%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_and.c.o
[ 7%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_clamp.c.o
[ 7%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_clear.c.o
[ 8%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_clear_multi.c.o
[ 8%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_cmp.c.o
[ 9%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_cmp_d.c.o
[ 9%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_cmp_mag.c.o
[ 10%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_cnt_lsb.c.o
[ 10%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_complement.c.o
[ 11%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_copy.c.o
[ 11%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_count_bits.c.o
[ 12%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_decr.c.o
[ 12%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_div.c.o
[ 13%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_div_2.c.o
[ 14%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_div_2d.c.o
[ 14%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_div_d.c.o
[ 15%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_dr_is_modulus.c.o
[ 15%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_dr_reduce.c.o
[ 16%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_dr_setup.c.o
[ 16%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_error_to_string.c.o
[ 17%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_exch.c.o
[ 17%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_expt_n.c.o
[ 18%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_exptmod.c.o
[ 18%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_exteuclid.c.o
[ 19%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_fread.c.o
[ 19%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_from_sbin.c.o
[ 20%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_from_ubin.c.o
[ 20%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_fwrite.c.o
[ 21%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_gcd.c.o
[ 21%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_get_double.c.o
[ 22%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_get_i32.c.o
[ 23%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_get_i64.c.o
[ 23%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_get_l.c.o
[ 24%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_get_mag_u32.c.o
[ 24%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_get_mag_u64.c.o
[ 25%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_get_mag_ul.c.o
[ 25%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_grow.c.o
[ 26%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_incr.c.o
[ 26%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init.c.o
[ 27%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_copy.c.o
[ 27%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_i32.c.o
[ 28%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_i64.c.o
[ 28%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_l.c.o
[ 29%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_multi.c.o
[ 29%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_set.c.o
[ 30%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_size.c.o
[ 31%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_u32.c.o
[ 31%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_u64.c.o
[ 32%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_init_ul.c.o
[ 32%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_invmod.c.o
[ 33%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_is_square.c.o
[ 33%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_iseven.c.o
[ 34%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_isodd.c.o
[ 34%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_kronecker.c.o
[ 35%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_lcm.c.o
[ 35%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_log_n.c.o
[ 36%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_lshd.c.o
[ 36%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_mod.c.o
[ 37%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_mod_2d.c.o
[ 37%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_mod_d.c.o
[ 38%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_montgomery_calc_normalizati
on.c.o
[ 39%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_montgomery_reduce.c.o
[ 39%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_montgomery_setup.c.o
[ 40%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_mul.c.o
[ 40%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_mul_2.c.o
[ 41%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_mul_2d.c.o
[ 41%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_mul_d.c.o
[ 42%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_mulmod.c.o
[ 42%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_neg.c.o
[ 43%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_or.c.o
[ 43%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_pack.c.o
[ 44%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_pack_count.c.o
[ 44%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_prime_fermat.c.o
[ 45%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_prime_frobenius_underwood.c
.o
[ 45%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_prime_is_prime.c.o
[ 46%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_prime_miller_rabin.c.o
[ 46%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_prime_next_prime.c.o
[ 47%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_prime_rabin_miller_trials.c
.o
[ 48%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_prime_rand.c.o
[ 48%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_prime_strong_lucas_selfridg
e.c.o
[ 49%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_radix_size.c.o
[ 49%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_radix_smap.c.o
[ 50%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_rand.c.o
[ 50%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_read_radix.c.o
[ 51%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_reduce.c.o
[ 51%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_reduce_2k.c.o
[ 52%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_reduce_2k_l.c.o
[ 52%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_reduce_2k_setup.c.o
[ 53%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_reduce_2k_setup_l.c.o
[ 53%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_reduce_is_2k.c.o
[ 54%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_reduce_is_2k_l.c.o
[ 54%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_reduce_setup.c.o
[ 55%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_root_n.c.o
[ 56%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_rshd.c.o
[ 56%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_sbin_size.c.o
[ 57%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_set.c.o
[ 57%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_set_double.c.o
[ 58%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_set_i32.c.o
[ 58%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_set_i64.c.o
[ 59%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_set_l.c.o
[ 59%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_set_u32.c.o
[ 60%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_set_u64.c.o
[ 60%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_set_ul.c.o
[ 61%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_shrink.c.o
[ 61%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_signed_rsh.c.o
[ 62%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_sqr.c.o
[ 62%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_sqrmod.c.o
[ 63%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_sqrt.c.o
[ 64%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_sqrtmod_prime.c.o
[ 64%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_sub.c.o
[ 65%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_sub_d.c.o
[ 65%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_submod.c.o
[ 66%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_to_radix.c.o
[ 66%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_to_sbin.c.o
[ 67%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_to_ubin.c.o
[ 67%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_ubin_size.c.o
[ 68%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_unpack.c.o
[ 68%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_xor.c.o
[ 69%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_mp_zero.c.o
[ 69%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_prime_tab.c.o
[ 70%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_add.c.o
[ 70%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_balance_mul.c.o
[ 71%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_div_3.c.o
[ 71%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_exptmod.c.o
[ 72%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_exptmod_fast.c.o
[ 73%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_get_bit.c.o
[ 73%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_invmod_fast.c.o
[ 74%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_invmod_slow.c.o
[ 74%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_karatsuba_mul.c.o
[ 75%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_karatsuba_sqr.c.o
[ 75%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_log.c.o
[ 76%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_log_2expt.c.o
[ 76%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_log_d.c.o
[ 77%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_montgomery_reduce_fast.c.
o
[ 77%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_mul_digs.c.o
[ 78%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_mul_digs_fast.c.o
[ 78%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_mul_high_digs.c.o
[ 79%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_mul_high_digs_fast.c.o
[ 79%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_prime_is_divisible.c.o
[ 80%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_rand_jenkins.c.o
[ 81%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_rand_platform.c.o
[ 81%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_reverse.c.o
[ 82%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_sqr.c.o
[ 82%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_sqr_fast.c.o
[ 83%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_sub.c.o
[ 83%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_toom_mul.c.o
[ 84%] Building C object libtommath/CMakeFiles/libtommath.dir/bn_s_mp_toom_sqr.c.o
[ 84%] Linking C shared library libtommath.so
[ 84%] Built target libtommath
[ 85%] Building C object secp256k1/src/CMakeFiles/secp256k1_precomputed.dir/precomputed_ecmult.
c.o
[ 85%] Building C object secp256k1/src/CMakeFiles/secp256k1_precomputed.dir/precomputed_ecmult_
gen.c.o
[ 85%] Built target secp256k1_precomputed
[ 86%] Building C object secp256k1/src/CMakeFiles/secp256k1.dir/secp256k1.c.o
[ 86%] Linking C shared library ../lib/libsecp256k1.so
[ 86%] Built target secp256k1
[ 86%] Building C object CMakeFiles/ethc.dir/src/abi.c.o
/home/xanxad/libethc/src/abi.c: In function ‘eth_abi_mpint’:
/home/xanxad/libethc/src/abi.c:718:5: error: ‘mp_unsigned_bin_size’ is deprecated: replaced by
mp_ubin_size [-Werror=deprecated-declarations]
718 | size = mp_unsigned_bin_size(mpint);
| ^~~~
In file included from /home/xanxad/libethc/include/ethc/abi.h:11,
from /home/xanxad/libethc/src/abi.c:3:
/home/xanxad/libethc/libtommath/tommath.h:734:33: note: declared here
734 | MP_DEPRECATED(mp_ubin_size) int mp_unsigned_bin_size(const mp_int *a) MP_WUR;
| ^~~~~~~~~~~~~~~~~~~~
/home/xanxad/libethc/src/abi.c:722:5: error: ‘mp_to_unsigned_bin’ is deprecated: replaced by mp
_to_ubin [-Werror=deprecated-declarations]
722 | if (mp_to_unsigned_bin(mpint, buf + (32 - size)) != MP_OKAY)
| ^~
In file included from /home/xanxad/libethc/include/ethc/abi.h:11,
from /home/xanxad/libethc/src/abi.c:3:
/home/xanxad/libethc/libtommath/tommath.h:736:34: note: declared here
736 | MP_DEPRECATED(mp_to_ubin) mp_err mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
MP_WUR;
| ^~~~~~~~~~~~~~~~~~
/home/xanxad/libethc/src/abi.c:732:5: error: ‘mp_read_unsigned_bin’ is deprecated: replaced by
mp_from_ubin [-Werror=deprecated-declarations]
732 | if (mp_read_unsigned_bin(mpint, buf, 32) != MP_OKAY)
| ^~
In file included from /home/xanxad/libethc/include/ethc/abi.h:11,
from /home/xanxad/libethc/src/abi.c:3:
/home/xanxad/libethc/libtommath/tommath.h:735:36: note: declared here
735 | MP_DEPRECATED(mp_from_ubin) mp_err mp_read_unsigned_bin(mp_int *a, const unsigned char
*b, int c) MP_WUR;
| ^~~~~~~~~~~~~~~~~~~~
/home/xanxad/libethc/src/abi.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-sometimes-uninitialized’ may have been intend
ed to silence earlier diagnostics
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/ethc.dir/build.make:76: CMakeFiles/ethc.dir/src/abi.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:166: CMakeFiles/ethc.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
xanxad@xanxad:~/libethc/build$
clang compiler is so annoying and doesn't want to show the deprecation warnings. Fixing on linux machine
Can you clone the patch and try one more time?
Can you clone the patch and try one more time?
sure...testing..