Commit Graph

386 Commits

Author SHA1 Message Date
Martin HS
f3b4bbbaf3
all: remove personal RPC namespace (#30704)
This PR is a first step towards removing account management from geth,
and contains a lot of the user-facing changes.

With this PR, the `personal` namespace disappears. **Note**: `personal`
namespace has been deprecated for quite some time (since
https://github.com/ethereum/go-ethereum/pull/26390 1 year and 8 months
ago), and users who have wanted to use it has been forced to used the
flag `--rpc.enabledeprecatedpersonal`. So I think it's fairly
non-controversial to drop it at this point.

Specifically, this means: 

- Account/wallet listing
  -`personal.getListAccounts`  
  -`personal.listAccounts`     
  -`personal.getListWallets`   
  -`personal.listWallets`      
- Lock/unlock
  -`personal.lockAccount`      
  -`personal.openWallet`       
  -`personal.unlockAccount`
- Sign ops
  -`personal.sign`             
  -`personal.sendTransaction`  
  -`personal.signTransaction`  
- Imports / inits
  -`personal.deriveAccount`    
  -`personal.importRawKey`     
  -`personal.initializeWallet` 
  -`personal.newAccount`       
  -`personal.unpair` 
- Other: 
  -`personal.ecRecover`        


The underlying keystores and account managent code is still in place,
which means that `geth --dev` still works as expected, so that e.g. the
example below still works:

```
> eth.sendTransaction({data:"0x6060", value: 1, from:eth.accounts[0]})
```	

Also, `ethkey` and `clef` are untouched. 

With the removal of `personal`, as far as I know we have no more API
methods which contain credentials, and if we want to implement
logging-capabilities of RPC ingress payload, it would be possible after
this.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-10-31 19:53:35 +01:00
Martin HS
459bb4a647
core/state: move state log mechanism to a separate layer (#30569)
This PR moves the logging/tracing-facilities out of `*state.StateDB`,
in to a wrapping struct which implements `vm.StateDB` instead.

In most places, it is a pretty straight-forward change: 
- First, hoisting the invocations from state objects up to the statedb. 
- Then making the mutation-methods simply return the previous value, so
that the external logging layer could log everything.

Some internal code uses the direct object-accessors to mutate the state,
particularly in testing and in setting up state overrides, which means
that these changes are unobservable for the hooked layer. Thus, configuring
the overrides are not necessarily part of the API we want to publish.

The trickiest part about the layering is that when the selfdestructs are
finally deleted during `Finalise`, there's the possibility that someone
sent some ether to it, which is burnt at that point, and thus needs to
be logged. The hooked layer reaches into the inner layer to figure out
these events.

In package `vm`, the conversion from `state.StateDB + hooks` into a
hooked `vm.StateDB` is performed where needed.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-10-23 08:03:36 +02:00
Péter Szilágyi
a5fe7353cf
common: drop BigMin and BigMax, they pollute our dep graph (#30645)
Way back we've added `common.math.BigMin` and `common.math.BigMax`.
These were kind of cute helpers, but unfortunate ones, because package
all over out codebase added dependencies to this package just to avoid
having to write out 3 lines of code.

Because of this, we've also started having package name clashes with the
stdlib `math`, which got solves even more badly by moving some helpers
over ***from*** the stdlib into our custom lib (e.g. MaxUint64). The
latter ones were nuked out in a previous PR and this PR nukes out BigMin
and BigMax, inlining them at all call sites.

As we're transitioning to uint256, if need be, we can add a min and max
to that.
2024-10-21 12:45:33 +03:00
Péter Szilágyi
48d05c43c9
all: get rid of custom MaxUint64 and MaxUint64 (#30636) 2024-10-20 14:41:51 +03:00
Péter Szilágyi
368e16f39d
core, eth, ethstats: simplify chain head events (#30601) 2024-10-16 10:32:58 +03:00
jwasinger
4b9c7821b9
internal/ethapi: refactor TxArgs.setCancunFeeDefaults (#30541)
calculating a reasonable tx blob fee cap (`max_blob_fee_per_gas *
total_blob_gas`) only depends on the excess blob gas of the parent
header. The parent header is assumed to be correct, so the method should
not be able to fail and return an error.
2024-10-15 10:02:02 +02:00
Felix Lange
3a5313f3f3
all: implement EIP-7002 & EIP-7251 (#30571)
This is a redo of #29052 based on newer specs. Here we implement EIPs
scheduled for the Prague fork:

- EIP-7002: Execution layer triggerable withdrawals
- EIP-7251: Increase the MAX_EFFECTIVE_BALANCE

Co-authored-by: lightclient <lightclient@protonmail.com>
2024-10-11 21:36:13 +02:00
Felix Lange
2936b41514
all: implement flat deposit requests encoding (#30425)
This implements recent changes to EIP-7685, EIP-6110, and
execution-apis.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: Shude Li <islishude@gmail.com>
2024-10-09 12:24:58 +02:00
Sina M
40fd887df6
internal/ethapi: remove td field from block (#30386)
implement https://github.com/ethereum/execution-apis/pull/570
2024-10-01 11:36:56 +02:00
Sina M
f2e13c7e33
internal/ethapi: fix gascap 0 for eth_simulateV1 (#30496)
Similar to #30474.
2024-09-24 13:14:38 +02:00
jwasinger
564b616163
internal/ethapi/api: for simulated calls, set gaspool to max value if global gascap is 0 (#30474)
In #27720, we introduced RPC global gas cap. A value of `0` means an unlimited gas cap. However, this was not the case for simulated calls. This PR fixes the behaviour.
2024-09-23 13:31:56 +02:00
Håvard Anda Estensen
4c4f21293e
internal: run tests in parallel (#30381)
Continuation of https://github.com/ethereum/go-ethereum/pull/28546
2024-09-16 08:44:47 +02:00
Sina M
8f4fac7b86
internal/ethapi: eth_multicall (#27720)
This is a successor PR to #25743. This PR is based on a new iteration of
the spec: https://github.com/ethereum/execution-apis/pull/484.

`eth_multicall` takes in a list of blocks, each optionally overriding
fields like number, timestamp, etc. of a base block. Each block can
include calls. At each block users can override the state. There are
extra features, such as:

- Include ether transfers as part of the logs
- Overriding precompile codes with evm bytecode
- Redirecting accounts to another address

## Breaking changes

This PR includes the following breaking changes:

- Block override fields of eth_call and debug_traceCall have had the
following fields renamed
  - `coinbase` -> `feeRecipient`
  - `random` -> `prevRandao`
  - `baseFee` -> `baseFeePerGas`

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-09-06 11:31:00 +02:00
Marius van der Wijden
b0b67be0a2
all: remove forkchoicer and reorgNeeded (#29179)
This PR changes how sidechains are handled. 

Before the merge, it was possible to import a chain with lower td and not set it as canonical. After the merge, we expect every chain that we get via InsertChain to be canonical. Non-canonical blocks can still be inserted
with InsertBlockWIthoutSetHead.

If during the InsertChain, the existing chain is not canonical anymore, we mark it as a sidechain and send the SideChainEvents normally.
2024-09-04 15:03:06 +02:00
lightclient
dfd33c7792
all: implement EIP-6110, execution layer triggered deposits (#29431)
This PR implements EIP-6110: Supply validator deposits on chain. It also sketches
out the base for Prague in the engine API types.
2024-09-04 14:33:51 +02:00
lightclient
f94baab238
internal/ethapi: fix state override test (#30228)
Looks like #30094 became a bit stale after #30185 was merged and now we
have a stale ref to a state override object causing CI to fail on
master.
2024-07-26 11:02:37 +08:00
caseylove
ac0f220040
eth/tracers, internal/ethapi: remove unnecessary map pointer in state override (#30094) 2024-07-25 01:01:59 +02:00
rjl493456442
766ce23032
core/state: fix SetStorage override behavior (#30185)
This pull request fixes the broken feature where the entire storage set is overridden.

Originally, the storage set override was achieved by marking the associated account
as deleted, preventing access to the storage slot on disk. However, since #29520, this
flag is also checked when accessing the account, rendering the account unreachable.

A fix has been applied in this pull request, which re-creates a new state object with all
account metadata inherited.
2024-07-23 14:54:35 +02:00
Ha DANG
67a862db9d
cmd/geth, ethdb/pebble: improve database statistic (#29948)
* cmd/geth, ethdb/pebble: polish method naming and code comment

* implement db stat for pebble

* cmd, core, ethdb, internal, trie: remove db property selector

* cmd, core, ethdb: fix function description

---------

Co-authored-by: prpeh <prpeh@proton.me>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-06-19 14:47:17 +08:00
Felix Lange
1e97148249
all: fix inconsistent receiver name and add lint rule for it (#29974)
* .golangci.yml: enable check for consistent receiver name

* beacon/light/sync: fix receiver name

* core/txpool/blobpool: fix receiver name

* core/types: fix receiver name

* internal/ethapi: use consistent receiver name 'api' for handler object

* signer/core/apitypes: fix receiver name

* signer/core: use consistent receiver name 'api' for handler object

* log: fix receiver name
2024-06-12 10:45:42 +03:00
SangIlMo
682ae838b2
internal/ethapi: recap higher args.Gas with block GasLimit in DoEstimateGas (#29738)
* internal/ethapi: recap higher args.Gas with block GasLimit in DoEstimateGas

* internal/ethapi: fix gas estimator capping code

* internal/ethapi: fix test

* fix goimports lint (remove space)

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2024-06-04 10:59:41 +03:00
Mobin Mohanan
7224576fba
core, eth/protocols/snap, internal/ethapi: remove redundant types (#29841) 2024-05-27 14:39:39 +08:00
Karl Bartel
0d4cdb3dbe
internal/ethapi: fix typos (#29784)
Fix typos in api.go
2024-05-23 10:41:51 +02:00
lightclient
2e8e35f2ad
all: refactor so NewBlock, WithBody take types.Body (#29482)
* all: refactor so NewBlock(..) and WithBody(..) take a types.Body

* core: fixup comments, remove txs != receipts panic

* core/types: add empty withdrawls to body if len == 0
2024-04-30 14:55:08 +02:00
Martin HS
5e07054589
internal/ethapi: listen to ctx cancellation in access list (#29686) 2024-04-30 14:48:54 +02:00
yujinpark
2f6ff492ae
internal/ethapi: typo (#29636) 2024-04-25 13:47:29 +08:00
Ryan Schneider
1ec7af2612
eth: Add eth_blobBaseFee RPC and blob fields to eth_feeHistory (#29140)
Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-04-22 12:17:06 +02:00
Aaron Chen
34aac1d756
all: use big.Sign to compare with zero (#29490) 2024-04-09 12:14:30 +02:00
Martin HS
7ee9a6e89f
signer: implement blob txs sendtxargs, enable blobtx-signing (#28976)
This change makes it possible to sign blob transactions
2024-04-05 19:29:44 +02:00
Matthieu Vachon
738b5a586e
Removes some leftover err check (#29339)
Before, `ToMessage` was returning both the resulting `Message` and an error while no error is returned now.

Those error checks were probably leftover from the past.
2024-03-26 12:01:13 +08:00
Martin HS
14cc967d19
all: remove dependency on golang.org/exp (#29314)
This change includes a leftovers from https://github.com/ethereum/go-ethereum/pull/29307
- using the [new `slices` package](https://go.dev/doc/go1.21#slices) and
- using the [new `cmp.Ordered`](https://go.dev/doc/go1.21#cmp) instead of exp `constraints.Ordered`
2024-03-25 07:50:18 +01:00
Sina M
064f37d6f6
eth/tracers: live chain tracing with hooks (#29189)
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: Matthieu Vachon <matthieu.o.vachon@gmail.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Martin HS <martin@swende.se>
2024-03-22 18:53:53 +01:00
Martin HS
d5bacfa4de
crypto/kz4844: pass blobs by ref (#29050)
This change makes use of the following underlying changes to the kzg-libraries in order to avoid passing large things on the stack:

- c-kzg: https://github.com/ethereum/c-kzg-4844/pull/393 and
- go-kzg: https://github.com/crate-crypto/go-kzg-4844/pull/63
2024-03-13 07:51:46 +01:00
Marius van der Wijden
d8e0807da2
miner: refactor the miner, make the pending block on demand (#28623)
* miner: untangle miner

* miner: use common.hash instead of *types.header

* cmd/geth: deprecate --mine

* eth: get rid of most miner api

* console: get rid of coinbase in welcome message

* miner/stress: get rid of the miner stress test

* eth: get rid of miner.setEtherbase

* ethstats: remove miner and hashrate flags

* ethstats: remove miner and hashrate flags

* cmd: rename pendingBlockProducer to miner.pending.feeRecipient flag

* miner: use pendingFeeRecipient instead of etherbase

* miner: add mutex to protect the pending block

* miner: add mutex to protect the pending block

* eth: get rid of etherbase mentions

* miner: no need to lock the coinbase

* eth, miner: fix linter

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2024-03-06 14:45:03 +02:00
Tom
588c5480fd
internal/ethapi: delete needless error check (#29127) 2024-03-06 13:23:35 +08:00
buddho
9986a69c25
internal/ethapi: pass in accesslist in test (#29089)
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2024-02-28 18:38:21 +01:00
maskpp
8bca93e82c
internal/ethapi: pass blob hashes to gas estimation (#29085) 2024-02-26 11:02:18 +01:00
colin
b87b9b4533
internal/ethapi:fix zero rpc gas cap in eth_createAccessList (#28846)
This PR enhances eth_createAccessList RPC call to support scenarios where the node is launched with an unlimited gas cap (--rpc.gascap 0). The eth_createAccessList RPC call returns failure if user doesn't explicitly set a gas limit.
2024-02-22 16:35:23 +01:00
ArtificialPB
e47a7c22c4
internal/ethapi: use overriden baseFee for gasPrice (#29051)
eth_call and debug_traceCall allow users to override various block fields, among them base fee. However the overriden base fee was not considered for computing the effective gas price of that message, and instead base fee of the base block was used. This has been fixed in this commit.
2024-02-22 14:39:22 +01:00
Sina Mahmoodi
b47cf8fe1d
internal/ethapi: fix defaults for blob fields (#29037)
Co-authored-by: Martin HS <martin@swende.se>
2024-02-21 12:46:32 +01:00
buddho
bba3fa9af9
core,eth,internal: fix typo (#29024) 2024-02-20 19:42:48 +08:00
Martin HS
ac0ff04460
core/vm, params: ensure order of forks, prevent overflow (#29023)
This PR fixes an overflow which can could happen if inconsistent blockchain rules were configured. Additionally, it tries to prevent such inconsistencies from occurring by making sure that merge cannot be enabled unless previous fork(s) are also enabled.
2024-02-19 16:29:59 +01:00
Sina Mahmoodi
95741b1844
core: move genesis alloc types to core/types (#29003)
We want to use these types in public user-facing APIs, so they shouldn't be in core.

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-02-16 19:05:33 +01:00
Lindlof
4c15d58007
internal/ethapi, signer/core: fix documentation-links (#28979)
fix: management api links
2024-02-13 10:14:18 +01:00
maskpp
f1c27c286e
internal/ethapi: fix gas estimation bug in eth_fillTransaction for blob tx (#28929) 2024-02-09 20:53:04 +01:00
Sina Mahmoodi
ac5aa672d3
internal/ethapi: add support for blobs in eth_fillTransaction (#28839)
This change adds support for blob-transaction in certain API-endpoints, e.g. eth_fillTransaction. A follow-up PR will add support for signing such transactions.
2024-02-08 19:53:32 +01:00
zoereco
2ab365f6d8
all: fix docstring names (#28923)
* fix wrong comment

* reviewers input

* Update log/handler_glog.go

---------

Co-authored-by: Martin HS <martin@swende.se>
2024-02-07 21:10:49 +01:00
rjl493456442
6b0de79935
core: move tx indexer to its own file (#28857)
This change moves all the transaction indexing functions to a separate txindexer.go file and defines a txIndexer structure as a refactoring.
2024-01-23 21:00:50 +01:00
Martin HS
a5a4fa7032
all: use uint256 in state (#28598)
This change makes use of uin256 to represent balance in state. It touches primarily upon statedb, stateobject and state processing, trying to avoid changes in transaction pools, core types, rpc and tracers.
2024-01-23 14:51:58 +01:00
rjl493456442
78a3c32ef4
core, core/rawdb, eth/sync: no tx indexing during snap sync (#28703)
This change simplifies the logic for indexing transactions and enhances the UX when transaction is not found by returning more information to users.

Transaction indexing is now considered as a part of the initial sync, and `eth.syncing` will thus be `true` if transaction indexing is not yet finished. API consumers can use the syncing status to determine if the node is ready to serve users.
2024-01-22 21:05:18 +01:00