Commit graph

2332 commits

Author SHA1 Message Date
Matthieu Vachon
3abff91f34 Merge branch 'feature/gas-full-cycle-and-reason' into feature/firehose-extended-tracer 2023-09-11 11:22:00 -04:00
Matthieu Vachon
06badab596 Inverted GasChangeCallLeftOverRefunded and GasChangeCallLeftOverReturned 2023-09-11 11:21:45 -04:00
Matthieu Vachon
31f1a01ec5 Merge branch 'feature/gas-full-cycle-and-reason' into feature/firehose-extended-tracer
# Conflicts:
#	core/blockchain.go
#	core/state_transition.go
#	core/vm/contracts.go
#	core/vm/evm.go
#	core/vm/instructions.go
#	core/vm/interpreter.go
#	core/vm/logger.go
#	core/vm/operations_acl.go
#	eth/backend.go
#	eth/tracers/logger/access_list_tracer.go
#	eth/tracers/logger/logger.go
#	eth/tracers/logger/logger_json.go
2023-09-11 10:27:01 -04:00
Matthieu Vachon
8f17c19c63 Fixed wrong split of trx and call 2023-09-06 17:05:02 -04:00
Matthieu Vachon
da14392fc6 Merge remote-tracking branch 's1na/extended-tracer' into feature/gas-full-cycle-and-reason 2023-09-06 11:40:01 -04:00
Sina Mahmoodi
651c438621 fix runtime tests 2023-09-04 17:55:01 +02:00
Sina Mahmoodi
f7ca31eb78 fix import cycle in blockchain test 2023-09-04 17:51:42 +02:00
Matthieu Vachon
daf3f63421 Merge remote-tracking branch 's1na/extended-tracer' into feature/gas-full-cycle-and-reason
# Conflicts:
#	eth/tracers/logger/access_list_tracer.go
#	eth/tracers/logger/logger.go
#	eth/tracers/logger/logger_json.go
2023-09-01 09:34:29 -04:00
Matthieu Vachon
aad080db33 Normalized GasChange constats, emit Refund/BuyBack only if doing something, updated comments 2023-09-01 09:32:19 -04:00
Sina Mahmoodi
abd880712b use defer for OnBlockEnd 2023-08-31 18:46:45 +02:00
Sina Mahmoodi
0be6e22eaf add comment to statedb logger 2023-08-31 16:35:43 +02:00
Matthieu Vachon
216a4b0f5a
Added writing of genesis.Alloc on bootstrap (#15) 2023-08-30 13:45:00 +02:00
Matthieu Vachon
5763314b0d Removed tracer support when doing genesis.Flush(...)
The genesis flush do set the logger, but we receive the genesis block allocs via `OnGenesisBlock` meaning it's not necessary to have the logger in the flush.
2023-08-29 16:12:59 -04:00
Matthieu Vachon
d0dbbaf6a5 Change OnGasConsumed(gas, cost uint64, reason) to OnGasChange(old, new uint64, reason)
This way, we avoid having a `cost` that is negative which does not make sense for a `uint64`. Having the `old, new` also yields correct value and the delta can then be negative and be holded in a `int64`.

# Conflicts:
#	core/vm/evm.go
2023-08-28 19:20:01 -04:00
Matthieu Vachon
47d9118557 Fixed PR review comments and behavior change 2023-08-28 15:39:51 -04:00
Matthieu Vachon
a2e2df461f Reverted changes to geth init 2023-08-28 15:39:43 -04:00
Matthieu Vachon
01ccd7126e Change OnGasConsumed(gas, cost uint64, reason) to OnGasChange(old, new uint64, reason)
This way, we avoid having a `cost` that is negative which does not make sense for a `uint64`. Having the `old, new` also yields correct value and the delta can then be negative and be holded in a `int64`.
2023-08-28 15:30:10 -04:00
Matthieu Vachon
e0af166ffa Full OnGasConsumed loop and added GasChangeReason
With this change, the full gas loop of a transaction can be tracked going from initial balance (`gasLimit`) back down to 0.

I validated on my regression test suite that those conditions applied to all transactions I have:
- First `OnGasConsumed` is always going from 0 -> `trx.gasLimit`
- Last `OnGasConsumed` "new value" is always 0
- trx.gasLimit - last balance of last `OnGasConsumed` is equal to `trx.gasUsed`

The addition of `reason` make it possible for a logger to filter out unwanted signal, for example one could want to drop all OpCode related gas change and only cares about "transaction" level. The reason is also a good thing for visibility and for creating powerful debug tools for Ethereum transaction execution.

Also, I would like that we change the `OnGasConsumed` logic from `OnGasConsumed(actual, cost uint64, reason)` to `OnGasConsumed(old, new uint64, reason)`. With the new tracing I've done, we now have negative `cost` that needs to be passed around but the `cost` is `uint64` so it creates overflow. Everything works fine if you record the new/old value `gas-cost` as the final value goes back to a valid range. But it's weird for consumer that would log `cost` that it's `18127127187219...`. An alternative would be to accept a `int64` for the cost which is also valid, not full coverage theorically but I don't see why an operation would cost more than i64 max value. Maybe it make more sense than to have signature `OnGasConsumed(gas uint64, cost int64, reason)`, I'm fine with it also, I leave the decision to you.
2023-08-28 15:30:10 -04:00
Matthieu Vachon
1f947081a2 BLockchain logger now record OnGenesisBlock on boot, geth init will also fill the missing value now 2023-08-04 12:31:15 -04:00
Matthieu Vachon
4838043913 Revert "Added writing of genesis.Alloc on bootstrap, geth init will also fill the missing value"
This reverts commit 09d66773bd.
2023-08-04 12:30:58 -04:00
Matthieu Vachon
00a19d3c57
Fixed tests compilation (#13) 2023-08-02 21:35:21 +02:00
Matthieu Vachon
09df0e0c95 Merge branch 'extended-tracer' into feature/firehose-extended-tracer
# Conflicts:
#	core/vm/evm.go
2023-08-02 09:49:36 -04:00
Matthieu Vachon
32c14945da Full OnGasConsumed loop and added GasChangeReason
With this change, the full gas loop of a transaction can be tracked going from initial balance (`gasLimit`) back down to 0.

I validated on my regression test suite that those conditions applied to all transactions I have:
- First `OnGasConsumed` is always going from 0 -> `trx.gasLimit`
- Last `OnGasConsumed` "new value" is always 0
- trx.gasLimit - last balance of last `OnGasConsumed` is equal to `trx.gasUsed`

The addition of `reason` make it possible for a logger to filter out unwanted signal, for example one could want to drop all OpCode related gas change and only cares about "transaction" level. The reason is also a good thing for visibility and for creating powerful debug tools for Ethereum transaction execution.
2023-08-02 09:16:45 -04:00
Matthieu Vachon
d723124530 Added IsPrecompileAddr on EVM to let tracer easily determine if an address is a precompiled address 2023-07-28 17:03:59 -04:00
Sina Mahmoodi
b7ff573886
minor refactor
Co-authored-by: Delweng <delweng@gmail.com>
2023-07-28 14:01:56 +02:00
Matthieu Vachon
5952799988 Fixed wrong EVM call tracing code 2023-07-27 16:32:03 -04:00
Sina Mahmoodi
f9f377d64f capture call validation errors 2023-07-27 21:57:40 +02:00
Matthieu Vachon
9af0334dff Use leftOverGas instead of gas as it's sure to respect Go rules for defer to have latest returned value 2023-07-27 15:37:09 -04:00
Matthieu Vachon
4e834c10d0 Merge remote-tracking branch 's1na/extended-tracer' into feature/firehose-extended-tracer
# Conflicts:
#	core/state/state_object.go
#	core/state/statedb_test.go
#	core/state_transition.go
#	core/txpool/legacypool/legacypool_test.go
#	core/vm/evm.go
#	core/vm/instructions.go
#	eth/api_debug_test.go
#	eth/tracers/js/tracer_test.go
#	go.sum
2023-07-27 11:47:40 -04:00
Sina Mahmoodi
09ee197723 fix merge conflict 2023-07-27 14:48:26 +02:00
Sina Mahmoodi
b2b32e6ff6 fix merge conflict 2023-07-27 14:41:47 +02:00
Péter Szilágyi
0f4b21feac
core/txpool/blobpool: fix a merge conflict from a package rename (#27790) 2023-07-27 14:53:05 +03:00
Felix Lange
393d4db18c
core/types: add 4844 data gas fields in Receipt (#27743)
* core/types: add data gas fields in Receipt

* core/types: use BlobGas method of tx

* core: fix test

* core/types: fix receipt tests, add data gas used field test

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2023-07-27 14:11:09 +03:00
Péter Szilágyi
1662228ac6
core/txpool/blobpool: 4844 blob transaction pool (#26940)
* core/blobpool: implement txpool for blob txs

* core/txpool: track address reservations to notice any weird bugs

* core/txpool/blobpool: add support for in-memory operation for tests

* core/txpool/blobpool: fix heap updating after SetGasTip if account is evicted

* core/txpool/blobpool: fix eviction order if cheap leading txs are included

* core/txpool/blobpool: add note as to why the eviction fields are not inited in reinject

* go.mod: pull in inmem billy form upstream

* core/txpool/blobpool: fix review commens

* core/txpool/blobpool: make heap and heap test deterministic

* core/txpool/blobpool: luv u linter

* core/txpool: limit blob transactions to 16 per account

* core/txpool/blobpool: fix rebase errors

* core/txpool/blobpool: luv you linter

* go.mod: revert some strange crypto package dep updates
2023-07-27 13:45:35 +03:00
Darioush Jalali
37b952a4a2
core/types: deepcopy ExcessDataGas, DataGasUsed (#27767) 2023-07-27 11:32:15 +03:00
Matthieu Vachon
09d66773bd Added writing of genesis.Alloc on bootstrap, geth init will also fill the missing value 2023-07-26 14:37:32 -04:00
Sina Mahmoodi
2faf3dbfd6 emit err on tx validation failure 2023-07-26 20:07:13 +02:00
Matthieu Vachon
5466fa3133
Capture balance reason (#12) 2023-07-26 10:49:04 +02:00
Matthieu Vachon
dd86f19df4 Move up CaptureStart/CaptureEnd as well as CaptureEnter/CaptureExit higher directly when function starts 2023-07-25 14:35:59 -04:00
Matthieu Vachon
751b984c9b Merge remote-tracking branch 's1na/extended-tracer' into feature/firehose-extended-tracer
# Conflicts:
#	core/blockchain.go
2023-07-25 10:41:22 -04:00
Matthieu Vachon
75e8c96f4e WIP 2023-07-25 10:40:30 -04:00
Sina Mahmoodi
4370527cf9 fix prefetcher double emit 2023-07-24 18:46:58 +02:00
rjl493456442
88f3d61468
all: expose block number information to statedb (#27753)
* core/state: clean up

* all: add block number infomration to statedb

* core, trie: rename blockNumber to block
2023-07-24 13:22:09 +03:00
Matthieu Vachon
939c4ec7d8 Merge remote-tracking branch 's1na/extended-tracer' into feature/firehose-extended-tracer
# Conflicts:
#	core/blockchain.go
#	eth/tracers/printer.go
2023-07-20 14:35:52 -04:00
Matthieu Vachon
e93892267f Continued our work on new Firehose tracer 2023-07-19 09:34:40 -04:00
jwasinger
988d84aa7c
core/state, core/vm: implement EIP 6780 (#27189)
EIP-6780: SELFDESTRUCT only in same transaction

>     SELFDESTRUCT will recover all funds to the caller but not delete the account, except when called in the same transaction as creation

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-07-17 13:02:18 -04:00
Martin Holst Swende
b058cf454b
core, tests: EIP-4844 transaction processing logic (#27721)
This updates the reference tests to the latest version and also adds logic
to process EIP-4844 blob transactions into the state transition. We are now
passing most Cancun fork tests.

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-07-15 23:27:36 +02:00
ucwong
99e000cb13
core/vm: use types.EmptyCodeHash (#27729) 2023-07-15 17:45:57 +02:00
jwasinger
d233b6b23a
core: replace instances of 'suicide' with 'selfdestruct' to improve code consistency. (#27716)
---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
2023-07-15 10:35:30 -04:00
ucwong
c40ab6af72
core/blockchain: fast to snap in comments (#27722) 2023-07-14 15:06:51 +03:00