Commit graph

12708 commits

Author SHA1 Message Date
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
Daniel Liu
5b48621c36 accouts, core: fix some comments (#21617) 2025-01-24 16:18:30 +08:00
Daniel Liu
b0063d39b9 accounts/abi: ABI explicit difference between Unpack and UnpackIntoInterface (#21091)
* accounts/abi: refactored abi.Unpack

* accounts/abi/bind: fixed error

* accounts/abi/bind: modified template

* accounts/abi/bind: added ToStruct for conversion

* accounts/abi: reenabled tests

* accounts/abi: fixed tests

* accounts/abi: fixed tests for packing/unpacking

* accounts/abi: fixed tests

* accounts/abi: added more logic to ToStruct

* accounts/abi/bind: fixed template

* accounts/abi/bind: fixed ToStruct conversion

* accounts/abi/: removed unused code

* accounts/abi: updated template

* accounts/abi: refactored unused code

* contracts/checkpointoracle: updated contracts to sol ^0.6.0

* accounts/abi: refactored reflection logic

* accounts/abi: less code duplication in Unpack*

* accounts/abi: fixed rebasing bug

* fix a few typos in comments

* rebase on master

Co-authored-by: Guillaume Ballet <gballet@gmail.com>
2025-01-24 16:18:30 +08:00
Daniel Liu
22df50c77a accounts/abi: improve documentation and names (#21540)
* accounts: abi/bid/backends; cleaned doc errors, camelCase refactors and anonymous variable assignments

* acounts/abi/bind: doc errors, anonymous parameter assignments

* accounts/abi: doc edits, camelCase refactors

* accounts/abi/bind: review fix

* reverted name changes

* name revert

Co-authored-by: Osoro Bironga <osoro@doctaroo.com>
2025-01-24 16:18:29 +08:00
Daniel Liu
7c3c703559 tests/fuzzers/abi: add fuzzer for fuzzing package accounts/abi (#21217)
* tests/fuzzers/abi: added abi fuzzer

* accounts/abi: fixed issues found by fuzzing

* tests/fuzzers/abi: update fuzzers, added repro test

* tests/fuzzers/abi: renamed abi_fuzzer to abifuzzer

* tests/fuzzers/abi: updated abi fuzzer

* tests/fuzzers/abi: updated abi fuzzer

* accounts/abi: minor style fix

* go.mod: added go-fuzz dependency

* tests/fuzzers/abi: updated abi fuzzer

* tests/fuzzers/abi: make linter happy

* tests/fuzzers/abi: make linter happy

* tests/fuzzers/abi: comment out false positives
2025-01-24 16:18:29 +08:00
Daniel Liu
321bcff620 accounts/usbwallet, signer/core: show accounts from ledger legacy derivation paths (#21517)
* accounts/usbwallet, signer/core: un-hide accounts from ledger legacy derivation paths

* Update accounts/usbwallet/wallet.go

* Update signer/core/api.go

* Update signer/core/api.go
2025-01-24 16:18:29 +08:00
Daniel Liu
c9643e9c90 accounts/abi/bind/backends: clean doc errors (#21514) 2025-01-24 16:18:29 +08:00
Daniel Liu
f4feaebb40 accounts/abi: fix a bug in getTypeSize method (#21501)
* accounts/abi: fix a bug in getTypeSize method

e.g. for "Tuple[2]" type, the element of the array is a tuple type and the size of the tuple may not be 32.

* accounts/abi: add unit test of getTypeSize method
2025-01-24 16:18:29 +08:00
Daniel Liu
089242bb39 accounts/abi/bind/backends: Disallow AdjustTime for non-empty blocks (#21334) 2025-01-24 16:18:29 +08:00
Daniel Liu
25d42fef2c accounts/abi: make GetType public again (#21157) 2025-01-24 16:18:29 +08:00