Commit Graph

280 Commits

Author SHA1 Message Date
Marius van der Wijden
023b87b9d1
accounts/abi/bind: fixed erroneous filtering of negative ints (#20865)
* accounts/abi/bind: fixed erroneous packing of negative ints

* accounts/abi/bind: added test cases for negative ints in topics

* accounts/abi/bind: fixed genIntType for go 1.12

* accounts/abi: minor  nitpick
2020-04-09 10:54:57 +02:00
Marius van der Wijden
5065cdefff
accounts/abi/bind: Refactored topics (#20851)
* 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>
2020-04-08 12:00:10 +02:00
Marius van der Wijden
f15849cf00
accounts/abi faster unpacking of int256 (#20850) 2020-04-01 18:46:53 +02:00
Péter Szilágyi
542df8898e
core: initial version of state snapshots 2020-02-25 12:51:04 +02:00
gary rong
2e1ecc02bd
les, miner, accounts/abi/bind: fix load-sensitive unit tests (#20698) 2020-02-20 13:05:54 +01:00
Marius van der Wijden
46c4b699c8
accounts/abi/bind/backends: add support for historical state (#20644) 2020-02-12 11:33:17 +01:00
Sylvain Laurent
b7cf41e4b3 accounts/abi: fix method constant flag for solidity 6.0 (#20482) 2020-01-06 12:03:26 +01:00
Ilan Gitter
93b1171316 accounts/abi/backends/simulated: add more API methods (#5) (#20208)
* Add more functionality to the sim (#5)

* backends: implement more of ethclient in sim

* backends: add BlockByNumber to simulated backend

* backends: make simulated progress function agree with syncprogress interface for client

* backends: add more tests

* backends: add more comments

* backends: fix sim for index in tx and add tests

* backends: add lock back to estimategas

* backends: goimports

* backends: go ci lint

* Add more functionality to the sim (#5)

* backends: implement more of ethclient in sim

* backends: add BlockByNumber to simulated backend

* backends: make simulated progress function agree with syncprogress interface for client

* backends: add more tests

* backends: add more comments

* backends: fix sim for index in tx and add tests

* backends: add lock back to estimategas

* backends: goimports

* backends: go ci lint

* assert errs
2019-12-20 11:33:32 +01:00
Jeff Wentworth
6ae9dc15cc [#20266] Fix bugs decoding integers and fixed bytes in indexed event fields (#20269)
* fix parseTopics() and add tests

* remove printf

* add ParseTopicsIntoMap() tests

* fix FixedBytesTy

* fix int and fixed bytes

* golint topics_test.go
2019-12-18 11:16:07 +01:00
Felix Lange
d90d1db609
eth/filters: remove use of event.TypeMux for pending logs (#20312) 2019-12-10 12:39:14 +01:00
Marius van der Wijden
7ce7c3967c accounts/abi/bind: fix destructive packing of *big.Int (#20412) 2019-12-02 10:29:25 +01:00
gary rong
b26eedf9e9 accounts/abi/bind: avoid reclaring structs (#20381) 2019-11-25 14:03:22 +01:00
Felix Lange
36a684ca1e accounts/abi: fix staticcheck warnings (#20358)
* accounts/abi: fix staticcheck warnings

* accounts/abi: restore unused field for test
2019-11-21 23:22:47 +02:00
Felix Lange
bcc1234778 accounts/abi/bind/backends: remove unused assignment (#20359) 2019-11-21 20:30:28 +02:00
Péter Szilágyi
f4ec85486a
accounts/abi/bind: switch binding test to go modules 2019-11-20 14:42:33 +02:00
gary rong
f8a95d996f accounts/abi/bind, cmd/abigen: implement alias for abigen (#20244)
* accounts/abi/bind, cmd/abigen: implement alias for abigen

* accounts/abi/bind: minor fixes

* accounts/abi/bind: address comments

* cmd/abigen: address comments

* accounts/abi/bind: print error log when identifier collision

* accounts/abi/bind: address comments

* accounts/abi/bind: address comment
2019-11-14 08:26:10 +01:00
gary rong
44b74cfc40 accounts/abi: add internalType information and fix issues (#20179)
* 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
2019-10-31 14:17:51 +01:00
Piotr Dyraga
538f763fdc accounts/abi/bind: take into account gas price during gas estimation (#20189)
The gas price was not passed to the `EstimateGas` function. As a result,
conditional execution paths depending on `tx.gasprice` could be not
correctly processed and we could get invalid gas estimates for contract
function calls.
2019-10-21 10:13:41 +02:00
gary rong
947f5f2b15 accounts/abi, signer/fourbyte: fix incorrect signature (#19881)
The abi package already supports function overload by adding a suffix to the overloaded function name, but it uses the function name with suffix to calculate signature(both for the event and method).

This PR fixes it by adding a new field named RawName, which can be used to calcuate all signatures but use Name to distinguish different overloaded function.
2019-08-02 09:20:46 +02:00
Péter Szilágyi
140a7e9177
accounts/abi/bind: support closing a simulated backend 2019-07-31 11:35:57 +03:00
Péter Szilágyi
1a83114c74
all: update author list and licenses 2019-07-22 12:17:27 +03:00
Felix Lange
f088c650a5 all: replace t.Log(); t.FailNow() with t.Fatal() (#19849) 2019-07-18 15:21:24 +03:00
Guillaume Ballet
5bc9ccfa0a
accounts/abi/bind: link dependent libs in deploy (#19718)
* accounts, abigen: link dependent libs in deploy

* abigen: add java generation

* bind: Fix unit tests

* abigen: add unit test

* Fix CI

* Post-rebase fixes

* Fix rebase issue

* accounts/abi: Gary's review feedback

* accounts/abi: More Gary feedback

* accounts/abi: minor fixes
2019-07-08 10:27:05 +02:00
Guillaume Ballet
d9c75cd10e
accounts/abi/bind: fix typo in comments (#19791) 2019-07-04 10:00:34 +02:00
gary rong
6814797173 accounts, cmd, contracts, les: integrate clef for transaction signing (#19783)
* accounts, cmd, contracts, les: integrate clef for transaction signing

* accounts, cmd/checkpoint-admin, signer/core: minor fixups
2019-07-03 22:54:59 +03:00
gary rong
5f5de49cd9 accounts/abi: enable struct golang binding generation (#18491)
* 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
2019-07-03 12:17:43 +02:00
Guillaume Ballet
6bf5555c4f
accounts/abi/bind: Accept function ptr parameter (#19755)
* accounts/abi/bind: Accept function ptr parameter

They are translated as [24]byte

* Add Java template version

* accounts/abi/bind: fix merge issue

* Fix CI
2019-07-02 09:52:58 +02:00
zer0to0ne
0b26a826e9 accounts/abi: Fix method overwritten by same name methods. (#17099)
* accounts/abi: Fix method overwritten by same name methods.

* accounts/abi: Fix method overwritten by same name methods.

* accounts/abi: avoid possible name conflict

Co-authored-by: Guillaume Ballet <gballet@gmail.com>
2019-07-01 16:51:21 +02:00
gary rong
f7cdea2bdc all: on-chain oracle checkpoint syncing (#19543)
* all: implement simple checkpoint syncing

cmd, les, node: remove callback mechanism

cmd, node: remove callback definition

les: simplify the registrar

les: expose checkpoint rpc services in the light client

les, light: don't store untrusted receipt

cmd, contracts, les: discard stale checkpoint

cmd, contracts/registrar: loose restriction of registeration

cmd, contracts: add replay-protection

all: off-chain multi-signature contract

params: deploy checkpoint contract for rinkeby

cmd/registrar: add raw signing mode for registrar

cmd/registrar, contracts/registrar, les: fixed messages

* cmd/registrar, contracts/registrar: fix lints

* accounts/abi/bind, les: address comments

* cmd, contracts, les, light, params: minor checkpoint sync cleanups

* cmd, eth, les, light: move checkpoint config to config file

* cmd, eth, les, params: address comments

* eth, les, params: address comments

* cmd: polish up the checkpoint admin CLI

* cmd, contracts, params: deploy new version contract

* cmd/checkpoint-admin: add another flag for clef mode signing

* cmd, contracts, les: rename and regen checkpoint oracle with abigen
2019-06-28 10:34:02 +03:00
gary rong
6069b1a5f5 mobile: fix mobile interface (#19180)
* mobile: fix mobile interface

* mobile, accounts: generate correct java binding

* accounts: fix java type binding

* mobile: support integer slice

* accounts/abi/bind, cmd/abigen: implement java binding tests
2019-06-27 11:48:13 +03:00
salanfe
e4a1488b2f abi: adding the method EventByID and its test (#19359)
This function searches for an event+parameters in the ABI and returns it if found.

Co-authored-by: Victor Tran <vu.tran54@gmail.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
2019-06-24 12:52:50 +02:00
Péter Szilágyi
38c914be64
accounts/abi/bind/backends: use EIP155 on the simulated chain 2019-06-18 11:49:30 +03:00
Marius van der Wijden
b3f7609d7d accounts/abi/bind: rename NewKeystoreTransactor (#19703)
renamed NewKeyStoreFromTransactor to NewKeystoreTransactor
fixed godoc
2019-06-12 14:06:37 +03:00
Marius van der Wijden
6f80629383 accounts: added transactorFromKeyStore (#19685) 2019-06-08 15:19:26 +02:00
manlio
e687d063c3 accounts/abi: fix TestUnpackMethodIntoMap (#19484) 2019-05-17 15:24:04 +02:00
Jeremy Schlatter
184af72e4e accounts/abi: fix documentation (#19568) 2019-05-14 12:38:34 +03:00
Péter Szilágyi
7221cb1434
core, eth, les, light: scope receipt functionality a bit cleaner 2019-04-15 13:42:26 +03:00
Ian Norden
cd79bc61a9 accounts/abi: generic unpacking of event logs into map[string]interface{} (#18440)
Add methods that allow for the unpacking of event logs into maps (allows for agnostic unpacking of logs)
2019-04-01 15:42:59 +02:00
Mats Julian Olsen
5b0d3fa393 accounts/abi: Add the original name as json-structtag for tuples. 2019-03-28 14:32:09 +01:00
Péter Szilágyi
5ce192ce44
accounts/abi/bind: simulated test case for fixed bytes logs 2019-03-14 12:58:18 +02:00
Jeremy McNevin
7640c9c933
bind: Static byte arrays should be right-padded
Per https://solidity.readthedocs.io/en/v0.5.3/abi-spec.html:

"bytes<M>: enc(X) is the sequence of bytes in X padded with trailing zero-bytes to a length of 32 bytes"
2019-03-14 12:51:10 +02:00
Péter Szilágyi
054412e335
all: clean up and proerly abstract database access 2019-03-06 13:35:03 +02:00
Dan Kinsley
f49f95e2b0 accounts/abi: mutex lock in TransactionByHash and code cleanup (#19133) 2019-02-20 08:08:54 +01:00
Hsien-Tang Kao
4a090a1bab accounts/abi: fix error message format (#19122) 2019-02-19 10:34:55 +02:00
Dan Kinsley
555b3652dc accounts/abi/bind/backends: add TransactionByHash to SimulatedBackend (#19026) 2019-02-13 00:23:10 +01:00
gary rong
a50b471b6b accounts/abi: allow interface as the destination (#18490) 2019-01-23 14:36:49 +01:00
Guillaume Ballet
115b1c38ac
accounts/abi: Add tests for reflection ahead of refactor (#18434) 2019-01-15 16:45:52 +01:00
Guillaume Ballet
38cce9ac33 accounts/abi: Extra slice tests (#18424)
Co-authored-by: weimumu <934657014@qq.com>
2019-01-10 16:27:54 +01:00
gary rong
7ca40306af accounts/abi: tuple support (#18406) 2019-01-10 09:59:37 +01:00
Dragan Milic
27913dd226 accounts/abi/bind: add optional block number for calls (#17942) 2019-01-03 12:54:24 +01:00
Guillaume Ballet
9bfd0b60cc
accounts/abi: fix case of generated java functions (#18372) 2019-01-02 10:22:10 +01:00
Matt K
a4af734328 accounts/abi: change unpacking of abi fields w/ underscores (#16513)
* 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.
2018-12-29 11:32:58 +01:00
weimumu
735343430d fix string array unpack bug in accounts/abi (#18364) 2018-12-28 08:43:55 +01:00
Jeff Prestes
335760bf06 accounts/abi: Brings out the msg defined at require statement in SC function (#17328) 2018-12-22 11:39:08 +01:00
bas-vk
7df52e324c accounts/abi: add support for unpacking returned bytesN arrays (#15242) 2018-12-22 11:26:49 +01:00
weimumu
3ad73443c7 fix slice unpack bug in accounts/abi (#18321)
* fix slice unpack bug in accounts/abi
2018-12-17 09:50:52 +01:00
tzapu
e79821cabe accounts/abi: argument type and name were reversed (#17947)
argument type and name were reversed
2018-12-13 15:12:19 +01:00
Vedhavyas Singareddi
92639b676a Add packing for dynamic array and slice types (#18051)
* added tests for new abi encoding features (#4)

* added tests from bytes32[][] and string[]

* added offset to other types

* formatting

* Abi/dynamic types (#5)

* Revert "Abi/dynamic types (#5)" (#6)

This reverts commit dabca31d797623d43bd780721fc0ad461d24be53.

* Abi/dynamic types (#7)

* some cleanup

* Apply suggestions from code review

apply suggestions

Co-Authored-By: vedhavyas <vedhavyas.singareddi@gmail.com>

* added better formatting (#8)

* review chnages

* better comments
2018-12-04 15:27:55 +01:00
Jeremy Schlatter
5ed3960b9b accounts/abi/bind: stop using goimports in the binding generator (#17768) 2018-10-05 22:24:54 +02:00
Martin Holst Swende
96fd50be10 accounts/abi: fix panic in MethodById lookup. Fixes #17797 (#17798) 2018-10-01 14:17:36 +02:00
CDsigma
a5aaab2f22 accounts/abi/bind/backends: fix typo (#17749) 2018-09-28 22:47:46 +02:00
gary rong
d6254f827b all: protect self-mined block during reorg (#17656) 2018-09-20 15:09:30 +03:00
Martin Holst Swende
16bc8741bf abi, signer: fix nil dereference in #17633 (#17653)
* abi,signer: fix nil dereference in #17633

* signer/core: tiny typo fix in test error message
2018-09-19 12:07:53 +03:00
Diep Pham
42bd67bd6f accounts/abi: fix unpacking of negative int256 (#17583) 2018-09-04 17:53:28 +02:00
Wenbiao Zheng
d1aa605f1e all: remove the duplicate 'the' in annotations (#17509) 2018-08-27 11:49:29 +03:00
Jeff Prestes
212bba47ff backends: configurable gas limit to allow testing large contracts (#17358)
* backends: increase gaslimit in order to allow tests of large contracts

* backends: increase gaslimit in order to allow tests of large contracts

* backends: increase gaslimit in order to allow tests of large contracts
2018-08-15 10:15:42 +03:00
Péter Szilágyi
21c059b67e
Merge pull request #16734 from reductionista/eip234
eth/filters, interfaces: EIP-234 Add blockHash option to eth_getLogs
2018-07-24 12:52:16 +03:00
Roc Yu
040dd5bd5d accounts/abi: refactor Method#Sig() to use index in range iterator directly (#17198) 2018-07-19 11:42:47 +03:00
Péter Szilágyi
e1f1d3085c
accounts, eth, les: blockhash based filtering on all code paths 2018-07-12 18:16:54 +03:00
Wenbiao Zheng
61a5976368 accounts: remove deadcode isSigned (#16990) 2018-06-20 11:46:29 +02:00
Péter Szilágyi
49719e21bc
core, eth: minor txpool event cleanups 2018-05-18 12:08:24 +03:00
rjl493456442
a2e43d28d0
all: collate new transaction events together 2018-05-18 11:46:44 +03:00
Guillaume Ballet
247b5f0369
accounts/abi: allow abi: tags when unpacking structs
Go code users can now tag event struct members with `abi:` to specify in what fields the event will be de-serialized.

See PR #16648 for details.
2018-05-14 14:47:31 +02:00
gary rong
7beccb29be all: get rid of error when creating memory database (#16716)
* all: get rid of error when create mdb

* core: clean up variables definition

* all: inline mdb definition
2018-05-09 15:24:25 +03:00
Péter Szilágyi
6cf0ab38bd
core/rawdb: separate raw database access to own package (#16666) 2018-05-07 14:35:06 +03:00
kiel barry
c1ea527573 accounts: golint updates for this or self warning (#16627) 2018-05-02 11:17:52 +03:00
Ricardo Domingos
6ab9f0a19f accounts/abi: improve test coverage (#16044) 2018-04-04 13:42:36 +02:00
Martin Holst Swende
933972d139
Merge pull request #16256 from epiclabs-io/unpack_one_arg_event
Fix issue unmarshaling single parameter events from abigen generated go code #16208
2018-03-21 10:11:37 +01:00
Martin Holst Swende
faed47b3c5
Merge pull request #15990 from markya0616/sim_backend_block_hash
accounts/abi, core: add AddTxWithChain in BlockGen for simulation
2018-03-19 08:29:54 +01:00
Mark
cddb529d70 accounts/abi: normalize method name to a camel-case string (#15976) 2018-03-07 14:34:53 +02:00
Javier Peletier
60a999f238 accounts/abi: Modified unpackAtomic to accept struct lvalues 2018-03-05 16:01:40 +01:00
Javier Peletier
13b566e06e accounts/abi: Add one-parameter event test case from enriquefynn/unpack_one_arg_event 2018-03-05 16:00:03 +01:00
protolambda
0b814d32f8 accounts/abi: Abi binding support for nested arrays, fixes #15648, including nested array unpack fix (#15676)
* 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.
2018-03-04 23:24:17 +01:00
Péter Szilágyi
5cf1d35470
eth, les, light: filter on logs only, derive receipts on demand 2018-02-22 19:12:43 +02:00
Martin Holst Swende
61f2279bde
abi: fix missing method on go 1.7/1.8 2018-02-21 12:27:50 +01:00
Martin Holst Swende
bd6ed23899
accounts/abi: harden unpacking against malicious input 2018-02-21 12:27:50 +01:00
Martin Holst Swende
08c5d4dd27
accounts/abi: address review concerns 2018-02-21 12:27:50 +01:00
Martin Holst Swende
f0f594d045
accounts/abi: Deduplicate code in unpacker 2018-02-21 12:27:50 +01:00
Martin Holst Swende
1ede68355d
accounts/abi: add another unpack interface 2018-02-21 12:27:50 +01:00
Fynn
1e72271f57
accounts/abi: use unpackTuple to unpack event arguments
Events with just 1 argument fail before this change
2018-02-16 11:46:25 +01:00
Felix Lange
a5c0bbb4f4
all: update license information (#16089) 2018-02-14 13:49:11 +01:00
Péter Szilágyi
55599ee95d core, trie: intermediate mempool between trie and database (#15857)
This commit reduces database I/O by not writing every state trie to disk.
2018-02-05 17:40:32 +01:00
mark.lin
c1d70ea970 accounts/abi, core: add AddTxWithChain in BlockGen for simulation 2018-01-29 18:47:08 +08:00
Péter Szilágyi
1bf508b449
accounts/abi/bind: support event filtering in abigen 2018-01-24 10:54:13 +02:00
Péter Szilágyi
6f69cdd109
all: switch gas limits from big.Int to uint64 2018-01-03 14:45:35 +02:00
Furkan KAMACI
b8caba9709 various: remove redundant parentheses (#15793) 2018-01-03 14:14:47 +02:00
Péter Szilágyi
b9731767af
accounts/abi: handle named ouputs prefixed with underscores (#15766)
* accounts/abi: handle named ouputs prefixed with underscores

* accounts/abi: handle collinding outputs for struct unpacks

* accounts: handle purely underscore output names
2017-12-29 23:20:02 +02:00
Martin Holst Swende
9d187f0238
Merge pull request #15731 from holiman/revamp_abi
accounts/abi refactor
2017-12-22 20:59:41 +01:00
Martin Holst Swende
c095c87e11
accounts/abi: merging of https://github.com/ethereum/go-ethereum/pull/15452 + lookup by id 2017-12-22 19:26:57 +01:00
Martin Holst Swende
73d4a57d47
acounts/abi: refactor abi, generalize abi pack/unpack to Arguments 2017-12-22 19:26:52 +01:00