exthereum / abi Goto Github PK
View Code? Open in Web Editor NEWThe Ethereum ABI Interface
License: MIT License
The Ethereum ABI Interface
License: MIT License
The input data of this transaction is over 7000 bytes. The function signature is multisend(address _tokenAddr, address[] dests, uint256[] values)
It seems the encoding for dynamic arrays is missing the placeholder for the location. Currently the output is this:
ABI.encode("dynamicUint(uint[])", [[1,2,3,4,5]]) |> Hexate.encode
=> "5d4e0342000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005"
Whereas I believe it should be something like this:
"5d4e03420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005"
Notice the 0000000000000000000000000000000000000000000000000000000000000020
preceding the length prefix. This is denoting that the dynamic array starts after 32 bytes. Since there is only one argument.
I was trying to get the function arguments for a function with bytes32[]
as the argument type.
ABI.decode
goes into an infinite loop.
Is this not supported yet?
The command I tried:
ABI.decode("myTempFunction(bytes32[],bytes32[])", "4251d89700000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000176a5ced4b86db8f44cb702405947e3d0b672980608810bb4d922702bbe1809440000000000000000000000000000000000000000000000000000000000000001e1ba3868e0fb3c2af6ad53db380ac069165eb51ae5b6f5ea3f574c2f79b81a08" |> Base.decode16!(case: :lower))
Hi,
thanks for exthereum/abi. When using it I've noticed that calls to functions with arguments of dynamic types are not properly encoded.
ABI.encode("foo(bytes)", [<<1>>]) |> Base.encode16(case: :lower)
outputs
"30c8d1da00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000"
The correct output is:
"30c8d1da000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000"
The missing part is:
0000000000000000000000000000000000000000000000000000000000000020
which is a head part of encoded bytes and should be put right behind encoded function signature.
https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#use-of-dynamic-types
Invalid encoding result.
ABI.encode("getVerificationContract(string)", ["test"]) |> Base.encode16(case: :lower)
Expected:
0x8575e5a5000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000047465737400000000000000000000000000000000000000000000000000000000
Returned
8575e5a500000000000000000000000000000000000000000000000000000000000000047465737400000000000000000000000000000000000000000000000000000000
Hi there! Thanks for library!
We've faced issue that :address
type is converted to uint 160
and it throws message:
Data overflow encoding uint, data
0x56e19818ba7e4c0335a4cbf82ee6530c89a30735 cannot fit in 160 bits
It happens here: lib/quorum/abi/type_encoder.ex:239: Quorum.ABI.TypeEncoder.encode_uint/2
Actually we are using quorum, so it may be connected somehow with this bug..
So, we need not to convert address to uint
Now it's solved with converting address to int, but result data generates incorrectly
{address_hex, _} = Integer.parse(address, 16)
address_hex
Hi.
Cannot start release with compiled :libsecp256k1
library.
Release failed on docker container with Alpine and local Mac.
I don't see libsecp256k1_nif.so
in priv dir. Could it raise an error?
{supervisor,kernel,['Argument__1']}
<0.1384.0>
[]
{exit,{on_load_function_failed,libsecp256k1},[{init,run_on_load_handlers,0,[]},{kernel,init,1,[{file,"kernel.erl"},{line,217}]},{supervisor,init,1,[{file,"supervisor.erl"},{line,294}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,365}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,333}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
initial_call: pid: registered_name: error_info: ancestors: message_queue_len: messages: links: dictionary: trap_exit: status: heap_size: stack_size: reductions: 2018-06-04 14:21:43 supervisor_report
[kernel_sup,<0.1360.0>]
0
[]
[<0.1361.0>]
[]
true
running
610
27
235
{local,kernel_sup}
start_error
{on_load_function_failed,libsecp256k1}
[{pid,undefined},{id,kernel_safe_sup},{mfargs,{supervisor,start_link,[{local,kernel_safe_sup},kernel,safe]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]
{application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}
supervisor: errorContext: reason: offender: 2018-06-04 14:21:44 crash_report
<0.1359.0>
[]
{exit,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,libsecp256k1}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,134}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
[<0.1358.0>]
1
[{'EXIT',<0.1360.0>,normal}]
[<0.1358.0>,<0.1357.0>]
[]
true
running
376
27
213
initial_call: pid: registered_name: error_info: ancestors: message_queue_len: messages: links: dictionary: trap_exit: status: heap_size: stack_size: reductions: 2018-06-04 14:21:44 std_info
kernel
{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,libsecp256k1}}},{kernel,start,[normal,[]]}}
permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,libsecp256k1}}},{kernel,start,[normal,[]]}}}"}
application: exited: type: Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,kernel_safe_sup,{on_load_function_failed,libsecp256k1}}},{kernel,start,[normal,[]]}}
Crash dump is being written to: erl_crash.dump...done```
Receiving this error when I try to output an int from a contract method:
** (RuntimeError) Unsupported decoding type: {:int, 256}
lib/abi/type_decoder.ex:241: ABI.TypeDecoder.decode_type/2
lib/abi/type_decoder.ex:219: anonymous fn/2 in ABI.TypeDecoder.decode_type/2
Here is a contract method that I'm failing on:
function getInt() public pure returns (int) {
return (40 - 100);
}
===> Compiling libsecp256k1
HEAD is now at d333521 Merge #494: Support OpenSSL versions >= 1.1 for ENABLE_OPENSSL_TESTS
Can't exec "/opt/local/bin/aclocal": No such file or directory at /opt/local/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run /opt/local/bin/aclocal: No such file or directory
===> Hook for compile failed!
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G65
automake: stable 1.16.1 (bottled)
Is there a way to build the ABI deps on Mac OSX?
Hello, dear developer!
Library fails when try to encode (and the same with decoding) long string
Here is sample:
function_selector = %FunctionSelector{
function: "setAccountFieldMainData",
returns: nil,
types: [:string, :string]
}
params = [{String.duplicate("1234567890", 10), "string"}]
ABI.encode(function_selector, params)
Suppose it's enough info to reproduce
Thank you for your time
no license on which software is made available
Below is the function signature in solidity:
get(bytes32)
I tried the following:
ABI.TypeEncoder.encode_raw([{"63cb2f697029ee491b58939796e9013087104b816ce0f51e731e9b03cc50c3b9"}], [{:tuple, [bytes: 32]}])
to which I get the following error:
** (RuntimeError) size mismatch for bytes32: "63cb2f697029ee491b58939796e9013087104b816ce0f51e731e9b03cc50c3b9"
lib/abi/type_encoder.ex:178: ABI.TypeEncoder.encode_type/2
This is because here: https://github.com/exthereum/abi/blob/master/lib/abi/type_encoder.ex#L173 , the size required will be less than or equal to 32
, since the function signature has bytes32
.
Am I providing the wrong input? Am I required to encode the hex string into another format that will be accepted in TypeEncoder.encode_raw
? I couldn't find a relevant example in the docs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.