Commit graph

432 commits

Author SHA1 Message Date
wit liu
79460e4bfb
all: fix whitespace error of golangci-lint, remove extra empty lines (#1624) 2025-10-19 14:42:12 +08:00
wanwiset25
fe275a9459 update package version:
github.com/btcsuite/btcd
2025-10-07 15:28:17 +04:00
Daniel Liu
241a5b3fb2
all: using testing.B.Loop (#1554)
* p2p: using testing.B.Loop

* core/state: using testing.B.Loop

* eth: using testing.B.Loop

* log: using testing.B.Loop

* core: using testing.B.Loop

* core/vm: using testing.B.Loop

* core/types: using testing.B.Loop

* crypto: using testing.B.Loop
2025-09-24 07:59:48 +08:00
wit liu
d20f91057a
all: fix whitespace (#1572) 2025-09-24 07:58:40 +08:00
Daniel Liu
aafcae3b28
core/vm: refactor push-functions to use min builtin #29515 (#1571)
* optimize-push

* revert push1 change

* Update instructions.go

* core/vm: go format

* core/vm: fix nit

---------

Co-authored-by: Devon Bear <itsdevbear@berachain.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2025-09-24 07:58:03 +08:00
Daniel Liu
8d16201f0f
core/vm: reject contract creation if the storage is non-empty #28912 (#1569)
This change implements EIP-7610, which rejects the contract deployment if the destination has non-empty storage.

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-24 07:57:02 +08:00
Daniel Liu
36fb646cb1
core/vm: fix mismatched names in comments (#1567) 2025-09-24 07:56:11 +08:00
wit liu
ff1867cc45
all: fix govet (#1562) 2025-09-24 07:52:07 +08:00
wit liu
7d5a03a46e
all: fix unnecessary conversion (#1527)
Co-authored-by: wit <wit765765346@gmail>
2025-09-21 19:45:42 +08:00
wit liu
1a2c8ee180
all: fix govet (#1517)
Co-authored-by: wit <wit765765346@gmail>
2025-09-21 18:55:13 +08:00
Daniel Liu
af69d382ff
eth/tracers: various fixes #30540 (#1491)
Breaking changes:

- The ChainConfig was exposed to tracers via VMContext passed in
`OnTxStart`. This is unnecessary specially looking through the lens of
live tracers as chain config remains the same throughout the lifetime of
the program. It was there so that native API-invoked tracers could
access it. So instead we moved it to the constructor of API tracers.

Non-breaking:

- Change the default config of the tracers to be `{}` instead of nil.
This way an extra nil check can be avoided.

Refactoring:

- Rename `supply` struct to `supplyTracer`.
- Un-export some hook definitions.

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
2025-09-17 09:04:38 +08:00
wit liu
e9da4ca95b
all: fix ineffassign (#1516)
Co-authored-by: wit <wit765765346@gmail>
2025-09-17 08:49:28 +08:00
Daniel Liu
47abf2eb16
core/vm: better error-info for vm errors #29354 (#1464)
Co-authored-by: Martin HS <martin@swende.se>
2025-09-13 10:20:34 +08:00
wit765
12eab8e785
all: rename ChainId to ChainID #16853 (#1456)
Co-authored-by: wit <wit765765346@gmail>
2025-09-09 22:54:34 +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
96a7ed54c6
core/vm: set tracer-observable value of a delegatecall to match parent value #26632 (#1317)
This is a breaking change in the tracing hooks API as well as semantics of the callTracer:

- CaptureEnter hook provided a nil value argument in case of DELEGATECALL. However to stay consistent with how delegate calls behave in EVM this hook is changed to pass in the value of the parent call.
- callTracer will return parent call's value for DELEGATECALL frames.

---------

Co-authored-by: Chris Ziogas <ziogaschr@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-09-09 10:41:48 +08:00
Daniel Liu
7d4d81f586
eth/tracers, core/vm: remove time from trace output and tracing interface #26291 (#1311)
This removes the 'time' field from logs, as well as from the tracer interface. This change makes the trace output deterministic.  If a tracer needs the time they can measure it themselves. No need for evm to do this.

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-09-09 09:26:10 +08:00
Daniel Liu
0bc25c35b4
core,eth: implement tx-level hooks for tracers #24510 (#1277)
* core,eth: add empty tx logger hooks

* core,eth: add initial and remaining gas to tx hooks

* store tx gasLimit in js tracer

* use gasLimit to compute intrinsic cost for js tracer

* re-use rules in transitiondb

* rm logs

* rm logs

* Mv some fields from Start to TxStart

* simplify sender lookup in prestate tracer

* mv env to TxStart

* Revert "mv env to TxStart"

This reverts commit 656939634b9aff19f55a1cd167345faf8b1ec310.

* Revert "simplify sender lookup in prestate tracer"

This reverts commit ab65bce48007cab99e68232e7aac2fe008338d50.

* Revert "Mv some fields from Start to TxStart"

This reverts commit aa50d3d9b2559addc80df966111ef5fb5d0c1b6b.

* fix intrinsic gas for prestate tracer

* add comments

* refactor

* fix test case

* simplify consumedGas calc in prestate tracer

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2025-09-08 17:53:21 +08:00
Daniel Liu
e2edc41b50
all: mv loggers to eth/tracers #23892 (#1269) 2025-09-03 15:35:28 +08:00
Daniel Liu
031ea75eca
eth/tracers: package restructuring #23857 (#1266) 2025-08-29 05:26:36 +08:00
Daniel Liu
0be5580b98
all: use big.Sign to compare with zero #29490 (#1387) 2025-08-28 18:56:39 +08:00
Daniel Liu
9c6816eab6
core/vm: make time field use uint64 #26474 (#1319) 2025-08-20 15:22:06 +08:00
Daniel Liu
9cad0a0cc0
all: create global hasher pool #31769 (#1233)
This PR creates a global hasher pool that can be used by all packages.
It also removes a bunch of the package local pools.

It also updates a few locations to use available hashers or the global
hashing pool to reduce allocations all over the codebase.
This change should reduce global allocation count by ~1%

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-08-20 15:11:09 +08:00
Daniel Liu
34020969ff
all: simplify timestamps to uint64 #19372 (#1318) 2025-08-08 10:33:37 +08:00
Daniel Liu
3620d9930d
core/vm: use clear from go v1.21 #29307 (#1246) 2025-08-04 11:54:49 +08:00
Daniel Liu
1d9fd6bdd2
core: show db error-info in case of mismatched hash root #26870 (#1220)
When a database failure occurs, bubble it up a into statedb, and report it in suitable places, such as during a 'bad block' report.

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-08-04 11:51:47 +08:00
Daniel Liu
52f5766059
core: pre-allocate in Copy() #25279 (#1213) 2025-07-28 16:57:51 +08:00
Daniel Liu
7bb2c7793b
core/vm: delete unused error #29062 (#1245) 2025-07-26 17:45:31 +08:00
Daniel Liu
6f6e08f83b
core/vm: prevent overflow #29023 (#1244) 2025-07-26 17:44:45 +08:00
Daniel Liu
42d3549e2c
core: using math.MaxUint64 instead of 0xffffffffffffffff #29022 #29024 (#1243) 2025-07-26 17:43:36 +08:00
Daniel Liu
5561c27308
core: fix typos (#1237)
fixes various typos in core

Co-authored-by: 0xbstn <bastien-bouge@hotmail.fr>
2025-07-26 17:42:50 +08:00
Daniel Liu
32b929e781
core/vm/runtime: add Random field to config #28001 (#1234) 2025-07-26 17:41:56 +08:00
Daniel Liu
8f76709a10
core/vm, go.mod: update uint256 to v1.3.2 and use faster method #30868 (#1241) 2025-07-17 17:56:53 +08:00
Daniel Liu
4b4980d949
core/vm: set basefee to 0 internally on eth_call #28470 (#1238) 2025-07-17 17:54:23 +08:00
Daniel Liu
dc01dba464
core/vm: minor code formatting #28199 (#1235)
Adding a space beween function opOrigin() and opcCaller() in instruciton.go.
Adding a space beween function opkeccak256()  and opAddress() in instruciton.go.

Co-authored-by: hzysvilla <ecjgvmhc@gmail.com>
2025-07-17 17:53:02 +08:00
Daniel Liu
4fabc43a01
core/vm: fix invalid merkle root caused by PR #627 (#1033) 2025-05-14 16:47:53 +08:00
Daniel Liu
a997425b03
all: fix warning of DeepEqual on error #23624 (#960) 2025-04-24 18:31:47 +08:00
Daniel Liu
30195e88ee core/vm: enable cancun instruction set 2025-02-19 14:20:45 +08:00
Daniel Liu
511a372f14 core/vm: BLOBHASH opcode 0x49 (#27356) 2025-02-11 18:31:30 +08:00
Daniel Liu
af4a3b0f9f core/vm: implement BLOBBASEFEE opcode 0x4a (#28098) 2025-02-10 10:58:59 +08:00
Daniel Liu
c08d4ff4a6 core/state, core/vm: implement EIP 6780 (#27189) 2025-02-07 14:52:29 +08:00
Daniel Liu
186d49b1f3 core/vm: use types.EmptyCodeHash (#27729) 2025-02-07 13:50:48 +08:00
Daniel Liu
ebb2c3b2ea all: new empty trie with types.EmptyRootHash instead of null (#27230) 2025-02-07 13:04:45 +08:00
Daniel Liu
6d40cdf7c0 core/vm: implement EIP-5656, mcopy instruction (#26181) 2025-02-06 16:54:19 +08:00
Daniel Liu
240de84287 core/vm: define cancun + enable 1153 (tstore/tload) in cancun (#27663) 2025-02-05 18:16:17 +08:00
Daniel Liu
07fd1c64cf core/vm: order opcodes properly (#27113) 2025-02-05 18:16:17 +08:00
Daniel Liu
4bbcd988b2 params: remove EIP150Hash from chainconfig (#27087) 2025-02-05 18:16:17 +08:00
Daniel Liu
3f58066879 all: remove debug field from vm config (#27048) 2025-02-05 18:16:17 +08:00
joohhnnn
6473d18cdb core/vm: clarify comment (#27045) 2025-02-05 18:16:17 +08:00
Daniel Liu
551e3594cf core/vm: use atomic.Bool (#26951) 2025-02-05 18:16:17 +08:00