Commit graph

412 commits

Author SHA1 Message Date
Daniel Liu
a8a96a804f accounts/abi/bind: make it possible to wait for tx hash (#30079)
This change adds methods which makes it possible for to wait for a transaction with a specific hash when deploying contracts during abi bind interaction.

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2025-01-24 16:54:12 +08:00
Daniel Liu
6f37e85e80 accounts/abi: support unpacking solidity errors (#30738)
This PR adds the error fragments to `func (abi ABI) getArguments` which
allows typed decoding of errors.
2025-01-24 16:54:12 +08:00
Daniel Liu
aa164fbbc1 accounts/abi: fix MakeTopics mutation of big.Int inputs (#30785)
However, it also changed the behavior of the function from just
_reading_ the input `*big.Int` via `Bytes()`, to leveraging
`big.U256Bytes` which is documented as being _destructive_:

This change updates `MakeTopics` to not mutate the original, and
also applies the same change in signer/core/apitypes.
2025-01-24 16:54:12 +08:00
Daniel Liu
72e5ee7f17 accounts/abi: golangci-lint 1.61.0 (#30587) 2025-01-24 16:54:12 +08:00
Daniel Liu
ced65923db accounts/abi/bind: check SendTransaction error in tests (#30349)
In few tests the returned error from `SendTransaction` is not being
checked. This PR checks the returned err in tests.

Returning errors also revealed tx in `TestCommitReturnValue` is not
actually being sent, and returns err ` only replay-protected (EIP-155)
transactions allowed over RPC`. Fixed the transaction by using the
`testTx` function.
2025-01-24 16:54:12 +08:00
Daniel Liu
11d3afd849 accounts/abi: handle ABIs with contract type parameter (#30315)
convert parameter of type contract to the basic `address` type
---------

Co-authored-by: Martin HS <martin@swende.se>
2025-01-24 16:54:12 +08:00
Daniel Liu
c6a8f79702 accounts/abi/bind: add accessList support to base bond contract (#30195)
Adding the correct accessList parameter when calling a contract can
reduce gas consumption. However, the current version only allows adding
the accessList manually when constructing the transaction. This PR can
provide convenience for saving gas.
2025-01-24 16:54:12 +08:00
Daniel Liu
52ac8ae22b accounts/abi/bind: use embed pkg to split go source template to file (#30098) 2025-01-24 16:54:12 +08:00
Daniel Liu
d2e00672c5 accounts: avoid duplicate regex compilation (#29943)
* fix: Optimize regular initialization

* modify var name

* variable change to private types
2025-01-24 16:54:12 +08:00
Daniel Liu
02a3aa13c1 accounts/abi: fix typos (#29542 #29600) 2025-01-24 16:54:12 +08:00
Daniel Liu
733a5fc193 accounts: fix mismatched names in comments (#29348) 2025-01-24 16:54:12 +08:00
Daniel Liu
30dc0f47c9 accounts/abi/bind: check invalid chainID first (#29275) 2025-01-24 16:54:12 +08:00
Daniel Liu
85059ed0d7 accounts/abi: delete duplicate error check (#29136) 2025-01-24 16:54:12 +08:00
Daniel Liu
b6f3007af1 core: move genesis alloc types to core/types (#29003) 2025-01-24 16:54:12 +08:00
Daniel Liu
2dfb1cf7d3 accounts: fix typos (#28881) 2025-01-24 16:54:12 +08:00
Daniel Liu
c1913bb22a accounts/abi/bind/backends: replace NewSimulatedBackend with NewXDCSimulatedBackend 2025-01-24 16:54:12 +08:00
Daniel Liu
b5f6104d5d accounts/abi: fix bigInt topic encoding (#28764) 2025-01-24 16:54:12 +08:00
Daniel Liu
8133f96d5f all: fix typos in comments (#28662)
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-01-24 16:54:12 +08:00
Daniel Liu
4a54407eb9 accounts: run tests in parallel (#28544) 2025-01-24 16:54:12 +08:00
Daniel Liu
c032eed8f8 accounts/abi/bind: fixed typos (#28634)
* Update auth.go

* Update backend.go

* Update bind.go

* Update bind_test.go
2025-01-24 16:54:12 +08:00
Daniel Liu
0b30a3de38 accounts/abi/bind: fix typo (#28630) 2025-01-24 16:54:12 +08:00
Daniel Liu
ea6606ad1c accounts/abi: context info on unpack-errors (#28529)
adds contextual information to errors returned by unpack
2025-01-24 16:54:12 +08:00
Daniel Liu
ccda15ef5d accounts, cmd: fix typos (#28526) 2025-01-24 16:54:12 +08:00
Daniel Liu
919cbf6032 accounts/abi: improve readability of method-to-string conversion (#28530)
refactor: improve readability of NewMethod print
2025-01-24 16:54:12 +08:00
Daniel Liu
390daf98e4 accounts: fix errors checked by go-staticcheck ST1005 (#28532) 2025-01-24 16:54:12 +08:00
Daniel Liu
5081ad72f5 accounts: move fuzzers into native packages (#28467) 2025-01-24 16:54:12 +08:00
Daniel Liu
df87605355 api/bind: add CallOpts.BlockHash to allow calling contracts at a specific block hash (#28084)
* api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash.

* ethclient: Add BalanceAtHash, NonceAtHash and StorageAtHash functions
2025-01-24 16:54:12 +08:00
Daniel Liu
b6c33b9a14 internal/ethapi, accounts/abi/bind: use errors.Is for error comparison (#28348)
Co-authored-by: lightclient <lightclient@protonmail.com>
2025-01-24 16:54:12 +08:00
Daniel Liu
57598e1825 accounts/abi/bind/backend: use requested header for gas prices and gas limits (#28280) 2025-01-24 16:54:12 +08:00
Daniel Liu
0efc73d664 accounts: handle genesis state missing (#28171) 2025-01-24 16:54:12 +08:00
Daniel Liu
4c7507af85 account/abi: handle solidity panic revert (#27868)
See  https://docs.soliditylang.org/en/v0.8.21/control-structures.html#panic-via-assert-and-error-via-require
2025-01-24 16:54:12 +08:00
Daniel Liu
d2cfa789da account/abi: convert if-else-if chain to tagged switch (#27869)
account/abi: conver if-else-if chain to tagged switch
2025-01-24 16:54:12 +08:00
Daniel Liu
e1c7317374 all: remove trailing whitespace (#27741) 2025-01-24 16:54:12 +08:00
Daniel Liu
0f737b4725 core: replace suicide with selfdestruct to improve code consistency (#27716) 2025-01-24 16:54:12 +08:00
Daniel Liu
80967d52f6 accounts: fix docstrings (#27703)
fix function name in comment

Signed-off-by: cui fliter <imcusg@gmail.com>
2025-01-24 16:54:12 +08:00
Daniel Liu
d4bf06d689 accounts: replace noarg fmt.Errorf with errors.New (#27331)
* accounts: replace noarg fmt.Errorf with errors.New

Signed-off-by: jsvisa <delweng@gmail.com>

* accounts: go autoimport

Signed-off-by: jsvisa <delweng@gmail.com>

---------

Signed-off-by: jsvisa <delweng@gmail.com>
2025-01-24 16:54:12 +08:00
Daniel Liu
013c90a4e8 accounts/abi: add ErrorById (#27277)
Adds `ErrorById` lookup
2025-01-24 16:54:12 +08:00
Daniel Liu
d9ec687a2c accounts/abi: resolve name conflict for methods starting with a number (#26999)
This adds logic to prepend 'M' or 'E' to Solidity identifiers when they would
otherwise violate Go identifier naming rules.

Closes #26972

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-01-24 16:54:12 +08:00
Daniel Liu
5de961552e accounts/abi/bind: handle UnpackLog with zero topics (#26920)
Adds error handling for the case that UnpackLog or UnpackLogIntoMap is called with a log that has zero topics.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-01-24 16:54:12 +08:00
Daniel Liu
1a07b9bb49 accounts/abi: add error-checks (#26914) 2025-01-24 16:54:12 +08:00
Daniel Liu
b18e0e45b7 accounts/abi: fix integer encoding/decoding (#26568)
This PR fixes this abi encoder/decoder to be more stringent.
2025-01-24 16:54:11 +08:00
Daniel Liu
cab293859a eth/filters: update Backend interface (#26126) 2025-01-24 16:54:11 +08:00
Daniel Liu
e88251d63a accounts/abi: properly quote untrusted data in error message (#26110)
* abi: Format data as hex-string instead of string(data)

* Update accounts/abi/abi.go

Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-01-24 16:54:11 +08:00
Daniel Liu
cd9c09f384 accounts/abi.bind: don't fetch head in transact unless required (#25988)
If GasFeeCap and GasTipCap are specified, we don't need to retrieve the head block for constructing a transaction
2025-01-24 16:54:11 +08:00
Daniel Liu
19085392a2 accounts/abi: return error on fixed bytes with size larger than 32 bytes (#26075)
* fixed bytes with size larger than 32 bytes is not allowed

* add testcase
2025-01-24 16:54:11 +08:00
Daniel Liu
c241fc3574 eth/filters: fix for eth_getLogs failing with tag (#25922) 2025-01-24 16:54:11 +08:00
Daniel Liu
98c67ab2d9 accounts/abi: return toGoType error immediately (#25565) 2025-01-24 16:54:11 +08:00
Daniel Liu
73947f03b7 accounts/abi/bind/backends: fix AdjustTime to respect Fork (#25225) 2025-01-24 16:54:11 +08:00
Daniel Liu
0389524da8 accounts/abi: fix typo in error message (#25742) 2025-01-24 16:54:11 +08:00
Daniel Liu
e2b5a03ce8 accounts: lint comments (#25726) 2025-01-24 16:54:11 +08:00