Commit Graph

14524 Commits

Author SHA1 Message Date
Martin Holst Swende
55c5f5964d
travis, build: update Go to 1.21.0 (#27958)
build: update to go 1.21
2023-08-22 11:00:01 +03:00
shuo
bbee0e7e50
miner: fix reply -> replay typo (#27961)
* typo: reply -> replay

* rebuild
2023-08-22 10:59:38 +03:00
Delweng
7c0d90c8c9
core: ensure txindex will be triggered at least once (#27847)
Currently, we trigger the logic to (un)index transactions when the node receives a new
block. However, in some cases the node may not receive new blocks (eg, when the Geth node
is configured without peer discovery, or when it acts as an RPC node for historical-only
data).

In these situations, the Geth node user may not have previously configured txlookuplimit
(i.e. the default of around one year), but later realizes they need to index all
historical blocks. However, adding txlookuplimit=0 and restarting geth has no effect. This
change makes it check for required indexing work once, on startup, to fix the issue.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-08-22 02:58:20 +02:00
Delweng
9f4a528793
internal/ethapi: add testcases for blobTx (#27818)
Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-08-22 02:53:29 +02:00
jwasinger
f56ee7d9c5
eth/catalyst: set finalized block hash properly in dev mode (#27886)
Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-08-21 13:33:37 -04:00
Marius van der Wijden
b3024e8fe6
eth: ignore genesis block on importChain (#27956) 2023-08-21 13:32:34 -04:00
Marius van der Wijden
5976e58415
trie: reduce allocs in recHash (#27770) 2023-08-18 22:41:19 +02:00
Marius van der Wijden
7dea9c10cd
internal/ethapi: eth API changes needed for 4844 (#27928)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-08-18 14:22:35 +02:00
Roberto Bayardo
950ccddfc8
internal/ethapi: optimize & clean up EstimateGas (#27710)
Optimizations:

- Previously, if a transaction was reverting, EstimateGas would exhibit worst-case behavior and binary search up to the max gas limit (~40 state-clone + tx executions). This change allows EstimateGas to return after only a single unconstrained execution in this scenario.
- Uses the gas used from the unconstrained execution to bias the remaining binary search towards the likely solution in a simple way that doesn't impact the worst case. For a typical contract-invoking transaction, this reduces the median number of state-clone+executions from 25 to 18 (28% reduction).

Cleanup:

- added & improved function + code comments
- correct the EstimateGas documentation to clarify the gas limit determination is at latest block, not pending, if the blockNr is unspecified.
2023-08-18 03:03:14 -04:00
Delweng
649deb69f3
eth/downloader: fix rare crash when parent header missing in db (#27945)
ReadSkeletonHeader can return nil if the header is missing, so we should
not access fields on it. Note that calling .Hash() on a nil header is fine, so there 
is no need to actually check for nil.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-08-17 23:15:29 +02:00
Martin Holst Swende
1aa5520d75
core/txpool/legacypool: protect cache with mutex (#27898)
This change fixes the a potential race by using mutexes when the m.cache is read or modified.
2023-08-17 05:22:18 -04:00
lightclient
32fde3f838
core/forkid: correctly compute forkid when timestamp fork is activated in genesis (#27895)
This changes the forkID calculation to ignore time-based forks that occurred before the
genesis block. It's supposed to be done this way because the spec says:

> If a chain is configured to start with a non-Frontier ruleset already in its genesis, that is NOT considered a fork.
2023-08-16 23:31:02 +02:00
lightclient
a3e35414b7
core/types: fix unmarshalling of BlobTx values (#27939)
FromBig returns true *when overflow occurs*
2023-08-16 23:22:15 +02:00
Delweng
386cba15b5
node: increase batch limits for auth rpc API (#27924)
This raises the JSON-RPC batch request limits significantly for the engine API endpoint.
The limits are now also hard-coded, so users won't get them wrong. I have chosen these limits:

    maximum batch items: 2000
    maximum batch response size: 250MB

While it would also be possible to disable batch limits completely for the engine API, 
I think having some limits is a good safety net against misbehaving CLs. Since this
 isn't configurable, we really want to ensure this limit will never become an issue in the
 CL/EL communication, so I set them quite high.

---------

Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-08-16 15:26:49 +02:00
Martin Holst Swende
a16d757cd4
build: remove ubuntu kinetic (deprecated) (#27933) 2023-08-16 12:11:22 +02:00
Joe Netti
e0b119884c
eth/tracers/js: use t.toBig on ctx.GasPrice for js tracing (#27903)
This change fixes a bug in js tracer, where `ctx.GasPrice.toString(16)` returns a number string in base `10`.
2023-08-15 14:19:37 -04:00
Paweł Bylica
ab28680e66
trie: add tests for "short" nodes in StackTrie (#27932) 2023-08-15 14:16:00 -04:00
lonika
05a8b887a9
crypto/bls12381: fix typo in comment (#27930) 2023-08-15 14:37:34 +02:00
Delweng
f1801a9fed
internal/ethapi: implement eth_getBlockReceipts (#27702) 2023-08-15 14:35:48 +02:00
ucwong
509cd428e9
go.mod: upgrade goja (#27899) 2023-08-14 14:59:05 +02:00
Delweng
68855216c9
cmd/utils: restore support for txlookuplimit flag (#27917)
This fixes a regression where -txlookuplimit was not applied anymore.
2023-08-14 14:58:01 +02:00
Felix Lange
2a6beb6a39
core/types: support for optional blob sidecar in BlobTx (#27841)
This PR removes the newly added txpool.Transaction wrapper type, and instead adds a way
of keeping the blob sidecar within types.Transaction. It's better this way because most
code in go-ethereum does not care about blob transactions, and probably never will. This
will start mattering especially on the client side of RPC, where all APIs are based on
types.Transaction. Users need to be able to use the same signing flows they already
have.

However, since blobs are only allowed in some places but not others, we will now need to
add checks to avoid creating invalid blocks. I'm still trying to figure out the best place
to do some of these. The way I have it currently is as follows:

- In block validation (import), txs are verified not to have a blob sidecar.
- In miner, we strip off the sidecar when committing the transaction into the block.
- In TxPool validation, txs must have a sidecar to be added into the blobpool.
  - Note there is a special case here: when transactions are re-added because of a chain
    reorg, we cannot use the transactions gathered from the old chain blocks as-is,
    because they will be missing their blobs. This was previously handled by storing the
    blobs into the 'blobpool limbo'. The code has now changed to store the full
    transaction in the limbo instead, but it might be confusing for code readers why we're
    not simply adding the types.Transaction we already have.

Code changes summary:

- txpool.Transaction removed and all uses replaced by types.Transaction again
- blobpool now stores types.Transaction instead of defining its own blobTx format for storage
- the blobpool limbo now stores types.Transaction instead of storing only the blobs
- checks to validate the presence/absence of the blob sidecar added in certain critical places
2023-08-14 10:13:34 +02:00
Felix Lange
68860063fb
internal/build: apply -ubuntu to env (#27910) 2023-08-12 10:32:50 +02:00
Felix Lange
e91b21ce2b
go.mod, build: upgrade c-kzg-4844 (#27907)
This upgrades to the latest release of ckzg, and also attempts to fix some blst-related
build errors that occur on launchpad.net.
2023-08-12 00:21:46 +02:00
Péter Szilágyi
be65b47645
all: update golang/x/ext and fix slice sorting fallout (#27909)
The Go authors updated golang/x/ext to change the function signature of the slices sort method. 
It's an entire shitshow now because x/ext is not tagged, so everyone's codebase just 
picked a new version that some other dep depends on, causing our code to fail building.

This PR updates the dep on our code too and does all the refactorings to follow upstream...
2023-08-12 00:04:12 +02:00
Péter Szilágyi
0ce331f56a
trie/triedb/pathdb: make shutdown journal log friendlier (#27905) 2023-08-11 17:05:35 +03:00
DongXi Huang
80b76a9527
core/types: remove duplication in eip2930 signer (#27860)
Remove duplication in signer
---------

Co-authored-by: GDdark <huangdongxi@minijoy.work>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-08-11 09:50:57 -04:00
Felix Lange
8f8ef2bc0c
rpc: attempt to fix ping/pong logic race (#27733)
This should fix #27726. With enough load, it might happen that the SetPongHandler 
callback gets invoked before the call to SetReadDeadline is made in pingLoop. When 
this occurs, the socket will end up with a 30s read deadline even though it got the pong,
which will lead to a timeout.

The fix here is processing the pong on pingLoop, synchronizing with the code that 
sends the ping.
2023-08-11 15:16:45 +02:00
Delweng
35f7f3d015
ethdb/leveldb: support more than 7 levels in metrics (#27904) 2023-08-11 15:15:49 +02:00
imulmat4
6ddb92cac3
core/txpool/blobpool: fix metrics name for prometheus export (#27901) 2023-08-11 10:12:26 +03:00
Péter Szilágyi
e2507a17e8 params: switch release family to 1.13 to prep for PBSS 2023-08-10 22:22:17 +03:00
rjl493456442
503f1f7ada
all: activate pbss as experimental feature (#26274)
* all: activate pbss

* core/rawdb: fix compilation error

* cma, core, eth, les, trie: address comments

* cmd, core, eth, trie: polish code

* core, cmd, eth: address comments

* cmd, core, eth, les, light, tests: address comment

* cmd/utils: shorten log message

* trie/triedb/pathdb: limit node buffer size to 1gb

* cmd/utils: fix opening non-existing db

* cmd/utils: rename flag name

* cmd, core: group chain history flags and fix tests

* core, eth, trie: fix memory leak in snapshot generation

* cmd, eth, internal: deprecate flags

* all: enable state tests for pathdb, fixes

* cmd, core: polish code

* trie/triedb/pathdb: limit the node buffer size to 256mb

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2023-08-10 22:21:36 +03:00
Sina Mahmoodi
5e89ff4d6b
graphql: validate block params (#27876)
Block takes a number and a hash. The spec is unclear on what should happen in this case, leaving it an implemenation detail. With this change, we return an error in case both number and hash are passed in.
2023-08-10 07:00:52 -04:00
dependabot[bot]
86d7f5aeee
deps: update supranational/blst to 0.3.11 (#27890)
build(deps): bump github.com/supranational/blst

Bumps [github.com/supranational/blst](https://github.com/supranational/blst) from 0.3.11-0.20230406105308-e9dfc5ee724b to 0.3.11.
- [Release notes](https://github.com/supranational/blst/releases)
- [Commits](https://github.com/supranational/blst/commits/v0.3.11)

---
updated-dependencies:
- dependency-name: github.com/supranational/blst
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-10 06:50:09 -04:00
Martin Holst Swende
8d1db1601d
eth/filters, core/rawdb: remove unused param, refactor filtering-loop (#27891)
This change removes a chainconfig parameter passed into rawdb.ReadLogs, which is not used nor needed.
It also modifies the filter loop slightly, avoiding a labeled break and instead using a method.

This change does not modify any behaviour.
2023-08-10 06:49:05 -04:00
Felix Lange
d9a8b0ff71 params: begin v1.12.2 release cycle 2023-08-10 12:13:15 +02:00
Felix Lange
9c216bd6cb params: release go-ethereum v1.12.1 2023-08-10 12:10:33 +02:00
Guillaume Ballet
67979022aa
core/state: move UpdateContractCode before the trie hash is computed (#27853)
Context: The UpdateContractCode method was introduced for the state storage commitment
schemes that include the whole code for their commitment computation. It must therefore be called
before the root hash is computed at the end of IntermediateRoot.

This should have no impact on the MPT since, in this context, the method is a no-op.
2023-08-09 18:02:45 +02:00
Delweng
10d9f9377b
graphql: add yParity field for transactions (#27882)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-08-09 17:57:57 +02:00
Felix Lange
7ec60d5f0c
p2p: move ping handling into pingLoop goroutine (#27887)
Moving the response sending there allows tracking all peer goroutines
in the peer WaitGroup.
2023-08-09 16:00:31 +02:00
Martin Holst Swende
e13fa32cea
core/vm: update 4844 - point evaluation precompile address (#27874) 2023-08-08 15:54:19 +03:00
Martin Holst Swende
0d772b9f09
graphql: avoid greedy allocation (#27873)
Fixes a graphql-dos

---------

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2023-08-08 07:35:58 -04:00
ucwong
6d2bcb911a
p2p/simulations/examples: use atomic.Int64 (#27861) 2023-08-07 18:30:05 +02:00
Amin Talebi
eeebb07c73
internal/ethapi: add state override to estimateGas (#27845) 2023-08-07 16:03:57 +02:00
ucwong
d14c07d91e
accounts: use atomic type (#27857) 2023-08-07 03:11:50 -04:00
ucwong
857476753d
internal: use atomic type (#27858) 2023-08-07 03:11:06 -04:00
Christopher Harrison
60070fe5c6
internal/ethapi, graphql: correct comments about gas price logic (#27752) 2023-08-05 01:08:53 +02:00
ucwong
5c30541c2a
log: use atomic types (#27763)
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-08-05 00:58:53 +02:00
Felix Lange
bb148dd342
core/types: support yParity field in JSON transactions (#27744)
This adds support for the "yParity" field in transaction objects returned by RPC
APIs. We somehow forgot to add this field even though it has been in the spec for
a long time.
2023-08-05 00:54:55 +02:00
Darioush Jalali
57cdbaef30
all: remove trailing whitespace (#27741) 2023-08-05 00:24:32 +02:00