Commit graph

716 commits

Author SHA1 Message Date
Daniel Liu
338d1b4632
feat(eth,miner): wire miner gas tip updates from RPC #28933 (#2136)
Synchronize miner gas tip updates across subsystems when RPC updates gas price.

- update eth miner API to apply gas tip changes to both txpool and miner
- add miner/worker SetGasTip path and initialize worker tip from config
- adjust bind util test to use params.GWei over base fee

Ref: #28933
2026-03-11 07:26:47 +05:30
Daniel Liu
3fad5e1ab4
refactor(ethclient): implement new sim backend #28202 (#2062)
Introduce a new simulated backend implementation under ethclient/simulated and migrate bind-facing wrappers/tests to use it.

Key changes:

- Add the new backend entry points and behavior in ethclient/simulated, including chain control helpers used by tests (commit/rollback/fork/time adjustment).

- Update legacy bind wrappers in accounts/abi/bind/backends to delegate to the new simulated backend while preserving old APIs.

- Align bind v2/backend and utility tests to the new simulated backend client surface and transaction flow.

- Refresh abigen/bind tests and shared interfaces impacted by the backend migration.

Compatibility notes:

- Keep backward-compatible wrapper constructors for existing contract test code.

- Preserve legacy transaction paths in tests while supporting EIP-1559-aware flows where applicable.

Validation:

- Verified affected packages compile and pass tests.

- Verified repository-wide go test ./... passes after follow-up compatibility fixes.
2026-03-06 11:09:10 +05:30
Daniel Liu
ad0eea0f07
refactor(crypto): vendor in golang.org/x/crypto/sha3 #33323 (#2046)
The upstream libray has removed the assembly-based implementation of
keccak. We need to maintain our own library to avoid a peformance
regression.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
2026-02-28 17:23:57 +04:00
Daniel Liu
2a96ecf87e
feat(accounts): add support for Ledger Nano Gen5 #33297 (#2042)
adds support for the 0x0008 / 0x8000 product ID (Ledger Apex | Nano
Gen5).

