Commit graph

12717 commits

Author SHA1 Message Date
Daniel Liu
98629d0c4b accounts: fix typo in comments (#24805) 2025-01-24 16:54:11 +08:00
Daniel Liu
206b61420f abi/base: return error for pending call error (#24649)
If a pending contract call errors, return that error right away rather
than ignoring it to allow an error somewhere else. This is helpful for
callers to know if perhaps a call failed because of the context deadline
being expired. This change mirrors the behavior of non-pending contract
calls.
2025-01-24 16:54:11 +08:00
Daniel Liu
5b10b2441c all: use T.TempDir to create temporary test directories (#24633) 2025-01-24 16:54:08 +08:00
Daniel Liu
8b9138521e accounts/abi/bind: improve WaitMined error handling (#24321)
This change makes it so WaitMined no longer logs an error when the receipt
is unavailable. It also changes the simulated backend to return NotFound for
unavailable receipts, just like ethclient does.
2025-01-24 16:18:30 +08:00
Daniel Liu
f22046701f accounts: correct spelling mistake (#24323)
I believe the sentence is attempting to explain that the URL is "[used] by upper layers to define a sorting order over all wallets from multiple backends."
2025-01-24 16:18:30 +08:00
Daniel Liu
c78cc1e8f8 accounts/abi: simplify Arguments.Unpack (#24277)
Since len(nonIndexedArgs) is definitely 0 in this context, the code can be simplified.
2025-01-24 16:18:30 +08:00
Daniel Liu
c55d8c8bab accounts: fix typo in errors.go (#24270) 2025-01-24 16:18:30 +08:00
Daniel Liu
4f7123c3c0 accounts/abi/bind/backends: return errors instead of panic (#24242) 2025-01-24 16:18:30 +08:00
Daniel Liu
9e82b201c7 accouts/scwallet: typo fix (#24207) 2025-01-24 16:18:30 +08:00
Daniel Liu
78fd3b44d7 accounts: corrected spelling mistakes (#24194)
Co-authored-by: sanskar khare <sanskarkhare@sanskars-MacBook-Air.local>
2025-01-24 16:18:30 +08:00
Daniel Liu
d89e2d6734 accounts: fix comments (#24186) 2025-01-24 16:18:30 +08:00
Daniel Liu
c5acd6822d accounts/abi: avoid unnecessary alloc (#24128) 2025-01-24 16:18:30 +08:00
Daniel Liu
b33307eaea accounts/abi/bind: correctly handle structs used only as constructor params (#23940)
The `structs` map is populated by iterating over all methods except the constructor, which results in a nil-pointer dereference.

I've first reproduced the problem with a new test and then implemented the fix.

Co-authored-by: Arran Schlosberg <me@arranschlosberg.com>
2025-01-24 16:18:30 +08:00
Daniel Liu
bdf9d80b56 accounts/abi/bind/backends: fix race condition in simulated backend (#23898)
Now that `SimulatedBackend.SuggestGasPrice` inspects member values, a lock needs to be added to prevent a race condition.
2025-01-24 16:18:30 +08:00
Daniel Liu
65c3ad5cba accounts/abi/bin/backends: return basefee in suggestGasPrice (#23838)
Co-authored-by: mrx <mrx@mrx.com>
2025-01-24 16:18:30 +08:00
Daniel Liu
7fb05b7c16 accounts/abi: add basic support for error types (#23161)
This is the initial step for support of Solidity errors in contract bindings.
As of this change, errors can be decoded, but are not supported in
bindings yet.

Closes #23157
2025-01-24 16:18:30 +08:00
Daniel Liu
0c9babc95c accounts/abi/bind: refactor transact method (#23719) 2025-01-24 16:18:30 +08:00
Daniel Liu
46a16f9149 accounts/abi: fix some go-critic linter warnings (#23709) 2025-01-24 16:18:30 +08:00
Daniel Liu
2af78feca0 accounts/abi/bind: check event signature before parsing (#23230)
* accounts/abi/bind: check event signature before parsing

* remove redundant break line
2025-01-24 16:18:30 +08:00
Daniel Liu
2b396f29ad accounts/abi: fix resolving single struct argument (#23573) 2025-01-24 16:18:30 +08:00
Daniel Liu
bcae4205e4 accounts/keystore: fix flaky tests (#23599)
* ethclient/gethclient: fix flaky test (due to map key ordering)

* accounts/keystore: fix test failing due to rand collision due to low time resolution on windows
2025-01-24 16:18:30 +08:00
Daniel Liu
f74eacd2cd node: remove dependency on wallet backend packages (#23019)
* accounts: new AddBackends method in manager

* node,cmd/geth: mv accman backend init to cmd/geth

* node,cmd/geth: mv scrypt config downstreawm from node

* accounts: use static buffer size for accman sub chan

minor fix

* accounts,cmd/geth: update accman backends through its event loop

* accounts,node: add comments

* accounts: un-export newBackendEvent

* accounts: use chan instead of wg in newBlockEvent

* node: rename isKeyDirEphem

* accounts,cmd: AddBackends->AddBackend

* accounts: fix potential blocking when adding backend
2025-01-24 16:18:30 +08:00
Daniel Liu
e33909649b cmd/utils: don't enumerate usb when --usb isn't set (#22130) 2025-01-24 16:18:30 +08:00
Daniel Liu
83b7c0eacb accounts/keystore: add go:build lines (#23468) 2025-01-24 16:18:30 +08:00
Daniel Liu
36d3e7dcc2 accounts/abi/bind: set Context in TransactOpts (#23188) 2025-01-24 16:18:30 +08:00
Daniel Liu
92d9f7e13a accounts/abi/bind: parse ABI only once, create metadata struct (#22583) 2025-01-24 16:18:30 +08:00
Daniel Liu
74ec7022c2 accounts/abi/bind: replace context.TODO with context.Background (#23088) 2025-01-24 16:18:30 +08:00
Daniel Liu
e26b70e5cc accounts/abi/bind: fix sim backend test for 1559 (#23038) 2025-01-24 16:18:30 +08:00
Daniel Liu
c2e71efd65 accounts/abi/bind/backends: add simulated reorgs (#22624) 2025-01-24 16:18:30 +08:00
Daniel Liu
da6675f05c accounts: documentation fixes (#22645)
* replaces `an chance` with `a chance`
* replaces `SignHashWithPassphrase` with `SignTextWithPassphrase` as there was no SignHashWithPasspharse function in the file
2025-01-24 16:18:30 +08:00
Daniel Liu
345ed3dc36 accounts: eip-712 signing for ledger (#22378)
* accounts: eip-712 signing for ledger

* address review comments
2025-01-24 16:18:30 +08:00
Daniel Liu
c75ba99267 accounts/keystore: use github.com/google/uuid (#22217)
This replaces the github.com/pborman/uuid dependency with
github.com/google/uuid because the former is only a wrapper for
the latter (since v1.0.0).

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-01-24 16:18:30 +08:00
Daniel Liu
146ea8ba78 accounts: EIP-2718: Typed Transaction Envelope + EIP-2930 (#21502) 2025-01-24 16:18:30 +08:00
Daniel Liu
01d3be7eb8 accounts/abi/bind: fixed unpacking error (#22230)
There was a dormant error with structured inputs that failed unpacking.
This commit fixes the error by switching casting to the better abi.ConvertType function.
It also adds a test for calling a view function that returns a struct
2025-01-24 16:18:30 +08:00
Daniel Liu
2ffdb94855 accounts/keystore: remove uneeded syntax (#21921) 2025-01-24 16:18:30 +08:00
Daniel Liu
4e23f7b607 accounts/scwallet: update documentation (#22242) 2025-01-24 16:18:30 +08:00
Daniel Liu
f8c67edb64 accounts/scwallet: use go-ethereum crypto instead of go-ecdh (#22212)
* accounts/scwallet: use go-ethereum crypto instead of go-ecdh

github.com/wsddn/go-ecdh is a wrapper package for ECDH functionality
with any elliptic curve.

Since 'generic' ECDH is not required in accounts/scwallet (the curve is
always secp256k1), we can just use the standard library functionality
and our own crypto libraries to perform ECDH and save a dependency.

* Update accounts/scwallet/securechannel.go

Co-authored-by: Guillaume Ballet <gballet@gmail.com>

* Use the correct key

Co-authored-by: Guillaume Ballet <gballet@gmail.com>
2025-01-24 16:18:30 +08:00
Daniel Liu
cebdb44051 accounts/abi/bind: fix erroneous test (#22053)
closes #22049
2025-01-24 16:18:30 +08:00
Daniel Liu
f87376535d cmd/abigen: clarify abigen alias flag usage (#21875)
* doc: clarify abigen alias flag usage

update the `abigen --alias` flag help info, give an example to make it more clear

related issue: https://github.com/ethereum/go-ethereum/issues/21846

* Update cmd/abigen/main.go

Co-authored-by: ligi <ligi@ligi.de>

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: ligi <ligi@ligi.de>
2025-01-24 16:18:30 +08:00
Daniel Liu
54e0d6c093 abi/bind: fix error-handling in generated wrappers for functions returning structs (#22005)
Fixes the template used when generating code, which in some scenarios would lead to panic instead of returning an error.
2025-01-24 16:18:30 +08:00
Daniel Liu
fb85aca8d8 accounts/abi/bind: allow specifying signer on transactOpts (#21356) 2025-01-24 16:18:30 +08:00
Daniel Liu
2ff9f336ed core: improve contextual information on core errors (#21869) 2025-01-24 16:18:30 +08:00
Daniel Liu
05e9dc0def accounts/keystore: add missing function doc for SignText (#21914)
Co-authored-by: Pascal Dierich <pascal@pascaldierich.com>
2025-01-24 16:18:30 +08:00
Daniel Liu
ddea01dc9c accounts: fix Ledger Live account derivation path (clef) (#21757)
* signer/core/api: fix derivation of ledger live accounts

For ledger hardware wallets, change account iteration as follows:

- ledger legacy: m/44'/60'/0'/X; for 0<=X<5
- ledger live: m/44'/60'/0'/0/X; for 0<=X<5

- ledger legacy: m/44'/60'/0'/X; for 0<=X<10
- ledger live: m/44'/60'/X'/0/0; for 0<=X<10

Non-ledger derivation is unchanged and remains as:
- non-ledger: m/44'/60'/0'/0/X; for 0<=X<10

* signer/core/api: derive ten default paths for all hardware wallets, plus ten legacy and ten live paths for ledger wallets

* signer/core/api: as .../0'/0/0 already included by default paths, do not include it again with ledger live paths

* accounts, signer: implement path iterators for hd wallets

Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-01-24 16:18:30 +08:00
Daniel Liu
25284155d8 accounts: remove redundant conversions and import names (#21903) 2025-01-24 16:18:30 +08:00
Daniel Liu
7f2ae32933 accounts/abi: template: set events Raw field in Parse methods (#21807) 2025-01-24 16:18:30 +08:00
Daniel Liu
c7efbcd9fd accounts/abi/bind: restore error functionality (#21743) 2025-01-24 16:18:30 +08:00
Daniel Liu
3946405983 accounts/usbwallet: fix ledger version check (#21733)
The version check logic did not take into account the second digit (i.e. the '4' in v1.4.0) - this one line patch corrects this.
2025-01-24 16:18:30 +08:00
Daniel Liu
d02ba1db81 accounts/keystore: fix flaky test (#21703)
* accounts/keystore: add timeout to test to prevent failure on travis

The TestWalletNotifications test sporadically fails on travis.
This is because we shutdown the event collection before all events are received.
Adding a small timeout (10 milliseconds) allows the collector to be scheduled
and to consume all pending events before we shut it down.

* accounts/keystore: added newlines back in

* accounts/keystore: properly fix the walletNotifications test
2025-01-24 16:18:30 +08:00
Daniel Liu
d8c9ad3c9f all: replace RWMutex with Mutex in places where RLock is not used (#21622) 2025-01-24 16:18:30 +08:00