Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancun code merge [v1.13.0, v1.13.11] #2200

Merged
merged 430 commits into from
Mar 4, 2024

Conversation

buddh0
Copy link
Collaborator

@buddh0 buddh0 commented Feb 2, 2024

Description

Cancun code merge [v1.13.0, v1.13.11]

Rationale

code upstream, status

  1. compile pass
make all
  1. can work with latest commit of main branch in node-deploy
  2. snap sync ok

Example

add an example CLI or API response...

Changes

Notable changes:

RPC

internal/ethapi: implement eth_getBlockReceipts (#27702)
eth, rpc: add configurable option for wsMessageSizeLimit (#27801)
api/bind: add CallOpts.BlockHash to allow calling contracts at a specific block hash (#28084)
internal/ethapi: eth_call block parameter is optional (#28165)
internal/ethapi: ethSendTransaction check baseFee (#27834)

Command

cmd/utils: fix a startup issue on deleted chaindata but dangling ancients(#27989)
cmd/geth, internal/flags, go.mod: colorize cli help, support env vars(#28103)
cmd/rlpdump: add -pos flag, displaying byte positions (#28785)
cmd/geth: make it possible to autopilot removedb (#28725)

Flag

cmd/utils: restore support for txlookuplimit flag (#27917)
cmd/utils, eth: disallow invalid snap sync / snapshot flag combos (#28657)

Client

ethclient: use 'input', not 'data' as field for transaction input (#28078)
ethclient: fix forwarding 1559 gas fields (#28462)
ethclient/simulated: implement new sim backend (#28202)
ethclient: apply accessList field in toCallArg (#28832) 

Tracer

eth/tracers: add position field for callTracer logs (#28389)
eth/tracers: tx-level state in debug_traceCall (#28460)

Txpool

eth/fetcher: allow underpriced transactions in after timeout (#28097)

Sync

eth/downloader: prevent pivot moves after state commit (#28126)
core, eth/downloader: fix genesis state missing due to state sync (#28124)
core, accounts, eth, trie: handle genesis state missing (#28171)
eth/protocols/snap: fix snap sync failure on empty storage range (#28306)
core, eth, trie: filter out boundary nodes and remove dangling nodes in stacktrie (#28327)
core, core/rawdb, eth/sync: no tx indexing during snap sync (#28703)

PBSS Related

core/rawdb: skip pathdb state inspection in hashdb mode (#28108)
eth: abort on api operations not available in pbss-mode (#28104)
trie: remove internal nodes between shortNode and child in path mode (#28163)
trie/triedb/pathdb: improve dirty node flushing trigger (#28426) 
core/rawdb: fsync the index file after each freezer write (#28483) 
trie: remove inconsistent trie nodes during sync in path mode (#28595)
core, cmd, trie: fix the condition of pathdb initialization (#28718) 

GraphQL

graphql: validate block params (#27876
graphql: always set content-type to application/json (#28417)

Cancun

core/types: support for optional blob sidecar in BlobTx (#27841)
core, params, beacon/engine: implement EIP 4788 BeaconRoot (#27849) 
miner: add to build block with EIP-4844 blobs (#27875)
core: implement BLOBBASEFEE opcode (0x4a) (#28098)
core, eth, miner: start propagating and consuming blob txs (#28243)
eth/fetcher: throttle tx fetches to 128KB responses (#28304)
crypto/kzg4844: use the new trusted setup file and format (#28383)
internal/ethapi: handle blobs in API methods (#28786)

P2P

cmd/devp2p, eth: drop eth/66 (#28239) 
cmd/devp2p: use bootnodes as crawl input (#28139)
p2p/discover: add liveness check in collectTableNodes (#28686)

Test

build, tests: add execution-spec-tests (#26985) 
tests/fuzzers: update fuzzers to be based on go-native fuzzing (#28352) 
tests/fuzzers: move fuzzers into native packages (#28467)

Clear Up

eth/downloader: remove header rollback mechanism (#28147)

Others

core/forkid: correctly compute forkid when timestamp fork is activated in genesis (#27895)
core/vm/runtime: Add Random field to config (#28001)
core/rawdb: no need to run truncateFile for readonly mode (#28145)
core/bloombits: fix deadlock when matcher session hits an error (#28184) 
core/state, tests: fix memory leak via fastcache (#28387)
internal/ethapi: compact db missing key starts with 0xff (#28207)
internal/ethapi: fix codehash lookup in eth_getProof (#28357) 
eth: set networkID to chainID by default (#28250)
eth: fix potential hang in waitSnapExtension (#28744)
metrics, cmd/geth: informational metrics (prometheus, influxdb, opentsb (#24877)
ethdb/pebble: don't double-close iterator inside pebbleIterator (#28566)
trie/triedb/hashdb: take lock around access to dirties cache (#28542) 
accounts: properly close managed wallets when closing manager (#28710)
event: fix Resubscribe deadlock when unsubscribing after inner sub ends (#28359)
all: replace log15 with slog (#28187)

holiman and others added 30 commits October 11, 2023 06:12
This change
  - Removes the owner-notion from a stacktrie; the owner is only ever needed for comitting to the database, but the commit-function, the `writeFn` is provided by the caller, so the caller can just set the owner into the `writeFn` instead of having it passed through the stacktrie.
  - Removes the `encoding.BinaryMarshaler`/`encoding.BinaryUnmarshaler` interface from stacktrie. We're not using it, and it is doubtful whether anyone downstream is either.
* eth/fetcher: throttle tx fetches to 128KB responses

* eth/fetcher: unindent a clause per review request
* cmd, core: resolve scheme from a read-write database

* cmd, core, eth: move the scheme check in the ethereum constructor

* cmd/geth: dump should in ro mode

* cmd: reverts
…306)

This change addresses an issue in snap sync, specifically when the entire sync process can be halted due to an encountered empty storage range.

Currently, on the snap sync client side, the response to an empty (partial) storage range is discarded as a non-delivery. However, this response can be a valid response, when the particular range requested does not contain any slots.

For instance, consider a large contract where the entire key space is divided into 16 chunks, and there are no available slots in the last chunk [0xf] -> [end]. When the node receives a request for this particular range, the response includes:

    The proof with origin [0xf]
    A nil storage slot set

If we simply discard this response, the finalization of the last range will be skipped, halting the entire sync process indefinitely. The test case TestSyncWithUnevenStorage can reproduce the scenario described above.

In addition, this change also defines the common variables MaxAddress and MaxHash.
* build: upgrade to golang 1.21.2

* build: verify checksums via tool

* deps: upgrade go to 1.21.3

* build: move more build metadata into checksum file

* build: move gobootsrc to checksums
During snap-sync, we request ranges of values: either a range of accounts or a range of storage values. For any large trie, e.g. the main account trie or a large storage trie, we cannot fetch everything at once.

Short version; we split it up and request in multiple stages. To do so, we use an origin field, to say "Give me all storage key/values where key > 0x20000000000000000". When the server fulfils this, the server provides the first key after origin, let's say 0x2e030000000000000 -- never providing the exact origin. However, the client-side needs to be able to verify that the 0x2e03.. indeed is the first one after 0x2000.., and therefore the attached proof concerns the origin, not the first key.

So, short-short version: the left-hand side of the proof relates to the origin, and is free-standing from the first leaf.

On the other hand, (pun intended), the right-hand side, there's no such 'gap' between "along what path does the proof walk" and the last provided leaf. The proof must prove the last element (unless there are no elements).

Therefore, we can simplify the semantics for trie.VerifyRangeProof by removing an argument. This doesn't make much difference in practice, but makes it so that we can remove some tests. The reason I am raising this is that the upcoming stacktrie-based verifier does not support such fancy features as standalone right-hand borders.
* cmd, core, ethdb: enable Pebble on 32 bits and OpenBSD too

* ethdb/pebble: use Pebble's internal constant calculation
Updates execution-spec-tests to 1.0.5: https://github.com/ethereum/execution-spec-tests/releases/tag/v1.0.5, switching to develop which contains Cancun tests (which are also enabled in this change).
This change fixes #28355, where eth_getProof failed to return the correct codehash under certain conditions. This PR changes the logic to unconditionally look up the codehash, and also adds some more tests.
This changes fixes a bug in the fetcher, where the timeout for how long to remember underpriced transaction was erroneously compared, and the timeout never hit.
---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
This change enhances the stacktrie constructor by introducing an option struct. It also simplifies the `Hash` and `Commit` operations, getting rid of the special handling round root node.
…son (#28348)


Co-authored-by: lightclient <lightclient@protonmail.com>
…ific block hash (#28084)

* api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash.

* ethclient: Add BalanceAtHash, NonceAtHash and StorageAtHash functions
* remove i386 linux tests

* test: fix building of tests

* return empty logs instead of nil in receipts

* keep InitialBaseFee same with geth, so not break a ton of cases

* fix eth dir

* fix subdir of core

* fix subdir of eth

* fix cmd/geth dir

* fix ethtest by adding UpgradeStatusMsg when handshake

* fix ethclient_test.go

* fix ethclient/simulated

* fix internal

* fix graphql

* fix consensus

* fix accounts

* fix log

* fix p2p

* fix metrics

* fix tests dir

* fix golangci-lint

---------

Co-authored-by: Matus Kysel <matus.kysel@bnbchain.org>
@buddh0 buddh0 marked this pull request as ready for review February 21, 2024 11:19
@buddh0 buddh0 marked this pull request as draft February 21, 2024 11:20
@buddh0 buddh0 marked this pull request as ready for review February 21, 2024 11:22
@buddh0 buddh0 marked this pull request as draft February 21, 2024 11:22
@buddh0 buddh0 marked this pull request as ready for review February 21, 2024 11:23
@buddh0 buddh0 marked this pull request as draft February 21, 2024 11:48
* rerun go generate

* fix log in worker

* enable blobpool

* add SubscribeReannoTxsEvent for blobpool

* eth: fix potential hang in waitXXXExtension

* fix networkID when new eth handler

* remove unexpected +

* disable SyncTargetFlag

* add commented code in enableSyncedFeatures

* fix typo
@buddh0 buddh0 marked this pull request as ready for review February 28, 2024 01:29
MatusKysel
MatusKysel previously approved these changes Feb 28, 2024
Copy link
Contributor

@MatusKysel MatusKysel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

fynnss
fynnss previously approved these changes Feb 29, 2024
Copy link
Contributor

@fynnss fynnss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

sysvm
sysvm previously approved these changes Feb 29, 2024
Copy link
Contributor

@sysvm sysvm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* add GenesisHeader to ChainHeaderReader

* fix check cancun header for parlia

* misc
@buddh0 buddh0 dismissed stale reviews from sysvm, fynnss, and MatusKysel via 93d652b March 1, 2024 11:19
Copy link
Collaborator

@zzzckck zzzckck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zzzckck zzzckck merged commit b23dd6c into bnb-chain:develop Mar 4, 2024
6 of 7 checks passed
@buddh0 buddh0 deleted the cancun_code_merge_v1.13.0_v1.13.11 branch March 4, 2024 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.