* accounts/abi: simplified reflection logic
* accounts/abi: simplified reflection logic
* accounts/abi: removed unpack
* accounts/abi: removed comments
* accounts/abi: removed uneccessary complications
* accounts/abi: minor changes in error messages
* accounts/abi: removed unnused code
* accounts/abi: fixed indexed argument unpacking
* accounts/abi: removed superfluous test cases
This commit removes two test cases. The first one is trivially invalid as we have the same
test cases as passing in packing_test.go L375. The second one passes now,
because we don't need the mapArgNamesToStructFields in unpack_atomic anymore.
Checking for purely underscored arg names generally should not be something we do
as the abi/contract is generally out of the control of the user.
* accounts/abi: removed comments, debug println
* accounts/abi: added commented out code
* accounts/abi: addressed comments
* accounts/abi: remove unnecessary dst.CanSet check
* accounts/abi: added dst.CanSet checks
* accounts/abi/bind: added test cases for waitDeployed
* accounts/abi/bind: added test case for boundContract
* accounts/abi/bind: removed unnecessary resolve methods
* accounts/abi: moved topics from /bind to /abi
* accounts/abi/bind: cleaned up format... functions
* accounts/abi: improved log message
* accounts/abi: added type tests
* accounts/abi/bind: remove superfluous template methods
* accounts/abi: added documentation
* accounts/abi: reduced usage of arguments.LengthNonIndexed
* accounts/abi: simplified reflection logic
* accounts/abi: moved testjson data into global declaration
* accounts/abi: removed duplicate test cases
* accounts/abi: reworked abi tests
* accounts/abi: added more tests for abi packing
* accounts/abi/bind: refactored base tests
* accounts/abi: run pack tests as subtests
* accounts/abi: removed duplicate tests
* accounts/abi: removed unnused arguments.LengthNonIndexed
Due to refactors to the code, we do not need the arguments.LengthNonIndexed function anymore.
You can still get the length by calling len(arguments.NonIndexed())
* accounts/abi: added type test
* accounts/abi: modified unpack test to pack test
* accounts/abi: length check on arrayTy
* accounts/abi: test invalid abi
* accounts/abi: fixed rebase error
* accounts/abi: fixed rebase errors
* accounts/abi: removed unused definition
* accounts/abi: merged packing/unpacking tests
* accounts/abi: fixed [][][32]bytes encoding
* accounts/abi: added tuple test cases
* accounts/abi: renamed getMockLog -> newMockLog
* accounts/abi: removed duplicate test
* accounts/abi: bools -> booleans
* accounts/abi: prevent recalculation of ID, Sig and String
* accounts/abi: fixed unpacking of no values
* accounts/abi: multiple fixes to arguments
* accounts/abi: refactored methodName and eventName
This commit moves the complicated logic of how we assign method names
and event names if they already exist into their own functions for
better readability.
* accounts/abi: prevent recalculation of internal
In this commit, I changed the way we calculate the string
representations, sig representations and the id's of methods. Before
that these fields would be recalculated everytime someone called .Sig()
.String() or .ID() on a method or an event.
Additionally this commit fixes issue #20856 as we assign names to inputs
with no name (input with name "" becomes "arg0")
* accounts/abi: added unnamed event params test
* accounts/abi: fixed rebasing errors in method sig
* accounts/abi: fixed rebasing errors in method sig
* accounts/abi: addressed comments
* accounts/abi: added FunctionType enumeration
* accounts/abi/bind: added test for unnamed arguments
* accounts/abi: improved readability in NewMethod, nitpicks
* accounts/abi: method/eventName -> overloadedMethodName
* accounts/abi/bind: refactored topics
* accounts/abi/bind: use store function to remove code duplication
* accounts/abi/bind: removed unused type defs
* accounts/abi/bind: error on tuples in topics
* Cosmetic changes to restart travis build
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
* accounts/abi: fix various issues
The fixed issues include:
(1) If there is no return in a call function, unpack should
return nil error
(2) For some functions which have struct array as parameter,
it will also be detected and generate the struct definition
(3) For event, if it has non-indexed parameter, the parameter
name will also be assigned if empty. Also the internal struct
will be detected and generate struct defition if not exist.
(4) Fix annotation generation in event function
* accounts/abi: add new abi field internalType
* accounts: address comments and add tests
* accounts/abi: replace strings.ReplaceAll with strings.Replace
* accounts/abi, cmd/abigen: support tuple
accounts/abi/bind, cmd/abigen: add objc back
accounts/abi/bind: use byte[24] as function indicator
accounts/abi/bind: resolve struct slice or array
accounts/abi/bind: remove sort logic
accounts: fix issues in abi
* accounts/abi: address comment
* accounts/abi: fix name styling when unpacking abi fields w/ underscores
ABI fields with underscores that are being unpacked
into structs expect structs with following form:
int_one -> Int_one
whereas in abigen the generated structs are camelcased
int_one -> IntOne
so updated the unpack method to expect camelcased structs as well.
* accounts/abi/bind: support for multi-dim arrays
Also:
- reduce usage of regexes a bit.
- fix minor Java syntax problems
Fixes#15648
* accounts/abi/bind: Add some more documentation
* accounts/abi/bind: Improve code readability
* accounts/abi: bugfix for unpacking nested arrays
The code previously assumed the arrays/slices were always 1 level
deep. While the packing supports nested arrays (!!!).
The current code for unpacking doesn't return the "consumed" length, so
this fix had to work around that by calculating it (i.e. packing and
getting resulting length) after the unpacking of the array element.
It's far from ideal, but unpacking behaviour is fixed now.
* accounts/abi: Fix unpacking of nested arrays
Removed the temporary workaround of packing to calculate size, which was
incorrect for slice-like types anyway.
Full size of nested arrays is used now.
* accounts/abi: deeply nested array unpack test
Test unpacking of an array nested more than one level.
* accounts/abi: Add deeply nested array pack test
Same as the deep nested array unpack test, but the other way around.
* accounts/abi/bind: deeply nested arrays bind test
Test the usage of bindings that were generated
for methods with multi-dimensional (and not
just a single extra dimension, like foo[2][3])
array arguments and returns.
edit: trigger rebuild, CI failed to fetch linter module.
* accounts/abi/bind: improve array binding
wrapArray uses a regex now, and arrayBindingJava is improved.
* accounts/abi: Improve naming of element size func
The full step size for unpacking an array
is now retrieved with "getFullElemSize".
* accounts/abi: support nested nested array args
Previously, the code only considered the outer-size of the array,
ignoring the size of the contents. This was fine for most types,
but nested arrays are packed directly into it, and count towards
the total size. This resulted in arguments following a nested
array to replicate some of the binary contents of the array.
The fix: for arrays, calculate their complete contents size:
count the arg.Type.Elem.Size when Elem is an Array, and
repeat when their child is an array too, etc.
The count is the number of 32 byte elements, similar to how it
previously counted, but nested.
* accounts/abi: Test deep nested arr multi-arguments
Arguments with a deeply nested array should not cause the next arguments
to be read from the wrong position.
+ The event slice unpacker doesn't correctly extract element from the
slice. The indexed arguments are not ignored as they should be
(the data offset should not include the indexed arguments).
+ The `Elem()` call in the slice unpack doesn't work.
The Slice related tests fails because of that.
+ the check in the loop are suboptimal and have been extracted
out of the loop.
+ extracted common code from event and method tupleUnpack
This significantly reduces the dependency closure of ethclient, which no
longer depends on core/vm as of this change.
All uses of vm.Logs are replaced by []*types.Log. NewLog is gone too,
the constructor simply returned a literal.