Commit graph

79 commits

Author SHA1 Message Date
Daniel Liu
3211c8ef2f
perf(core): speed up push and interpreter loop #30662 (#2032) 2026-02-23 07:21:05 +05:30
Daniel Liu
f744e86dd7
feat(core): add ContractCode to the OpContext #30466 (#2030) 2026-02-07 00:15:38 +05:30
Daniel Liu
d74c23cca1
perf(core): use uint256 in state #28598 (#1977) 2026-02-05 13:59:23 +05:30
Daniel Liu
a74b7e2466
core/vm: reuse Memory instances #30137 #33056 (#1974) 2026-01-29 11:27:13 +05:30
Daniel Liu
4c098ddf1f
core/vm: fold EVMInterpreter into EVM #32352 (#1838) 2025-12-04 10:31:40 +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
Daniel Liu
36fb646cb1
core/vm: fix mismatched names in comments (#1567) 2025-09-24 07:56:11 +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
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
031ea75eca
eth/tracers: package restructuring #23857 (#1266) 2025-08-29 05:26:36 +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
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
30195e88ee core/vm: enable cancun instruction set 2025-02-19 14:20:45 +08:00
Daniel Liu
3f58066879 all: remove debug field from vm config (#27048) 2025-02-05 18:16:17 +08:00
Daniel Liu
733c298b0e core/vm: improve EVM reusability (#26341) 2024-12-09 17:47:05 +08:00
Daniel Liu
4cac1865ba all: remove noop vm config flags (#23111) 2024-11-15 20:12:49 +08:00
Daniel Liu
18bc355e89 core, internal: support various eth_call invocations post 1559 (#23027) 2024-11-01 11:36:52 +08:00
Daniel Liu
1c84a31bb6 core/vm: deepcopy jumptable when enabling extra eips (#26137) 2024-10-17 11:23:04 +08:00
Daniel Liu
480adaf960 core/vm: minor trivial clean up (#25880) 2024-10-17 11:23:04 +08:00
Daniel Liu
ee5dd8673f core/vm: remove empty lines 2024-10-17 11:23:04 +08:00
Daniel Liu
c78b9e6245 core/vm: for tracing, do not report post-op memory (#24867) 2024-10-17 11:23:04 +08:00
Daniel Liu
6fa968201f core/vm: fix some typos 2024-10-17 11:23:04 +08:00
Daniel Liu
224caa5a08 core/vm: avoid memory expansion check for trivial ops (#24048) 2024-10-17 11:23:04 +08:00
Daniel Liu
67b5b2bf9a core/vm: less allocations for various call variants (#21222) 2024-09-22 18:42:11 +08:00
wgr523
52077f18f3
support for golang tracers + add golang callTracer (#558)
* feat: rename Tracer interface to EVMLogger;
minor changes in API
refine api_tracer.go
refine Tracer interface

* fix: broken tracer tests

* feat: add BenchmarkTransactionTrace

* feat: tracer CaptureEnter CaptureExit in evm

* feat: upgrade js tracers with geth upstream

* chore: clean test

* feat: eth/tracers: support for golang tracers + add golang callTracer
cf. https://github.com/ethereum/go-ethereum/pull/23708

* chore: clean testdata json

* fix: change test due to IntrinsicGas is not upgraded

* feat: make native Tracer the default Tracer

* fix: update tracers.New in api

* fix: addr prefix in callTracer

* fix: remove `native` in BenchmarkTracers

* fix: return consensus error of InsufficientBalance for tx, instead of vmerr

* chore: drop js tracers: call and noop
2024-08-06 00:14:04 -07:00
Daniel Liu
5cb014b60f core, eth/tracer: initialize tracer statedb in CaptureStart (#22333) 2024-05-14 23:27:23 +08:00
Daniel Liu
8568af05cc all: implement EIP-2929 (gas cost increases for state access opcodes) (#21509) 2024-04-22 21:14:54 +08:00
geruiwang
968440ce3d core/vm: implement EIP-3855: PUSH0 instruction. 2024-03-07 21:44:37 +08:00
Gerui Wang
a31489541d implement EIP-4399, PREVRANDAO opcode.
and remove unused LondonBlock and BerlinBlock in `params/config.go` (already defined in constants.go)
2024-03-04 00:32:14 +08:00
Daniel Liu
928a0691ca implement EIP-3198 2024-03-01 15:04:32 +08:00
Leon
8b6db6d87a core/vm: better handle error on eip activation check (#25131)
* core/vm: correct logic for eip check of NewEVMInterpreter

* refactor
2024-03-01 14:13:24 +08:00
Martin Holst Swende
fbc1cc11ba core/vm: remove no-recursion option from config (24066) 2024-03-01 14:13:24 +08:00
Andrei Maiboroda
4c27910a77 core/vm: move interpreter interruption check to jump instructions (#24026)
* core/vm: Remove interpreter loop interruption check

* core/vm: Unit test for interpreter loop interruption

* core/vm: Check for interpreter loop abort on every jump
2024-03-01 14:13:24 +08:00
Paweł Bylica
7d3c783bb9 core/vm: fill gaps in jump table with opUndefined (#24031) 2024-03-01 14:13:24 +08:00
Alex Beregszaszi
bfbb678309 core/vm: move interpreter.ReadOnly check into the opcode implementations (#23970)
* core/vm: Move interpreter.ReadOnly check into the opcode implementations

Also remove the same check from the interpreter inner loop.

* core/vm: Remove obsolete operation.writes flag

* core/vm: Capture fault states in logger

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/vm: Remove panic added for testing

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-03-01 14:13:24 +08:00
Andrei Maiboroda
002be52ae9 core/vm: don't copy JumpTable when no EIP mods are needed (#23977) 2024-03-01 14:13:24 +08:00
Paweł Bylica
823ec33484 core/vm: simplify error handling in interpreter loop (#23952)
* core/vm: break loop on any error

* core/vm: move ErrExecutionReverted to opRevert()

* core/vm: use "stop token" to stop the loop

* core/vm: unconditionally pc++ in the loop

* core/vm: set return data in instruction impls
2024-03-01 14:13:24 +08:00
Paweł Bylica
3d3cc6c6d7 core/vm: use proper JumpTable type (#23967) 2024-03-01 14:13:23 +08:00
aaronbuchwald
7c6908b959 core/vm: fix interpreter comments (#22797)
* Fix interpreter comment

* Fix comment
2024-03-01 14:13:23 +08:00
Péter Szilágyi
06d5da016c core/vm: use pointers to operations vs. copy by value (#21336) 2024-03-01 14:13:23 +08:00
Paweł Bylica
192edc0c63 core/vm: use uint256 in EVM implementation (#20787)
* core/vm: use fixed uint256 library instead of big

* core/vm: remove intpools

* core/vm: upgrade uint256, fixes uint256.NewFromBig

* core/vm: use uint256.Int by value in Stack

* core/vm: upgrade uint256 to v1.0.0

* core/vm: don't preallocate space for 1024 stack items (only 16)

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-03-01 14:13:23 +08:00
olumuyiwadad
b5abbfed79 new EVM Upgrade
- Solidity Upgraded up to v0.8.0
-  Fixed and Added eth_chainId
- Fix error in TransactionRecipet
- Reward halving issue fixed
2021-09-21 16:53:46 +05:30
olumuyiwadad
571c41f891 FIx Bad block error. 2021-09-17 17:59:06 +05:30
Péter Szilágyi
1d3d4a4d57 core/vm: reuse Keccak-256 hashes across opcode executions (#17863) 2018-10-08 13:14:29 +02:00
Guillaume Ballet
da29332c5f core/vm: add switches to select evm+ewasm interpreters (#17687)
Interpreter initialization is left to the PRs implementing them.
Options for external interpreters are passed after a colon in the
`--vm.ewasm` and `--vm.evm` switches.
2018-09-20 10:44:35 +03:00
Paweł Bylica
ae992a5d73 core/vm: Hide read only flag from Interpreter interface (#17461)
Makes Interface interface a bit more stateless and abstract.

Obviously this change is dictated by EVMC design. The EVMC tries to keep the responsibility for EVM features totally inside the VMs, if feasible. This makes VM "stateless" because VM does not need to pass any information between executions, all information is included in parameters of the execute function.
2018-09-07 18:13:25 +02:00
Guillaume Ballet
7abedf9bbb
core/vm: support for multiple interpreters (#17093)
- Define an Interpreter interface
- One contract can call contracts from other interpreter types.
- Pass the interpreter to the operands instead of the evm.
  This is meant to prevent type assertions in operands.
2018-07-25 08:56:39 -04:00
Guillaume Ballet
4e5d1f1c39 core/vm: reuse bigint pools across transactions (#17070)
* core/vm: A pool for int pools

* core/vm: fix rebase issue

* core/vm: push leftover stack items after execution, not before
2018-07-03 13:06:42 +03:00
hydai
6134990709
core/vm: Fixed typos in core/vm/interpreter.go 2018-03-27 12:29:04 +08:00
hydai
84c5db5409 core/vm: remove JIT VM codes (#16362) 2018-03-26 13:48:04 +03:00