Commit graph

530 commits

Author SHA1 Message Date
Danno Ferrin
9edd35cefe Apply new container mode validations
Apply new rules
prohibiting STOP/RETURN in initcode and RETURNCONTRACT in runtime mode.
For fuzzing, consider all input data to be runtime code.
2024-09-08 12:38:50 +02:00
Danno Ferrin
28db438a8e CALLF Stack validation height
CALLF should use the target function data when checking stack overflow.
2024-09-08 12:38:50 +02:00
Danno Ferrin
71528b30a4 Remove TXCREATE
TXCREATE was removed from mega-eof
and now causes validation tests to fail.
Remove it from go-ethereum.
2024-09-08 12:38:50 +02:00
Marius van der Wijden
a484bfacf0 core/vm: updated to v1.0.6, fix bugs 2024-09-08 12:38:50 +02:00
Danno Ferrin
e61f11a7a3 Fix EXTCALL Order
For EXTCALL, value trails offset and length.
2024-09-08 12:38:50 +02:00
Marius van der Wijden
1a9855486f core/vm: fix create, reject EOF deployment from legacy contracts 2024-09-08 12:38:50 +02:00
Marius van der Wijden
3f038776b6 core/vm: fix opCreate, reject eof contracts 2024-09-08 12:38:50 +02:00
Marius van der Wijden
f6d4997820 core/vm: fix opEOFCreate, forward calldata 2024-09-08 12:38:50 +02:00
Marius van der Wijden
e9ad878b90 core/vm: fix opEOFCreate, correct initcode stuff 2024-09-08 12:38:50 +02:00
Marius van der Wijden
abe9f28845 core/vm: fix opReturnContract, don't pay for mem copy 2024-09-08 12:38:50 +02:00
Marius van der Wijden
fbec4dca55 core/vm: fix opEOFCreate hashing charge 2024-09-08 12:38:50 +02:00
Marius van der Wijden
80da4fd2bb core/vm: fix opDataCopy 2024-09-08 12:38:49 +02:00
Marius van der Wijden
218c887878 core/vm: fix opExt{*}Call address space extension 2024-09-08 12:38:49 +02:00
Marius van der Wijden
03b75144b9 core/vm: fix opExt{*}Call return values 2024-09-08 12:38:49 +02:00
Marius van der Wijden
e0c3db0de4 core/vm: mark the correct address as touched 2024-09-08 12:38:49 +02:00
Marius van der Wijden
dc4d53b83c core/vm: turn return values around 2024-09-08 12:38:49 +02:00
Marius van der Wijden
dff080904b core/vm: added comments 2024-09-08 12:38:49 +02:00
Marius van der Wijden
6c97819d94 core/vm: fix opExtCode{Size,Hash,Copy} 2024-09-08 12:38:49 +02:00
Marius van der Wijden
b2ae97892d core/vm: check for returnStack overflow in opCallf 2024-09-08 12:38:49 +02:00
Marius van der Wijden
3d8ca3c526 core/vm: check for returnStack overflow in opCallf 2024-09-08 12:38:49 +02:00
Marius van der Wijden
e1b9f4a6f5 core/vm: only allow eof calls from opExtCall 2024-09-08 12:38:49 +02:00
Marius van der Wijden
aa8e431183 core/vm: fix opExtStaticCall 2024-09-08 12:38:49 +02:00
Marius van der Wijden
a1b359f310 core/vm: fix opReturnDataLoad 2024-09-08 12:38:49 +02:00
Marius van der Wijden
fa6b1b9fa1 core/vm: fix opRJumpV 2024-09-08 12:38:49 +02:00
Marius van der Wijden
19e296506a core/vm: fix opSwapN 2024-09-08 12:38:49 +02:00
Marius van der Wijden
b5af91a5c9 core/vm: fix opExchange 2024-09-08 12:38:49 +02:00
Marius van der Wijden
d1317f2f76 core/vm: fixed bugs, made basic blockchain tests pass 2024-09-08 12:38:48 +02:00
Marius van der Wijden
07db5b86b1 core/types: implement mega-eof spec 2024-09-08 12:37:14 +02:00
Marius van der Wijden
1dccd90224 core/vm: add optional containerSections 2024-09-08 12:37:14 +02:00
lightclient@protonmail.com
9354ef082b core/vm: add eof container 2024-09-08 12:37:12 +02:00
lightclient
183e7b702a
core: force add new delegation to accesslist 2024-09-07 09:50:54 -06:00
lightclient
75a43aed6c
add delegation designator to witness 2024-09-07 09:12:20 -06:00
lightclient
9db178c799
all: impl eip-7702
Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: Mario Vega <marioevz@gmail.com>
2024-09-06 19:25:25 +02:00
Ignacio Hagopian
ab3ee99ca9
trie, core/state: Nyota EIP-6800 & EIP-4762 spec updates (#30357)
This PR implements changes related to
[EIP-6800](https://eips.ethereum.org/EIPS/eip-6800) and
[EIP-4762](https://eips.ethereum.org/EIPS/eip-4762) spec updates.

A TL;DR of the changes is that `Version`, `Balance`, `Nonce` and
`CodeSize` are encoded in a single leaf named `BasicData`. For more
details, see the [_Header Values_ table in
EIP-6800](https://eips.ethereum.org/EIPS/eip-6800#header-values).

The motivation for this was simplifying access event patterns, reducing
code complexity, and, as a side effect, saving gas since fewer leaf
nodes must be accessed.

---------

Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-08-30 14:13:02 +02:00
lmittmann
fc88cea648
core/vm: reuse Memory instances (#30137)
This PR adds a sync.Pool to reuse instances of Memory in EVMInterpreter.
2024-08-20 14:31:06 +02:00
Arran Schlosberg
710c3f32ac
vm: simplify error handling in vm.EVM.create() (#30292)
To allow all error paths in `vm.EVM.create()` to consume the necessary
gas, there is currently a pattern of gating code on `if err == nil`
instead of returning as soon as the error occurs. The same behaviour can
be achieved by abstracting the gated code into a method that returns
immediately on error, improving readability and thus making it easier to
understand and maintain.
2024-08-16 08:41:44 -06:00
lmittmann
4a3aed380e
core/vm: use uint64 in memory for indices everywhere (#30252)
Consistently use `uint64` for indices in `Memory` and drop lots of type
conversions from `uint64` to `int64`.

---------

Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
2024-08-08 11:27:38 +03:00
lmittmann
b37ac5c102
core/vm: improved stack swap performance (#30249)
This PR adds the methods `Stack.swap1..16()` that faster than `Stack.swap(1..16)`. 

Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
2024-08-06 14:38:47 +02:00
lightclient
dbc1d04f5e
core/vm/runtime: ensure tracer benchmark calls OnTxStart (#30257)
The struct-based tracing added in #29189 seems to have caused an issue
with the benchmark `BenchmarkTracerStepVsCallFrame`. On master we see
the following panic:

```console
BenchmarkTracerStepVsCallFrame
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x40 pc=0x1019782f0]

goroutine 37 [running]:
github.com/ethereum/go-ethereum/eth/tracers/js.(*jsTracer).OnOpcode(0x140004c4000, 0x0, 0x10?, 0x989680, 0x1, {0x101ea2298, 0x1400000e258}, {0x1400000e258?, 0x14000155928?, 0x10173020c?}, ...)
        /Users/matt/dev/go-ethereum/eth/tracers/js/goja.go:328 +0x140
github.com/ethereum/go-ethereum/core/vm.(*EVMInterpreter).Run(0x14000307da0, 0x140003cc0d0, {0x0, 0x0, 0x0}, 0x0)
 ...
FAIL    github.com/ethereum/go-ethereum/core/vm/runtime 0.420s
FAIL
```

The issue seems to be that `OnOpcode` expects that `OnTxStart` has
already been called to initialize the `env` value in the tracer. The JS
tracer uses it in `OnOpcode` for the `GetRefund()` method.

This patch resolves the issue by reusing the `Call` method already
defined in `runtime_test.go` which correctly calls `OnTxStart`.
2024-08-06 19:51:48 +08:00
gitglorythegreat
06f1d077d3
all: replace division with right shift if possible (#29911) 2024-06-28 18:08:31 +02:00
jwasinger
ed8fd0ac09
all: stateless witness builder and (self-)cross validator (#29719)
* all: add stateless verifications

* all: simplify witness and integrate it into live geth

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2024-06-25 14:48:08 +03:00
jwasinger
85587d5ef2
cmd, core: prefetch reads too from tries if requested (#29807)
* cmd/utils, consensus/beacon, core/state: when configured via stub  flag: prefetch all reads from account/storage tries, terminate prefetcher synchronously.

* cmd, core/state: fix nil panic, fix error handling, prefetch nosnap too

* core/state: expand prefetcher metrics for reads and writes separately

* cmd/utils, eth: fix noop collect witness flag

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2024-06-11 11:10:07 +03:00
Martin HS
42471d7a3e
core/vm/runtime: set random to enable merge-opcodes (#29799) 2024-05-28 13:45:16 +02:00
Guillaume Ballet
44a50c9f96
cmd, core, params, trie: add verkle access witness gas charging (#29338)
Implements some of the changes required to charge and do gas accounting in verkle testnet.
2024-05-10 20:13:11 +02:00
Hteev Oli
47af69c2bc
core, beacon, ethdb: fix typos (#29748)
* core, beacon, ethdb: fix typos

* revert file that can't be changed
2024-05-10 19:48:14 +02:00
Aaron Chen
bc609e852a
core/vm: remove redundant error checks (#29692) 2024-05-02 11:18:59 +03:00
Marius van der Wijden
bd6bc37eec
core/vm: add subgroup checks for mul/mulexp for G1/G2 (#29637) 2024-04-30 14:35:48 +02:00
Aaron Chen
ea89f9adf0
core/vm: remove a redundant zero check in opAddmod (#29672) 2024-04-30 14:08:13 +02:00
Martin HS
0d4c38865e
core/state: remove account reset operation v2 (#29520)
* core/state, tests: remove account reset operation

* core/state, core/vm: implement createcontract journal event

* core/state: make createcontract not emit dirtied account, unskip tests

* core/state: add createcontract to journal fuzzing

* core/state: fix journal

* core/state: address comments

* core/state: remove useless code

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-04-24 12:59:06 +03:00
Mario Vega
94579932b1
core/vm: fix Prague contracts (#29612)
core/vm: fix prague contracts
2024-04-23 15:10:24 +02:00