Co-authored-by: mmsqe <tqd0800210105@gmail.com>
2026-02-28 17:00:13 +04:00
Daniel Liu
cfca45a7eb
refactor(all): rework EVM constructor #30745 (#2065) 2026-02-17 14:35:18 +05:30
Daniel Liu
85f2bebfd1
refactor(all): move genesis initialization to blockchain #25523 (#2018) 2026-02-10 16:56:34 +05:30
Daniel Liu
798b0cdf2f
fix(accounts): not use magic numbers for rpc.BlockNumber (#2016) 2026-02-05 11:53:11 +05:30
Daniel Liu
7ce60a2a79
rpc: add a rpc.rangelimit flag #33163 (#1957) 2026-01-29 11:50:58 +05:30
Daniel Liu
7fd5927081
accounts/scwallet: fix panic in decryptAPDU #33606 (#1982)
Validate ciphertext length in decryptAPDU, preventing runtime panics on
invalid input.

Co-authored-by: DeFi Junkie <deffie.jnkiee@gmail.com>
2026-01-29 11:25:27 +05:30
Daniel Liu
b6ae09a36c
accounts/abi/bind/v2: replace rng in test #33612 (#1964) 2026-01-27 08:47:13 +05:30
Daniel Liu
b4cbf663a7
accounts/keystore: fix panic in decryptPreSaleKey #33602 (#1951)
Validate ciphertext length in decryptPreSaleKey, preventing runtime
panics on invalid input.

Co-authored-by: DeFi Junkie <deffie.jnkiee@gmail.com>
2026-01-19 12:15:03 +05:30
Daniel Liu
0d76b69517
accounts/abi: check presence of payable fallback or receive before proceeding with transfer #32374 (#1950)
remove todo

Co-authored-by: cui <cuiweixie@gmail.com>
2026-01-19 12:14:44 +05:30
Daniel Liu
f5d921bad2
accounts/abi/bind: fix data race in TestWaitDeployedCornerCases #32740 #33041 (#1949) 2026-01-19 12:13:50 +05:30
Daniel Liu
999ded17da
all: change chain head markers from block to header #26777 (#1846) 2025-12-16 07:36:51 +04:00
Daniel Liu
ebbbdf2bff
core/state: move state log mechanism to a separate layer #30569 #30732 (#1775) 2025-12-16 07:33:19 +04:00
Daniel Liu
94d0fceffe
all: use FinalizedBlockNumber instead of CommittedBlockNumber (#1847) 2025-12-11 16:19:51 +05:30
wit liu
62272ed4e6
accounts/usbwallet: fix double hashing in SignTextWithPassphrase #33138 (#1852) 2025-12-09 11:27:13 +05:30
wit liu
ea3a55aef4
all: fix invalid directive syntax for golangci-lint nolint (#1799) 2025-12-08 13:02:54 +05:30
Daniel Liu
eaaeea0cad
all: use slices.Sort() to sort strings (#1712) 2025-12-07 15:49:13 +05:30
Daniel Liu
ec08863ba0
all: use WaigGroup.Go() to simplify code (#1699) 2025-11-29 17:17:08 +05:30
wit liu
ea179d287c
accounts/keystore: clear decrypted key after use#33090 (#1790) 2025-11-24 10:55:09 +05:30
Daniel Liu
0050bef807
all: rework trc21 (#1777) 2025-11-18 11:24:56 +05:30
Daniel Liu
eef5242fa3
all: pre-allocate memory for slices and maps, close XFN-148 (#1714) 2025-11-14 20:13:36 +05:30
wit liu
0fe8742241
accounts/usbwallet: fix version check in SignTypedMessage #33113 (#1767) 2025-11-14 20:06:46 +05:30
Daniel Liu
3af629078a
internal/ethapi: eth_simulateV1 #27720 (#1606) 2025-11-08 16:09:18 +05:30
Daniel Liu
956767a41e
consensus/XDPoS: remove unused parameters in BlockConsensusVersion, close XFN-02 (#1613) 2025-10-08 13:19:45 +08:00
wit liu
7c5d2a45da
accounts/keystore: use ticker to avoid timer allocations #32732 (#1592) 2025-10-08 12:50:48 +08:00
Daniel Liu
6e8d261e42
all: eliminate zero owner variables (#1587) 2025-10-08 12:38:32 +08:00
wit liu
09b6622165
accounts/keystore: use runtime.AddCleanup #32610 (#1580)
Co-authored-by: cui <cuiweixie@gmail.com>
2025-10-08 12:29:03 +08:00
wit liu
077c4e6a45
accounts/usbwallet/trezor: fix gengerate files (#1577) 2025-10-08 12:27:34 +08:00
wit liu
d9ae317a38
all: format golang files (#1548)
Co-authored-by: wit <wit765765346@gmail>
2025-09-21 19:41:54 +08:00
Daniel Liu
7c69d03a88
accounts/abi/bind/v2: add Address method to BoundContract #32559 (#1518)
Co-authored-by: Mobin Mohanan <47410557+tr1sm0s1n@users.noreply.github.com>
2025-09-21 18:55:42 +08:00
Daniel Liu
b3ae8beb91
accounts/abi: generate TryPack* methods for abigen v2 bindings #31692 (#1424)
1. Fix the error return format.
**todo**: ~~`bindtype` needs more complex logic to fix it.~~
`
if err != nil {
  return nil, err
}
if err == nil {
  return obj, nil
}
`
2. ~~Return pointer type object to avoid copying the whole struct
content.~~
3. Give the panic decision to the user.
4. Fix empty line at the end of function.

**TODO**: ~~fix some related test cases.~~

---------

Co-authored-by: maskpp <maskpp266@gmail.com>
Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com>
2025-09-17 08:24:03 +08:00
Daniel Liu
23acecf6d8
account/abi/bind/v2: fix TestDeploymentWithOverrides #32212 (#1426)
The root cause of the flaky test was a nonce conflict caused by async
contract deployments.

This solution defines a custom deployer with automatic nonce management.

Co-authored-by: steven <wangpeculiar@gmail.com>
2025-09-13 09:50:19 +08:00
Daniel Liu
dd198e0371
accounts/abi/abigen: remove unnecessary test files #31804 (#1421) 2025-09-13 09:44:10 +08:00
Daniel Liu
d87774c6a3
accounts/abi/abigen: safe chain view update #31590 (#1420) 2025-09-13 09:41:35 +08:00
Daniel Liu
ad9003c41e
eth/tracers: live chain tracing with hooks #29189 (#1352)
Here we add a Go API for running tracing plugins within the main block import process.

As an advanced user of geth, you can now create a Go file in eth/tracers/live/, and within
that file register your custom tracer implementation. Then recompile geth and select your tracer
on the command line. Hooks defined in the tracer will run whenever a block is processed.

The hook system is defined in package core/tracing. It uses a struct with callbacks, instead of
requiring an interface, for several reasons:

- We plan to keep this API stable long-term. The core/tracing hook API does not depend on
  on deep geth internals.
- There are a lot of hooks, and tracers will only need some of them. Using a struct allows you
   to implement only the hooks you want to actually use.

All existing tracers in eth/tracers/native have been rewritten to use the new hook system.

This change breaks compatibility with the vm.EVMLogger interface that we used to have.
If you are a user of vm.EVMLogger, please migrate to core/tracing, and sorry for breaking
your stuff. But we just couldn't have both the old and new tracing APIs coexist in the EVM.

---------

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
Co-authored-by: Matthieu Vachon <matthieu.o.vachon@gmail.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Martin HS <martin@swende.se>
2025-09-09 17:30:56 +08:00
Daniel Liu
be61f66cb2
core/types: remove message #25977 (#1322) 2025-09-09 11:23:47 +08:00
Daniel Liu
343cd1021a
accounts/abi: precompile regex #32301 (#1427)
Co-authored-by: cui <cuiweixie@gmail.com>
2025-09-08 15:36:33 +08:00
Daniel Liu
4fd1e0b04d
accounts/abi/abigen: fix a flaky bind test case NewSingleStructArgument #31501 (#1418)
Co-authored-by: Delweng <delweng@gmail.com>
2025-09-08 15:34:39 +08:00
Daniel Liu
8e8a04d9ce
accounts/abi: include access-list in gas estimation #31394 (#1417)
Simple bugfix to include the access-list in the gas-estimation step of
the ABI bindings code.

Co-authored-by: protolambda <proto@protolambda.com>
2025-09-08 15:33:31 +08:00
Daniel Liu
a85b4ee518
accounts/abi: fix panic when check event with log has empty or nil topics #32503 (#1431)
When the log has empty or nil topics, the generated bindings code will
panic when accessing `log.Topics[0]`, add a check to avoid it.

Co-authored-by: nthumann <nthumanna@gmail.com>
2025-09-06 17:04:33 +08:00
Daniel Liu
b0996a2829
accounts/usbwallet: correct version comparison logic #32417 (#1430)
This PR fixes a bug in the Ledger hardware wallet version validation
logic for EIP-155 transaction signing. The original condition
incorrectly allowed older versions that don't support EIP-155 such as
0.9.9 and 0.1.5 to proceed.

Co-authored-by: Rizky Ikwan <rizzikwann@gmail.com>
2025-09-06 17:03:55 +08:00
Daniel Liu
8c4863a567
accounts/scwallet: fixes nil pointer dereference in scwallet #32186 (#1429)
Fixes #32181

Signed-off-by: kapil <kapilsareen584@gmail.com>
Co-authored-by: Kapil Sareen <kapilsareen584@gmail.com>
2025-09-06 17:03:04 +08:00
Daniel Liu
9b189e1ea3
accounts/abi, accounts/keystore: use reflect.TypeFor #32323 (#1428)
Co-authored-by: cui <cuiweixie@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-06 17:01:22 +08:00
Daniel Liu
61fcd420b3
accounts/keystore: update links to documenation #32194 (#1425) 2025-09-03 15:50:18 +08:00
Daniel Liu
aec5f28dab
accounts: fix data race when closing manager #31982 (#1423)
Fixes a data race on the `wallets` slice when closing account Manager.

At the moment, there is a data race between a go-routine calling the
Manager's `Close` function and the background go-routine handling most
operations on the `Manager`. The `Manager`'s `wallets` field is accessed
without proper synchronization.

By moving the closing of wallets from the `Close()` function into the
background thread, this issue can be resolved.

Co-authored-by: Herbert <herbert.jordan.jun@gmail.com>
2025-09-03 15:49:24 +08:00
Daniel Liu
b6f28effa9
accounts/abi: error when packing negative values in unsigned types #31790 (#1422)
This is an alternative approach to
https://github.com/ethereum/go-ethereum/pull/31607 , that doesn't break
backwards-compatibility with abigen.

Note that this does change the behavior of `Argument.Pack`: previously,
packing negative values for a `uint` parameter would cause them to be
represented in signed binary representation via two's complement. Now,
it will fail explicitly in this case.

However, I don't see a reason to support this functionality. The ABI
already explicitly supports signed integers. There's no reason that a
smart contract author would choose to store signed values in a `uint`
afaict.

---------

Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
2025-09-03 15:48:44 +08:00
Daniel Liu
4e3bd78545
accounts/usbwallet: full 32bit chainId support for Trezor #17439 (#1419)
This fix allows Trezor to support full 32bit chainId in geth, with the
next version of firmware.

For `chainId > 2147483630` case, Trezor returns signature bit only.
- Trezor returns only signature parity for `chainId > 2147483630` case.
- for `chainId == 2147483630` case, Trezor returns `MAX_UINT32` or `0`,
but it doesn't matter.
  (`2147483630 * 2 + 35` = `4294967295`(`MAX_UINT32`))

chainId | returned signature_v | compatible issue
---------|------------------------|--------------------
0 < chainId <= 255 | chainId * 2 + 35 + v | no issue (firmware `1.6.2`
for Trezor one)
255 < chainId <= 2147483630 | chainId * 2 + 35 + v | ***fixed.***
*firmware `1.6.3`*
chainId > 2147483630 | v | *firmware `1.6.3`*

Please see also: full 32bit chainId support for Trezor
- Trezor one: https://github.com/trezor/trezor-mcu/pull/399 ***merged***
- Trezor model T: https://github.com/trezor/trezor-core/pull/311
***merged***

---------

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: HackyMiner <hackyminer@gmail.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
2025-09-03 15:48:01 +08:00
Daniel Liu
05a9e91898
cmd/abigen, accounts/abi/bind: implement abigen version 2 #31379 (#1416)
This PR implements a new version of the abigen utility (v2) which exists
along with the pre-existing v1 version.

Abigen is a utility command provided by go-ethereum that, given a
solidity contract ABI definition, will generate Go code to transact/call
the contract methods, converting the method parameters/results and
structures defined in the contract into corresponding Go types. This is
useful for preventing the need to write custom boilerplate code for
contract interactions.

Methods in the generated bindings perform encoding between Go types and
Solidity ABI-encoded packed bytecode, as well as some action (e.g.
`eth_call` or creating and submitting a transaction). This limits the
flexibility of how the generated bindings can be used, and prevents
easily adding new functionality, as it will make the generated bindings
larger for each feature added.

Abigen v2 was conceived of by the observation that the only
functionality that generated Go bindings ought to perform is conversion
between Go types and ABI-encoded packed data. Go-ethereum already
provides various APIs which in conjunction with conversion methods
generated in v2 bindings can cover all functionality currently provided
by v1, and facilitate all other previously-desired use-cases.

To generate contract bindings using abigen v2, invoke the `abigen`
command with the `--v2` flag. The functionality of all other flags is
preserved between the v2 and v1 versions.

The execution of `abigen --v2` generates Go code containing methods
which convert between Go types and corresponding ABI-encoded data
expected by the contract. For each input-accepting contract method and
the constructor, a "packing" method is generated in the binding which
converts from Go types to the corresponding packed solidity expected by
the contract. If a method returns output, an "unpacking" method is
generated to convert this output from ABI-encoded data to the
corresponding Go types.

For contracts which emit events, an unpacking method is defined for each
event to unpack the corresponding raw log to the Go type that it
represents.

Likewise, where custom errors are defined by contracts, an unpack method
is generated to unpack raw error data into a Go type.

For a smooth user-experience, abigen v2 comes with a number of utility
functions to be used in conjunction with the generated bindings for
performing common contract interaction use-cases. These include:

* filtering for historical logs of a given topic
* watching the chain for emission of logs with a given topic
* contract deployment methods
* Call/Transact methods

https://geth.ethereum.org will be updated to include a new tutorial page
for abigen v2 with full code examples. The page currently exists in a
PR: https://github.com/ethereum/go-ethereum/pull/31390 .

There are also extensive examples of interactions with contract bindings
in [test
cases](cc855c7ede/accounts/abi/bind/v2/lib_test.go)
provided with this PR.

---------

Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-03 15:47:12 +08:00