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

core/vm: set tracer-observable value of a delegatecall to match parent value #26632

Merged
merged 2 commits into from
Feb 10, 2023

Conversation

ziogaschr
Copy link
Contributor

@ziogaschr ziogaschr commented Feb 7, 2023

This PR has been created after request at #26377 (comment)

Backwards compatibility

This is a breaking change in the tracing hooks API as well as semantics of the callTracer:

  • CaptureEnter hook provided a nil value argument in case of DELEGATECALL. However to stay consistent with how delegate calls behave in EVM this hook is changed to pass in the value of the parent call.
  • callTracer will return parent call's value for DELEGATECALL frames.

@ziogaschr ziogaschr requested a review from s1na as a code owner February 7, 2023 16:36
ziogaschr added a commit to etclabscore/ethereum.go-ethereum that referenced this pull request Feb 7, 2023
@s1na
Copy link
Contributor

s1na commented Feb 8, 2023

I'm considering setting the value directly to the hook in EVM. I.e. changing this:

evm.Config.Tracer.CaptureEnter(DELEGATECALL, caller.Address(), addr, input, gas, nil)

To:

evm.Config.Tracer.CaptureEnter(DELEGATECALL, caller.Address(), addr, input, gas, caller.(*Contract).value)

Then all tracers would inherit this value. IMO this is right behavior, but this potentially affects people's scripts

@s1na
Copy link
Contributor

s1na commented Feb 8, 2023

I think we should make this change, since the whole CaptureEnter hook is a relatively new API.

@ziogaschr
Copy link
Contributor Author

It's indeed fairly new, and it will return what's true.
Lucky shot is that nobody will have a check like value == nil, as it doesn't make sense in this context.

Give me the green light and I will change this, or feel free to commit the change :)

@holiman
Copy link
Contributor

holiman commented Feb 8, 2023

Start: from 000000000000000000000000000073656e646572 to 000000000000000000000000000000000000ff0a, value: 0x1337
  pc 0, op PUSH1, stack []
  pc 2, op PUSH1, stack [0x0]
  pc 4, op PUSH1, stack [0x0,0x0]
  pc 6, op PUSH1, stack [0x0,0x0,0x0]
  pc 8, op PUSH2, stack [0x0,0x0,0x0,0x0]
  pc 11, op GAS, stack [0x0,0x0,0x0,0x0,0xff0b]
  pc 12, op DELEGATECALL, stack [0x0,0x0,0x0,0x0,0xff0b,0x98966f]
   pc 0, op CALLVALUE, stack []
   pc 1, op ISZERO, stack [0x1337]
   pc 2, op STOP, stack [0x0]
  pc 13, op STOP, stack [0x1]

I wanted to verify that indeed, that's how the EVM works, it uses the parent callvalue for the `CALLVALUE1 op.

@holiman
Copy link
Contributor

holiman commented Feb 8, 2023

I agree with @s1na to change it on evm.go:L318. But, also add the comment from AsDelegate before doig the cast

	// NOTE: caller must, at all times be a contract. It should never happen
	// that caller is something other than a Contract.
	parent := c.caller.(*Contract)

@holiman holiman added this to the 1.11.0 milestone Feb 9, 2023
@s1na
Copy link
Contributor

s1na commented Feb 9, 2023

From goerli tx:

{
    calls: [{
        from: "0x5b9ae6234cf1e447680c245200e066091e631bf3",
        gas: "0x649",
        gasUsed: "0x30b",
        input: "0x",
        to: "0x54ded98a6720eceaa54eb0f858c81737cde9ff9e",
        type: "DELEGATECALL",
        value: "0x650e1ca0690e"
    }],
    from: "0x26b17999f109b3ee24ef26a60495d5c583f3ee6f",
    gas: "0x8fc",
    gasUsed: "0x5cb",
    input: "0x",
    to: "0x5b9ae6234cf1e447680c245200e066091e631bf3",
    type: "CALL",
    value: "0x650e1ca0690e"
}

Except the callTracer no other built-in tracers uses value from CaptureEnter.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@holiman holiman changed the title Set the value of a delegated call to the value of its parent for CallTracer core/vm: set tracer-observable value of a delegatecall to match parent value Feb 9, 2023
Copy link
Contributor

@s1na s1na left a comment

Choose a reason for hiding this comment

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

LGTM! tests passed, only an unrelated flaky one failed. I restarted CI and will merge on green. Then merge this into #26377 and that will be ready to go too.

@s1na s1na merged commit b0cd8c4 into ethereum:master Feb 10, 2023
gitteri pushed a commit to paxosglobal/go-ethereum that referenced this pull request May 1, 2023
* cmd/bootnode, cmd/utils: add 'pmp:<IP>' to --nat flag description (ethereum#26381)

* cmd/evm: fix typo in README.md (ethereum#26500)

* build: upgrade -dlgo version to Go 1.19.5 (ethereum#26472)

* cmd/evm: typo fix in docs (ethereum#26506)

* metrics/influxdb: fix time ticker leaks (ethereum#26507)

* eth/filters: fix typo in comment (ethereum#26515)

* les/fetcher : fix requestTimer leak (ethereum#26514)

les/fetcher : fix requestTimer leak

* core/txpool: check if initcode size is exceeded (ethereum#26504)

* core/txpool: check if initcode size is exceeded

* core/txpool: move check

* all: remove Kiln testnet (ethereum#26522)

Kiln was deprecated after the merge.

* console, internal/jsre: fix autocomplete issues (ethereum#26518)

Fixes ethereum#26505 where the console crashed when a property getter
raised an exception during autocompletion. I also noticed while fixing this
issue that autocomplete wasn't working for objects/fields with numbers in
them (most importantly web3.<tab><tab>) which is also now fixed.

* go.mod: upgrade to go-bip39 v1.1.0 (ethereum#26527)

* go.sum: tidy (ethereum#26525)

* .travis.yml: go1.19.5 for android builds (ethereum#26524)

* params: define cancun and prague as timestamp based forks (ethereum#26481)

* params: define cancun and osaka as timestamp based forks

* core, params: change osaka to prague

* params: fix

* signer/core: don't require capital lettered reference types (ethereum#26462)

* miner, cmd, eth: require explicit etherbase address (ethereum#26413)

This change introduces a breaking change to miner.etherbase is configured.

Previously, users did not need to explicitly set the  etherbase address via flag, since 'first' local account was used as etherbase automatically. This change removes the  "default first account" feature.

In Proof-of-stake world, the fee recipient address is provided by CL, and not configured in Geth any more - meaning that miner.etherbase is mostly for legacy networks(pow, clique networks etc).

* go.mod: upgrade to latest goja (ethereum#26523)


Co-authored-by: Felix Lange <fjl@twurst.com>

* go.sum: go mod tidy (ethereum#26536)

* all: use http package to replace http method names (ethereum#26535)

* cmd/utils: improve parsing of --miner.etherbase address (ethereum#26541)

This fixes a regression where the flag did not accept values without
the 0x prefix anymore. What's worse, if an invalid value was passed,
the client would just log an INFO level message and continue.

* all: make timestamp-based fork checks based on uint64 (ethereum#26474)

This PR changes the API so that uint64 is used for fork timestamps.
It's a good choice because types.Header also uses uint64 for time.

Co-authored-by: Felix Lange <fjl@twurst.com>

* all: implement withdrawals (EIP-4895)  (ethereum#26484)

This change implements withdrawals as specified in EIP-4895.

Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: marioevz <marioevz@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>

* cmd/utils: fix error at geth startup in --dev mode (ethereum#26550)

This fixes a regression in ethereum#26541 where we turned the miner address
being missing into a startup error. The address was not configured in
--dev mode.

* eth/catalyst: error on nil withdrawals post-shanghai (ethereum#26549)

This adds explicit checks for the presence of withdrawals in the engine API.

Co-authored-by: Felix Lange <fjl@twurst.com>

* eth/catalyst: implement exchangeCapabilities method (ethereum#26555)

Spec: ethereum/execution-apis#364

* params: fix timestamp display in fork banner (ethereum#26553)

* params: remove deprecated bootnodes (ethereum#26530)

This change removes the Infura rinkeby bootnode as well as two deprecated ropsten bootnodes. 

Co-authored-by: Nicola Cocchiaro <ncocchiaro@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* go.mod: gnark-crypto upgrade (ethereum#26545)

* cmd/evm: add blocktest subcommand to evm (ethereum#26526)

Adds blocktest subcommand to the evm command, which is very similar to statetest, but instead of loading a StateTest static test it loads a BlockchainTest from a json file and runs it.

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>

* eth/catalyst: fix panic in TestWithdrawals (ethereum#26563)

Fixes a regression introduced in ethereum#26549

* log: fix typo in comment (ethereum#26569)

* cmd/devp2p: fix broken link in readme(ethereum#26576)

fix broken link to DNS discovery tutorial

* log: better sanitation (ethereum#26556)

* ethclient/gethclient: fix typo (ethereum#26580)

fix grammar typo

* eth/tracer: rename to revertReason (ethereum#26574)

* internal/ethapi: always return block withdrawals if present (ethereum#26565)

The execution-apis specification says that the full list of withdrawals should always be returned when requesting a block over RPC:

https://github.com/ethereum/execution-apis/blob/378c4304f75b5af2c9b5263c9c76b511e33e8984/src/schemas/block.yaml#L90-L94

This change adopts the expected behavior.

* cmd/puppeth: remove puppeth

* core: improve ambiguous block validation message (ethereum#26582)

* eth/catalyst: return invalid params instead of invalid payload params (ethereum#26591)

* cmd, eth, node: deprecate personal namespace (ethereum#26390)

* eth: cmd: deprecate personal namespace

* eth: cmd: move deprecation to node

* node: disable toml of enablepersonal

* node: disable personal on ipc as well

* Update node/node.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* console: error -> warn

* node: less roulette

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* accounts, build, mobile: remove Andriod and iOS support

* core/vm: improve EVM instance reusability (ethereum#26341)

This change improves reusability of the EVM struct. Two methods are added:

- SetBlockContext(...)
- SetTracer(...)

Other attributes like the TransactionContext and the StateDB can already be updated.
BlockContext and Tracer are partially not updateable right now. This change fixes it and
opens the potential to reuse an EVM struct in more ways.

Co-authored-by: Felix Lange <fjl@twurst.com>

* eth/catalyst: implement engine_getPayloadBodiesByHash/Range methods (ethereum#26232)

This change implements engine_getPayloadBodiesByHash and engine_getPayloadBodiesByRange, according to the specification at https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#specification-4 .

Co-authored-by: Martin Holst Swende <martin@swende.se>

* readme: fix broken link  (ethereum#26612)

* rpc: fix off-by-one in ipc endpoint length check (ethereum#26614)

This change fixes a minor flaw in the check for ipc endpoint length. The max_path_size is the max path that an ipc endpoint can have, which is 208. However, that size concerns the null-terminated pathname, so we need to account for an extra null-character too.

* core/vm: add bn256ScalarMul testcase for zero scalar value (ethereum#26607)

EIP-196 allows a zero value in the scalar argument to precompile `0x07`. This change adds a test for that case.

* README: remove text about GPU mining (ethereum#26609)


Co-authored-by: Felix Lange <fjl@twurst.com>

* all: prepare for path-based trie storage (ethereum#26603)

This PR moves some trie-related db accessor methods to a different file, and also removes the schema type. Instead of the schema type, a string is used to distinguish between hashbased/pathbased db accessors.
This also moves some code from trie package to rawdb package.

This PR is intended to be a no-functionality-change prep PR for ethereum#25963 .

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* beacon/engine: move core/beacon to beacon/engine (ethereum#26616)

This PR moves core/beacon to beacon/engine so that beacon-chain related code has its own top level package which also can house the the beacon lightclient-code.

* build: upgrade to golangci-lint v1.51.1 (ethereum#26618)

* tests: update (ethereum#26548)

This updates the reference tests to the latest version.

Co-authored-by: Felix Lange <fjl@twurst.com>

* accounts/abi: fix integer encoding/decoding (ethereum#26568)

This PR fixes this abi encoder/decoder to be more stringent.

* rpc: remove DecimalOrHex type (ethereum#26629)

It's the same as math.HexOrDecimal64, which has more uses across the codebase.

* eth/catalyst,miner: include withdrawals in payload id calculation (ethereum#26554)

According to the spec the payloadID needs to be random or dependent on all arguments, to prevent two payloads from clashing. This change adds withdrawals into the payload derivation. 

---------

Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>

* light: fix receiver name from Python style to Go (ethereum#26631)

Co-authored-by: Halil Yildirim <halilgolang@gmail.com>

* log: allow tabs in log messages (ethereum#26630)

* log: allow tabs in log messages

This fixes a regression where panic reports in RPC handlers were quoted
because they contain tab characters.

* Update format.go

* all: remove database commit callback, rework noderesolver (ethereum#26637)

This change ports some changes from the main PBSS PR:

  - get rid of callback function in `trie.Database.Commit` which is not required anymore
  - rework the `nodeResolver` in `trie.Iterator` to make it compatible with multiple state scheme
  - some other shallow changes in tests and typo-fixes

* eth/catalyst: make getPayloadBodiesByRange take hex inputs (ethereum#26624)


Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* all: remove support for Ropsten (ethereum#26644)

* ethdb: pebble backend (64bit platforms only) (ethereum#26517)

* ethdb: use pebble

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

foo

update

* apply suggested changes

* flags: go format

node: fix ddir lookup mistake

accounts/abi/bind: fix go.mod replacement for generated binding

deps: update pebble + with fix 32-bit build

* ethdb/pebble: respect max memtable size

* core/rawdb, ethdb: enable pebble on non-32bit platforms only

* core/rawdb: fix build tags, fix some review concerns

* core/rawdb: refactor methods for database opening

* core/rawdb: remove erroneous build tag

* cmd/geth: fix the flag default handling + testcase

* cmd/geth: improve testing regarding custom backends

* ethdb/pebble, deps: update pebble dependency

* core/rawdb: replace method with Open

* ethdb/pebble: several updates for pebble (ethereum#49)

* ethdb/pebble: fix size count in batch

* ethdb/pebble: disable seek compaction

* ethdb/pebble: more fixes

* ethdb, core, cmd: polish and fixes (ethereum#50)

* cmd/utils, core/rawdb, ethdb/pebble: address some review concerns

* Update flags.go

* ethdb/pebble: minor refactors

* ethdb/pebble: avoid copy on batch replay

* ethdb: fix compilation flaw

* cmd: fix test fail due to mismatching error message

* cmd/geth, node: rename backingdb to db.engine

---------

Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* eth/catalyst: disallow forkchoiceupdate v1 post-shanghai (ethereum#26645)

* common/prque: generic priority queue (ethereum#26290)

* common, core, eth, les, trie: make prque generic

* les/vflux/server: fixed issues in priorityPool

* common, core, eth, les, trie: make priority also generic in prque

* les/flowcontrol: add test case for priority accumulator overflow

* les/flowcontrol: avoid priority value overflow

* common/prque: use int priority in some tests

No need to convert to int64 when we can just change the type used by the
queue.

* common/prque: remove comment about int64 range

---------

Co-authored-by: Zsolt Felfoldi <zsfelfoldi@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* ethdb/pebble: fix nil callbacks (ethereum#26650)

* eth/downloader: fix timeout resurrection panic (ethereum#26652)

* common/prque, eth/downloader: fix timeout resurrection panic

* common/prque: revert -1 hack for les, temporaryly!

* core/state, trie: remove unused error-return from trie Commit operation (ethereum#26641)

* go.mod: update pebble to latest master (ethereum#26654)

* core/vm: set tracer-observable `value` of a delegatecall to match parent `value` (ethereum#26632)

This is a breaking change in the tracing hooks API as well as semantics of the callTracer:

- CaptureEnter hook provided a nil value argument in case of DELEGATECALL. However to stay consistent with how delegate calls behave in EVM this hook is changed to pass in the value of the parent call.
- callTracer will return parent call's value for DELEGATECALL frames.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* ethdb: add benchmark test suite (ethereum#26659)

* params: schedule shanghai fork on sepolia (ethereum#26662)

* params: schedule shanghai fork on sepolia

* params: u64 -> newUint64

* eth/filters: avoid block body retrieval when no matching logs (ethereum#25199)

Logs stored on disk have minimal information. Contextual information such as block
number, index of log in block, index of transaction in block are filled in upon request.
We can fill in all these fields only having the block header and list of receipts.
But determining the transaction hash of a log requires the block body.

The goal of this PR is postponing this retrieval until we are sure we the transaction hash.
It happens often that the header bloom filter signals there might be matches in a block,
but after actually checking them reveals the logs do not match. We want to avoid fetching
the body in this case.

Note that this changes the semantics of Backend.GetLogs. Downstream callers of
GetLogs now assume log context fields have not been derived, and need to call
DeriveFields on the logs if necessary.

* eth/tracers: more fork overrides in traceBlockToFile (ethereum#26655)

This change allows all post-Berlin forks to be specified as overrides for futureForkBlock in the config parameter for traceBlockToFile.

* tests/fuzzers: supply gnark multiexp config, fixes ethereum#26669 (ethereum#26670)

This change fixes a fuzzer which broke when we updated the gnark dependency earlier.

* cmd/devp2p: reduce output of node crawler (ethereum#26674)

Our discovery crawler spits out a huge amount of logs, most of which is pretty non-interesting. This change moves the very verbose output to Debug, and adds a 8-second status log message giving the general idea about what's going on.

* params: update mainnet + rinkeby CHT (ethereum#26677)

This change updates the CHT entries for mainnet and rinkeby

* eth/filters: replace atomic pointer with value (ethereum#26689)

* eth/filters: replace atomic.Pointer

* fix

* improve

Co-authored-by: Martin Holst Swende <martin@swende.se>

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* p2p/dnsdisc: fix tests with Go 1.20 (ethereum#26690)

* eth/catalyst: return error if withdrawals are nil post-shanghai (ethereum#26691)

Spec: https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#request

* ethdb/pebble: Fix `MemTableStopWritesThreshold` (ethereum#26692)

MemTableStopWritesThreshold was set to the max size of all memtables before blocking writing but should be set to the max number of memtables. This is documented [here](https://github.com/cockroachdb/pebble/blob/master/options.go#L738-L742).

* eth/downloader: handle missing withdrawals if empty list is expected (ethereum#26675)

This PR relaxes the block body ingress handling a bit: if block body withdrawals are missing (but expected to be empty), the body withdrawals are set to 'empty list' before being passed to upper layers. 

This fixes an issue where a block passed from EthereumJS to geth was deemed invalid.

* params: go-ethereum v1.11.0 stable

* params: begin v1.11.1 release cycle

* travis, build: update Go to 1.20.1 (ethereum#26653)

travis, build: update Go to 1.20

* core: check genesis state presence by disk read (ethereum#26703)

* core, eth/downloader: make body validation more strict (ethereum#26704)

* eth/downloader: fix empty-body case in queue fetchresult (ethereum#26707)

* eth/downloader: fix typo (ethereum#26716)

* all: remove deprecated uses of math.rand (ethereum#26710)

This PR is a (superior) alternative to ethereum#26708, it handles deprecation, primarily two specific cases. 

`rand.Seed` is typically used in two ways
- `rand.Seed(time.Now().UnixNano())` -- we seed it, just to be sure to get some random, and not always get the same thing on every run. This is not needed, with global seeding, so those are just removed. 
- `rand.Seed(1)` this is typically done to ensure we have a stable test. If we rely on this, we need to fix up the tests to use a deterministic prng-source. A few occurrences like this has been replaced with a proper custom source. 

`rand.Read` has been replaced by `crypto/rand`.`Read` in this PR.

* params: go-ethereum v1.11.1 stable

* params: begin v1.11.2 release cycle

* eth/catalyst: send INVALID instead of INVALID_BLOCK_HASH (ethereum#26696)

This change will break one hive test, but pass another and it will be the better way going forward

* ci: disable coverage reporting in appveyor and travis

* eth/catalyst: request too large error (ethereum#26722)

The method `GetPayloadBodiesByRangeV1` now returns "-38004: Too large request" error if the requested range is too large, according to spec

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/trie: remove trie tracer (ethereum#26665)

This PR contains a small portion of the full pbss PR, namely

    Remove the tracer from trie (and comitter), and instead using an accessList.
    Related changes to the Nodeset.


---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* rpc: fix unmarshaling of null result in CallContext (ethereum#26723)

The change fixes unmarshaling of JSON null results into json.RawMessage.

---------

Co-authored-by: Jason Yuan <jason.yuan@curvegrid.com>
Co-authored-by: Jason Yuan <jason.yuan869@gmail.com>

* build: ship bootstrapper Go along with builder for PPA (ethereum#26731)

* build: fix setting env var, temp early exit

* build: fix gobootstrap path for the PPA

* build: add some PPA debug logs, sigh

* internal/build: revert raising the chunk size for PPA

* build: yet another weird PPA fix

* build: fix (finaly?) the PPA env vars for Go bootstrapping

* build: fix Go 1.19.0 bootstrapper issues on 386 PPA

* build: enable Lunar Lobster PPA builds

* Revert "core/trie: remove trie tracer (ethereum#26665)" (ethereum#26732)

This reverts commit 7c749c9.

* cmd/geth: clarify dumpconfig options (ethereum#26729)

Clarifies the documentation around dumpconfi

Signed-off-by: Sungwoo Kim <git@sung-woo.kim>

* core, eth: merge snap-sync chain download progress logs (ethereum#26676)

* core: fix accessor mismatch for genesis state (ethereum#26747)

* core/rawdb: expose chain freezer constructor without internals (ethereum#26748)

* all: use unified emptyRootHash and emptyCodeHash (ethereum#26718)

The EmptyRootHash and EmptyCodeHash are defined everywhere in the codebase, this PR replaces all of them with unified one defined in core/types package, and also defines constants for TxRoot, WithdrawalsRoot and UncleRoot

* eth/filters: fix a breaking change and return rpctransaction (ethereum#26757)

* eth/filters: fix a breaking change and return rpctransaction

* eth/filters: fix test cases

---------

Co-authored-by: Catror <me@catror.com>

* common/math: allow HexOrDecimal to accept unquoted decimals too (ethereum#26758)

* params: release Geth v1.11.2

* params: begin v.1.11.3 release cycle

* log: improve documentation (ethereum#26753)

Add usage examples

* core/rawdb, node: use standalone flock dependency (ethereum#26633)

* eth: use the last announced finalized block as the sync ancient limit (ethereum#26685)

* cmd/devp2p: faster crawling + less verbose dns updates (ethereum#26697)

This improves the speed of DHT crawling by using concurrent requests.
It also removes logging of individual DNS updates.

* eth/tracers: add native flatCallTracer (aka parity style tracer) (ethereum#26377)

Adds support for a native call tracer with the Parity format, which outputs call frames
in a flat array. This tracer accepts the following options:

- `convertParityErrors: true` will convert error messages to match those of Parity
- `includePrecompiles: true` will report all calls to precompiles. The default
  matches Parity's behavior where CALL and STATICCALLs to precompiles are excluded

Incompatibilities with Parity include:

- Parity removes the result object in case of failure. This behavior is maintained
  with the exception of reverts. Revert output usually contains useful information,
  i.e. Solidity revert reason.
- The `gasUsed` field accounts for intrinsic gas (e.g. 21000 for simple transfers)
  and refunds unlike Parity
- Block rewards are not reported

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* core: improve withdrawal index assignment in GenerateChain (ethereum#26756)

This fixes an issue where the withdrawal index was not calculated correctly
for multiple withdrawals in a single block.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* ethdb/pebble: fix range compaction (ethereum#26771)

* ethdb/pebble: fix range compaction

* ethdb/pebble: add comment

* ethdb/pebble: fix max memorytable size (ethereum#26776)

* ethclient: include withdrawals in ethclient block responses (ethereum#26778)

* include withdrawals in ethclient responses

* omit empty withdrawals array in json serialization

* all: change chain head markers from block to header (ethereum#26777)

* core/rawdb, ethdb/pebble: disable pebble on openbsd (ethereum#26801)

* core: fix a merge fault (ethereum#26802)

* README, go.mod, event, internal/version: bump min Go to 1.19 (ethereum#26803)

* travi: remove strange leftover Go version

* core, params: schedule Shanghai on goerli (ethereum#26795)

* core: params: schedule Shanghai on goerli

* core/forkid: fix comment

* eth: remove admin.peers[i].eth.head and difficulty (ethereum#26804)

* core/types: add EffectiveGasPrice in Receipt (ethereum#26713)

This change adds a struct field EffectiveGasPrice in types.Receipt. The field is present
in RPC responses, but not in the Go struct, and thus can't easily be accessed via ethclient.

Co-authored-by: PulsarAI <dev@pulsar-systems.fi>

* core, eth/catalyst: fix race conditions in tests (ethereum#26790)

Fixes a race in TestNewPayloadOnInvalidTerminalBlock where setting the TTD raced with
the miner. Solution: set the TTD on the blockchain config not the genesis config.

Also fixes a race in CopyHeader which resulted in race reports all over the place.

* metrics: improve accuracy of CPU gauges (ethereum#26793)

This PR changes metrics collection to actually measure the time interval between collections, rather
than assume 3 seconds. I did some ad hoc profiling, and on slower hardware (eg, my Raspberry Pi 4)
I routinely saw intervals between 3.3 - 3.5 seconds, with some being as high as 4.5 seconds. This
will generally cause the CPU gauge readings to be too high, and in some cases can cause impossibly
large values for the CPU load metrics (eg. greater than 400 for a 4 core CPU).

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* ethclient: fix panic when requesting missing blocks (ethereum#26817)

This fixes a regression introduced by ethereum#26723.
Fixes ethereum#26816.

* core, miner: revert block gas counter in case of invalid transaction (ethereum#26799)

This change fixes a flaw where, in certain scenarios, the block sealer did not accurately reset the remaining gas after failing to include an invalid transaction. Fixes ethereum#26791

* internal/ethapi: add tests for transaction types JSON marshal/unmarshal (ethereum#26667)

Checks that Transaction.MarshalJSON and newRPCTransaction JSON output can be parsed by Transaction.UnmarshalJSON

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd/evm: correct `alloc` for `t8n` testdata (ethereum#26822)

Fixes a minor error in the testdata

* eth/tracers/native: set created address to nil in case of failure (ethereum#26779)

Fixes ethereum#26073

* accounts/usbwallet: mitigate ledger app chunking issue (ethereum#26773)

This PR mitigates an issue with Ledger's on-device RLP deserialization, see
LedgerHQ/app-ethereum#409

Ledger's RLP deserialization code does not validate the length of the RLP list received,
and it may prematurely enter the signing flow when a APDU chunk boundary falls immediately
before the EIP-155 chain_id when deserializing a transaction. Since the chain_id is
uninitialized, it is 0 during this signing flow. This may cause the user to accidentally
sign the transaction with chain_id = 0. That signature would be returned from the device 1
packet earlier than expected by the communication loop. The device blocks the
second-to-last packet waiting for the signer flow, and then errors on the successive
packet (which contains the chain_id, zeroed r, and zeroed s)

Since the signature's early arrival causes successive errors during the communication
process, geth does not parse the improper signature produced by the device, and therefore
no improperly-signed transaction can be created. User funds are not at risk.

We mitigate by selecting the highest chunk size that leaves at least 4 bytes in the
final chunk.

* beacon/engine: don't omit empty withdrawals in ExecutionPayloadBodies (ethereum#26698)

This ensures the "withdrawals" field will always be present in responses
to getPayloadBodiesByRangeV1 and getPayloadBodiesByHashV1.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* build: update to go 1.20.2 (ethereum#26824)

* params: go-ethereum v1.11.3 stable

* params: begin v1.11.4 release cycle

* core/rawdb: find smallest block stored in key-value store when chain gapped (ethereum#26719)

This change prints out more information about the problem, in the case where geth detects a gap between leveldb and ancients, so we can determine more exactly where the gap is (what the first missing is). Also prints out more metadata. 

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* signer/core: accept all solidity primitive types for EIP-712 signing  (ethereum#26770)

Accept all primitive types in Solidity for EIP-712 from intN, uintN, intN[], uintN[] for N as 0 to 256 in multiples of 8

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* params: remove EF azure bootnodes (ethereum#26828)

* core/vm: use golang native big.Int (ethereum#26834)

reverts ethereum#26021, to use the upstream bigint instead.

* core/vm: fix typo in comment (ethereum#26838)

fixes eip 220 ->  2200

* core/forkid: fix issue in validation test (ethereum#26544)

This changes the test to match the comment description. Using timestampedConfig in this test case is incorrect, the comment says 'local is at Gray Glacier' and isn't aware of more forks.

* cmd/evm: update readmes for the tests (ethereum#26841)

* core, core/types: plain Message struct (ethereum#25977)

Here, the core.Message interface turns into a plain struct and
types.Message gets removed.

This is a breaking change to packages core and core/types. While we do
not promise API stability for package core, we do for core/types. An
exception can be made for types.Message, since it doesn't have any
purpose apart from invoking the state transition in package core.
types.Message was also marked deprecated by the same commit it
got added in, 4dca5d4 (November 2016).

The core.Message interface was added in December 2014, in commit
db49417, for the purpose of 'testing' state transitions. It's the
same change that made transaction struct fields private. Before that,
the state transition used *types.Transaction directly.

Over time, multiple implementations of the interface accrued across
different packages, since constructing a Message is required whenever
one wants to invoke the state transition. These implementations all
looked very similar, a struct with private fields exposing the fields
as accessor methods.

By changing Message into a struct with public fields we can remove all
these useless interface implementations. It will also hopefully
simplify future changes to the type with less updates to apply across
all of go-ethereum when a field is added to Message.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* travis: only build PPAs nightly, not on every push, too heavy (ethereum#26846)

* p2p: small comment typo (ethereum#26850)

Update server.go

* core: add Timestamp method in BlockGen (ethereum#26844)

Since forks are now scheduled by block time, it can be necessary
to check the timestamp of a block while generating transactions.

* core/txpool: implement additional DoS defenses (ethereum#26648)

This adds two new rules to the transaction pool:

- A future transaction can not evict a pending transaction.
- A transaction can not overspend available funds of a sender.

---

Co-authored-by: dwn1998 <42262393+dwn1998@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* params: go-ethereum v1.11.4 stable

* params: begin v1.11.5 release cycle

* tests: define `MuirGlacier` fork (ethereum#26856)

add muir glacier to t8n

* code/vm: fix comment typo (ethereum#26865)

it should be constantinople rather than contantinople

* core: minor code refactor (ethereum#26852)

* core: refactor code

* core: drop it from this anonymous goroutine func

* core/txpool: use priceList.Put instead of heap.Push (ethereum#26863)

Minor refactor to use the 'intended' accessor

* eth: return error if 'safe' or 'finalized' tag used pre-merge (ethereum#26862)


Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>

* .travis.yml: reenable PPA build on tag push (ethereum#26873)

* core/state, trie: port changes from PBSS (ethereum#26763)

* p2p/discover: pass invalid discv5 packets to Unhandled channel (ethereum#26699)

This makes it possible to run another protocol alongside discv5, by reading 
unhandled packets from the channel.

* all: update links in documentation (ethereum#26882)


Co-authored-by: Stephen Flynn <stephen.flynn@gapac.com>

* Increase websocket frame size (from erigon rpc client) (ethereum#26883)

This increases the maximum allowed message size to 32MB.

Originally submitted at erigontech/erigon#2739

example block failure: https://etherscan.io/tx/0x1317d973a55cedf9b0f2df6ea48e8077dd176f5444a3423368a46d6e4db89982#internal

* cmd/devp2p, cmd/geth: add version in --help output (ethereum#26895)

Not sure why this was removed, it's pretty useful to see the version
also in --help.

* core: show db error-info in case of mismatched hash root (ethereum#26870)

When a database failure occurs, bubble it up a into statedb, and report it in suitable places, such as during a 'bad block' report.

* consensus: improve consensus engine definition (ethereum#26871)

Makes clear the distinction between Finalize and FinalizedAndAssemble:

- In Finalize function, a series of state operations are applied according to consensus rules. The statedb is mutated and the root hash can be checked and compared afterwards.

This function should be used in block processing(receive afrom network and apply it locally) but not block generation.

- In FinalizeAndAssemble function, after applying state mutations, the block is also to be assembled with the latest
  state root computed, updating the header. 

 This function should be used in block generation only.

* eth/catalyst: increase update consensus timeout (ethereum#26840)

 Increases the time between consensus updates that we give the CL before we start warning the user.

* internal/ethapi: avoid int overflow in GetTransactionReceipt (ethereum#26911)

* trie, accounts/abi: add error-checks (ethereum#26914)

* rlp: support for uint256 (ethereum#26898)

This adds built-in support in package rlp for encoding, decoding and generating code dealing with uint256.Int.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* eth: fix output file permissions in admin_exportChain (ethereum#26912)

* api: Use 0700 file permissions for ExportChain

* change perm to 0644

* Update api.go

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* trie: reduce unit test time (ethereum#26918)

* core/txpool: use atomic int added in go1.19 (ethereum#26913)

Makes use of atomic.Uint64 instead of atomic by pointer

* params: schedule shanghai fork on mainnet (ethereum#26908)

Schedules the shanghai hardfork on timestamp 1681338455 as discussed on ACDE 157: ethereum/execution-specs#727

* core/txpool: allow future local transactions  (ethereum#26930)

Local transactions should not be subject to the "future shouldn't churn pending txs" rule

* params: go-ethereum v1.11.5 stable

* params: begin v1.11.6 release cycle

* build: allow building nightly archives via cron jobs (ethereum#26938)

* log: add special casing of uint256 into the logger (ethereum#26936)

* core/rawdb: use atomic int added in go1.19 (ethereum#26935)

* core/vm: expose jumptable constructors (ethereum#26880)

When interacting with geth as a library to e.g. produce state tests, it is desirable to obtain the consensus-correct jumptable definition for a given fork. This changes adds accessors so the instructionset can be obtained and characteristics about opcodes can be inspected.

* eth/catalyst: fix races (ethereum#26950)

* core/rawdb: update freezertable read meter (ethereum#26946)

The meter for "for measuring the effective amount of data read" within the freezertable was never updated. This change remedies that. 
---------

Signed-off-by: jsvisa <delweng@gmail.com>

* cmd/evm, tests: record preimages if dump is expected (ethereum#26955)

With ethereum#25287 we made it so that preimages were not recorded by default. This had the side effect that the evm command is no longer able to dump state since it does a preimage lookup to determine the address represented by a key.

This change enables the recording of preimages when the dump command is given.

* core/state: add account address to Trie slot accessors (ethereum#26934)

This changes the Trie interface to add the plain account address as a
parameter to all storage-related methods.

After the introduction of the TryAccount* functions, TryGet, TryUpdate and
TryDelete are now only meant to read an account's storage. In their current
form, they assume that an account storage is stored in a separate trie, and
that the hashing of the slot is independent of its account's address.

The proposed structure for a stateless storage breaks these two
assumptions: the hashing of a slot key requires the address and all slots
and accounts are stored in a single trie.

This PR therefore adds an address parameter to the interface. It is ignored
in the MPT version, so this change has no functional impact, however it
will reduce the diff size when merging verkle trees.

* metrics: add cpu counters (ethereum#26796)

This PR adds counter metrics for the CPU system and the Geth process.
Currently the only metrics available for these items are gauges. Gauges are
fine when the consumer scrapes metrics data at the same interval as Geth
produces new values (every 3 seconds), but it is likely that most consumers
will not scrape that often. Intervals of 10, 15, or maybe even 30 seconds
are probably more common.

So the problem is, how does the consumer estimate what the CPU was doing in
between scrapes. With a counter, it's easy ... you just subtract two
successive values and divide by the time to get a nice, accurate average.
But with a gauge, you can't do that. A gauge reading is an instantaneous
picture of what was happening at that moment, but it gives you no idea
about what was going on between scrapes. Taking an average of values is
meaningless.

* metrics/influxdb: use smaller dependency and reuse code between v1 and v2 reporters  (ethereum#26963)

This change switches to use the smaller influxdata/influxdb1-client package instead of depending on the whole infuxdb package. The new smaller client is very similar to the influxdb-v2 client, which made it possible to refactor the two reporters to reuse code a lot more.

* eth/gasprice: change feehistory input type from int to uint64 (ethereum#26922)

Change input param type from int to uint64

* go.mod: update golang.org/x/tools (ethereum#26960)

* rlp/rlpgen: print want/expect output string if mismatch (ethereum#26932)


Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* ethclient: ensure returned subscription is nil on error (ethereum#26976)

* core/state, trie: remove Try prefix in Trie accessors (ethereum#26975)

This change renames StateTrie methods to remove the Try* prefix. 

We added the Trie methods with prefix 'Try' a long time ago, working
around the problem that most existing methods of Trie did not return the
database error. This weird naming convention has persisted until now.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* metrics/librato: ensure resp.body closed (ethereum#26969)

This change ensures that we call Close on a http response body, in various places in the source code (mostly tests)

* core/vm: use atomic.Bool (ethereum#26951)

Make use of new atomic types
---------

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/bloombits: use atomic type (ethereum#26993)

* core/state: use atomic.Bool (ethereum#26992)

* graphql: fix data races (ethereum#26965)

Fixes multiple data races caused by the fact that resolving fields are done concurrently by the graphql library. It also enforces caching at the stateobject level for account fields.

* eth/tracers/native: prevent panic for LOG edge-cases (ethereum#26848)

This PR fixes OOM panic in the callTracer as well as panicing on
opcode validation errors (e.g. stack underflow) in callTracer and
prestateTracer.

Co-authored-by: Martin Holst Swende <martin@swende.se>

* internal/debug: add log.logfmt flag to set logging to use logfmt (ethereum#26970)

* docs: update outdated DeriveSha docs comment (ethereum#26968)

* remove @gballet as a GraphQL codeowner (ethereum#27012)

* core: use atomic type (ethereum#27011)

* graphql: revert storage access regression (ethereum#27007)

* cmd/geth: Add `--log.format` cli param (ethereum#27001)

Removes the new --log.logfmt directive and hides --log.json, replacing both with log.format=(json|logfmt|terminal). The hidden log.json option is still respected if log.format is not specified for backwards compatibility.

Co-authored-by: Martin Holst Swende <martin@swende.se>

* ethdb/pebble: use atomic type (ethereum#27014)

* common: fix json marshaller MixedcaseAddress (ethereum#26998)

Fix the json marshaller of MixedcaseAddress

* eth/catalyst: improve consensus heartbeat (ethereum#26896)

improve the heartbeat function that is no longer suitable in the current situation

Co-authored-by: “openex27” <“openexkevin@gmail.com”>

* miner: use atomic type (ethereum#27013)

Use the new typed atomics in the miner package

* accounts/abi/bind: handle UnpackLog with zero topics (ethereum#26920)

Adds error handling for the case that UnpackLog or UnpackLogIntoMap is called with a log that has zero topics.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* cmd/evm: use correct parent number for t8n base fee calculation (ethereum#27032)

Currently the t8n tool uses the same block number for the current block and its parent while calculating the base fee. This causes incorrect base fee calculation for the london fork block. This commit sets the parent block number to be one less than the current block number

* go.mod : update snappy (ethereum#27027)

* common: delete MakeName (ethereum#27023)

common,p2p: remove unused function MakeName

* cmd/geth: enable log rotation (ethereum#26843)

This change enables log rotation, which can be activated using the flag --log.rotate. Additional parameters that can be given are: 

  - log.maxsize to set maximum size before files are rotated,
  - log.maxbackups to set how many files are retailed, 
  - log.maxage to configure max age of rotated files, 
  - log.compress whether to compress rotated files

The way to configure location of the logfile(s) is left unchanged, via the `log.logfile` parameter.  

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd, miner, signer: avoid panic if keystore is not available (ethereum#27039)

* cmd, miner, singer: avoid panic if keystore is not available

* cmd/geth: print warning instead of panic

* test/fuzzers: fuzz rlp handling of big.Int and uint256.Int (ethereum#26917)

test/fuzzers: fuzz rlp handling of big.Lnt and uint256.Int

* core/txpool: move some validation to outside of mutex (ethereum#27006)

Currently, most of transaction validation while holding the txpool mutex: one exception being an early-on signature check. 

This PR changes that, so that we do all non-stateful checks before we entering the mutex area. This means they can be performed in parallel, and to enable that, certain fields have been made atomic bools and uint64.

* eth/downloader: use atomic types (ethereum#27030)

* eth/downloader: use atomic type

* Update eth/downloader/downloader_test.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* Update eth/downloader/downloader_test.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/vm: clarify comment (ethereum#27045)

* consensus, core/typer: add 4844 excessDataGas to header, tie it to Cancun (ethereum#27046)

* consensus/misc, params: add EIP-4844 blobfee conversions (ethereum#27041)

* consensus/misc, params: add EIP-4844 blobfee conversions

* consensus/misc: pull in fakeExponential test cases

* consensus/misc: reuse bigints

* consensus/misc: nit renames, additional larger testcase

---------

Co-authored-by: Roberto Bayardo <bayardo@alum.mit.edu>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/tracers: report correct gasLimit in call tracers (ethereum#27029)

This includes a semantic change to the `callTracer` as well as `flatCallTracer`.
The value of field `gas` in the **first** call frame will change as follows:

- It previously contained gas available after initial deductions (i.e. tx costs)
- It will now contain the full tx gasLimit value

Signed-off-by: jsvisa <delweng@gmail.com>

* all: remove debug-field from vm config (ethereum#27048)

This PR removes the Debug field from vmconfig, making it so that if a tracer is set, debug=true is implied.

---------

Co-authored-by: 0xTylerHolmes <tyler@ethereum.org>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* metrics: make gauge_float64 and counter_float64 lock free (ethereum#27025)

Makes the float-gauges lock-free

name                      old time/op  new time/op  delta
CounterFloat64Parallel-8  1.45µs ±10%  0.85µs ± 6%  -41.65%  (p=0.008 n=5+5)

---------

Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/tracers: use atomic type (ethereum#27031)

Use the new atomic types in package eth/tracers

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* build: upgrade -dlgo version to Go 1.20.3

* core/txpool: disallow future churn by remote txs (ethereum#26907)

Prior to this change, it was possible that transactions are erroneously deemed as 'future' although they are in fact 'pending', causing them to be dropped due to 'future' not being allowed to replace 'pending'. 

This change fixes that, by doing a more in-depth inspection of the queue.

* core, miner: drop transactions from the same sender when error occurs (ethereum#27038)

This PR unifies the error handling in miner. 

Whenever an error occur while applying a transaction, the transaction should be regarded as invalid and all following transactions from the same sender not executable because of the nonce restriction. The only exception is the `nonceTooLow` error which is handled separately.

* params: new sepolia bootnodes (ethereum#27099)

New sepolia bootnodes managed by EF devops

* cmd/devp2p: fix erroneous log output in crawler (ethereum#27089)

cmd/devp2p: fix log of ignored recent nodes counter

* signer/core: rename testdata files (ethereum#27063)

Sets a meaningful name on test-files

* core: fix comment to reflect function name (ethereum#27070)

* params: remove `EIP150Hash` from chainconfig (ethereum#27087)

The EIP150Hash was an idea where, after the fork, we hardcoded the forked hash as an extra defensive mechanism. It wasn't really used, since forks weren't contentious and for all the various testnets and private networks it's been a hassle to have around. 

This change removes that config field. 

---------

Signed-off-by: jsvisa <delweng@gmail.com>

* p2p: access embedded fields of Server directly (ethereum#27078)

* consensus/ethash: use atomic type (ethereum#27068)

* cmd/devp2p: make crawler-route53-updater less verbose (ethereum#27116)

Follow-up to ethereum#26697, makes the crawler less verbose on route53-based scenarios.

It also changes the loglevel from debug to info on Updates, which are typically the root, and can be interesting to see.

* cmd/geth: rename --vmodule to --log.vmodule (ethereum#27071)

renames `--vmodule` to `--log.vmodule`, and prints a warning if the old form is used.

* core/vm: order opcodes properly (ethereum#27113)

* metrics: use atomic type (ethereum#27121)

* all: refactor trie API (ethereum#26995)

In this PR, all TryXXX(e.g. TryGet) APIs of trie are renamed to XXX(e.g. Get) with an error returned.

The original XXX(e.g. Get) APIs are renamed to MustXXX(e.g. MustGet) and does not return any error -- they print a log output. A future PR will change the behaviour to panic on errorrs.

* params: go-ethereum v1.11.6 stable

* fix merge conflicts

* add market gas price to simulate duplicate nonce behavior (#7)

---------

Signed-off-by: Sungwoo Kim <git@sung-woo.kim>
Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Seungbae Yu <dbadoy4874@gmail.com>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
Co-authored-by: Marius Kjærstad <sandakersmann@users.noreply.github.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Paul <41552663+molecula451@users.noreply.github.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Zachinquarantine <Zachinquarantine@protonmail.com>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: meehow <michal@ert.pl>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Shude Li <islishude@gmail.com>
Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: marioevz <marioevz@gmail.com>
Co-authored-by: Nicola Cocchiaro <3538109+ncocchiaro@users.noreply.github.com>
Co-authored-by: Nicola Cocchiaro <ncocchiaro@users.noreply.github.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: Pascal Marco Caversaccio <pcaversaccio@users.noreply.github.com>
Co-authored-by: Mio <mshimmeris@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: lmittmann <3458786+lmittmann@users.noreply.github.com>
Co-authored-by: delihiros <delihiros@gmail.com>
Co-authored-by: raulk <raul.kripalani@gmail.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
Co-authored-by: zhiqiangxu <652732310@qq.com>
Co-authored-by: halilylm <65048618+halilylm@users.noreply.github.com>
Co-authored-by: Halil Yildirim <halilgolang@gmail.com>
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: Chris Ziogas <ziogaschr@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: Patrick O'Grady <prohb125@gmail.com>
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
Co-authored-by: Jason Yuan <jason.yuan@curvegrid.com>
Co-authored-by: Jason Yuan <jason.yuan869@gmail.com>
Co-authored-by: Sungwoo Kim <git@sung-woo.kim>
Co-authored-by: Yier <90763233+yierx@users.noreply.github.com>
Co-authored-by: Catror <me@catror.com>
Co-authored-by: Nate Armstrong <naterarmstrong@gmail.com>
Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
Co-authored-by: Peter (bitfly) <1674920+peterbitfly@users.noreply.github.com>
Co-authored-by: PulsarAI <dev@pulsar-systems.fi>
Co-authored-by: turboboost55 <7891737+turboboost55@users.noreply.github.com>
Co-authored-by: Adrian Sutton <adrian@symphonious.net>
Co-authored-by: Guruprasad Kamath <48196632+gurukamath@users.noreply.github.com>
Co-authored-by: James Prestwich <10149425+prestwich@users.noreply.github.com>
Co-authored-by: Daniel Fernandes <711733+daferna@users.noreply.github.com>
Co-authored-by: Rafael Matias <rafael@skyle.net>
Co-authored-by: xiyang <90125263+JBossBC@users.noreply.github.com>
Co-authored-by: Roberto Bayardo <bayardo@alum.mit.edu>
Co-authored-by: panicalways <113693386+panicalways@users.noreply.github.com>
Co-authored-by: dwn1998 <42262393+dwn1998@users.noreply.github.com>
Co-authored-by: s7v7nislands <s7v7nislands@gmail.com>
Co-authored-by: Stephen Flynn <ssflynn@gmail.com>
Co-authored-by: Stephen Flynn <stephen.flynn@gapac.com>
Co-authored-by: Jonathan Otto <jonathan.otto@gmail.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: ucwong <ethereum2k@gmail.com>
Co-authored-by: norwnd <112318969+norwnd@users.noreply.github.com>
Co-authored-by: Adrian Sutton <adrian@oplabs.co>
Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com>
Co-authored-by: openex <openexkevin@gmail.com>
Co-authored-by: “openex27” <“openexkevin@gmail.com”>
Co-authored-by: sudeep <sudeepdino008@gmail.com>
Co-authored-by: joohhnnn <68833933+joohhnnn@users.noreply.github.com>
Co-authored-by: 0xTylerHolmes <tyler@ethereum.org>
Co-authored-by: Exca-DK <85954505+Exca-DK@users.noreply.github.com>
Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: Marius Kjærstad <mkjaerstad@protonmail.com>
Co-authored-by: Parithosh Jayanthi <parithosh@indenwolken.xyz>
Co-authored-by: noel <72006780+0x00Duke@users.noreply.github.com>
Co-authored-by: Taeguk Kwon <xornrbboy@gmail.com>
Co-authored-by: Anusha <63559942+anusha-ctrl@users.noreply.github.com>
Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
Co-authored-by: susannapaxos <86749396+susannapaxos@users.noreply.github.com>
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
…ent `value` (ethereum#26632)

This is a breaking change in the tracing hooks API as well as semantics of the callTracer:

- CaptureEnter hook provided a nil value argument in case of DELEGATECALL. However to stay consistent with how delegate calls behave in EVM this hook is changed to pass in the value of the parent call.
- callTracer will return parent call's value for DELEGATECALL frames.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
maoueh pushed a commit to streamingfast/go-ethereum that referenced this pull request Sep 10, 2023
* ethdb/pebble: fix nil callbacks (ethereum#26650)

* eth/downloader: fix timeout resurrection panic (ethereum#26652)

* common/prque, eth/downloader: fix timeout resurrection panic

* common/prque: revert -1 hack for les, temporaryly!

* core/state, trie: remove unused error-return from trie Commit operation (ethereum#26641)

* go.mod: update pebble to latest master (ethereum#26654)

* core/vm: set tracer-observable `value` of a delegatecall to match parent `value` (ethereum#26632)

This is a breaking change in the tracing hooks API as well as semantics of the callTracer:

- CaptureEnter hook provided a nil value argument in case of DELEGATECALL. However to stay consistent with how delegate calls behave in EVM this hook is changed to pass in the value of the parent call.
- callTracer will return parent call's value for DELEGATECALL frames.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* ethdb: add benchmark test suite (ethereum#26659)

* params: schedule shanghai fork on sepolia (ethereum#26662)

* params: schedule shanghai fork on sepolia

* params: u64 -> newUint64

* eth/filters: avoid block body retrieval when no matching logs (ethereum#25199)

Logs stored on disk have minimal information. Contextual information such as block
number, index of log in block, index of transaction in block are filled in upon request.
We can fill in all these fields only having the block header and list of receipts.
But determining the transaction hash of a log requires the block body.

The goal of this PR is postponing this retrieval until we are sure we the transaction hash.
It happens often that the header bloom filter signals there might be matches in a block,
but after actually checking them reveals the logs do not match. We want to avoid fetching
the body in this case.

Note that this changes the semantics of Backend.GetLogs. Downstream callers of
GetLogs now assume log context fields have not been derived, and need to call
DeriveFields on the logs if necessary.

* eth/tracers: more fork overrides in traceBlockToFile (ethereum#26655)

This change allows all post-Berlin forks to be specified as overrides for futureForkBlock in the config parameter for traceBlockToFile.

* tests/fuzzers: supply gnark multiexp config, fixes ethereum#26669 (ethereum#26670)

This change fixes a fuzzer which broke when we updated the gnark dependency earlier.

* cmd/devp2p: reduce output of node crawler (ethereum#26674)

Our discovery crawler spits out a huge amount of logs, most of which is pretty non-interesting. This change moves the very verbose output to Debug, and adds a 8-second status log message giving the general idea about what's going on.

* params: update mainnet + rinkeby CHT (ethereum#26677)

This change updates the CHT entries for mainnet and rinkeby

* eth/filters: replace atomic pointer with value (ethereum#26689)

* eth/filters: replace atomic.Pointer

* fix

* improve

Co-authored-by: Martin Holst Swende <martin@swende.se>

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* p2p/dnsdisc: fix tests with Go 1.20 (ethereum#26690)

* eth/catalyst: return error if withdrawals are nil post-shanghai (ethereum#26691)

Spec: https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#request

* ethdb/pebble: Fix `MemTableStopWritesThreshold` (ethereum#26692)

MemTableStopWritesThreshold was set to the max size of all memtables before blocking writing but should be set to the max number of memtables. This is documented [here](https://github.com/cockroachdb/pebble/blob/master/options.go#L738-L742).

* eth/downloader: handle missing withdrawals if empty list is expected (ethereum#26675)

This PR relaxes the block body ingress handling a bit: if block body withdrawals are missing (but expected to be empty), the body withdrawals are set to 'empty list' before being passed to upper layers. 

This fixes an issue where a block passed from EthereumJS to geth was deemed invalid.

* params: go-ethereum v1.11.0 stable

* params: begin v1.11.1 release cycle

* travis, build: update Go to 1.20.1 (ethereum#26653)

travis, build: update Go to 1.20

* core: check genesis state presence by disk read (ethereum#26703)

* core, eth/downloader: make body validation more strict (ethereum#26704)

* eth/downloader: fix empty-body case in queue fetchresult (ethereum#26707)

* eth/downloader: fix typo (ethereum#26716)

* all: remove deprecated uses of math.rand (ethereum#26710)

This PR is a (superior) alternative to ethereum#26708, it handles deprecation, primarily two specific cases. 

`rand.Seed` is typically used in two ways
- `rand.Seed(time.Now().UnixNano())` -- we seed it, just to be sure to get some random, and not always get the same thing on every run. This is not needed, with global seeding, so those are just removed. 
- `rand.Seed(1)` this is typically done to ensure we have a stable test. If we rely on this, we need to fix up the tests to use a deterministic prng-source. A few occurrences like this has been replaced with a proper custom source. 

`rand.Read` has been replaced by `crypto/rand`.`Read` in this PR.

* params: go-ethereum v1.11.1 stable

* params: begin v1.11.2 release cycle

* eth/catalyst: send INVALID instead of INVALID_BLOCK_HASH (ethereum#26696)

This change will break one hive test, but pass another and it will be the better way going forward

* ci: disable coverage reporting in appveyor and travis

* eth/catalyst: request too large error (ethereum#26722)

The method `GetPayloadBodiesByRangeV1` now returns "-38004: Too large request" error if the requested range is too large, according to spec

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/trie: remove trie tracer (ethereum#26665)

This PR contains a small portion of the full pbss PR, namely

    Remove the tracer from trie (and comitter), and instead using an accessList.
    Related changes to the Nodeset.


---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* rpc: fix unmarshaling of null result in CallContext (ethereum#26723)

The change fixes unmarshaling of JSON null results into json.RawMessage.

---------

Co-authored-by: Jason Yuan <jason.yuan@curvegrid.com>
Co-authored-by: Jason Yuan <jason.yuan869@gmail.com>

* build: ship bootstrapper Go along with builder for PPA (ethereum#26731)

* build: fix setting env var, temp early exit

* build: fix gobootstrap path for the PPA

* build: add some PPA debug logs, sigh

* internal/build: revert raising the chunk size for PPA

* build: yet another weird PPA fix

* build: fix (finaly?) the PPA env vars for Go bootstrapping

* build: fix Go 1.19.0 bootstrapper issues on 386 PPA

* build: enable Lunar Lobster PPA builds

* Revert "core/trie: remove trie tracer (ethereum#26665)" (ethereum#26732)

This reverts commit 7c749c9.

* cmd/geth: clarify dumpconfig options (ethereum#26729)

Clarifies the documentation around dumpconfi

Signed-off-by: Sungwoo Kim <git@sung-woo.kim>

* core, eth: merge snap-sync chain download progress logs (ethereum#26676)

* core: fix accessor mismatch for genesis state (ethereum#26747)

* core/rawdb: expose chain freezer constructor without internals (ethereum#26748)

* all: use unified emptyRootHash and emptyCodeHash (ethereum#26718)

The EmptyRootHash and EmptyCodeHash are defined everywhere in the codebase, this PR replaces all of them with unified one defined in core/types package, and also defines constants for TxRoot, WithdrawalsRoot and UncleRoot

* eth/filters: fix a breaking change and return rpctransaction (ethereum#26757)

* eth/filters: fix a breaking change and return rpctransaction

* eth/filters: fix test cases

---------

Co-authored-by: Catror <me@catror.com>

* common/math: allow HexOrDecimal to accept unquoted decimals too (ethereum#26758)

* params: release Geth v1.11.2

* params: begin v.1.11.3 release cycle

* log: improve documentation (ethereum#26753)

Add usage examples

* core/rawdb, node: use standalone flock dependency (ethereum#26633)

* eth: use the last announced finalized block as the sync ancient limit (ethereum#26685)

* cmd/devp2p: faster crawling + less verbose dns updates (ethereum#26697)

This improves the speed of DHT crawling by using concurrent requests.
It also removes logging of individual DNS updates.

* eth/tracers: add native flatCallTracer (aka parity style tracer) (ethereum#26377)

Adds support for a native call tracer with the Parity format, which outputs call frames
in a flat array. This tracer accepts the following options:

- `convertParityErrors: true` will convert error messages to match those of Parity
- `includePrecompiles: true` will report all calls to precompiles. The default
  matches Parity's behavior where CALL and STATICCALLs to precompiles are excluded

Incompatibilities with Parity include:

- Parity removes the result object in case of failure. This behavior is maintained
  with the exception of reverts. Revert output usually contains useful information,
  i.e. Solidity revert reason.
- The `gasUsed` field accounts for intrinsic gas (e.g. 21000 for simple transfers)
  and refunds unlike Parity
- Block rewards are not reported

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* core: improve withdrawal index assignment in GenerateChain (ethereum#26756)

This fixes an issue where the withdrawal index was not calculated correctly
for multiple withdrawals in a single block.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* ethdb/pebble: fix range compaction (ethereum#26771)

* ethdb/pebble: fix range compaction

* ethdb/pebble: add comment

* ethdb/pebble: fix max memorytable size (ethereum#26776)

* ethclient: include withdrawals in ethclient block responses (ethereum#26778)

* include withdrawals in ethclient responses

* omit empty withdrawals array in json serialization

* all: change chain head markers from block to header (ethereum#26777)

* core/rawdb, ethdb/pebble: disable pebble on openbsd (ethereum#26801)

* core: fix a merge fault (ethereum#26802)

* README, go.mod, event, internal/version: bump min Go to 1.19 (ethereum#26803)

* travi: remove strange leftover Go version

* core, params: schedule Shanghai on goerli (ethereum#26795)

* core: params: schedule Shanghai on goerli

* core/forkid: fix comment

* eth: remove admin.peers[i].eth.head and difficulty (ethereum#26804)

* core/types: add EffectiveGasPrice in Receipt (ethereum#26713)

This change adds a struct field EffectiveGasPrice in types.Receipt. The field is present
in RPC responses, but not in the Go struct, and thus can't easily be accessed via ethclient.

Co-authored-by: PulsarAI <dev@pulsar-systems.fi>

* core, eth/catalyst: fix race conditions in tests (ethereum#26790)

Fixes a race in TestNewPayloadOnInvalidTerminalBlock where setting the TTD raced with
the miner. Solution: set the TTD on the blockchain config not the genesis config.

Also fixes a race in CopyHeader which resulted in race reports all over the place.

* metrics: improve accuracy of CPU gauges (ethereum#26793)

This PR changes metrics collection to actually measure the time interval between collections, rather
than assume 3 seconds. I did some ad hoc profiling, and on slower hardware (eg, my Raspberry Pi 4)
I routinely saw intervals between 3.3 - 3.5 seconds, with some being as high as 4.5 seconds. This
will generally cause the CPU gauge readings to be too high, and in some cases can cause impossibly
large values for the CPU load metrics (eg. greater than 400 for a 4 core CPU).

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* ethclient: fix panic when requesting missing blocks (ethereum#26817)

This fixes a regression introduced by ethereum#26723.
Fixes ethereum#26816.

* core, miner: revert block gas counter in case of invalid transaction (ethereum#26799)

This change fixes a flaw where, in certain scenarios, the block sealer did not accurately reset the remaining gas after failing to include an invalid transaction. Fixes ethereum#26791

* internal/ethapi: add tests for transaction types JSON marshal/unmarshal (ethereum#26667)

Checks that Transaction.MarshalJSON and newRPCTransaction JSON output can be parsed by Transaction.UnmarshalJSON

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd/evm: correct `alloc` for `t8n` testdata (ethereum#26822)

Fixes a minor error in the testdata

* eth/tracers/native: set created address to nil in case of failure (ethereum#26779)

Fixes ethereum#26073

* accounts/usbwallet: mitigate ledger app chunking issue (ethereum#26773)

This PR mitigates an issue with Ledger's on-device RLP deserialization, see
LedgerHQ/app-ethereum#409

Ledger's RLP deserialization code does not validate the length of the RLP list received,
and it may prematurely enter the signing flow when a APDU chunk boundary falls immediately
before the EIP-155 chain_id when deserializing a transaction. Since the chain_id is
uninitialized, it is 0 during this signing flow. This may cause the user to accidentally
sign the transaction with chain_id = 0. That signature would be returned from the device 1
packet earlier than expected by the communication loop. The device blocks the
second-to-last packet waiting for the signer flow, and then errors on the successive
packet (which contains the chain_id, zeroed r, and zeroed s)

Since the signature's early arrival causes successive errors during the communication
process, geth does not parse the improper signature produced by the device, and therefore
no improperly-signed transaction can be created. User funds are not at risk.

We mitigate by selecting the highest chunk size that leaves at least 4 bytes in the
final chunk.

* beacon/engine: don't omit empty withdrawals in ExecutionPayloadBodies (ethereum#26698)

This ensures the "withdrawals" field will always be present in responses
to getPayloadBodiesByRangeV1 and getPayloadBodiesByHashV1.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* build: update to go 1.20.2 (ethereum#26824)

* params: go-ethereum v1.11.3 stable

* params: begin v1.11.4 release cycle

* core/rawdb: find smallest block stored in key-value store when chain gapped (ethereum#26719)

This change prints out more information about the problem, in the case where geth detects a gap between leveldb and ancients, so we can determine more exactly where the gap is (what the first missing is). Also prints out more metadata. 

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* signer/core: accept all solidity primitive types for EIP-712 signing  (ethereum#26770)

Accept all primitive types in Solidity for EIP-712 from intN, uintN, intN[], uintN[] for N as 0 to 256 in multiples of 8

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* params: remove EF azure bootnodes (ethereum#26828)

* core/vm: use golang native big.Int (ethereum#26834)

reverts ethereum#26021, to use the upstream bigint instead.

* core/vm: fix typo in comment (ethereum#26838)

fixes eip 220 ->  2200

* core/forkid: fix issue in validation test (ethereum#26544)

This changes the test to match the comment description. Using timestampedConfig in this test case is incorrect, the comment says 'local is at Gray Glacier' and isn't aware of more forks.

* cmd/evm: update readmes for the tests (ethereum#26841)

* core, core/types: plain Message struct (ethereum#25977)

Here, the core.Message interface turns into a plain struct and
types.Message gets removed.

This is a breaking change to packages core and core/types. While we do
not promise API stability for package core, we do for core/types. An
exception can be made for types.Message, since it doesn't have any
purpose apart from invoking the state transition in package core.
types.Message was also marked deprecated by the same commit it
got added in, 4dca5d4 (November 2016).

The core.Message interface was added in December 2014, in commit
db49417, for the purpose of 'testing' state transitions. It's the
same change that made transaction struct fields private. Before that,
the state transition used *types.Transaction directly.

Over time, multiple implementations of the interface accrued across
different packages, since constructing a Message is required whenever
one wants to invoke the state transition. These implementations all
looked very similar, a struct with private fields exposing the fields
as accessor methods.

By changing Message into a struct with public fields we can remove all
these useless interface implementations. It will also hopefully
simplify future changes to the type with less updates to apply across
all of go-ethereum when a field is added to Message.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* travis: only build PPAs nightly, not on every push, too heavy (ethereum#26846)

* p2p: small comment typo (ethereum#26850)

Update server.go

* core: add Timestamp method in BlockGen (ethereum#26844)

Since forks are now scheduled by block time, it can be necessary
to check the timestamp of a block while generating transactions.

* core/txpool: implement additional DoS defenses (ethereum#26648)

This adds two new rules to the transaction pool:

- A future transaction can not evict a pending transaction.
- A transaction can not overspend available funds of a sender.

---

Co-authored-by: dwn1998 <42262393+dwn1998@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* params: go-ethereum v1.11.4 stable

* params: begin v1.11.5 release cycle

* tests: define `MuirGlacier` fork (ethereum#26856)

add muir glacier to t8n

* code/vm: fix comment typo (ethereum#26865)

it should be constantinople rather than contantinople

* core: minor code refactor (ethereum#26852)

* core: refactor code

* core: drop it from this anonymous goroutine func

* core/txpool: use priceList.Put instead of heap.Push (ethereum#26863)

Minor refactor to use the 'intended' accessor

* eth: return error if 'safe' or 'finalized' tag used pre-merge (ethereum#26862)


Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>

* .travis.yml: reenable PPA build on tag push (ethereum#26873)

* core/state, trie: port changes from PBSS (ethereum#26763)

* p2p/discover: pass invalid discv5 packets to Unhandled channel (ethereum#26699)

This makes it possible to run another protocol alongside discv5, by reading 
unhandled packets from the channel.

* all: update links in documentation (ethereum#26882)


Co-authored-by: Stephen Flynn <stephen.flynn@gapac.com>

* Increase websocket frame size (from erigon rpc client) (ethereum#26883)

This increases the maximum allowed message size to 32MB.

Originally submitted at erigontech/erigon#2739

example block failure: https://etherscan.io/tx/0x1317d973a55cedf9b0f2df6ea48e8077dd176f5444a3423368a46d6e4db89982#internal

* cmd/devp2p, cmd/geth: add version in --help output (ethereum#26895)

Not sure why this was removed, it's pretty useful to see the version
also in --help.

* core: show db error-info in case of mismatched hash root (ethereum#26870)

When a database failure occurs, bubble it up a into statedb, and report it in suitable places, such as during a 'bad block' report.

* consensus: improve consensus engine definition (ethereum#26871)

Makes clear the distinction between Finalize and FinalizedAndAssemble:

- In Finalize function, a series of state operations are applied according to consensus rules. The statedb is mutated and the root hash can be checked and compared afterwards.

This function should be used in block processing(receive afrom network and apply it locally) but not block generation.

- In FinalizeAndAssemble function, after applying state mutations, the block is also to be assembled with the latest
  state root computed, updating the header. 

 This function should be used in block generation only.

* eth/catalyst: increase update consensus timeout (ethereum#26840)

 Increases the time between consensus updates that we give the CL before we start warning the user.

* internal/ethapi: avoid int overflow in GetTransactionReceipt (ethereum#26911)

* trie, accounts/abi: add error-checks (ethereum#26914)

* rlp: support for uint256 (ethereum#26898)

This adds built-in support in package rlp for encoding, decoding and generating code dealing with uint256.Int.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* eth: fix output file permissions in admin_exportChain (ethereum#26912)

* api: Use 0700 file permissions for ExportChain

* change perm to 0644

* Update api.go

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* trie: reduce unit test time (ethereum#26918)

* core/txpool: use atomic int added in go1.19 (ethereum#26913)

Makes use of atomic.Uint64 instead of atomic by pointer

* params: schedule shanghai fork on mainnet (ethereum#26908)

Schedules the shanghai hardfork on timestamp 1681338455 as discussed on ACDE 157: ethereum/execution-specs#727

* core/txpool: allow future local transactions  (ethereum#26930)

Local transactions should not be subject to the "future shouldn't churn pending txs" rule

* params: go-ethereum v1.11.5 stable

* params: begin v1.11.6 release cycle

* build: allow building nightly archives via cron jobs (ethereum#26938)

* log: add special casing of uint256 into the logger (ethereum#26936)

* core/rawdb: use atomic int added in go1.19 (ethereum#26935)

* core/vm: expose jumptable constructors (ethereum#26880)

When interacting with geth as a library to e.g. produce state tests, it is desirable to obtain the consensus-correct jumptable definition for a given fork. This changes adds accessors so the instructionset can be obtained and characteristics about opcodes can be inspected.

* eth/catalyst: fix races (ethereum#26950)

* core/rawdb: update freezertable read meter (ethereum#26946)

The meter for "for measuring the effective amount of data read" within the freezertable was never updated. This change remedies that. 
---------

Signed-off-by: jsvisa <delweng@gmail.com>

* cmd/evm, tests: record preimages if dump is expected (ethereum#26955)

With ethereum#25287 we made it so that preimages were not recorded by default. This had the side effect that the evm command is no longer able to dump state since it does a preimage lookup to determine the address represented by a key.

This change enables the recording of preimages when the dump command is given.

* core/state: add account address to Trie slot accessors (ethereum#26934)

This changes the Trie interface to add the plain account address as a
parameter to all storage-related methods.

After the introduction of the TryAccount* functions, TryGet, TryUpdate and
TryDelete are now only meant to read an account's storage. In their current
form, they assume that an account storage is stored in a separate trie, and
that the hashing of the slot is independent of its account's address.

The proposed structure for a stateless storage breaks these two
assumptions: the hashing of a slot key requires the address and all slots
and accounts are stored in a single trie.

This PR therefore adds an address parameter to the interface. It is ignored
in the MPT version, so this change has no functional impact, however it
will reduce the diff size when merging verkle trees.

* metrics: add cpu counters (ethereum#26796)

This PR adds counter metrics for the CPU system and the Geth process.
Currently the only metrics available for these items are gauges. Gauges are
fine when the consumer scrapes metrics data at the same interval as Geth
produces new values (every 3 seconds), but it is likely that most consumers
will not scrape that often. Intervals of 10, 15, or maybe even 30 seconds
are probably more common.

So the problem is, how does the consumer estimate what the CPU was doing in
between scrapes. With a counter, it's easy ... you just subtract two
successive values and divide by the time to get a nice, accurate average.
But with a gauge, you can't do that. A gauge reading is an instantaneous
picture of what was happening at that moment, but it gives you no idea
about what was going on between scrapes. Taking an average of values is
meaningless.

* metrics/influxdb: use smaller dependency and reuse code between v1 and v2 reporters  (ethereum#26963)

This change switches to use the smaller influxdata/influxdb1-client package instead of depending on the whole infuxdb package. The new smaller client is very similar to the influxdb-v2 client, which made it possible to refactor the two reporters to reuse code a lot more.

* eth/gasprice: change feehistory input type from int to uint64 (ethereum#26922)

Change input param type from int to uint64

* go.mod: update golang.org/x/tools (ethereum#26960)

* rlp/rlpgen: print want/expect output string if mismatch (ethereum#26932)


Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* ethclient: ensure returned subscription is nil on error (ethereum#26976)

* core/state, trie: remove Try prefix in Trie accessors (ethereum#26975)

This change renames StateTrie methods to remove the Try* prefix. 

We added the Trie methods with prefix 'Try' a long time ago, working
around the problem that most existing methods of Trie did not return the
database error. This weird naming convention has persisted until now.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* metrics/librato: ensure resp.body closed (ethereum#26969)

This change ensures that we call Close on a http response body, in various places in the source code (mostly tests)

* core/vm: use atomic.Bool (ethereum#26951)

Make use of new atomic types
---------

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/bloombits: use atomic type (ethereum#26993)

* core/state: use atomic.Bool (ethereum#26992)

* graphql: fix data races (ethereum#26965)

Fixes multiple data races caused by the fact that resolving fields are done concurrently by the graphql library. It also enforces caching at the stateobject level for account fields.

* eth/tracers/native: prevent panic for LOG edge-cases (ethereum#26848)

This PR fixes OOM panic in the callTracer as well as panicing on
opcode validation errors (e.g. stack underflow) in callTracer and
prestateTracer.

Co-authored-by: Martin Holst Swende <martin@swende.se>

* internal/debug: add log.logfmt flag to set logging to use logfmt (ethereum#26970)

* docs: update outdated DeriveSha docs comment (ethereum#26968)

* remove @gballet as a GraphQL codeowner (ethereum#27012)

* core: use atomic type (ethereum#27011)

* graphql: revert storage access regression (ethereum#27007)

* cmd/geth: Add `--log.format` cli param (ethereum#27001)

Removes the new --log.logfmt directive and hides --log.json, replacing both with log.format=(json|logfmt|terminal). The hidden log.json option is still respected if log.format is not specified for backwards compatibility.

Co-authored-by: Martin Holst Swende <martin@swende.se>

* ethdb/pebble: use atomic type (ethereum#27014)

* common: fix json marshaller MixedcaseAddress (ethereum#26998)

Fix the json marshaller of MixedcaseAddress

* eth/catalyst: improve consensus heartbeat (ethereum#26896)

improve the heartbeat function that is no longer suitable in the current situation

Co-authored-by: “openex27” <“openexkevin@gmail.com”>

* miner: use atomic type (ethereum#27013)

Use the new typed atomics in the miner package

* accounts/abi/bind: handle UnpackLog with zero topics (ethereum#26920)

Adds error handling for the case that UnpackLog or UnpackLogIntoMap is called with a log that has zero topics.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* cmd/evm: use correct parent number for t8n base fee calculation (ethereum#27032)

Currently the t8n tool uses the same block number for the current block and its parent while calculating the base fee. This causes incorrect base fee calculation for the london fork block. This commit sets the parent block number to be one less than the current block number

* go.mod : update snappy (ethereum#27027)

* common: delete MakeName (ethereum#27023)

common,p2p: remove unused function MakeName

* cmd/geth: enable log rotation (ethereum#26843)

This change enables log rotation, which can be activated using the flag --log.rotate. Additional parameters that can be given are: 

  - log.maxsize to set maximum size before files are rotated,
  - log.maxbackups to set how many files are retailed, 
  - log.maxage to configure max age of rotated files, 
  - log.compress whether to compress rotated files

The way to configure location of the logfile(s) is left unchanged, via the `log.logfile` parameter.  

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd, miner, signer: avoid panic if keystore is not available (ethereum#27039)

* cmd, miner, singer: avoid panic if keystore is not available

* cmd/geth: print warning instead of panic

* test/fuzzers: fuzz rlp handling of big.Int and uint256.Int (ethereum#26917)

test/fuzzers: fuzz rlp handling of big.Lnt and uint256.Int

* core/txpool: move some validation to outside of mutex (ethereum#27006)

Currently, most of transaction validation while holding the txpool mutex: one exception being an early-on signature check. 

This PR changes that, so that we do all non-stateful checks before we entering the mutex area. This means they can be performed in parallel, and to enable that, certain fields have been made atomic bools and uint64.

* eth/downloader: use atomic types (ethereum#27030)

* eth/downloader: use atomic type

* Update eth/downloader/downloader_test.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* Update eth/downloader/downloader_test.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/vm: clarify comment (ethereum#27045)

* consensus, core/typer: add 4844 excessDataGas to header, tie it to Cancun (ethereum#27046)

* consensus/misc, params: add EIP-4844 blobfee conversions (ethereum#27041)

* consensus/misc, params: add EIP-4844 blobfee conversions

* consensus/misc: pull in fakeExponential test cases

* consensus/misc: reuse bigints

* consensus/misc: nit renames, additional larger testcase

---------

Co-authored-by: Roberto Bayardo <bayardo@alum.mit.edu>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/tracers: report correct gasLimit in call tracers (ethereum#27029)

This includes a semantic change to the `callTracer` as well as `flatCallTracer`.
The value of field `gas` in the **first** call frame will change as follows:

- It previously contained gas available after initial deductions (i.e. tx costs)
- It will now contain the full tx gasLimit value

Signed-off-by: jsvisa <delweng@gmail.com>

* all: remove debug-field from vm config (ethereum#27048)

This PR removes the Debug field from vmconfig, making it so that if a tracer is set, debug=true is implied.

---------

Co-authored-by: 0xTylerHolmes <tyler@ethereum.org>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* metrics: make gauge_float64 and counter_float64 lock free (ethereum#27025)

Makes the float-gauges lock-free

name                      old time/op  new time/op  delta
CounterFloat64Parallel-8  1.45µs ±10%  0.85µs ± 6%  -41.65%  (p=0.008 n=5+5)

---------

Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/tracers: use atomic type (ethereum#27031)

Use the new atomic types in package eth/tracers

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* build: upgrade -dlgo version to Go 1.20.3

* core/txpool: disallow future churn by remote txs (ethereum#26907)

Prior to this change, it was possible that transactions are erroneously deemed as 'future' although they are in fact 'pending', causing them to be dropped due to 'future' not being allowed to replace 'pending'. 

This change fixes that, by doing a more in-depth inspection of the queue.

* core, miner: drop transactions from the same sender when error occurs (ethereum#27038)

This PR unifies the error handling in miner. 

Whenever an error occur while applying a transaction, the transaction should be regarded as invalid and all following transactions from the same sender not executable because of the nonce restriction. The only exception is the `nonceTooLow` error which is handled separately.

* params: new sepolia bootnodes (ethereum#27099)

New sepolia bootnodes managed by EF devops

* cmd/devp2p: fix erroneous log output in crawler (ethereum#27089)

cmd/devp2p: fix log of ignored recent nodes counter

* signer/core: rename testdata files (ethereum#27063)

Sets a meaningful name on test-files

* core: fix comment to reflect function name (ethereum#27070)

* params: remove `EIP150Hash` from chainconfig (ethereum#27087)

The EIP150Hash was an idea where, after the fork, we hardcoded the forked hash as an extra defensive mechanism. It wasn't really used, since forks weren't contentious and for all the various testnets and private networks it's been a hassle to have around. 

This change removes that config field. 

---------

Signed-off-by: jsvisa <delweng@gmail.com>

* p2p: access embedded fields of Server directly (ethereum#27078)

* consensus/ethash: use atomic type (ethereum#27068)

* cmd/devp2p: make crawler-route53-updater less verbose (ethereum#27116)

Follow-up to ethereum#26697, makes the crawler less verbose on route53-based scenarios.

It also changes the loglevel from debug to info on Updates, which are typically the root, and can be interesting to see.

* cmd/geth: rename --vmodule to --log.vmodule (ethereum#27071)

renames `--vmodule` to `--log.vmodule`, and prints a warning if the old form is used.

* core/vm: order opcodes properly (ethereum#27113)

* metrics: use atomic type (ethereum#27121)

* all: refactor trie API (ethereum#26995)

In this PR, all TryXXX(e.g. TryGet) APIs of trie are renamed to XXX(e.g. Get) with an error returned.

The original XXX(e.g. Get) APIs are renamed to MustXXX(e.g. MustGet) and does not return any error -- they print a log output. A future PR will change the behaviour to panic on errorrs.

* params: go-ethereum v1.11.6 stable

* dev: chg: regression changes for bor after merge

* dev: chg: more regression changes for bor after merge

* dev: chg: txpool_test regression changes after merge

* dev: chg: gomock re-generate mocks for backend interface

* dev: chg: regression changes after develop is merged into upstream-merge

* dev: chg: further fixes merging develop into upstream-merge

* dev: chg: apply changes to NewParallelBlockChain

* dev: chg: solve some TODOs

* dev: fix: CreateConsensusEngine for new ethereum objects

* dev: fix: NewParallelBlockChain using Genesis

* dev: fix: build ci.go

* dev: fix: thelper and tparallel lint

* dev: fix: http related and nilnil lint errors

* dev: fix: ineffassign lint errors

* dev: chg: comment position fix

* dev: fix: govet lint errors

* dev: fix: error related lint issues

* dev: fix: bodyclose lint issues

* dev: fix: some wsl lint issues

* dev: fix: more wsl lint issues

* dev: fix: errorcheck lint issues

* dev: fix: solve more lint issues

* dev: fix: more wsl lint issues

* dev: fix: more errcheck lint issues

* dev: fix: most of wsl lint issues

* dev: fix: all remaining  lint issues

* dev: fix: t.Parallel called multiple times

* dev: fix: tests failing due to t.Parallel

* fix : runtime testcases

* fix : testcase : config, addTxWithChain, burnAmount

* fix : ethhash bor burn contract

* fix : genspec config

* fix : freezer, TestStateProcessorErrors

* core,eth,miner: fix initial test cases (ethereum#922)

* fix : TestTransactionIndices, testBeaconSync

* fix : TestBeaconSync66

* core,eth: fix TestDeduplication, TestSyncAccountPerformance, TestTraceTransaction

* fix : TestTxIndexer

* rm : multiple coinbase balance

* fix : testCommitInterruptExperimentBor

* adding balance send to burntcontract back

* Fix header encoding test

* core,eth/tracers: fix TestPrestateWithDiffModeTracer

* consensus/bor,eth/filters,miner,params,tests: fix mocks

* fix : TestGraphQLConcurrentResolvers

* fix : TestBuildPayload

* common,core,miner: fix goleaks,duplicate init and inconsistent mutex (un)locks

* fix : lint

* fix : lint

* fix : test-integration

* fix : test-integration

* core: restore AddFeeTransferLog post miner tipping

* fix : TestGraphQLConcurrentResolvers

* fix : deadlocks

* rm: t.parallel from testQueueTimeLimiting tests

* Merge branch 'develop' into mardizzone/upstream-merge

* fix : lint

* fix : test-integration

* fix : TxDependency

* add rpc.enabledeprecatedpersonal flag

---------

Signed-off-by: Sungwoo Kim <git@sung-woo.kim>
Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Chris Ziogas <ziogaschr@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Patrick O'Grady <prohb125@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
Co-authored-by: Jason Yuan <jason.yuan@curvegrid.com>
Co-authored-by: Jason Yuan <jason.yuan869@gmail.com>
Co-authored-by: Sungwoo Kim <git@sung-woo.kim>
Co-authored-by: Yier <90763233+yierx@users.noreply.github.com>
Co-authored-by: Catror <me@catror.com>
Co-authored-by: Nate Armstrong <naterarmstrong@gmail.com>
Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
Co-authored-by: Peter (bitfly) <1674920+peterbitfly@users.noreply.github.com>
Co-authored-by: PulsarAI <dev@pulsar-systems.fi>
Co-authored-by: turboboost55 <7891737+turboboost55@users.noreply.github.com>
Co-authored-by: Adrian Sutton <adrian@symphonious.net>
Co-authored-by: Guruprasad Kamath <48196632+gurukamath@users.noreply.github.com>
Co-authored-by: James Prestwich <10149425+prestwich@users.noreply.github.com>
Co-authored-by: Daniel Fernandes <711733+daferna@users.noreply.github.com>
Co-authored-by: Rafael Matias <rafael@skyle.net>
Co-authored-by: xiyang <90125263+JBossBC@users.noreply.github.com>
Co-authored-by: Roberto Bayardo <bayardo@alum.mit.edu>
Co-authored-by: panicalways <113693386+panicalways@users.noreply.github.com>
Co-authored-by: dwn1998 <42262393+dwn1998@users.noreply.github.com>
Co-authored-by: s7v7nislands <s7v7nislands@gmail.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: Stephen Flynn <ssflynn@gmail.com>
Co-authored-by: Stephen Flynn <stephen.flynn@gapac.com>
Co-authored-by: Jonathan Otto <jonathan.otto@gmail.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: ucwong <ethereum2k@gmail.com>
Co-authored-by: norwnd <112318969+norwnd@users.noreply.github.com>
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: Adrian Sutton <adrian@oplabs.co>
Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com>
Co-authored-by: openex <openexkevin@gmail.com>
Co-authored-by: “openex27” <“openexkevin@gmail.com”>
Co-authored-by: sudeep <sudeepdino008@gmail.com>
Co-authored-by: joohhnnn <68833933+joohhnnn@users.noreply.github.com>
Co-authored-by: 0xTylerHolmes <tyler@ethereum.org>
Co-authored-by: Exca-DK <85954505+Exca-DK@users.noreply.github.com>
Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: Marius Kjærstad <mkjaerstad@protonmail.com>
Co-authored-by: Parithosh Jayanthi <parithosh@indenwolken.xyz>
Co-authored-by: noel <72006780+0x00Duke@users.noreply.github.com>
Co-authored-by: Taeguk Kwon <xornrbboy@gmail.com>
Co-authored-by: Anusha <63559942+anusha-ctrl@users.noreply.github.com>
Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
Co-authored-by: Shivam Sharma <shivam691999@gmail.com>
Co-authored-by: Raneet Debnath <35629432+Raneet10@users.noreply.github.com>
Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
maoueh added a commit to streamingfast/go-ethereum that referenced this pull request Sep 20, 2023
* build: yet another weird PPA fix

* build: fix (finaly?) the PPA env vars for Go bootstrapping

* build: fix Go 1.19.0 bootstrapper issues on 386 PPA

* build: enable Lunar Lobster PPA builds

* Revert "core/trie: remove trie tracer (#26665)" (#26732)

This reverts commit 7c749c947a9d5181f5f2c1b3fdb5ea6b0e401e8e.

* cmd/geth: clarify dumpconfig options (#26729)

Clarifies the documentation around dumpconfi

Signed-off-by: Sungwoo Kim <git@sung-woo.kim>

* core, eth: merge snap-sync chain download progress logs (#26676)

* core: fix accessor mismatch for genesis state (#26747)

* core/rawdb: expose chain freezer constructor without internals (#26748)

* all: use unified emptyRootHash and emptyCodeHash (#26718)

The EmptyRootHash and EmptyCodeHash are defined everywhere in the codebase, this PR replaces all of them with unified one defined in core/types package, and also defines constants for TxRoot, WithdrawalsRoot and UncleRoot

* eth/filters: fix a breaking change and return rpctransaction (#26757)

* eth/filters: fix a breaking change and return rpctransaction

* eth/filters: fix test cases

---------

Co-authored-by: Catror <me@catror.com>

* common/math: allow HexOrDecimal to accept unquoted decimals too (#26758)

* params: release Geth v1.11.2

* params: begin v.1.11.3 release cycle

* log: improve documentation (#26753)

Add usage examples

* core/rawdb, node: use standalone flock dependency (#26633)

* eth: use the last announced finalized block as the sync ancient limit (#26685)

* cmd/devp2p: faster crawling + less verbose dns updates (#26697)

This improves the speed of DHT crawling by using concurrent requests.
It also removes logging of individual DNS updates.

* eth/tracers: add native flatCallTracer (aka parity style tracer) (#26377)

Adds support for a native call tracer with the Parity format, which outputs call frames
in a flat array. This tracer accepts the following options:

- `convertParityErrors: true` will convert error messages to match those of Parity
- `includePrecompiles: true` will report all calls to precompiles. The default
  matches Parity's behavior where CALL and STATICCALLs to precompiles are excluded

Incompatibilities with Parity include:

- Parity removes the result object in case of failure. This behavior is maintained
  with the exception of reverts. Revert output usually contains useful information,
  i.e. Solidity revert reason.
- The `gasUsed` field accounts for intrinsic gas (e.g. 21000 for simple transfers)
  and refunds unlike Parity
- Block rewards are not reported

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* core: improve withdrawal index assignment in GenerateChain (#26756)

This fixes an issue where the withdrawal index was not calculated correctly
for multiple withdrawals in a single block.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* ethdb/pebble: fix range compaction (#26771)

* ethdb/pebble: fix range compaction

* ethdb/pebble: add comment

* ethdb/pebble: fix max memorytable size (#26776)

* ethclient: include withdrawals in ethclient block responses (#26778)

* include withdrawals in ethclient responses

* omit empty withdrawals array in json serialization

* all: change chain head markers from block to header (#26777)

* core/rawdb, ethdb/pebble: disable pebble on openbsd (#26801)

* core: fix a merge fault (#26802)

* README, go.mod, event, internal/version: bump min Go to 1.19 (#26803)

* travi: remove strange leftover Go version

* core, params: schedule Shanghai on goerli (#26795)

* core: params: schedule Shanghai on goerli

* core/forkid: fix comment

* eth: remove admin.peers[i].eth.head and difficulty (#26804)

* core/types: add EffectiveGasPrice in Receipt (#26713)

This change adds a struct field EffectiveGasPrice in types.Receipt. The field is present
in RPC responses, but not in the Go struct, and thus can't easily be accessed via ethclient.

Co-authored-by: PulsarAI <dev@pulsar-systems.fi>

* core, eth/catalyst: fix race conditions in tests (#26790)

Fixes a race in TestNewPayloadOnInvalidTerminalBlock where setting the TTD raced with
the miner. Solution: set the TTD on the blockchain config not the genesis config.

Also fixes a race in CopyHeader which resulted in race reports all over the place.

* metrics: improve accuracy of CPU gauges (#26793)

This PR changes metrics collection to actually measure the time interval between collections, rather
than assume 3 seconds. I did some ad hoc profiling, and on slower hardware (eg, my Raspberry Pi 4)
I routinely saw intervals between 3.3 - 3.5 seconds, with some being as high as 4.5 seconds. This
will generally cause the CPU gauge readings to be too high, and in some cases can cause impossibly
large values for the CPU load metrics (eg. greater than 400 for a 4 core CPU).

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* ethclient: fix panic when requesting missing blocks (#26817)

This fixes a regression introduced by #26723.
Fixes #26816.

* core, miner: revert block gas counter in case of invalid transaction (#26799)

This change fixes a flaw where, in certain scenarios, the block sealer did not accurately reset the remaining gas after failing to include an invalid transaction. Fixes #26791

* internal/ethapi: add tests for transaction types JSON marshal/unmarshal (#26667)

Checks that Transaction.MarshalJSON and newRPCTransaction JSON output can be parsed by Transaction.UnmarshalJSON

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd/evm: correct `alloc` for `t8n` testdata (#26822)

Fixes a minor error in the testdata

* eth/tracers/native: set created address to nil in case of failure (#26779)

Fixes #26073

* accounts/usbwallet: mitigate ledger app chunking issue (#26773)

This PR mitigates an issue with Ledger's on-device RLP deserialization, see
https://github.com/LedgerHQ/app-ethereum/issues/409

Ledger's RLP deserialization code does not validate the length of the RLP list received,
and it may prematurely enter the signing flow when a APDU chunk boundary falls immediately
before the EIP-155 chain_id when deserializing a transaction. Since the chain_id is
uninitialized, it is 0 during this signing flow. This may cause the user to accidentally
sign the transaction with chain_id = 0. That signature would be returned from the device 1
packet earlier than expected by the communication loop. The device blocks the
second-to-last packet waiting for the signer flow, and then errors on the successive
packet (which contains the chain_id, zeroed r, and zeroed s)

Since the signature's early arrival causes successive errors during the communication
process, geth does not parse the improper signature produced by the device, and therefore
no improperly-signed transaction can be created. User funds are not at risk.

We mitigate by selecting the highest chunk size that leaves at least 4 bytes in the
final chunk.

* beacon/engine: don't omit empty withdrawals in ExecutionPayloadBodies (#26698)

This ensures the "withdrawals" field will always be present in responses
to getPayloadBodiesByRangeV1 and getPayloadBodiesByHashV1.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* build: update to go 1.20.2 (#26824)

* params: go-ethereum v1.11.3 stable

* params: begin v1.11.4 release cycle

* core/rawdb: find smallest block stored in key-value store when chain gapped (#26719)

This change prints out more information about the problem, in the case where geth detects a gap between leveldb and ancients, so we can determine more exactly where the gap is (what the first missing is). Also prints out more metadata. 

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* signer/core: accept all solidity primitive types for EIP-712 signing  (#26770)

Accept all primitive types in Solidity for EIP-712 from intN, uintN, intN[], uintN[] for N as 0 to 256 in multiples of 8

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* params: remove EF azure bootnodes (#26828)

* core/vm: use golang native big.Int (#26834)

reverts #26021, to use the upstream bigint instead.

* core/vm: fix typo in comment (#26838)

fixes eip 220 ->  2200

* core/forkid: fix issue in validation test (#26544)

This changes the test to match the comment description. Using timestampedConfig in this test case is incorrect, the comment says 'local is at Gray Glacier' and isn't aware of more forks.

* cmd/evm: update readmes for the tests (#26841)

* core, core/types: plain Message struct (#25977)

Here, the core.Message interface turns into a plain struct and
types.Message gets removed.

This is a breaking change to packages core and core/types. While we do
not promise API stability for package core, we do for core/types. An
exception can be made for types.Message, since it doesn't have any
purpose apart from invoking the state transition in package core.
types.Message was also marked deprecated by the same commit it
got added in, 4dca5d4db7 (November 2016).

The core.Message interface was added in December 2014, in commit
db494170dc, for the purpose of 'testing' state transitions. It's the
same change that made transaction struct fields private. Before that,
the state transition used *types.Transaction directly.

Over time, multiple implementations of the interface accrued across
different packages, since constructing a Message is required whenever
one wants to invoke the state transition. These implementations all
looked very similar, a struct with private fields exposing the fields
as accessor methods.

By changing Message into a struct with public fields we can remove all
these useless interface implementations. It will also hopefully
simplify future changes to the type with less updates to apply across
all of go-ethereum when a field is added to Message.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* travis: only build PPAs nightly, not on every push, too heavy (#26846)

* p2p: small comment typo (#26850)

Update server.go

* core: add Timestamp method in BlockGen (#26844)

Since forks are now scheduled by block time, it can be necessary
to check the timestamp of a block while generating transactions.

* core/txpool: implement additional DoS defenses (#26648)

This adds two new rules to the transaction pool:

- A future transaction can not evict a pending transaction.
- A transaction can not overspend available funds of a sender.

---

Co-authored-by: dwn1998 <42262393+dwn1998@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* params: go-ethereum v1.11.4 stable

* params: begin v1.11.5 release cycle

* tests: define `MuirGlacier` fork (#26856)

add muir glacier to t8n

* code/vm: fix comment typo (#26865)

it should be constantinople rather than contantinople

* core: minor code refactor (#26852)

* core: refactor code

* core: drop it from this anonymous goroutine func

* core/txpool: use priceList.Put instead of heap.Push (#26863)

Minor refactor to use the 'intended' accessor

* eth: return error if 'safe' or 'finalized' tag used pre-merge (#26862)


Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>

* .travis.yml: reenable PPA build on tag push (#26873)

* core/state, trie: port changes from PBSS (#26763)

* p2p/discover: pass invalid discv5 packets to Unhandled channel (#26699)

This makes it possible to run another protocol alongside discv5, by reading 
unhandled packets from the channel.

* all: update links in documentation (#26882)


Co-authored-by: Stephen Flynn <stephen.flynn@gapac.com>

* Increase websocket frame size (from erigon rpc client) (#26883)

This increases the maximum allowed message size to 32MB.

Originally submitted at https://github.com/ledgerwatch/erigon/pull/2739

example block failure: https://etherscan.io/tx/0x1317d973a55cedf9b0f2df6ea48e8077dd176f5444a3423368a46d6e4db89982#internal

* cmd/devp2p, cmd/geth: add version in --help output (#26895)

Not sure why this was removed, it's pretty useful to see the version
also in --help.

* core: show db error-info in case of mismatched hash root (#26870)

When a database failure occurs, bubble it up a into statedb, and report it in suitable places, such as during a 'bad block' report.

* consensus: improve consensus engine definition (#26871)

Makes clear the distinction between Finalize and FinalizedAndAssemble:

- In Finalize function, a series of state operations are applied according to consensus rules. The statedb is mutated and the root hash can be checked and compared afterwards.

This function should be used in block processing(receive afrom network and apply it locally) but not block generation.

- In FinalizeAndAssemble function, after applying state mutations, the block is also to be assembled with the latest
  state root computed, updating the header. 

 This function should be used in block generation only.

* eth/catalyst: increase update consensus timeout (#26840)

 Increases the time between consensus updates that we give the CL before we start warning the user.

* internal/ethapi: avoid int overflow in GetTransactionReceipt (#26911)

* trie, accounts/abi: add error-checks (#26914)

* rlp: support for uint256 (#26898)

This adds built-in support in package rlp for encoding, decoding and generating code dealing with uint256.Int.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* eth: fix output file permissions in admin_exportChain (#26912)

* api: Use 0700 file permissions for ExportChain

* change perm to 0644

* Update api.go

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* trie: reduce unit test time (#26918)

* core/txpool: use atomic int added in go1.19 (#26913)

Makes use of atomic.Uint64 instead of atomic by pointer

* params: schedule shanghai fork on mainnet (#26908)

Schedules the shanghai hardfork on timestamp 1681338455 as discussed on ACDE 157: https://github.com/ethereum/execution-specs/pull/727

* core/txpool: allow future local transactions  (#26930)

Local transactions should not be subject to the "future shouldn't churn pending txs" rule

* params: go-ethereum v1.11.5 stable

* params: begin v1.11.6 release cycle

* build: allow building nightly archives via cron jobs (#26938)

* log: add special casing of uint256 into the logger (#26936)

* core/rawdb: use atomic int added in go1.19 (#26935)

* core/vm: expose jumptable constructors (#26880)

When interacting with geth as a library to e.g. produce state tests, it is desirable to obtain the consensus-correct jumptable definition for a given fork. This changes adds accessors so the instructionset can be obtained and characteristics about opcodes can be inspected.

* eth/catalyst: fix races (#26950)

* core/rawdb: update freezertable read meter (#26946)

The meter for "for measuring the effective amount of data read" within the freezertable was never updated. This change remedies that. 
---------

Signed-off-by: jsvisa <delweng@gmail.com>

* cmd/evm, tests: record preimages if dump is expected (#26955)

With #25287 we made it so that preimages were not recorded by default. This had the side effect that the evm command is no longer able to dump state since it does a preimage lookup to determine the address represented by a key.

This change enables the recording of preimages when the dump command is given.

* core/state: add account address to Trie slot accessors (#26934)

This changes the Trie interface to add the plain account address as a
parameter to all storage-related methods.

After the introduction of the TryAccount* functions, TryGet, TryUpdate and
TryDelete are now only meant to read an account's storage. In their current
form, they assume that an account storage is stored in a separate trie, and
that the hashing of the slot is independent of its account's address.

The proposed structure for a stateless storage breaks these two
assumptions: the hashing of a slot key requires the address and all slots
and accounts are stored in a single trie.

This PR therefore adds an address parameter to the interface. It is ignored
in the MPT version, so this change has no functional impact, however it
will reduce the diff size when merging verkle trees.

* metrics: add cpu counters (#26796)

This PR adds counter metrics for the CPU system and the Geth process.
Currently the only metrics available for these items are gauges. Gauges are
fine when the consumer scrapes metrics data at the same interval as Geth
produces new values (every 3 seconds), but it is likely that most consumers
will not scrape that often. Intervals of 10, 15, or maybe even 30 seconds
are probably more common.

So the problem is, how does the consumer estimate what the CPU was doing in
between scrapes. With a counter, it's easy ... you just subtract two
successive values and divide by the time to get a nice, accurate average.
But with a gauge, you can't do that. A gauge reading is an instantaneous
picture of what was happening at that moment, but it gives you no idea
about what was going on between scrapes. Taking an average of values is
meaningless.

* metrics/influxdb: use smaller dependency and reuse code between v1 and v2 reporters  (#26963)

This change switches to use the smaller influxdata/influxdb1-client package instead of depending on the whole infuxdb package. The new smaller client is very similar to the influxdb-v2 client, which made it possible to refactor the two reporters to reuse code a lot more.

* eth/gasprice: change feehistory input type from int to uint64 (#26922)

Change input param type from int to uint64

* go.mod: update golang.org/x/tools (#26960)

* rlp/rlpgen: print want/expect output string if mismatch (#26932)


Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* ethclient: ensure returned subscription is nil on error (#26976)

* core/state, trie: remove Try prefix in Trie accessors (#26975)

This change renames StateTrie methods to remove the Try* prefix. 

We added the Trie methods with prefix 'Try' a long time ago, working
around the problem that most existing methods of Trie did not return the
database error. This weird naming convention has persisted until now.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* metrics/librato: ensure resp.body closed (#26969)

This change ensures that we call Close on a http response body, in various places in the source code (mostly tests)

* core/vm: use atomic.Bool (#26951)

Make use of new atomic types
---------

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/bloombits: use atomic type (#26993)

* core/state: use atomic.Bool (#26992)

* graphql: fix data races (#26965)

Fixes multiple data races caused by the fact that resolving fields are done concurrently by the graphql library. It also enforces caching at the stateobject level for account fields.

* eth/tracers/native: prevent panic for LOG edge-cases (#26848)

This PR fixes OOM panic in the callTracer as well as panicing on
opcode validation errors (e.g. stack underflow) in callTracer and
prestateTracer.

Co-authored-by: Martin Holst Swende <martin@swende.se>

* internal/debug: add log.logfmt flag to set logging to use logfmt (#26970)

* docs: update outdated DeriveSha docs comment (#26968)

* remove @gballet as a GraphQL codeowner (#27012)

* core: use atomic type (#27011)

* graphql: revert storage access regression (#27007)

* cmd/geth: Add `--log.format` cli param (#27001)

Removes the new --log.logfmt directive and hides --log.json, replacing both with log.format=(json|logfmt|terminal). The hidden log.json option is still respected if log.format is not specified for backwards compatibility.

Co-authored-by: Martin Holst Swende <martin@swende.se>

* ethdb/pebble: use atomic type (#27014)

* common: fix json marshaller MixedcaseAddress (#26998)

Fix the json marshaller of MixedcaseAddress

* eth/catalyst: improve consensus heartbeat (#26896)

improve the heartbeat function that is no longer suitable in the current situation

Co-authored-by: “openex27” <“openexkevin@gmail.com”>

* miner: use atomic type (#27013)

Use the new typed atomics in the miner package

* accounts/abi/bind: handle UnpackLog with zero topics (#26920)

Adds error handling for the case that UnpackLog or UnpackLogIntoMap is called with a log that has zero topics.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* cmd/evm: use correct parent number for t8n base fee calculation (#27032)

Currently the t8n tool uses the same block number for the current block and its parent while calculating the base fee. This causes incorrect base fee calculation for the london fork block. This commit sets the parent block number to be one less than the current block number

* go.mod : update snappy (#27027)

* common: delete MakeName (#27023)

common,p2p: remove unused function MakeName

* cmd/geth: enable log rotation (#26843)

This change enables log rotation, which can be activated using the flag --log.rotate. Additional parameters that can be given are: 

  - log.maxsize to set maximum size before files are rotated,
  - log.maxbackups to set how many files are retailed, 
  - log.maxage to configure max age of rotated files, 
  - log.compress whether to compress rotated files

The way to configure location of the logfile(s) is left unchanged, via the `log.logfile` parameter.  

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd, miner, signer: avoid panic if keystore is not available (#27039)

* cmd, miner, singer: avoid panic if keystore is not available

* cmd/geth: print warning instead of panic

* test/fuzzers: fuzz rlp handling of big.Int and uint256.Int (#26917)

test/fuzzers: fuzz rlp handling of big.Lnt and uint256.Int

* core/txpool: move some validation to outside of mutex (#27006)

Currently, most of transaction validation while holding the txpool mutex: one exception being an early-on signature check. 

This PR changes that, so that we do all non-stateful checks before we entering the mutex area. This means they can be performed in parallel, and to enable that, certain fields have been made atomic bools and uint64.

* eth/downloader: use atomic types (#27030)

* eth/downloader: use atomic type

* Update eth/downloader/downloader_test.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* Update eth/downloader/downloader_test.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/vm: clarify comment (#27045)

* consensus, core/typer: add 4844 excessDataGas to header, tie it to Cancun (#27046)

* consensus/misc, params: add EIP-4844 blobfee conversions (#27041)

* consensus/misc, params: add EIP-4844 blobfee conversions

* consensus/misc: pull in fakeExponential test cases

* consensus/misc: reuse bigints

* consensus/misc: nit renames, additional larger testcase

---------

Co-authored-by: Roberto Bayardo <bayardo@alum.mit.edu>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/tracers: report correct gasLimit in call tracers (#27029)

This includes a semantic change to the `callTracer` as well as `flatCallTracer`.
The value of field `gas` in the **first** call frame will change as follows:

- It previously contained gas available after initial deductions (i.e. tx costs)
- It will now contain the full tx gasLimit value

Signed-off-by: jsvisa <delweng@gmail.com>

* all: remove debug-field from vm config (#27048)

This PR removes the Debug field from vmconfig, making it so that if a tracer is set, debug=true is implied.

---------

Co-authored-by: 0xTylerHolmes <tyler@ethereum.org>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* metrics: make gauge_float64 and counter_float64 lock free (#27025)

Makes the float-gauges lock-free

name                      old time/op  new time/op  delta
CounterFloat64Parallel-8  1.45µs ±10%  0.85µs ± 6%  -41.65%  (p=0.008 n=5+5)

---------

Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/tracers: use atomic type (#27031)

Use the new atomic types in package eth/tracers

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* build: upgrade -dlgo version to Go 1.20.3

* core/txpool: disallow future churn by remote txs (#26907)

Prior to this change, it was possible that transactions are erroneously deemed as 'future' although they are in fact 'pending', causing them to be dropped due to 'future' not being allowed to replace 'pending'. 

This change fixes that, by doing a more in-depth inspection of the queue.

* core, miner: drop transactions from the same sender when error occurs (#27038)

This PR unifies the error handling in miner. 

Whenever an error occur while applying a transaction, the transaction should be regarded as invalid and all following transactions from the same sender not executable because of the nonce restriction. The only exception is the `nonceTooLow` error which is handled separately.

* params: new sepolia bootnodes (#27099)

New sepolia bootnodes managed by EF devops

* cmd/devp2p: fix erroneous log output in crawler (#27089)

cmd/devp2p: fix log of ignored recent nodes counter

* signer/core: rename testdata files (#27063)

Sets a meaningful name on test-files

* core: fix comment to reflect function name (#27070)

* params: remove `EIP150Hash` from chainconfig (#27087)

The EIP150Hash was an idea where, after the fork, we hardcoded the forked hash as an extra defensive mechanism. It wasn't really used, since forks weren't contentious and for all the various testnets and private networks it's been a hassle to have around. 

This change removes that config field. 

---------

Signed-off-by: jsvisa <delweng@gmail.com>

* p2p: access embedded fields of Server directly (#27078)

* consensus/ethash: use atomic type (#27068)

* cmd/devp2p: make crawler-route53-updater less verbose (#27116)

Follow-up to #26697, makes the crawler less verbose on route53-based scenarios.

It also changes the loglevel from debug to info on Updates, which are typically the root, and can be interesting to see.

* cmd/geth: rename --vmodule to --log.vmodule (#27071)

renames `--vmodule` to `--log.vmodule`, and prints a warning if the old form is used.

* core/vm: order opcodes properly (#27113)

* metrics: use atomic type (#27121)

* all: refactor trie API (#26995)

In this PR, all TryXXX(e.g. TryGet) APIs of trie are renamed to XXX(e.g. Get) with an error returned.

The original XXX(e.g. Get) APIs are renamed to MustXXX(e.g. MustGet) and does not return any error -- they print a log output. A future PR will change the behaviour to panic on errorrs.

* params: go-ethereum v1.11.6 stable

* dev: chg: regression changes for bor after merge

* dev: chg: more regression changes for bor after merge

* Use `big.Int#Set` instead of `big.Int#SetBytes` when possible (#896)

There is no reason to make the bytes transformation and back to big int to assign a big int to another one.

The `Set` method should be used instead.

* dev: chg: txpool_test regression changes after merge

* dev: chg: gomock re-generate mocks for backend interface

* dev: chg: regression changes after develop is merged into upstream-merge

* dev: chg: further fixes merging develop into upstream-merge

* dev: chg: apply changes to NewParallelBlockChain

* dev: chg: solve some TODOs

* dev: fix: CreateConsensusEngine for new ethereum objects

* dev: fix: NewParallelBlockChain using Genesis

* dev: fix: build ci.go

* dev: fix: thelper and tparallel lint

* dev: fix: http related and nilnil lint errors

* dev: fix: ineffassign lint errors

* dev: chg: comment position fix

* dev: fix: govet lint errors

* dev: fix: error related lint issues

* dev: fix: bodyclose lint issues

* dev: fix: some wsl lint issues

* dev: fix: more wsl lint issues

* dev: fix: errorcheck lint issues

* dev: fix: solve more lint issues

* dev: fix: more wsl lint issues

* dev: fix: more errcheck lint issues

* dev: fix: most of wsl lint issues

* dev: fix: all remaining  lint issues

* fixed MVHashMap being enabled even when paralellUniverse is set to 0 (#900)

* dev: fix: t.Parallel called multiple times

* dev: fix: tests failing due to t.Parallel

* fix : runtime testcases

* fix : testcase : config, addTxWithChain, burnAmount

* fix : ethhash bor burn contract

* fix : genspec config

* dev: chg: pos-1465: remove snyk and sonarqube (#908)

* fix : freezer, TestStateProcessorErrors

* core,eth,miner: fix initial test cases (#922)

* fix : TestTransactionIndices, testBeaconSync

* fix : TestBeaconSync66

* core,eth: fix TestDeduplication, TestSyncAccountPerformance, TestTraceTransaction

* fix : TestTxIndexer

* rm : multiple coinbase balance

* fix : testCommitInterruptExperimentBor

* adding balance send to burntcontract back

* Fix header encoding test

* Fix worker tracing `nil` pointer exception (#899)

The `baseFee` can be `nil` in certain situations, the tracing must not use `baseFee` unless it was checked otherwise if such case happen, Go is going to panic.

* core,eth/tracers: fix TestPrestateWithDiffModeTracer

* fixed go files

* consensus/bor,eth/filters,miner,params,tests: fix mocks

* fix : TestGraphQLConcurrentResolvers

* fix : TestBuildPayload

* common,core,miner: fix goleaks,duplicate init and inconsistent mutex (un)locks

* fix : lint

* fix : lint

* Move NumSpeculativeProcs from module variable to function parameter (#931)

This will prevent data races when more than one parallel execution are running at the same time.

* fix : test-integration

* fix : test-integration

* Calculate tx dependency only when mining is enabled (#935)

* core: restore AddFeeTransferLog post miner tipping

* fix : TestGraphQLConcurrentResolvers

* mardizzone/POS-1605: go and deps upgrade (#929)

* dev: chg: pos-1605: fix govulns by bumping golang version and replacing mongodb version

* dev: chg: pos-1605: update some dependencies to solve dependabot vulns

* dev: chg: update linter for compatibility with upgraded go version

* dev: chg: update go version in golangci lintere

* dev: chg: update go version in ci workflow, docker and travis

* dev: chg: change govulncheck version to a stable fixed one

* dev: chg: fix govulncheck version

* dev: chg: remove vulncheck version

* dev: chg: adapt tests based on go-ethereum for go version upgrade

* dev: chg: use explicit go version for templum action

* dev: chg: fix lint

* dev: chg: fix lint

* dev: chg: 1.20.x explicitly in packager

* dev: chg: ignore some additional leak to be fixed

* dev: chg: ignore some additional leak to be fixed

* dev: chg: fix lint

* rpc: add execution pool metrics (#919)

* rpc: add execution pool metrics

* rpc: stop execution pool and report metrics using ticker

* fix lint

* update go.mod, update metric report interval

* handle empty workerpool case to fix tests

* fix lint

* refactor ep metrics collection based on each service

* remove log

* rpc: convert processed metric to histogram

* lint

* Moved TxDependency Metadata to ExtraData in Block Header (#930)

* moved TxDependency Metadata to ExtraData in Block Header

* updated unit tests

* lints

* small bug fix

* small improvement

* minor bug fix

* addressed comments

* bug fix, only using the BlockExtraData structure after the Parallel Universe HF

* addressed comments

* fixed an error

* bug fix

* encoding nil ValidatorBytes and TxDependency in prepare if the current block is not the last block of the sprint

* bug fix

* fix : deadlocks

* rm: t.parallel from testQueueTimeLimiting tests

* Merge branch 'develop' into mardizzone/upstream-merge

* fix : lint

* fix : test-integration

* fix : TxDependency

* Update discord link in README.md (#938)

* add rpc.enabledeprecatedpersonal flag

* Upstream merge from go-ethereum/v1.11.6 (#901)

* ethdb/pebble: fix nil callbacks (#26650)

* eth/downloader: fix timeout resurrection panic (#26652)

* common/prque, eth/downloader: fix timeout resurrection panic

* common/prque: revert -1 hack for les, temporaryly!

* core/state, trie: remove unused error-return from trie Commit operation (#26641)

* go.mod: update pebble to latest master (#26654)

* core/vm: set tracer-observable `value` of a delegatecall to match parent `value` (#26632)

This is a breaking change in the tracing hooks API as well as semantics of the callTracer:

- CaptureEnter hook provided a nil value argument in case of DELEGATECALL. However to stay consistent with how delegate calls behave in EVM this hook is changed to pass in the value of the parent call.
- callTracer will return parent call's value for DELEGATECALL frames.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* ethdb: add benchmark test suite (#26659)

* params: schedule shanghai fork on sepolia (#26662)

* params: schedule shanghai fork on sepolia

* params: u64 -> newUint64

* eth/filters: avoid block body retrieval when no matching logs (#25199)

Logs stored on disk have minimal information. Contextual information such as block
number, index of log in block, index of transaction in block are filled in upon request.
We can fill in all these fields only having the block header and list of receipts.
But determining the transaction hash of a log requires the block body.

The goal of this PR is postponing this retrieval until we are sure we the transaction hash.
It happens often that the header bloom filter signals there might be matches in a block,
but after actually checking them reveals the logs do not match. We want to avoid fetching
the body in this case.

Note that this changes the semantics of Backend.GetLogs. Downstream callers of
GetLogs now assume log context fields have not been derived, and need to call
DeriveFields on the logs if necessary.

* eth/tracers: more fork overrides in traceBlockToFile (#26655)

This change allows all post-Berlin forks to be specified as overrides for futureForkBlock in the config parameter for traceBlockToFile.

* tests/fuzzers: supply gnark multiexp config, fixes #26669 (#26670)

This change fixes a fuzzer which broke when we updated the gnark dependency earlier.

* cmd/devp2p: reduce output of node crawler (#26674)

Our discovery crawler spits out a huge amount of logs, most of which is pretty non-interesting. This change moves the very verbose output to Debug, and adds a 8-second status log message giving the general idea about what's going on.

* params: update mainnet + rinkeby CHT (#26677)

This change updates the CHT entries for mainnet and rinkeby

* eth/filters: replace atomic pointer with value (#26689)

* eth/filters: replace atomic.Pointer

* fix

* improve

Co-authored-by: Martin Holst Swende <martin@swende.se>

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* p2p/dnsdisc: fix tests with Go 1.20 (#26690)

* eth/catalyst: return error if withdrawals are nil post-shanghai (#26691)

Spec: https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#request

* ethdb/pebble: Fix `MemTableStopWritesThreshold` (#26692)

MemTableStopWritesThreshold was set to the max size of all memtables before blocking writing but should be set to the max number of memtables. This is documented [here](https://github.com/cockroachdb/pebble/blob/master/options.go#L738-L742).

* eth/downloader: handle missing withdrawals if empty list is expected (#26675)

This PR relaxes the block body ingress handling a bit: if block body withdrawals are missing (but expected to be empty), the body withdrawals are set to 'empty list' before being passed to upper layers. 

This fixes an issue where a block passed from EthereumJS to geth was deemed invalid.

* params: go-ethereum v1.11.0 stable

* params: begin v1.11.1 release cycle

* travis, build: update Go to 1.20.1 (#26653)

travis, build: update Go to 1.20

* core: check genesis state presence by disk read (#26703)

* core, eth/downloader: make body validation more strict (#26704)

* eth/downloader: fix empty-body case in queue fetchresult (#26707)

* eth/downloader: fix typo (#26716)

* all: remove deprecated uses of math.rand (#26710)

This PR is a (superior) alternative to https://github.com/ethereum/go-ethereum/pull/26708, it handles deprecation, primarily two specific cases. 

`rand.Seed` is typically used in two ways
- `rand.Seed(time.Now().UnixNano())` -- we seed it, just to be sure to get some random, and not always get the same thing on every run. This is not needed, with global seeding, so those are just removed. 
- `rand.Seed(1)` this is typically done to ensure we have a stable test. If we rely on this, we need to fix up the tests to use a deterministic prng-source. A few occurrences like this has been replaced with a proper custom source. 

`rand.Read` has been replaced by `crypto/rand`.`Read` in this PR.

* params: go-ethereum v1.11.1 stable

* params: begin v1.11.2 release cycle

* eth/catalyst: send INVALID instead of INVALID_BLOCK_HASH (#26696)

This change will break one hive test, but pass another and it will be the better way going forward

* ci: disable coverage reporting in appveyor and travis

* eth/catalyst: request too large error (#26722)

The method `GetPayloadBodiesByRangeV1` now returns "-38004: Too large request" error if the requested range is too large, according to spec

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/trie: remove trie tracer (#26665)

This PR contains a small portion of the full pbss PR, namely

    Remove the tracer from trie (and comitter), and instead using an accessList.
    Related changes to the Nodeset.


---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* rpc: fix unmarshaling of null result in CallContext (#26723)

The change fixes unmarshaling of JSON null results into json.RawMessage.

---------

Co-authored-by: Jason Yuan <jason.yuan@curvegrid.com>
Co-authored-by: Jason Yuan <jason.yuan869@gmail.com>

* build: ship bootstrapper Go along with builder for PPA (#26731)

* build: fix setting env var, temp early exit

* build: fix gobootstrap path for the PPA

* build: add some PPA debug logs, sigh

* internal/build: revert raising the chunk size for PPA

* build: yet another weird PPA fix

* build: fix (finaly?) the PPA env vars for Go bootstrapping

* build: fix Go 1.19.0 bootstrapper issues on 386 PPA

* build: enable Lunar Lobster PPA builds

* Revert "core/trie: remove trie tracer (#26665)" (#26732)

This reverts commit 7c749c947a9d5181f5f2c1b3fdb5ea6b0e401e8e.

* cmd/geth: clarify dumpconfig options (#26729)

Clarifies the documentation around dumpconfi

Signed-off-by: Sungwoo Kim <git@sung-woo.kim>

* core, eth: merge snap-sync chain download progress logs (#26676)

* core: fix accessor mismatch for genesis state (#26747)

* core/rawdb: expose chain freezer constructor without internals (#26748)

* all: use unified emptyRootHash and emptyCodeHash (#26718)

The EmptyRootHash and EmptyCodeHash are defined everywhere in the codebase, this PR replaces all of them with unified one defined in core/types package, and also defines constants for TxRoot, WithdrawalsRoot and UncleRoot

* eth/filters: fix a breaking change and return rpctransaction (#26757)

* eth/filters: fix a breaking change and return rpctransaction

* eth/filters: fix test cases

---------

Co-authored-by: Catror <me@catror.com>

* common/math: allow HexOrDecimal to accept unquoted decimals too (#26758)

* params: release Geth v1.11.2

* params: begin v.1.11.3 release cycle

* log: improve documentation (#26753)

Add usage examples

* core/rawdb, node: use standalone flock dependency (#26633)

* eth: use the last announced finalized block as the sync ancient limit (#26685)

* cmd/devp2p: faster crawling + less verbose dns updates (#26697)

This improves the speed of DHT crawling by using concurrent requests.
It also removes logging of individual DNS updates.

* eth/tracers: add native flatCallTracer (aka parity style tracer) (#26377)

Adds support for a native call tracer with the Parity format, which outputs call frames
in a flat array. This tracer accepts the following options:

- `convertParityErrors: true` will convert error messages to match those of Parity
- `includePrecompiles: true` will report all calls to precompiles. The default
  matches Parity's behavior where CALL and STATICCALLs to precompiles are excluded

Incompatibilities with Parity include:

- Parity removes the result object in case of failure. This behavior is maintained
  with the exception of reverts. Revert output usually contains useful information,
  i.e. Solidity revert reason.
- The `gasUsed` field accounts for intrinsic gas (e.g. 21000 for simple transfers)
  and refunds unlike Parity
- Block rewards are not reported

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* core: improve withdrawal index assignment in GenerateChain (#26756)

This fixes an issue where the withdrawal index was not calculated correctly
for multiple withdrawals in a single block.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* ethdb/pebble: fix range compaction (#26771)

* ethdb/pebble: fix range compaction

* ethdb/pebble: add comment

* ethdb/pebble: fix max memorytable size (#26776)

* ethclient: include withdrawals in ethclient block responses (#26778)

* include withdrawals in ethclient responses

* omit empty withdrawals array in json serialization

* all: change chain head markers from block to header (#26777)

* core/rawdb, ethdb/pebble: disable pebble on openbsd (#26801)

* core: fix a merge fault (#26802)

* README, go.mod, event, internal/version: bump min Go to 1.19 (#26803)

* travi: remove strange leftover Go version

* core, params: schedule Shanghai on goerli (#26795)

* core: params: schedule Shanghai on goerli

* core/forkid: fix comment

* eth: remove admin.peers[i].eth.head and difficulty (#26804)

* core/types: add EffectiveGasPrice in Receipt (#26713)

This change adds a struct field EffectiveGasPrice in types.Receipt. The field is present
in RPC responses, but not in the Go struct, and thus can't easily be accessed via ethclient.

Co-authored-by: PulsarAI <dev@pulsar-systems.fi>

* core, eth/catalyst: fix race conditions in tests (#26790)

Fixes a race in TestNewPayloadOnInvalidTerminalBlock where setting the TTD raced with
the miner. Solution: set the TTD on the blockchain config not the genesis config.

Also fixes a race in CopyHeader which resulted in race reports all over the place.

* metrics: improve accuracy of CPU gauges (#26793)

This PR changes metrics collection to actually measure the time interval between collections, rather
than assume 3 seconds. I did some ad hoc profiling, and on slower hardware (eg, my Raspberry Pi 4)
I routinely saw intervals between 3.3 - 3.5 seconds, with some being as high as 4.5 seconds. This
will generally cause the CPU gauge readings to be too high, and in some cases can cause impossibly
large values for the CPU load metrics (eg. greater than 400 for a 4 core CPU).

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* ethclient: fix panic when requesting missing blocks (#26817)

This fixes a regression introduced by #26723.
Fixes #26816.

* core, miner: revert block gas counter in case of invalid transaction (#26799)

This change fixes a flaw where, in certain scenarios, the block sealer did not accurately reset the remaining gas after failing to include an invalid transaction. Fixes #26791

* internal/ethapi: add tests for transaction types JSON marshal/unmarshal (#26667)

Checks that Transaction.MarshalJSON and newRPCTransaction JSON output can be parsed by Transaction.UnmarshalJSON

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd/evm: correct `alloc` for `t8n` testdata (#26822)

Fixes a minor error in the testdata

* eth/tracers/native: set created address to nil in case of failure (#26779)

Fixes #26073

* accounts/usbwallet: mitigate ledger app chunking issue (#26773)

This PR mitigates an issue with Ledger's on-device RLP deserialization, see
https://github.com/LedgerHQ/app-ethereum/issues/409

Ledger's RLP deserialization code does not validate the length of the RLP list received,
and it may prematurely enter the signing flow when a APDU chunk boundary falls immediately
before the EIP-155 chain_id when deserializing a transaction. Since the chain_id is
uninitialized, it is 0 during this signing flow. This may cause the user to accidentally
sign the transaction with chain_id = 0. That signature would be returned from the device 1
packet earlier than expected by the communication loop. The device blocks the
second-to-last packet waiting for the signer flow, and then errors on the successive
packet (which contains the chain_id, zeroed r, and zeroed s)

Since the signature's early arrival causes successive errors during the communication
process, geth does not parse the improper signature produced by the device, and therefore
no improperly-signed transaction can be created. User funds are not at risk.

We mitigate by selecting the highest chunk size that leaves at least 4 bytes in the
final chunk.

* beacon/engine: don't omit empty withdrawals in ExecutionPayloadBodies (#26698)

This ensures the "withdrawals" field will always be present in responses
to getPayloadBodiesByRangeV1 and getPayloadBodiesByHashV1.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* build: update to go 1.20.2 (#26824)

* params: go-ethereum v1.11.3 stable

* params: begin v1.11.4 release cycle

* core/rawdb: find smallest block stored in key-value store when chain gapped (#26719)

This change prints out more information about the problem, in the case where geth detects a gap between leveldb and ancients, so we can determine more exactly where the gap is (what the first missing is). Also prints out more metadata. 

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* signer/core: accept all solidity primitive types for EIP-712 signing  (#26770)

Accept all primitive types in Solidity for EIP-712 from intN, uintN, intN[], uintN[] for N as 0 to 256 in multiples of 8

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* params: remove EF azure bootnodes (#26828)

* core/vm: use golang native big.Int (#26834)

reverts #26021, to use the upstream bigint instead.

* core/vm: fix typo in comment (#26838)

fixes eip 220 ->  2200

* core/forkid: fix issue in validation test (#26544)

This changes the test to match the comment description. Using timestampedConfig in this test case is incorrect, the comment says 'local is at Gray Glacier' and isn't aware of more forks.

* cmd/evm: update readmes for the tests (#26841)

* core, core/types: plain Message struct (#25977)

Here, the core.Message interface turns into a plain struct and
types.Message gets removed.

This is a breaking change to packages core and core/types. While we do
not promise API stability for package core, we do for core/types. An
exception can be made for types.Message, since it doesn't have any
purpose apart from invoking the state transition in package core.
types.Message was also marked deprecated by the same commit it
got added in, 4dca5d4db7 (November 2016).

The core.Message interface was added in December 2014, in commit
db494170dc, for the purpose of 'testing' state transitions. It's the
same change that made transaction struct fields private. Before that,
the state transition used *types.Transaction directly.

Over time, multiple implementations of the interface accrued across
different packages, since constructing a Message is required whenever
one wants to invoke the state transition. These implementations all
looked very similar, a struct with private fields exposing the fields
as accessor methods.

By changing Message into a struct with public fields we can remove all
these useless interface implementations. It will also hopefully
simplify future changes to the type with less updates to apply across
all of go-ethereum when a field is added to Message.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* travis: only build PPAs nightly, not on every push, too heavy (#26846)

* p2p: small comment typo (#26850)

Update server.go

* core: add Timestamp method in BlockGen (#26844)

Since forks are now scheduled by block time, it can be necessary
to check the timestamp of a block while generating transactions.

* core/txpool: implement additional DoS defenses (#26648)

This adds two new rules to the transaction pool:

- A future transaction can not evict a pending transaction.
- A transaction can not overspend available funds of a sender.

---

Co-authored-by: dwn1998 <42262393+dwn1998@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* params: go-ethereum v1.11.4 stable

* params: begin v1.11.5 release cycle

* tests: define `MuirGlacier` fork (#26856)

add muir glacier to t8n

* code/vm: fix comment typo (#26865)

it should be constantinople rather than contantinople

* core: minor code refactor (#26852)

* core: refactor code

* core: drop it from this anonymous goroutine func

* core/txpool: use priceList.Put instead of heap.Push (#26863)

Minor refactor to use the 'intended' accessor

* eth: return error if 'safe' or 'finalized' tag used pre-merge (#26862)


Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>

* .travis.yml: reenable PPA build on tag push (#26873)

* core/state, trie: port changes from PBSS (#26763)

* p2p/discover: pass invalid discv5 packets to Unhandled channel (#26699)

This makes it possible to run another protocol alongside discv5, by reading 
unhandled packets from the channel.

* all: update links in documentation (#26882)


Co-authored-by: Stephen Flynn <stephen.flynn@gapac.com>

* Increase websocket frame size (from erigon rpc client) (#26883)

This increases the maximum allowed message size to 32MB.

Originally submitted at https://github.com/ledgerwatch/erigon/pull/2739

example block failure: https://etherscan.io/tx/0x1317d973a55cedf9b0f2df6ea48e8077dd176f5444a3423368a46d6e4db89982#internal

* cmd/devp2p, cmd/geth: add version in --help output (#26895)

Not sure why this was removed, it's pretty useful to see the version
also in --help.

* core: show db error-info in case of mismatched hash root (#26870)

When a database failure occurs, bubble it up a into statedb, and report it in suitable places, such as during a 'bad block' report.

* consensus: improve consensus engine definition (#26871)

Makes clear the distinction between Finalize and FinalizedAndAssemble:

- In Finalize function, a series of state operations are applied according to consensus rules. The statedb is mutated and the root hash can be checked and compared afterwards.

This function should be used in block processing(receive afrom network and apply it locally) but not block generation.

- In FinalizeAndAssemble function, after applying state mutations, the block is also to be assembled with the latest
  state root computed, updating the header. 

 This function should be used in block generation only.

* eth/catalyst: increase update consensus timeout (#26840)

 Increases the time between consensus updates that we give the CL before we start warning the user.

* internal/ethapi: avoid int overflow in GetTransactionReceipt (#26911)

* trie, accounts/abi: add error-checks (#26914)

* rlp: support for uint256 (#26898)

This adds built-in support in package rlp for encoding, decoding and generating code dealing with uint256.Int.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* eth: fix output file permissions in admin_exportChain (#26912)

* api: Use 0700 file permissions for ExportChain

* change perm to 0644

* Update api.go

---------

Co-authored-by: Felix Lange <fjl@twurst.com>

* trie: reduce unit test time (#26918)

* core/txpool: use atomic int added in go1.19 (#26913)

Makes use of atomic.Uint64 instead of atomic by pointer

* params: schedule shanghai fork on mainnet (#26908)

Schedules the shanghai hardfork on timestamp 1681338455 as discussed on ACDE 157: https://github.com/ethereum/execution-specs/pull/727

* core/txpool: allow future local transactions  (#26930)

Local transactions should not be subject to the "future shouldn't churn pending txs" rule

* params: go-ethereum v1.11.5 stable

* params: begin v1.11.6 release cycle

* build: allow building nightly archives via cron jobs (#26938)

* log: add special casing of uint256 into the logger (#26936)

* core/rawdb: use atomic int added in go1.19 (#26935)

* core/vm: expose jumptable constructors (#26880)

When interacting with geth as a library to e.g. produce state tests, it is desirable to obtain the consensus-correct jumptable definition for a given fork. This changes adds accessors so the instructionset can be obtained and characteristics about opcodes can be inspected.

* eth/catalyst: fix races (#26950)

* core/rawdb: update freezertable read meter (#26946)

The meter for "for measuring the effective amount of data read" within the freezertable was never updated. This change remedies that. 
---------

Signed-off-by: jsvisa <delweng@gmail.com>

* cmd/evm, tests: record preimages if dump is expected (#26955)

With #25287 we made it so that preimages were not recorded by default. This had the side effect that the evm command is no longer able to dump state since it does a preimage lookup to determine the address represented by a key.

This change enables the recording of preimages when the dump command is given.

* core/state: add account address to Trie slot accessors (#26934)

This changes the Trie interface to add the plain account address as a
parameter to all storage-related methods.

After the introduction of the TryAccount* functions, TryGet, TryUpdate and
TryDelete are now only meant to read an account's storage. In their current
form, they assume that an account storage is stored in a separate trie, and
that the hashing of the slot is independent of its account's address.

The proposed structure for a stateless storage breaks these two
assumptions: the hashing of a slot key requires the address and all slots
and accounts are stored in a single trie.

This PR therefore adds an address parameter to the interface. It is ignored
in the MPT version, so this change has no functional impact, however it
will reduce the diff size when merging verkle trees.

* metrics: add cpu counters (#26796)

This PR adds counter metrics for the CPU system and the Geth process.
Currently the only metrics available for these items are gauges. Gauges are
fine when the consumer scrapes metrics data at the same interval as Geth
produces new values (every 3 seconds), but it is likely that most consumers
will not scrape that often. Intervals of 10, 15, or maybe even 30 seconds
are probably more common.

So the problem is, how does the consumer estimate what the CPU was doing in
between scrapes. With a counter, it's easy ... you just subtract two
successive values and divide by the time to get a nice, accurate average.
But with a gauge, you can't do that. A gauge reading is an instantaneous
picture of what was happening at that moment, but it gives you no idea
about what was going on between scrapes. Taking an average of values is
meaningless.

* metrics/influxdb: use smaller dependency and reuse code between v1 and v2 reporters  (#26963)

This change switches to use the smaller influxdata/influxdb1-client package instead of depending on the whole infuxdb package. The new smaller client is very similar to the influxdb-v2 client, which made it possible to refactor the two reporters to reuse code a lot more.

* eth/gasprice: change feehistory input type from int to uint64 (#26922)

Change input param type from int to uint64

* go.mod: update golang.org/x/tools (#26960)

* rlp/rlpgen: print want/expect output string if mismatch (#26932)


Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* ethclient: ensure returned subscription is nil on error (#26976)

* core/state, trie: remove Try prefix in Trie accessors (#26975)

This change renames StateTrie methods to remove the Try* prefix. 

We added the Trie methods with prefix 'Try' a long time ago, working
around the problem that most existing methods of Trie did not return the
database error. This weird naming convention has persisted until now.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* metrics/librato: ensure resp.body closed (#26969)

This change ensures that we call Close on a http response body, in various places in the source code (mostly tests)

* core/vm: use atomic.Bool (#26951)

Make use of new atomic types
---------

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/bloombits: use atomic type (#26993)

* core/state: use atomic.Bool (#26992)

* graphql: fix data races (#26965)

Fixes multiple data races caused by the fact that resolving fields are done concurrently by the graphql library. It also enforces caching at the stateobject level for account fields.

* eth/tracers/native: prevent panic for LOG edge-cases (#26848)

This PR fixes OOM panic in the callTracer as well as panicing on
opcode validation errors (e.g. stack underflow) in callTracer and
prestateTracer.

Co-authored-by: Martin Holst Swende <martin@swende.se>

* internal/debug: add log.logfmt flag to set logging to use logfmt (#26970)

* docs: update outdated DeriveSha docs comment (#26968)

* remove @gballet as a GraphQL codeowner (#27012)

* core: use atomic type (#27011)

* graphql: revert storage access regression (#27007)

* cmd/geth: Add `--log.format` cli param (#27001)

Removes the new --log.logfmt directive and hides --log.json, replacing both with log.format=(json|logfmt|terminal). The hidden log.json option is still respected if log.format is not specified for backwards compatibility.

Co-authored-by: Martin Holst Swende <martin@swende.se>

* ethdb/pebble: use atomic type (#27014)

* common: fix json marshaller MixedcaseAddress (#26998)

Fix the json marshaller of MixedcaseAddress

* eth/catalyst: improve consensus heartbeat (#26896)

improve the heartbeat function that is no longer suitable in the current situation

Co-authored-by: “openex27” <“openexkevin@gmail.com”>

* miner: use atomic type (#27013)

Use the new typed atomics in the miner package

* accounts/abi/bind: handle UnpackLog with zero topics (#26920)

Adds error handling for the case that UnpackLog or UnpackLogIntoMap is called with a log that has zero topics.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* cmd/evm: use correct parent number for t8n base fee calculation (#27032)

Currently the t8n tool uses the same block number for the current block and its parent while calculating the base fee. This causes incorrect base fee calculation for the london fork block. This commit sets the parent block number to be one less than the current block number

* go.mod : update snappy (#27027)

* common: delete MakeName (#27023)

common,p2p: remove unused function MakeName

* cmd/geth: enable log rotation (#26843)

This change enables log rotation, which can be activated using the flag --log.rotate. Additional parameters that can be given are: 

  - log.maxsize to set maximum size before files are rotated,
  - log.maxbackups to set how many files are retailed, 
  - log.maxage to configure max age of rotated files, 
  - log.compress whether to compress rotated files

The way to configure location of the logfile(s) is left unchanged, via the `log.logfile` parameter.  

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* cmd, miner, signer: avoid panic if keystore is not available (#27039)

* cmd, miner, singer: avoid panic if keystore is not available

* cmd/geth: print warning instead of panic

* test/fuzzers: fuzz rlp handling of big.Int and uint256.Int (#26917)

test/fuzzers: fuzz rlp handling of big.Lnt and uint256.Int

* core/txpool: move some validation to outside of mutex (#27006)

Currently, most of transaction validation while holding the txpool mutex: one exception being an early-on signature check. 

This PR changes that, so that we do all non-stateful checks before we entering the mutex area. This means they can be performed in parallel, and to enable that, certain fields have been made atomic bools and uint64.

* eth/downloader: use atomic types (#27030)

* eth/downloader: use atomic type

* Update eth/downloader/downloader_test.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* Update eth/downloader/downloader_test.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/vm: clarify comment (#27045)

* consensus, core/typer: add 4844 excessDataGas to header, tie it to Cancun (#27046)

* consensus/misc, params: add EIP-4844 blobfee conversions (#27041)

* consensus/misc, params: add EIP-4844 blobfee conversions

* consensus/misc: pull in fakeExponential test cases

* consensus/misc: reuse bigints

* consensus/misc: nit renames, additional larger testcase

---------

Co-authored-by: Roberto Bayardo <bayardo@alum.mit.edu>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/tracers: report correct gasLimit in call tracers (#27029)

This includes a semantic change to the `callTracer` as well as `flatCallTracer`.
The value of field `gas` in the **first** call frame will change as follows:

- It previously contained gas available after initial deductions (i.e. tx costs)
- It will now contain the full tx gasLimit value

Signed-off-by: jsvisa <delweng@gmail.com>

* all: remove debug-field from vm config (#27048)

This PR removes the Debug field from vmconfig, making it so that if a tracer is set, debug=true is implied.

---------

Co-authored-by: 0xTylerHolmes <tyler@ethereum.org>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* metrics: make gauge_float64 and counter_float64 lock free (#27025)

Makes the float-gauges lock-free

name                      old time/op  new time/op  delta
CounterFloat64Parallel-8  1.45µs ±10%  0.85µs ± 6%  -41.65%  (p=0.008 n=5+5)

---------

Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/tracers: use atomic type (#27031)

Use the new atomic types in package eth/tracers

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* build: upgrade -dlgo version to Go 1.20.3

* core/txpool: disallow future churn by remote txs (#26907)

Prior to this change, it was possible that transactions are erroneously deemed as 'future' although they are in fact 'pending', causing them to be dropped due to 'future' not being allowed to replace 'pending'. 

This change fixes that, by doing a more in-depth inspection of the queue.

* core, miner: drop transactions from the same sender when error occurs (#27038)

This PR unifies the error handling in miner. 

Whenever an error occur while applying a transaction, the transaction should be regarded as invalid and all following transactions from the same sender not executable because of the nonce restriction. The only exception is the `nonceTooLow` error which is handled separately.

* params: new sepolia bootnodes (#27099)

New sepolia bootnodes managed by EF devops

* cmd/devp2p: fix erroneous log output in crawler (#27089)

cmd/devp2p: fix log of ignored recent nodes counter

* signer/core: rename testdata files (#27063)

Sets a meaningful na…
yperbasis pushed a commit to erigontech/erigon that referenced this pull request May 29, 2024
yperbasis pushed a commit to erigontech/erigon that referenced this pull request May 29, 2024
blxdyx pushed a commit to node-real/bsc-erigon that referenced this pull request Jun 5, 2024
* fix Consensus specification tests CI (erigontech#10391) (erigontech#10396)

Cherry-pick:
erigontech@bc5fa6f

Need this to get PR CI green for v2.60.1 patches, e.g. -
erigontech#10390

Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>

* rpc/handler: do not append null to stream when json may be valid (erigontech#10390)

Cherry-pick:
erigontech@4d1c954
Relates to: erigontech#10376

* Fixed Bor Log appearing on Ethereum Mainnet (erigontech#10405) (erigontech#10420)

Cherry-pick:
erigontech@be889f6

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* fix gas price not right problem (erigontech#10456)

Cherry pick PR erigontech#10451 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* eth_estimateGas: default feeCap to base fee (erigontech#10499)

Copy PR erigontech#10495 into the release branch

* Add flag for bor waypoint types (erigontech#10501)

Cherry pick PR erigontech#10281 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>

* try to fix 'method handler crashed' for debug_traceCall of erigontech#9090 (erigontech#10502)

Cherry pick PR erigontech#10401 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* diagnostics: cherry pick speedtest disable (erigontech#10509)

Cherry pick PR erigontech#10449 into the release branch

* Enable DNS p2p discovery on holesky (erigontech#10507)

Cherry pick PR erigontech#10460 into the release branch

Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>

* fix eth_call 'method handler crashed' error when tx has set maxFeePerBlobGas (erigontech#10506)

Cherry pick PR erigontech#10452 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* e2: remove overlapped files only after merge (erigontech#10487)

Otherwise: if start after `kill -9` in the middle of merge - may remove
small files of 1 type of file, but leave small files of another type of
files (which merge was not finished) - and leave node in un-mergable
state: erigontech#10485

---------

Co-authored-by: awskii <awskii@users.noreply.github.com>

* add flag checking for pruning waypoints (erigontech#10508)

Cherry pick PR erigontech#10468 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* p2p/sentry: sentry doesn't start with ErrNoHead (erigontech#10454) (erigontech#10523)

cherry-pick erigontech#10494 to
release/2.60

* add lock to purgeMilestoneIDsList (erigontech#10524)

Cherry pick PR erigontech#10493 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* polygon/heimdall: fix checkpoint json marshalling (erigontech#10530)

Fixes a recent regression causing unwinds due to checkpoints having zero
root hash:
```
[WARN] [05-18|23:58:54.662] [bor] Root hash mismatch while whitelisting checkpoint expected=ac1c57270479250af3ce8eee90075cd8b2ba1bac55353105e063d9a4c87c743e got=0000000000000000000000000000000000000000000000000000000000000000
[WARN] [05-18|23:58:54.662] [bor] Rewinding chain due to checkpoint root hash mismatch number=57125727
```

Note this has already been fixed on Erigon 3 branch but as part of a
non-related PR -
https://github.com/ledgerwatch/erigon/pull/10124/files#diff-47d4532f399f2d6a45e6f19944a45c80bac573b4d1b5cb51485d0254229d1b16

* Fix capacity for immediate appends (erigontech#10539)

Cherry pick PR erigontech#10528 into the release branch

Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>

* core/vm: set tracer-observable value of a delegatecall to match parent value (erigontech#10370)

requested by erigontech#9549

port of ethereum/go-ethereum#26632

* params: version 2.60.1 (erigontech#10555)

* blobGasPrice should be marshalled as hex (erigontech#10571)

Cherry pick PR erigontech#10551 into the release branch

* Caplin: Fixed reforwarding of Bls Execution changes (erigontech#10577)

Cherry pick PR erigontech#10546 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (erigontech#10578)

Cherry pick PR erigontech#10512 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Update BlobSidecars Beacon API endpoint to the latest specs (erigontech#10580)

Cherry pick PR erigontech#10576 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* bor blocks retire: infinity loop fix (erigontech#10596)

Problem: `+1` was added to maxBlockNum instead of minBlockNum
for: erigontech#10554

* txpool: EIP-3860 should only apply to create transactions (erigontech#10609)

This fixes Issue erigontech#10607

---------

Co-authored-by: milen <94537774+taratorio@users.noreply.github.com>
Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
Co-authored-by: mars <marshalys@gmail.com>
Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
Co-authored-by: Dmytro <vovk.dimon@gmail.com>
Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>
Co-authored-by: awskii <awskii@users.noreply.github.com>
Co-authored-by: battlmonstr <battlmonstr@users.noreply.github.com>
Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>
blxdyx added a commit to node-real/bsc-erigon that referenced this pull request Jun 27, 2024
* fix Consensus specification tests CI (erigontech#10391) (erigontech#10396)

Cherry-pick:
erigontech@bc5fa6f

Need this to get PR CI green for v2.60.1 patches, e.g. -
erigontech#10390

Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>

* rpc/handler: do not append null to stream when json may be valid (erigontech#10390)

Cherry-pick:
erigontech@4d1c954
Relates to: erigontech#10376

* Fixed Bor Log appearing on Ethereum Mainnet (erigontech#10405) (erigontech#10420)

Cherry-pick:
erigontech@be889f6

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* fix gas price not right problem (erigontech#10456)

Cherry pick PR erigontech#10451 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* eth_estimateGas: default feeCap to base fee (erigontech#10499)

Copy PR erigontech#10495 into the release branch

* Add flag for bor waypoint types (erigontech#10501)

Cherry pick PR erigontech#10281 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>

* try to fix 'method handler crashed' for debug_traceCall of erigontech#9090 (erigontech#10502)

Cherry pick PR erigontech#10401 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* diagnostics: cherry pick speedtest disable (erigontech#10509)

Cherry pick PR erigontech#10449 into the release branch

* Enable DNS p2p discovery on holesky (erigontech#10507)

Cherry pick PR erigontech#10460 into the release branch

Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>

* fix eth_call 'method handler crashed' error when tx has set maxFeePerBlobGas (erigontech#10506)

Cherry pick PR erigontech#10452 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* e2: remove overlapped files only after merge (erigontech#10487)

Otherwise: if start after `kill -9` in the middle of merge - may remove
small files of 1 type of file, but leave small files of another type of
files (which merge was not finished) - and leave node in un-mergable
state: erigontech#10485

---------

Co-authored-by: awskii <awskii@users.noreply.github.com>

* add flag checking for pruning waypoints (erigontech#10508)

Cherry pick PR erigontech#10468 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* p2p/sentry: sentry doesn't start with ErrNoHead (erigontech#10454) (erigontech#10523)

cherry-pick erigontech#10494 to
release/2.60

* add lock to purgeMilestoneIDsList (erigontech#10524)

Cherry pick PR erigontech#10493 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* polygon/heimdall: fix checkpoint json marshalling (erigontech#10530)

Fixes a recent regression causing unwinds due to checkpoints having zero
root hash:
```
[WARN] [05-18|23:58:54.662] [bor] Root hash mismatch while whitelisting checkpoint expected=ac1c57270479250af3ce8eee90075cd8b2ba1bac55353105e063d9a4c87c743e got=0000000000000000000000000000000000000000000000000000000000000000
[WARN] [05-18|23:58:54.662] [bor] Rewinding chain due to checkpoint root hash mismatch number=57125727
```

Note this has already been fixed on Erigon 3 branch but as part of a
non-related PR -
https://github.com/ledgerwatch/erigon/pull/10124/files#diff-47d4532f399f2d6a45e6f19944a45c80bac573b4d1b5cb51485d0254229d1b16

* Fix capacity for immediate appends (erigontech#10539)

Cherry pick PR erigontech#10528 into the release branch

Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>

* core/vm: set tracer-observable value of a delegatecall to match parent value (erigontech#10370)

requested by erigontech#9549

port of ethereum/go-ethereum#26632

* params: version 2.60.1 (erigontech#10555)

* blobGasPrice should be marshalled as hex (erigontech#10571)

Cherry pick PR erigontech#10551 into the release branch

* Caplin: Fixed reforwarding of Bls Execution changes (erigontech#10577)

Cherry pick PR erigontech#10546 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (erigontech#10578)

Cherry pick PR erigontech#10512 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Update BlobSidecars Beacon API endpoint to the latest specs (erigontech#10580)

Cherry pick PR erigontech#10576 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* bor blocks retire: infinity loop fix (erigontech#10596)

Problem: `+1` was added to maxBlockNum instead of minBlockNum
for: erigontech#10554

* txpool: EIP-3860 should only apply to create transactions (erigontech#10609)

This fixes Issue erigontech#10607

* qa-tests: update 2.60.x test workflows from main (erigontech#10627)

* Fix potential p2p shutdown hangup (erigontech#10626)

This is a fix for: 

erigontech#10192

This fixes is a deadlock in v4_udp.go where 
* Thread A waits on mutex.Lock() in resetTimeout() called after reading
listUpdate channel.
* Thread B waits on listUpdate <- plist.PushBack(p) called after locking
mutex.Lock()
  
This fix decouples the list operations which need locking from the
channel operations which don't by storing the changes in local
variables. These updates are used for resetting a timeout - which is not
order dependent.

* downloader: Number of DNS requests seem excessive (erigontech#5145) (erigontech#10739)

cherry-pick erigontech#10693 to release

* rpc: Fix incorrect txfeecap (erigontech#10643)

Cherry pick PR erigontech#10636 to
Erigon 2

* downloader: don't block erigon startup if devs deploy new hashes (of same files) (erigontech#10761)

* skip hidden files when list files with given extension  (erigontech#10654)

for erigontech#10644

* qa-tests: backport to release/2.60 improvements made to e3 github action workflows (erigontech#10778)

This PR backports improvements that we added to the E3 tests: recording
runner name and db version used for testing on MongoDB database.

* e2: more snaps (all networks) (erigontech#10794)

* e2: configurable hashers amount (erigontech#10785)

* Revert "e2: configurable hashers amount" (erigontech#10834)

* diagnostics: move E3 changes to E2 (erigontech#10806)

Merged all the work done from main branch to keep diagnostics up to
date.

* Downloader: fix staticpeers flag (erigontech#10798)

Cherry pick erigontech#10792

* Fix NewPayload Validation during header download (erigontech#10837)

Cherry pick PR erigontech#10093 into the release branch

Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>

* e2: mainnet blob 9.3M (erigontech#10842)

* Fix gas fee calculation for debug calls (erigontech#10880)

Cherry pick PR erigontech#10825 into the release branch

Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>

* Revert "eth_estimateGas: default feeCap to base fee (erigontech#10499)" (erigontech#10904)

This reverts PR erigontech#10499. See
erigontech#10495 (comment)
and PR erigontech#10901

* params: version 2.60.2 (erigontech#10905)

* upstream v2.60.2

* fix ci lint

---------

Co-authored-by: milen <94537774+taratorio@users.noreply.github.com>
Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
Co-authored-by: mars <marshalys@gmail.com>
Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
Co-authored-by: Dmytro <vovk.dimon@gmail.com>
Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>
Co-authored-by: awskii <awskii@users.noreply.github.com>
Co-authored-by: battlmonstr <battlmonstr@users.noreply.github.com>
Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>
Co-authored-by: Michelangelo Riccobene <michelangelo.riccobene@gmail.com>
Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>
MakarovSg pushed a commit to chainstack/bsc-erigon that referenced this pull request Jul 2, 2024
* fix Consensus specification tests CI (erigontech#10391) (erigontech#10396)

Cherry-pick:
erigontech@bc5fa6f

Need this to get PR CI green for v2.60.1 patches, e.g. -
erigontech#10390

Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>

* rpc/handler: do not append null to stream when json may be valid (erigontech#10390)

Cherry-pick:
erigontech@4d1c954
Relates to: erigontech#10376

* Fixed Bor Log appearing on Ethereum Mainnet (erigontech#10405) (erigontech#10420)

Cherry-pick:
erigontech@be889f6

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* fix gas price not right problem (erigontech#10456)

Cherry pick PR erigontech#10451 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* eth_estimateGas: default feeCap to base fee (erigontech#10499)

Copy PR erigontech#10495 into the release branch

* Add flag for bor waypoint types (erigontech#10501)

Cherry pick PR erigontech#10281 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>

* try to fix 'method handler crashed' for debug_traceCall of erigontech#9090 (erigontech#10502)

Cherry pick PR erigontech#10401 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* diagnostics: cherry pick speedtest disable (erigontech#10509)

Cherry pick PR erigontech#10449 into the release branch

* Enable DNS p2p discovery on holesky (erigontech#10507)

Cherry pick PR erigontech#10460 into the release branch

Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>

* fix eth_call 'method handler crashed' error when tx has set maxFeePerBlobGas (erigontech#10506)

Cherry pick PR erigontech#10452 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* e2: remove overlapped files only after merge (erigontech#10487)

Otherwise: if start after `kill -9` in the middle of merge - may remove
small files of 1 type of file, but leave small files of another type of
files (which merge was not finished) - and leave node in un-mergable
state: erigontech#10485

---------

Co-authored-by: awskii <awskii@users.noreply.github.com>

* add flag checking for pruning waypoints (erigontech#10508)

Cherry pick PR erigontech#10468 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* p2p/sentry: sentry doesn't start with ErrNoHead (erigontech#10454) (erigontech#10523)

cherry-pick erigontech#10494 to
release/2.60

* add lock to purgeMilestoneIDsList (erigontech#10524)

Cherry pick PR erigontech#10493 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* polygon/heimdall: fix checkpoint json marshalling (erigontech#10530)

Fixes a recent regression causing unwinds due to checkpoints having zero
root hash:
```
[WARN] [05-18|23:58:54.662] [bor] Root hash mismatch while whitelisting checkpoint expected=ac1c57270479250af3ce8eee90075cd8b2ba1bac55353105e063d9a4c87c743e got=0000000000000000000000000000000000000000000000000000000000000000
[WARN] [05-18|23:58:54.662] [bor] Rewinding chain due to checkpoint root hash mismatch number=57125727
```

Note this has already been fixed on Erigon 3 branch but as part of a
non-related PR -
https://github.com/ledgerwatch/erigon/pull/10124/files#diff-47d4532f399f2d6a45e6f19944a45c80bac573b4d1b5cb51485d0254229d1b16

* Fix capacity for immediate appends (erigontech#10539)

Cherry pick PR erigontech#10528 into the release branch

Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>

* core/vm: set tracer-observable value of a delegatecall to match parent value (erigontech#10370)

requested by erigontech#9549

port of ethereum/go-ethereum#26632

* params: version 2.60.1 (erigontech#10555)

* blobGasPrice should be marshalled as hex (erigontech#10571)

Cherry pick PR erigontech#10551 into the release branch

* Caplin: Fixed reforwarding of Bls Execution changes (erigontech#10577)

Cherry pick PR erigontech#10546 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (erigontech#10578)

Cherry pick PR erigontech#10512 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Update BlobSidecars Beacon API endpoint to the latest specs (erigontech#10580)

Cherry pick PR erigontech#10576 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* bor blocks retire: infinity loop fix (erigontech#10596)

Problem: `+1` was added to maxBlockNum instead of minBlockNum
for: erigontech#10554

* txpool: EIP-3860 should only apply to create transactions (erigontech#10609)

This fixes Issue erigontech#10607

---------

Co-authored-by: milen <94537774+taratorio@users.noreply.github.com>
Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
Co-authored-by: mars <marshalys@gmail.com>
Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
Co-authored-by: Dmytro <vovk.dimon@gmail.com>
Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>
Co-authored-by: awskii <awskii@users.noreply.github.com>
Co-authored-by: battlmonstr <battlmonstr@users.noreply.github.com>
Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>
MakarovSg pushed a commit to chainstack/bsc-erigon that referenced this pull request Jul 2, 2024
* fix Consensus specification tests CI (erigontech#10391) (erigontech#10396)

Cherry-pick:
erigontech@bc5fa6f

Need this to get PR CI green for v2.60.1 patches, e.g. -
erigontech#10390

Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>

* rpc/handler: do not append null to stream when json may be valid (erigontech#10390)

Cherry-pick:
erigontech@4d1c954
Relates to: erigontech#10376

* Fixed Bor Log appearing on Ethereum Mainnet (erigontech#10405) (erigontech#10420)

Cherry-pick:
erigontech@be889f6

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* fix gas price not right problem (erigontech#10456)

Cherry pick PR erigontech#10451 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* eth_estimateGas: default feeCap to base fee (erigontech#10499)

Copy PR erigontech#10495 into the release branch

* Add flag for bor waypoint types (erigontech#10501)

Cherry pick PR erigontech#10281 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>

* try to fix 'method handler crashed' for debug_traceCall of erigontech#9090 (erigontech#10502)

Cherry pick PR erigontech#10401 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* diagnostics: cherry pick speedtest disable (erigontech#10509)

Cherry pick PR erigontech#10449 into the release branch

* Enable DNS p2p discovery on holesky (erigontech#10507)

Cherry pick PR erigontech#10460 into the release branch

Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>

* fix eth_call 'method handler crashed' error when tx has set maxFeePerBlobGas (erigontech#10506)

Cherry pick PR erigontech#10452 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* e2: remove overlapped files only after merge (erigontech#10487)

Otherwise: if start after `kill -9` in the middle of merge - may remove
small files of 1 type of file, but leave small files of another type of
files (which merge was not finished) - and leave node in un-mergable
state: erigontech#10485

---------

Co-authored-by: awskii <awskii@users.noreply.github.com>

* add flag checking for pruning waypoints (erigontech#10508)

Cherry pick PR erigontech#10468 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* p2p/sentry: sentry doesn't start with ErrNoHead (erigontech#10454) (erigontech#10523)

cherry-pick erigontech#10494 to
release/2.60

* add lock to purgeMilestoneIDsList (erigontech#10524)

Cherry pick PR erigontech#10493 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* polygon/heimdall: fix checkpoint json marshalling (erigontech#10530)

Fixes a recent regression causing unwinds due to checkpoints having zero
root hash:
```
[WARN] [05-18|23:58:54.662] [bor] Root hash mismatch while whitelisting checkpoint expected=ac1c57270479250af3ce8eee90075cd8b2ba1bac55353105e063d9a4c87c743e got=0000000000000000000000000000000000000000000000000000000000000000
[WARN] [05-18|23:58:54.662] [bor] Rewinding chain due to checkpoint root hash mismatch number=57125727
```

Note this has already been fixed on Erigon 3 branch but as part of a
non-related PR -
https://github.com/ledgerwatch/erigon/pull/10124/files#diff-47d4532f399f2d6a45e6f19944a45c80bac573b4d1b5cb51485d0254229d1b16

* Fix capacity for immediate appends (erigontech#10539)

Cherry pick PR erigontech#10528 into the release branch

Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>

* core/vm: set tracer-observable value of a delegatecall to match parent value (erigontech#10370)

requested by erigontech#9549

port of ethereum/go-ethereum#26632

* params: version 2.60.1 (erigontech#10555)

* blobGasPrice should be marshalled as hex (erigontech#10571)

Cherry pick PR erigontech#10551 into the release branch

* Caplin: Fixed reforwarding of Bls Execution changes (erigontech#10577)

Cherry pick PR erigontech#10546 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (erigontech#10578)

Cherry pick PR erigontech#10512 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Update BlobSidecars Beacon API endpoint to the latest specs (erigontech#10580)

Cherry pick PR erigontech#10576 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* bor blocks retire: infinity loop fix (erigontech#10596)

Problem: `+1` was added to maxBlockNum instead of minBlockNum
for: erigontech#10554

* txpool: EIP-3860 should only apply to create transactions (erigontech#10609)

This fixes Issue erigontech#10607

* qa-tests: update 2.60.x test workflows from main (erigontech#10627)

* Fix potential p2p shutdown hangup (erigontech#10626)

This is a fix for: 

erigontech#10192

This fixes is a deadlock in v4_udp.go where 
* Thread A waits on mutex.Lock() in resetTimeout() called after reading
listUpdate channel.
* Thread B waits on listUpdate <- plist.PushBack(p) called after locking
mutex.Lock()
  
This fix decouples the list operations which need locking from the
channel operations which don't by storing the changes in local
variables. These updates are used for resetting a timeout - which is not
order dependent.

* downloader: Number of DNS requests seem excessive (erigontech#5145) (erigontech#10739)

cherry-pick erigontech#10693 to release

* rpc: Fix incorrect txfeecap (erigontech#10643)

Cherry pick PR erigontech#10636 to
Erigon 2

* downloader: don't block erigon startup if devs deploy new hashes (of same files) (erigontech#10761)

* skip hidden files when list files with given extension  (erigontech#10654)

for erigontech#10644

* qa-tests: backport to release/2.60 improvements made to e3 github action workflows (erigontech#10778)

This PR backports improvements that we added to the E3 tests: recording
runner name and db version used for testing on MongoDB database.

* e2: more snaps (all networks) (erigontech#10794)

* e2: configurable hashers amount (erigontech#10785)

* Revert "e2: configurable hashers amount" (erigontech#10834)

* diagnostics: move E3 changes to E2 (erigontech#10806)

Merged all the work done from main branch to keep diagnostics up to
date.

* Downloader: fix staticpeers flag (erigontech#10798)

Cherry pick erigontech#10792

* Fix NewPayload Validation during header download (erigontech#10837)

Cherry pick PR erigontech#10093 into the release branch

Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>

* e2: mainnet blob 9.3M (erigontech#10842)

* Fix gas fee calculation for debug calls (erigontech#10880)

Cherry pick PR erigontech#10825 into the release branch

Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>

* Revert "eth_estimateGas: default feeCap to base fee (erigontech#10499)" (erigontech#10904)

This reverts PR erigontech#10499. See
erigontech#10495 (comment)
and PR erigontech#10901

* params: version 2.60.2 (erigontech#10905)

* upstream v2.60.2

* fix ci lint

---------

Co-authored-by: milen <94537774+taratorio@users.noreply.github.com>
Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
Co-authored-by: mars <marshalys@gmail.com>
Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
Co-authored-by: Dmytro <vovk.dimon@gmail.com>
Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>
Co-authored-by: awskii <awskii@users.noreply.github.com>
Co-authored-by: battlmonstr <battlmonstr@users.noreply.github.com>
Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>
Co-authored-by: Michelangelo Riccobene <michelangelo.riccobene@gmail.com>
Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>
MakarovSg pushed a commit to chainstack/bsc-erigon that referenced this pull request Jul 19, 2024
* fix Consensus specification tests CI (erigontech#10391) (erigontech#10396)

Cherry-pick:
erigontech@bc5fa6f

Need this to get PR CI green for v2.60.1 patches, e.g. -
erigontech#10390

Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>

* rpc/handler: do not append null to stream when json may be valid (erigontech#10390)

Cherry-pick:
erigontech@4d1c954
Relates to: erigontech#10376

* Fixed Bor Log appearing on Ethereum Mainnet (erigontech#10405) (erigontech#10420)

Cherry-pick:
erigontech@be889f6

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* fix gas price not right problem (erigontech#10456)

Cherry pick PR erigontech#10451 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* eth_estimateGas: default feeCap to base fee (erigontech#10499)

Copy PR erigontech#10495 into the release branch

* Add flag for bor waypoint types (erigontech#10501)

Cherry pick PR erigontech#10281 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>

* try to fix 'method handler crashed' for debug_traceCall of erigontech#9090 (erigontech#10502)

Cherry pick PR erigontech#10401 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* diagnostics: cherry pick speedtest disable (erigontech#10509)

Cherry pick PR erigontech#10449 into the release branch

* Enable DNS p2p discovery on holesky (erigontech#10507)

Cherry pick PR erigontech#10460 into the release branch

Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>

* fix eth_call 'method handler crashed' error when tx has set maxFeePerBlobGas (erigontech#10506)

Cherry pick PR erigontech#10452 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* e2: remove overlapped files only after merge (erigontech#10487)

Otherwise: if start after `kill -9` in the middle of merge - may remove
small files of 1 type of file, but leave small files of another type of
files (which merge was not finished) - and leave node in un-mergable
state: erigontech#10485

---------

Co-authored-by: awskii <awskii@users.noreply.github.com>

* add flag checking for pruning waypoints (erigontech#10508)

Cherry pick PR erigontech#10468 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* p2p/sentry: sentry doesn't start with ErrNoHead (erigontech#10454) (erigontech#10523)

cherry-pick erigontech#10494 to
release/2.60

* add lock to purgeMilestoneIDsList (erigontech#10524)

Cherry pick PR erigontech#10493 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* polygon/heimdall: fix checkpoint json marshalling (erigontech#10530)

Fixes a recent regression causing unwinds due to checkpoints having zero
root hash:
```
[WARN] [05-18|23:58:54.662] [bor] Root hash mismatch while whitelisting checkpoint expected=ac1c57270479250af3ce8eee90075cd8b2ba1bac55353105e063d9a4c87c743e got=0000000000000000000000000000000000000000000000000000000000000000
[WARN] [05-18|23:58:54.662] [bor] Rewinding chain due to checkpoint root hash mismatch number=57125727
```

Note this has already been fixed on Erigon 3 branch but as part of a
non-related PR -
https://github.com/ledgerwatch/erigon/pull/10124/files#diff-47d4532f399f2d6a45e6f19944a45c80bac573b4d1b5cb51485d0254229d1b16

* Fix capacity for immediate appends (erigontech#10539)

Cherry pick PR erigontech#10528 into the release branch

Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>

* core/vm: set tracer-observable value of a delegatecall to match parent value (erigontech#10370)

requested by erigontech#9549

port of ethereum/go-ethereum#26632

* params: version 2.60.1 (erigontech#10555)

* blobGasPrice should be marshalled as hex (erigontech#10571)

Cherry pick PR erigontech#10551 into the release branch

* Caplin: Fixed reforwarding of Bls Execution changes (erigontech#10577)

Cherry pick PR erigontech#10546 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (erigontech#10578)

Cherry pick PR erigontech#10512 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Update BlobSidecars Beacon API endpoint to the latest specs (erigontech#10580)

Cherry pick PR erigontech#10576 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* bor blocks retire: infinity loop fix (erigontech#10596)

Problem: `+1` was added to maxBlockNum instead of minBlockNum
for: erigontech#10554

* txpool: EIP-3860 should only apply to create transactions (erigontech#10609)

This fixes Issue erigontech#10607

---------

Co-authored-by: milen <94537774+taratorio@users.noreply.github.com>
Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
Co-authored-by: mars <marshalys@gmail.com>
Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
Co-authored-by: Dmytro <vovk.dimon@gmail.com>
Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>
Co-authored-by: awskii <awskii@users.noreply.github.com>
Co-authored-by: battlmonstr <battlmonstr@users.noreply.github.com>
Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>
MakarovSg pushed a commit to chainstack/bsc-erigon that referenced this pull request Jul 19, 2024
* fix Consensus specification tests CI (erigontech#10391) (erigontech#10396)

Cherry-pick:
erigontech@bc5fa6f

Need this to get PR CI green for v2.60.1 patches, e.g. -
erigontech#10390

Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>

* rpc/handler: do not append null to stream when json may be valid (erigontech#10390)

Cherry-pick:
erigontech@4d1c954
Relates to: erigontech#10376

* Fixed Bor Log appearing on Ethereum Mainnet (erigontech#10405) (erigontech#10420)

Cherry-pick:
erigontech@be889f6

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* fix gas price not right problem (erigontech#10456)

Cherry pick PR erigontech#10451 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* eth_estimateGas: default feeCap to base fee (erigontech#10499)

Copy PR erigontech#10495 into the release branch

* Add flag for bor waypoint types (erigontech#10501)

Cherry pick PR erigontech#10281 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>

* try to fix 'method handler crashed' for debug_traceCall of erigontech#9090 (erigontech#10502)

Cherry pick PR erigontech#10401 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* diagnostics: cherry pick speedtest disable (erigontech#10509)

Cherry pick PR erigontech#10449 into the release branch

* Enable DNS p2p discovery on holesky (erigontech#10507)

Cherry pick PR erigontech#10460 into the release branch

Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>

* fix eth_call 'method handler crashed' error when tx has set maxFeePerBlobGas (erigontech#10506)

Cherry pick PR erigontech#10452 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* e2: remove overlapped files only after merge (erigontech#10487)

Otherwise: if start after `kill -9` in the middle of merge - may remove
small files of 1 type of file, but leave small files of another type of
files (which merge was not finished) - and leave node in un-mergable
state: erigontech#10485

---------

Co-authored-by: awskii <awskii@users.noreply.github.com>

* add flag checking for pruning waypoints (erigontech#10508)

Cherry pick PR erigontech#10468 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* p2p/sentry: sentry doesn't start with ErrNoHead (erigontech#10454) (erigontech#10523)

cherry-pick erigontech#10494 to
release/2.60

* add lock to purgeMilestoneIDsList (erigontech#10524)

Cherry pick PR erigontech#10493 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* polygon/heimdall: fix checkpoint json marshalling (erigontech#10530)

Fixes a recent regression causing unwinds due to checkpoints having zero
root hash:
```
[WARN] [05-18|23:58:54.662] [bor] Root hash mismatch while whitelisting checkpoint expected=ac1c57270479250af3ce8eee90075cd8b2ba1bac55353105e063d9a4c87c743e got=0000000000000000000000000000000000000000000000000000000000000000
[WARN] [05-18|23:58:54.662] [bor] Rewinding chain due to checkpoint root hash mismatch number=57125727
```

Note this has already been fixed on Erigon 3 branch but as part of a
non-related PR -
https://github.com/ledgerwatch/erigon/pull/10124/files#diff-47d4532f399f2d6a45e6f19944a45c80bac573b4d1b5cb51485d0254229d1b16

* Fix capacity for immediate appends (erigontech#10539)

Cherry pick PR erigontech#10528 into the release branch

Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>

* core/vm: set tracer-observable value of a delegatecall to match parent value (erigontech#10370)

requested by erigontech#9549

port of ethereum/go-ethereum#26632

* params: version 2.60.1 (erigontech#10555)

* blobGasPrice should be marshalled as hex (erigontech#10571)

Cherry pick PR erigontech#10551 into the release branch

* Caplin: Fixed reforwarding of Bls Execution changes (erigontech#10577)

Cherry pick PR erigontech#10546 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (erigontech#10578)

Cherry pick PR erigontech#10512 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Update BlobSidecars Beacon API endpoint to the latest specs (erigontech#10580)

Cherry pick PR erigontech#10576 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* bor blocks retire: infinity loop fix (erigontech#10596)

Problem: `+1` was added to maxBlockNum instead of minBlockNum
for: erigontech#10554

* txpool: EIP-3860 should only apply to create transactions (erigontech#10609)

This fixes Issue erigontech#10607

* qa-tests: update 2.60.x test workflows from main (erigontech#10627)

* Fix potential p2p shutdown hangup (erigontech#10626)

This is a fix for: 

erigontech#10192

This fixes is a deadlock in v4_udp.go where 
* Thread A waits on mutex.Lock() in resetTimeout() called after reading
listUpdate channel.
* Thread B waits on listUpdate <- plist.PushBack(p) called after locking
mutex.Lock()
  
This fix decouples the list operations which need locking from the
channel operations which don't by storing the changes in local
variables. These updates are used for resetting a timeout - which is not
order dependent.

* downloader: Number of DNS requests seem excessive (erigontech#5145) (erigontech#10739)

cherry-pick erigontech#10693 to release

* rpc: Fix incorrect txfeecap (erigontech#10643)

Cherry pick PR erigontech#10636 to
Erigon 2

* downloader: don't block erigon startup if devs deploy new hashes (of same files) (erigontech#10761)

* skip hidden files when list files with given extension  (erigontech#10654)

for erigontech#10644

* qa-tests: backport to release/2.60 improvements made to e3 github action workflows (erigontech#10778)

This PR backports improvements that we added to the E3 tests: recording
runner name and db version used for testing on MongoDB database.

* e2: more snaps (all networks) (erigontech#10794)

* e2: configurable hashers amount (erigontech#10785)

* Revert "e2: configurable hashers amount" (erigontech#10834)

* diagnostics: move E3 changes to E2 (erigontech#10806)

Merged all the work done from main branch to keep diagnostics up to
date.

* Downloader: fix staticpeers flag (erigontech#10798)

Cherry pick erigontech#10792

* Fix NewPayload Validation during header download (erigontech#10837)

Cherry pick PR erigontech#10093 into the release branch

Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>

* e2: mainnet blob 9.3M (erigontech#10842)

* Fix gas fee calculation for debug calls (erigontech#10880)

Cherry pick PR erigontech#10825 into the release branch

Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>

* Revert "eth_estimateGas: default feeCap to base fee (erigontech#10499)" (erigontech#10904)

This reverts PR erigontech#10499. See
erigontech#10495 (comment)
and PR erigontech#10901

* params: version 2.60.2 (erigontech#10905)

* upstream v2.60.2

* fix ci lint

---------

Co-authored-by: milen <94537774+taratorio@users.noreply.github.com>
Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
Co-authored-by: mars <marshalys@gmail.com>
Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
Co-authored-by: Dmytro <vovk.dimon@gmail.com>
Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>
Co-authored-by: awskii <awskii@users.noreply.github.com>
Co-authored-by: battlmonstr <battlmonstr@users.noreply.github.com>
Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>
Co-authored-by: Michelangelo Riccobene <michelangelo.riccobene@gmail.com>
Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>
hexoscott added a commit to 0xPolygonHermez/cdk-erigon that referenced this pull request Oct 9, 2024
* mdbx: `Batch()` (erigontech#9999)

This task is mostly implemented to be used in
`erigon/erigon-lib/downloader/mdbx_piece_completion.go` and maybe in
`nodesDB` (where we need many parallel RwTx)

I was agains adding this "trick"/"api" last years, because thought that
we can implement our App to be more 1-big-rwtx-friendly. And we did it
in Erigon - StagedSync. TxPool also did, but with a bit less happy face
- by "map+mutex with periodic flush to db". But `anacrolix/torrent` is
external library and unlikely will survive such big mind-model-change.
Maybe it's time to add `db.Batch()`.

#### Batch Rw transactions

Each `DB.Update()` waits for disk to commit the writes. This overhead
can be minimized by combining multiple updates with the `DB.Batch()`
function:

```go
err := db.Batch(func(tx *bolt.Tx) error {
	...
	return nil
})
```

Concurrent Batch calls are opportunistically combined into larger
transactions. Batch is only useful when there are multiple goroutines
calling it.

The trade-off is that `Batch` can call the given
function multiple times, if parts of the transaction fail. The
function must be idempotent and side effects must take effect only
after a successful return from `DB.Batch()`.

For example: don't display messages from inside the function, instead
set variables in the enclosing scope:

```go
var id uint64
err := db.Batch(func(tx *bolt.Tx) error {
	// Find last key in bucket, decode as bigendian uint64, increment
	// by one, encode back to []byte, and add new key.
	...
	id = newValue
	return nil
})
if err != nil {
	return ...
}
fmt.Println("Allocated ID %d", id)
```


---- 

Implementation mostly taken from
https://github.com/etcd-io/bbolt/?tab=readme-ov-file#batch-read-write-transactions

Maybe in future can push-down it to
https://github.com/erigontech/mdbx-go

* downloader: rename TorrentFiles to AtomicTorrentFS (erigontech#10005)

* Caplin: indexing to use right buf size  (erigontech#9998)

- PutUvarint can produce 10 bytes
- re-using buffer - faster and less gc

* First round of fixes in making gossip publishing good for the validator: See comment (erigontech#9972)

* Fixed and simplified unaggregated bits check.
* There are 2 bits on, one for the attester and one for the
End-of-bitlist, needed to account for end of bitlist bit
 * Wrong publishing topic for sync_committee_ messages
* Added more Ignore by receiving specific errors to avoid forwarding
useless data.
 * Replaced `validateAttestation` with full message processing
 * Fixed forwarding of sync committee aggregates
 * Fixed subnet announcements

---------

Co-authored-by: kewei <kewei.train@gmail.com>

* Downloader: atomic-fs to be less smart. if app called - Create() - don't check .lock. Otherwise can't create .torrent for existing .seg files. (erigontech#10004)

* Implement the optional output field on ots_traceTransaction (erigontech#10014)

This is for E2.

It implements the backward compatible output field for traces on
ots_traceTransaction: otterscan/execution-apis#1

It'll be consumed by Otterscan in an upcoming release of this feature:
otterscan/otterscan#1530

* polygon/sync: Clean shutdown (erigontech#10017)

* re-gen mock files (erigontech#10007)

there was error:
```
prog.go:12:2: missing go.sum entry for module providing package github.com/golang/mock/mockgen/model; to add:
	go mod download github.com/golang/mock
```

* rename aggv3 to agg (erigontech#10011)

* chain-config: capital IsOsaka (erigontech#9989)

To Follow suit with rest of the naming

* move more services out from ForkchoiceStore (erigontech#9981)

- voluntary_exit
- bls_to_execution_change
- proposer_slashing
- expirable lru

---------

Co-authored-by: Giulio <giulio.rebuffo@gmail.com>

* WP - dvovk/diagnostics downloader print (erigontech#10000)

Added command which prints to console diagnostics data. In this initial
version it is possible to print stages list and snapshot download
progress. Erigon should be running with --metrics flag
There are two available commands:
- "downloader"
- "stages" "current"
There are two possible options for output: text and json
Run command - ./build/bin/diag [command] [text | json]

---------

Co-authored-by: Mark Holt <mark@distributed.vision>

* move `temporal` package to erigon-lib (erigontech#10015)

Co-authored-by: awskii <artem.tsskiy@gmail.com>

* downloader: more durable db mode  (erigontech#10010)

* Added body close on retry for downloader round trip (erigontech#10008)

Add missing body close method when webseed roundtrip is retried

* Set block baseFeePerGas value in graphql response (erigontech#9974)

Set baseFeePerGas value in graphql resolver for block

* vm: Rename stateTransition gas to gasRemaining (erigontech#10025)

The `StateTransition` property `gas` actually tracks the remaining gas
in the current context. This PR is to improve code readability.
Geth also uses similar naming.

* chore: fix function names in comment (erigontech#9987)

Signed-off-by: fuyangpengqi <995764973@qq.com>

* sonar: add test coverage (erigontech#9988)

- attempt to integrate sonar with test coverage by following 
-
https://sonarcloud.io/project/configuration/GitHubActions?id=ledgerwatch_erigon
-
https://docs.sonarsource.com/sonarcloud/advanced-setup/ci-based-analysis/github-actions-for-sonarcloud/
- adds sonar properties file to specify code coverage output
- also properties file can be used to filter out generated code from
sonar scan
    - protobuf
    - graphql
    - ignore pedersen hash bindings code
- ... there will be more ignores coming in later PRs (e.g. some c/c++
code we dont need to scan, some js code, some contract gen code, etc.)

* sonar: disable c/c++ scanning (erigontech#10033)

Fixes error in Sonar GitHub action:
<img width="1645" alt="Screenshot 2024-04-23 at 17 46 01"
src="https://github.com/ledgerwatch/erigon/assets/94537774/3833db1c-6a8a-4db2-8bb7-5de58b57e638">

* Caplin: Added `SyncAggregate` computation to block production (erigontech#10009)

This PR allows the computation for the computation of the
`SyncAggregate` field in block production:
https://sepolia.beaconcha.in/slot/4832922 proof of the code working is
that now Caplin validators can include sync aggregates in their blocks.

Things modified:
* We do not aggregate pre-aggregated `SyncContributionAndProof`s,
instead we just listen to the network and pick the most profitable ones
for each sub sync committee (4 sync subcommittee on mainnet).
profitability == most bits set in `AggregationBits` field.
* Separate aggregates set for contribution to be included in a block
from the ones constructed from `SyncCommitteeMessage`s, combining the
two causes some contributions to be marked as invalid and not
aggregable.
* Remove SyncContributionMock in favor of gomock

* polygon/sync: message listener to preserve peer events ordering (erigontech#10032)

Observed the following issue in a long running Astrid sync on
bor-mainnet:
```
[DBUG] [04-17|14:25:43.504] [p2p.peerEventObserver] received new peer event id=Disconnect peerId=51935aa1eeabdb73b70d36c7d5953a3bfdf5c84e88241c44a7d16d508b281d397bdd8504c934bfb45af146b86eb5899ccea85e590774f9823d056a424080b763
[DBUG] [04-17|14:25:43.504] [p2p.peerEventObserver] received new peer event id=Connect peerId=51935aa1eeabdb73b70d36c7d5953a3bfdf5c84e88241c44a7d16d508b281d397bdd8504c934bfb45af146b86eb5899ccea85e590774f9823d056a424080b763
```

Note the timestamps are the same on the millisecond level, however the
disconnect was processed before the connect which is wrong (connect
should always be first).

This then got the `PeerTracker` in a bad state - it kept on returning
peer
`51935aa1eeabdb73b70d36c7d5953a3bfdf5c84e88241c44a7d16d508b281d397bdd8504c934bfb45af146b86eb5899ccea85e590774f9823d056a424080b763`
as a valid peer to download from, which caused repeated `peer not found`
errors when sending messages to it.

Fix is to have the message listener wait for all observers to finish
processing peer event 1 before proceeding to notifying them about peer
event 2.

* check attestation signature (erigontech#10018)

* sonar: fix warnings (erigontech#10034)

Fixes Sonar warnings:
<img width="550" alt="Screenshot 2024-04-23 at 19 37 53"
src="https://github.com/ledgerwatch/erigon/assets/94537774/b85c9607-3800-408d-8a1b-c5bf80da38b2">

* sonar: fix js warnings and exclude mocks (erigontech#10042)

- Excludes go mock generated files from analysis
- Excludes broken js files (valid as they are used for tracers and test
data) to fix below warnings
<img width="1658" alt="Screenshot 2024-04-24 at 11 12 04"
src="https://github.com/ledgerwatch/erigon/assets/94537774/7925d07f-37f3-43c9-b34a-9a5361e48a8a">

* tests: Support iterations in Heimdall simulator (erigontech#10040)

Accept a slice of block numbers that represents the final block number
that will be available to the client of the simulator.Any data after the
iteration stage end is not accessible to the client.

The iteration moves to the next stage under certain conditions:
- requesting the latest span via `FetchSpan`
- requesting state sync events beyond current last iteration block's
timestamp

* Fix forward bor snaps (erigontech#10027)

This fixes this issue:

erigontech#9499

which is caused by restarting erigon during the bor-heimdall stage.

Previously after the initial call to bor-heimdall (header 0), forward
downloading was disabled, but backward
downloading recursively collects headers - holding results in memory
until it can roll them forward. This should
only be called for a limited number of headers, otherwise it leads to a
large amount of memory >45GB for bor
main net if the process is stopped at block 1.

* Added downloader request count (erigontech#10036)

The downloader is not complete until all of its requested files have
been downloaded.

This changes adds a request count to the downloader stats to be checked
for completeness, otherwise the downloader
may appear complete before all required torrents have been added.

* StageSenders: `--sync.loop.block.limit` support (erigontech#9982)

We reverted support of this flag in `updateForkChoice` because
implementation was too complex and fragile:
erigontech#9900

But it's good-enough if StageSenders will preserve this flag - then next
stages (exec) will also follow (because they look at prev stage
progress).

It's good-enough - because users just want to save some partial progress
after restoring node from backup (long downtime). And enforce "all
stages progress together" invariant

* chore:fix typo (erigontech#9952)

* Optimize prune old chunks (erigontech#10019)

**Summary**
Fixes prune point for log (+index)
- Unnecessary to use ETL again for deleting `kv.Log` entries, can just
introduce `RwCursor` in the initial loop
- Put the last `pruneTo` block number in the `PruneState` - this will
begin pruning from that point. Earlier the `pruneFrom` point being
passed in was buggy as it used some other assumption for this value

* [ots] Fix block rewards calculation on post-merge blocks (erigontech#10038)

This is for E2.

The block rewards returned by Otterscan API is incorrect since the
merge. It replaces very old code with the same calculation used for
trace_block.

this code probably won't work with Aura consensus, but that's ok since
the current one doesn't work as well. It would actually require exposing
more code from block execution and I don't want to handle it for now,
let's fix only the post-merge calc for now.

Co-authored-by: sealer3 <125761775+sealer3@users.noreply.github.com>

* sonar: use fixed version for sonarcloud-github-action (erigontech#10046)

* standardize mock file name (erigontech#10043)

* chore: remove repetitive words (erigontech#10044)

* mdbx, erigon backup: fix typo (erigontech#10031)

* Build Silkworm RpcDaemon settings from Erigon ones (erigontech#10002)

This PR introduces support for customising Silkworm RpcDaemon settings
in Erigon++.

Common RPC settings between Erigon and Silkworm are simply translated
from the existing Erigon command-line options. They include:
- `--http.addr`
- `--http.port`
- `--http.compression`
- `--http.corsdomain`
- `--http.api`
- `--ws`
- `--ws.compression`

Moreover, the following Silkworm-specific command-line options are
added:
- `--silkworm.verbosity`
- `--silkworm.contexts`
- `--silkworm.rpc.log`
- `--silkworm.rpc.log.maxsize`
- `--silkworm.rpc.log.maxfiles`
- `--silkworm.rpc.log.response`
- `--silkworm.rpc.workers`
- `--silkworm.rpc.compatibility`

Default values cover the common usages of Erigon++ experimental
features, yet such options can be useful for testing some corner cases
or collecting information.

Finally, this PR adds a new `LogDirPath` function to `logging` module
just to determine the log dir path used by Erigon and put there also
Silkworm RPC interface logs, when enabled.

* Optimized attestation processing (erigontech#10020)

* Decrease memory footprint on chain tip
* Fix a race
* Better times on `Attestation` processing. 1 sec -> 54 ms

* Revert "Fix new_heads Events Emission on Block Forks (erigontech#9738)" (erigontech#10055)

This reverts commit f4aefdc.

See PR erigontech#9738

* chore: fix comments (erigontech#9958)

Fix some comments

* Revert "Added downloader request count" (erigontech#10053)

Reverts erigontech#10036

* drop go 1.20 support (erigontech#10052)

drop go 1.20 support 

use ` github.com/erigontech/torrent v1.54.2-alpha` - to simplify future
support and features backport

* cmd/integration: print_table_sizes (erigontech#10061)

* Revert "StageSenders: `--sync.loop.block.limit` support" (erigontech#10060)

Reverts erigontech#9982

* downloader: remove deprecated manual fsync  (erigontech#10064)

After switching to more durable db mode
erigontech#10010 - we don't need manual
fsync anymore.

* cmd/integration: import erigon-lib/kv to execute init func (erigontech#10065)

* Caplin: fixed attestation broadcasting (erigontech#10041)

This PR fixes 2 things:
* Superset handling (should ignore)
* SSZ offset not set for custom ssz in attestation encoding after json
unmarshalling

* feat: add `fullTx` params to `NewPendingTransactions` (erigontech#9204)

feat: add `fullTx` params to `NewPendingTransactions`

Closes erigontech#9203

* backward compatibility of .lock (erigontech#10006)

In PR: 
- new .lock format introduced by
erigontech#9766 is not backward
compatible. In the past “empty .lock” did mean “all prohibited” and it
was changed to “all allowed”.
- commit

Not in PR: I have idea to make .lock also forward compatible - by making
it whitelist instead of blacklist: after adding new snap type it will
not be downloaded by accident. Will do it in next PR.

But I need one more confirmation - why do we need exceptions from .lock?
Why we breaking "download once" invariant for some type of files? Can we
avoid it?

* Make logs subscription channel size configurable (erigontech#9810)

This PR makes the channel that is used to send logs to subscriptions
configurable so logs are not dropped when the channel gets filled. See
issue 9699.
This is just an initial version since I wanted to gather some feedback
and was unsure if this is the correct approach to solve this.

* cmd/integration: print table sizes to filter deprecated tables (erigontech#10066)

* [ots] Fix incorrect return type and overflow on total block fees calc (erigontech#10070)

For E2: fix incorrect type + overflow in certain blocks

Corresponding otterscan issue:
otterscan/otterscan#1658

* RPC: `--http.dbg.single=true` and custom HTTP header `dbg: true` (erigontech#10039)

- Added method `tx.Context()` - because Tx already bounded to context by
`db.BeginRo(ctx)`
- Removed ctx parameter from `BlockWithSenders` method in interfaces
- Added `dbg.ToContext()` and `dbg.Enabled(ctx)` methods to set/get
debugging tag to `ctx`.

Added way to debug single http request: 
To print more detailed logs for 1 request - add `--http.dbg.single=true`
flag. Then can send HTTP header `"dbg: true"`:

```
curl -X POST -H "dbg: true" -H "Content-Type: application/json" --data '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id":1}' localhost:8545
```

---------

Co-authored-by: battlmonstr <battlmonstr@users.noreply.github.com>

* all: use the built-in slices library (erigontech#9842)

In the current go 1.21 version used in the project, slices are no longer
an experimental feature and have entered the standard library

Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>

* chore(config): json marshal chainName (erigontech#9865)

As the other fields are json marshaled into lowerUpper case, we should
use the same style.

---------

Signed-off-by: jsvisa <delweng@gmail.com>

* Fix new_heads Events Emission on Block Forks (erigontech#10072)

TL;DR: on a reorg, the common ancestor block is not being published to
subscribers of newHeads

#### Expected behavior

if the reorg's common ancestor is 2, I expect 2 to be republished

1, 2, **2**, **3**, **4**

#### Actual behavior

2 is not republished, and 3's parentHash points to a 2 header that was
never received

1, 2, **3**, **4**

This PR is the same thing as
erigontech#9738 except with a test.

Note... the test passes, but **this does not actually work in
production** (for Ethereum mainnet with prysm as external CL).

Why? Because in production, `h.sync.PrevUnwindPoint()` is always nil:
https://github.com/ledgerwatch/erigon/blob/a5270bccf5e69a6beaaab9a0663bdad80e989505/turbo/stages/stageloop.go#L291
which means the initial "if block" is never entered, and thus we have
**no control** of increment/decrement `notifyFrom` during reorgs
https://github.com/ledgerwatch/erigon/blob/a5270bccf5e69a6beaaab9a0663bdad80e989505/eth/stagedsync/stage_finish.go#L137-L146

I don't know why `h.sync.PrevUnwindPoint()` is seemingly always nil, or
how the test can pass if it fails in prod. I'm hoping to pass the baton
to someone who might. Thank you @indanielo for original fix.

If we can figure this bug out, it closes erigontech#8848 and closes erigontech#9568 and
closes erigontech#10056

---------

Co-authored-by: Daniel Gimenez <25278291+indanielo@users.noreply.github.com>

* chore: remove repetitive words with tools (erigontech#10076)

use https://github.com/Abirdcfly/dupword to check repetitive words

* grafana: configurable datasource (erigontech#10073)

* Revert "Fix new_heads Events Emission on Block Forks" (erigontech#10081)

Reverts erigontech#10072

* AggregateAndProof put aggregated data into attestationsPool (erigontech#10079)

* downloader: docs on MMAP for data-files r/w and experiments with bufio (erigontech#10074)

Pros:
- it allows to not pre-alloc files:
erigontech#8688
- it allows to not "sig-bus" when no space left on disk (return
user-friendly error). see:
erigontech#8500 - but DB will be MMAP
anyway and may get "sig-bus"

FYI:
- seems no perf difference (but i tested only on cloud drives)
- erigon will anyway open it as mmap 
 
Cons: 
- i did implemented `fsync` for mmap (
anacrolix/torrent#755 ) - probably will need
implement it for bufio: anacrolix/torrent#937
- no zero-copy: more `alloc` memory will be holded by APP (PageCache
starvation). I see 2x mem usage (at `--torrent.download.slots=500` 20gb
vs 40gb)
- i see "10K threads exchaused" error earlier (on
`--torrent.download.slots=500`).
- what else?

* polygon/p2p: Add blk/s and bytes/s to periodic log (erigontech#9976)

* wrong ttl value initialization in expirable lru cache (erigontech#10090)

fix issue erigontech#10089

* Fetch and skip sync events (erigontech#10051)

For period where there are not many sync events (mostly testnets) sync
event fecthing can be slow becuase sync events are fetched at the end of
every sprint.

Fetching the next and looking at its block number optimizes this because
fetches can be skipped until the next known block with sync events.

* EIP-2537 (BLS12-381): use gnark instead of kilic (erigontech#10082)

Cherry pick ethereum/go-ethereum#29441

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* abi: fix abigen issue with make devtools (erigontech#10091)

fixes erigontech#7593 

it introduced a regression: `"fmt"` and `"reflect"` imports were added
for all files generated by `abigen` assuming that they will be used in
all cases, however that assumption was wrong for some cases resulting in
invalid code being generated (in this case after running `make
devtools`):
<img width="982" alt="Screenshot 2024-04-27 at 10 50 37"
src="https://github.com/ledgerwatch/erigon/assets/94537774/9a1b93a5-2141-40d9-8c9e-01a1ff6c031c">

* Caplin: Inclusion of `VoluntaryExits`, `AttesterSlashing`s, `ProposerSlashing`s, `BlsExecutionToChange`s and `Attestation`s into block production (erigontech#10071)

This PR add operations inclusion.
## Normal operations

* BlsExecutionChange
* VoluntaryExit
* Slashings

Each of these operations blacklist the index they work on so we do not
have repeating indices for the same operations twice. we assume all
signatures are pre-validated and just see if it is a good time to
produce a block with them (by looking at their slot)
## Aggregated Attestations

There is a lot of trash attestations on the network so we separate our
algorithm in 3 steps:

### Eligibility

We iterate over the entire pool of accumulated attestations and filter
out all attestations who cannot be included at the current slot, and
compute their expected reward. (filter out if 0).

### Ranking

We rank the `Attestation`s by their expected reward (we just sort the
array of candidates) by expected reward in ascending order.

### Filtering by superset

We may have some supersets left-over, filter attestation which ends up
being supersets of other. this process is done from highest reward down
to lowest reward.

* mdbx: Return err early in iter.Next() (erigontech#10078)

`HasNext` will return true even with existing error and the application
will expect a next entry. The `Next` function can get into an internal
error (such as a `panic()`) while fetching the next cursor item and thus
fail to return the error.

---------

Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>

* make: mocks using mockgen (erigontech#10098)

- replaces usages of `moq` in `erigon-lib` with `mockgen` (gomock)
- adds a `make mocks` and `mocks-clean` command for `erigon`
- updates existing `make mocks` command and adds a `mocks-clean` common
for `erigon-lib`

* mockgen: use typed mocks for compile time check (erigontech#10103)

Use `mockgen -typed=true` to generate mocks with type-safe `Return`,
`Do`, `DoAndReturn` function -
https://github.com/uber-go/mock?tab=readme-ov-file#flags

* make: add gen commands (erigontech#10106)

adds:
- `make gen`
- `make solc`
- `make abigen`
- `make codecgen`
- `make gencodec`
- `make graphql`

tidies up `make devtools`

* added print DBs table sizes (erigontech#10111)

Added command to print databases tables basic info. There are two
options :
- print all info: ./build/bin/diag dbs all
- print only populated tables and dbs: ./build/bin/diag dbs pop   

Here is example output:
![Screenshot 2024-04-28 at 21 38
18](https://github.com/ledgerwatch/erigon/assets/29065143/f0a04931-8d87-4c45-b71a-71d75404f3fc)


@taratorio if you want I can add flag which will print specific DB.

* nodedb: UpdateNode method to create 1 rwtx instead of 2 (erigontech#10109)

* Caplin: tweaks to make staking more stable. (erigontech#10097)

Tweaks I did:
1) Decreased attestation expiry down to 30 minutes
2) Removed slot check in committeeSubAggregation
3) More reliable algorithm for the dependent root

Results:
* Better aggregates
* Less strain on the node
* No blocks/attestations missed

* mdbx: pre-open read pagesize from db (erigontech#10113)

Problem: if --pageSize parameter not set - we using `default pagesize`
instead of `real pagesize of db`. And it causing different `dirtySpace`
size (because it's accounted in "pages")

* RPC: Receipts LRU cache (erigontech#10112)

for erigontech#10099
for things like `eth_getTransactionReceipt`,
`ots_searchTransactionsAfter`, etc...

Also moved:
- moved `api.chainConfig()` inside `api.getReceipts()`
- switched `ots` to use blocks/receipts lru
- switched price oracle to use blocks/receipts

* use sonar for code coverage badge (erigontech#10107)

- use sonar badge for code coverage
- remove unnecessary "Coverage" GitHub action and unnecessary duplicate
test run on "devel" CI for it
- the existing coverage job + badge didn't seem to be accurate (wasn't
taking into account `erigon-lib` sub-module)

<img width="982" alt="Screenshot 2024-04-29 at 12 06 46"
src="https://github.com/ledgerwatch/erigon/assets/94537774/e47367ed-340d-42b5-ad00-2f59edce100c">

* dvovk/limit mem usage (erigontech#10069)

Implemented limit for saving peers in an Erigon node memory to be able
to turn on diagnostics data collection by default.

* chore: fix some function names (erigontech#10117)

Signed-off-by: luchenhan <hanluchen@aliyun.com>

* Revert "backward compatibility of .lock" and Backward compatibility by Giulio (erigontech#10077)

Reverts erigontech#10006 and add a proper migration routine

* dvovk/enable_dignostic (erigontech#10083)

Enabled diagnostics by default to collect data. It will allow to connect
to node and get stored data. It includes three new flags:
- "diagnostics.disabled" - it's set to "false" by default. Set to "true"
if you want to disable diagnostics.
- "diagnostics.endpoint.addr" - address of HTTP endpoint to get
diagnostics data
- "diagnostics.endpoint.port" - port of HTTP endpoint to get diagnostics
data

[DO NOT MERGE] as it depend on: 
- erigontech#10069
- update support command
- update diagnostics UI

* Revert "mdbx: pre-open read pagesize from db" (erigontech#10125)

Reverts erigontech#10113

* Bor waypoint storage (erigontech#9793)

Implementation of db and snapshot storage for additional synced hiemdall
waypoint types

* Checkpoint
* Milestones

This is targeted at the Astrid downloader which uses waypoints to verify
headers during syncing and fork choice selection.

Post milestones for heimdall these types are currently downloaded by
erigon but not persisted locally. This change adds persistence for these
types.

In addition to the pure persistence changes this PR also contains a
refactor step which is part of the process of extracting polygon related
types from erigon core into a seperate package which may eventually be
extracted to a separate module and possibly repo.

The aim is rather than the core `turbo\snapshotsync\freezeblocks` having
to know about types it manages and how to exaract and index their
contents this can concern it self with a set of macro shard management
actions.

This process is partially completed by this PR, a final step will be to
remove BorSnapshots and to simplify the places in the code which has to
remeber to deal with them. This requires further testing so has been
left out of this PR to avoid delays in delivering the base types.

# Status

* Waypont types and storage are complete and integrated in to the
BorHeimdall stage, The code has been tested to check that types are
inserted into mdbx, extracted and merged correctly
* I have verified that when produced from block 0 the new snapshot
correctly follow the merging strategy of existing snapshots
* The functionality is enables by a **--bor.waypoints=true** this is
false by default.

# Testing

This has been tested as follows:

* Run a Mumbai instance to the tip and check current processing for
milestones and checkpoints

# Post merge steps

* Produce and release snapshots for mumbai and bor mainnet
* Check existing node upgrades
* Remove --bor.waypoints flags

* Replace snaptype.AllTypes with local definitions (erigontech#10132)

When adding bor waypont types I have removed snaptype.AllTypes because
it causes package cross-dependencies.

This fixes the places where all types have been used post the merge
changes.

* Caplin: process new attesting indicies before block comes in to avoid occasiona Reorg (erigontech#10085)

* qa-tests: small improvements (erigontech#10127)

This PR
- avoids installing Golang on every test run, 
- clean up the testbed datadir at the end of the test

* fix some flags parsing  (erigontech#10134)

* align deps of e35 and devel (erigontech#10136)

- upgrade docker 
- remove tendermint

* core/types: disable go:generate codecgen for receipts and logs (erigontech#10105)

running `go generate ./...` fails with:
```
codecgen error: error running 'go run codecgen-main-2.generated.go': exit status 1, console: panic: encoding alphabet includes duplicate symbols

goroutine 1 [running]:
encoding/base64.NewEncoding(...)
    /usr/local/go/src/encoding/base64/base64.go:82
github.com/ugorji/go/codec.init()
    /Users/milen/go/pkg/mod/github.com/ugorji/go/codec@v1.1.13/gen.go:168 +0xf1c
exit status 2
```

this is a problem when using go1.22 and it has been fixed here:
-
ugorji/go@8286c2d
- issue: ugorji/go#407

* fix concurrent rw on map in operation_pool (erigontech#10140)

relates to erigontech#10139

* Refactored types to force runtime registrations to be type dependent (erigontech#10147)

This resolves erigontech#10135

All enums are constrained by their owning type which forces package
includsion and hence type registration.

Added tests for each type to check the construction cycle.

* protection from starting e2 git branch on e3 db (erigontech#10150)

* Set existing torrent webseeds after download (erigontech#10149)

Fix a timing hole where torrents that get created before webseeds have
been downloaded don't get webseeds set.

* eth, txpool: enforce 30gwei for gas related configs for polygon (erigontech#10158)

Cherry-pick PR erigontech#10119 into the release

Co-authored-by: Marcello Ardizzone <marcelloardizzone@hotmail.it>

* make: fix gen issue with mockgen not found in PATH (erigontech#10162) (erigontech#10166)

Fixes
erigontech#10157 (comment)

Problem was:
```
grep -r -l --exclude-dir=erigon-lib "^// Code generated by MockGen. DO NOT EDIT.$" . | xargs rm -r
```

was deleting the `mockgen` binary after it was built 🙃

* abigen: fix duplicate struct definitions (erigontech#10157) (erigontech#10164)

fixes a 2nd regression introduced by -
erigontech#7593

- it generates duplicate struct types in the same package (check
screenshot below)
- also found a better way to fix the first regression with unused
imports (improvement over
erigontech#10091)

<img width="1438" alt="Screenshot 2024-04-30 at 17 30 42"
src="https://github.com/ledgerwatch/erigon/assets/94537774/154d484b-4b67-4104-8a6e-eac2423e1c0e">

* dvovk/pprof fix (erigontech#10155) (erigontech#10178)

Cherry pick PR erigontech#10155 into the release

Co-authored-by: Dmytro <vovk.dimon@gmail.com>

* Engine API: NewPayload fails with a "context canceled" error in Current/GetHeader (erigontech#9786) (erigontech#9894)

* improved logging
* check ctx in ServeHTTP: The context might be cancelled if the client's
connection was closed while waiting for ServeHTTP.
* If execution API returns ExecutionStatus_Busy, limit retry attempts to
10 seconds. This timeout must be lower than a typical client timeout (30
sec), in order to give the client feedback about the server status.
* If execution API returns ExecutionStatus_Busy, increase retry delay
from 10 ms to 100 ms to avoid stalling ourselves with multiple busy
loops. IMO this delay should be higher (e.g. 1 sec). Ideally we
shouldn't do polling at all, but doing a blocking ctx call requires
rearchitecting the ExecutionStatus_Busy logic.

see erigontech#9786

* torrent v1.54.2-alpha -> v1.54.2-alpha-7 (release/2.60) (erigontech#10183)

* Unnecessary Logs in sentry removed (erigontech#10190)

Cherry pick PR erigontech#10187 into the release

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* nil block during execution (erigontech#10193)

release cherry pick

* qa-tests: updating test workflow on release/2.60 (erigontech#10196)

This PR brings the changes of erigontech#10195 to the branch release/2.60 with the
necessary modifications

* qa-tests: fix workflows for release 2.60 (erigontech#10217)

Running a test every day doesn't make sense on an inactive branch. 
It also seems that the schedule trigger favours the main branch if the
test workflow has the same name on the main and other branches.
So this PR changes the test trigger to "push events".

* Release: fix logs spam (erigontech#10211)

for erigontech#10203

* Blocks snaps - see 0 indices after reopen (erigontech#10219)

Cherry pick PR erigontech#10214 into the release

Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>

* torrent v1.54.2-alpha-7 -> v1.54.2-alpha-8 (release/2.60) (erigontech#10224)

This adds torrent fixes that remove bad peers due to non handling of
http errs.

* fixed start diag server (erigontech#10236)

fixed start diag server if metrics address is different from pprof
address

---------

Co-authored-by: taratorio <94537774+taratorio@users.noreply.github.com>

* params: version 2.60.0-rc1 (erigontech#10230)

* downloader: --seedbox doesn't init snaptypes (erigontech#10245)

Cherry pick PR erigontech#10215 into the release

Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>

* e2: bor-mainnet fix broken v1-054600-054700-borspans.seg  (erigontech#10243)

Pick erigontech/erigon-snapshot#160

* test

* e2: set dirty-space for chaindb to 512mb (erigontech#10269)

* Fix potential index out of bounds in decodeBlobVersionedHashes (erigontech#10294)

* remove nils from p2p logs (erigontech#10303)

fix for 
```
[p2p] Server                             protocol=68 peers=2 trusted=0 inbound=1 LOG15_ERROR= LOG15_ERROR= LOG15_ERROR= LOG15_ERROR= LOG15_ERROR= i/o timeout=53 EOF=65 closed by remote=215 too many peers=6 ecies: invalid message=5
```

* params: version 2.60.0 (erigontech#10330)

* Fix tests

* fix Consensus specification tests CI (erigontech#10391) (erigontech#10396)

Cherry-pick:
erigontech@bc5fa6f

Need this to get PR CI green for v2.60.1 patches, e.g. -
erigontech#10390

Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>

* rpc/handler: do not append null to stream when json may be valid (erigontech#10390)

Cherry-pick:
erigontech@4d1c954
Relates to: erigontech#10376

* Remove files that should have been ignored

* Bump go version to 1.21

* Add erigon-lib back

* Fixed Bor Log appearing on Ethereum Mainnet (erigontech#10405) (erigontech#10420)

Cherry-pick:
erigontech@be889f6

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Fix dynamic config

* Fix APIList

* Upstream merge fix

Fix txpool and metrics

* Fix nil pointer dereference during first stage cycle

* fix gas price not right problem (erigontech#10456)

Cherry pick PR erigontech#10451 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* eth_estimateGas: default feeCap to base fee (erigontech#10499)

Copy PR erigontech#10495 into the release branch

* Add flag for bor waypoint types (erigontech#10501)

Cherry pick PR erigontech#10281 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>

* try to fix 'method handler crashed' for debug_traceCall of erigontech#9090 (erigontech#10502)

Cherry pick PR erigontech#10401 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* diagnostics: cherry pick speedtest disable (erigontech#10509)

Cherry pick PR erigontech#10449 into the release branch

* Enable DNS p2p discovery on holesky (erigontech#10507)

Cherry pick PR erigontech#10460 into the release branch

Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>

* fix eth_call 'method handler crashed' error when tx has set maxFeePerBlobGas (erigontech#10506)

Cherry pick PR erigontech#10452 into the release branch

Co-authored-by: mars <marshalys@gmail.com>

* e2: remove overlapped files only after merge (erigontech#10487)

Otherwise: if start after `kill -9` in the middle of merge - may remove
small files of 1 type of file, but leave small files of another type of
files (which merge was not finished) - and leave node in un-mergable
state: erigontech#10485

---------

Co-authored-by: awskii <awskii@users.noreply.github.com>

* add flag checking for pruning waypoints (erigontech#10508)

Cherry pick PR erigontech#10468 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* p2p/sentry: sentry doesn't start with ErrNoHead (erigontech#10454) (erigontech#10523)

cherry-pick erigontech#10494 to
release/2.60

* add lock to purgeMilestoneIDsList (erigontech#10524)

Cherry pick PR erigontech#10493 into the release branch

Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>

* polygon/heimdall: fix checkpoint json marshalling (erigontech#10530)

Fixes a recent regression causing unwinds due to checkpoints having zero
root hash:
```
[WARN] [05-18|23:58:54.662] [bor] Root hash mismatch while whitelisting checkpoint expected=ac1c57270479250af3ce8eee90075cd8b2ba1bac55353105e063d9a4c87c743e got=0000000000000000000000000000000000000000000000000000000000000000
[WARN] [05-18|23:58:54.662] [bor] Rewinding chain due to checkpoint root hash mismatch number=57125727
```

Note this has already been fixed on Erigon 3 branch but as part of a
non-related PR -
https://github.com/ledgerwatch/erigon/pull/10124/files#diff-47d4532f399f2d6a45e6f19944a45c80bac573b4d1b5cb51485d0254229d1b16

* Fix capacity for immediate appends (erigontech#10539)

Cherry pick PR erigontech#10528 into the release branch

Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>

* core/vm: set tracer-observable value of a delegatecall to match parent value (erigontech#10370)

requested by erigontech#9549

port of ethereum/go-ethereum#26632

* Remove unused binary

* params: version 2.60.1 (erigontech#10555)

* remove: externalcl flag from default configs

* blobGasPrice should be marshalled as hex (erigontech#10571)

Cherry pick PR erigontech#10551 into the release branch

* Caplin: Fixed reforwarding of Bls Execution changes (erigontech#10577)

Cherry pick PR erigontech#10546 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (erigontech#10578)

Cherry pick PR erigontech#10512 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Caplin: Update BlobSidecars Beacon API endpoint to the latest specs (erigontech#10580)

Cherry pick PR erigontech#10576 into the release branch

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* wip

* resolve conflicts/issues after merge

* bor blocks retire: infinity loop fix (erigontech#10596)

Problem: `+1` was added to maxBlockNum instead of minBlockNum
for: erigontech#10554

* add modes in acl db

* refactored code

* acl cli

* Uts

* Revert "Uts"

This reverts commit 807bc91.

Revert "acl cli"

This reverts commit c8eead9.

Revert "refactored code"

This reverts commit aa4b8a4.

Revert "add modes in acl db"

This reverts commit 09c512a.

Revert "wip"

This reverts commit ca6db9e.

* bor blocks retire: infinity loop fix (erigontech#10596)

Problem: `+1` was added to maxBlockNum instead of minBlockNum
for: erigontech#10554

* txpool: EIP-3860 should only apply to create transactions (erigontech#10609)

This fixes Issue erigontech#10607

* qa-tests: update 2.60.x test workflows from main (erigontech#10627)

* Fix potential p2p shutdown hangup (erigontech#10626)

This is a fix for: 

erigontech#10192

This fixes is a deadlock in v4_udp.go where 
* Thread A waits on mutex.Lock() in resetTimeout() called after reading
listUpdate channel.
* Thread B waits on listUpdate <- plist.PushBack(p) called after locking
mutex.Lock()
  
This fix decouples the list operations which need locking from the
channel operations which don't by storing the changes in local
variables. These updates are used for resetting a timeout - which is not
order dependent.

* downloader: Number of DNS requests seem excessive (erigontech#5145) (erigontech#10739)

cherry-pick erigontech#10693 to release

* rpc: Fix incorrect txfeecap (erigontech#10643)

Cherry pick PR erigontech#10636 to
Erigon 2

* downloader: don't block erigon startup if devs deploy new hashes (of same files) (erigontech#10761)

* skip hidden files when list files with given extension  (erigontech#10654)

for erigontech#10644

* qa-tests: backport to release/2.60 improvements made to e3 github action workflows (erigontech#10778)

This PR backports improvements that we added to the E3 tests: recording
runner name and db version used for testing on MongoDB database.

* Fix tests

* Fix docker file and make file

* Fix configs

* Add a dummy flag 'externalcl' for backward compatibility

* Enable CI in upstream-merge PRs

* Exclude non-buildable targets from CI

* e2: more snaps (all networks) (erigontech#10794)

* Update ubuntu version in CI

* e2: configurable hashers amount (erigontech#10785)

* Revert "e2: configurable hashers amount" (erigontech#10834)

* diagnostics: move E3 changes to E2 (erigontech#10806)

Merged all the work done from main branch to keep diagnostics up to
date.

* Downloader: fix staticpeers flag (erigontech#10798)

Cherry pick erigontech#10792

* Fix NewPayload Validation during header download (erigontech#10837)

Cherry pick PR erigontech#10093 into the release branch

Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>

* e2: mainnet blob 9.3M (erigontech#10842)

* Fix gas fee calculation for debug calls (erigontech#10880)

Cherry pick PR erigontech#10825 into the release branch

Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>

* Revert "eth_estimateGas: default feeCap to base fee (erigontech#10499)" (erigontech#10904)

This reverts PR erigontech#10499. See
erigontech#10495 (comment)
and PR erigontech#10901

* Change CI branches

* params: version 2.60.2 (erigontech#10905)

* Add bridge test to CI

* Remove matrix

* [bugfix] Fix gas estimation bug where EVM was not correctly used in the interpreter

* Changing Caplin Finality Checkpoint API response to match spec (erigontech#10944)

Cherry pick PR erigontech#10843 into the release branch

Co-authored-by: Angus Scott <angusscott@me.com>

* Add zero check in tx.Sender func (erigontech#10737)

This is an additional check as erigontech#9990 could not be reliably reproduced.
The conjecture is that at some point there is a race condition somewhere
related to either storing snapshot file for an older block or updating
the DB for a more recent block.
Somewhere the code sets sender value directly to zero or overwrites a
pointer, leading to sender address being incorrectly assigned to ZERO.

* Add Normalcy hardfork (#676)

* Add Normalcy fork

* Add a few missed functions

* eth/tracers: fix prestate tracer bug with create with value (erigontech#10960)

fixes erigontech#9531

Changes:
- fixes a bug with the prestate tracer where we were incorrectly
subtracting the value of a transaction from the "to" address balance in
the "pre" state (should not be done for CREATE calls)
- fixes a bug with the prestate tracer where we were incorrectly adding
the value of a transaction to the "from" address balance in the "pre"
state (should not be done for CREATE calls)
- fixes a bug with the prestate tracer where we were incorrectly
decrementing the nonce value of a transaction's "from" address in the
"pre" state (should not be done for CREATE calls)
- adds a test generator that can generate the test files for us based on
real life transaction hash and node rpc url - check README
https://github.com/ledgerwatch/erigon/blob/fix-prestate-tracer-on-create-e2/eth/tracers/internal/tracetest/testgenerator/README.md
- adds test cases
- fixes some existing test cases that were setup with incorrect data

* eth/tracers: add optional includePrecompiles flag to callTracer - default true is preserved (erigontech#10986)

relates to erigontech#9784

- Adds support for an optional `"includePrecompiles"` tracer config
option for `callTracer` that users can use to control behaviour
(previous default of including precompile traces is preserved)
- Adds tests for default and for `"includePrecompiles": false` based on
https://etherscan.io/tx/0x536434786ace02697118c44abf2835f188bf79902807c61a523ca3a6200bc350

* Cherry-pick: Caplin's past finalization check (erigontech#11006)

* turbo/jsonrpc: add optional includePrecompiles flag to trace_* apis (erigontech#10979)

relates to erigontech#9784

- Adds support for an optional `"includePrecompiles"` tracer config
option for our OeTracer (OpenEthereum) that users can use to match
output of debug_* apis with callTracer (by default it includes
precompiles). Note default spec for OpenEthereum traces are to not
include precompiles - this is preserved by this PR
- Note geth has support for `"includePrecompiles"` so we are getting
more aligned as well -
https://github.com/ethereum/go-ethereum/blob/master/eth/tracers/native/call_flat.go#L124
- Adds tests for OeTracer

* eth/tracers: always pop precompiles stack in callTracer (erigontech#11004)

made a mistake in previous PR
erigontech#10986
should always pop the precompiles stack for correctness

* allow to gracefully exit from CL downloading stage (erigontech#10887) (erigontech#11020)

Duplicating erigontech#10887

Co-authored-by: awskii <awskii@users.noreply.github.com>

* Less troublesome way of identifying content-type (erigontech#10770) (erigontech#11018)

Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>

* Diagnostics: loglevel (erigontech#11015)

Changed log level

* dl: additional pre-check for having info  (erigontech#11012)

cherry-pick of erigontech#10853

* Diagnostics: Optimize db write (erigontech#11016)

Fix for erigontech#10932

* qa-tests: add Tip-Tracking test for Gnosis (erigontech#11053)

This add a Tip-Tracking test on Erigon v2 for Gnosis chain/network

* params: version 2.60.3 (erigontech#11069)

* Fix issues for post-london hardforks

* Fix unit test

* Add dynamic gas fee tx to CI for post-london

* Fix kurtosis in CI

* Disable blob opcodes and point evaluation precompile (#1147)

* Disable blob tx (#1150)

* Avoid log padding when normalcy is enabled

* Bump kurtosis version

* Remove auto claim

* update with feat/zero branch zero.go file (#1109)

Co-authored-by: Jerry <jerrycgh@gmail.com>

* Fix stage_batches bug

* Fix unwind ci

* Fix RPC doc check ci

* Fix unwind ci build

---------

Signed-off-by: fuyangpengqi <995764973@qq.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: luchenhan <hanluchen@aliyun.com>
Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
Co-authored-by: Giulio rebuffo <giulio.rebuffo@gmail.com>
Co-authored-by: kewei <kewei.train@gmail.com>
Co-authored-by: Willian Mitsuda <wmitsuda@gmail.com>
Co-authored-by: Shoham Chakraborty <shhmchk@gmail.com>
Co-authored-by: Somnath <snb895@outlook.com>
Co-authored-by: Dmytro <vovk.dimon@gmail.com>
Co-authored-by: Mark Holt <mark@distributed.vision>
Co-authored-by: awskii <artem.tsskiy@gmail.com>
Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com>
Co-authored-by: Stuart Corring <1814344+scorring@users.noreply.github.com>
Co-authored-by: fuyangpengqi <167312867+fuyangpengqi@users.noreply.github.com>
Co-authored-by: milen <94537774+taratorio@users.noreply.github.com>
Co-authored-by: goofylfg <165781272+goofylfg@users.noreply.github.com>
Co-authored-by: sealer3 <125761775+sealer3@users.noreply.github.com>
Co-authored-by: mcfx <0mcfx0@gmail.com>
Co-authored-by: canepat <16927169+canepat@users.noreply.github.com>
Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
Co-authored-by: persmor <166146971+persmor@users.noreply.github.com>
Co-authored-by: galois <fenghaojiang97@m.scnu.edu.cn>
Co-authored-by: adytzu2007 <adrian.bacircea@gmail.com>
Co-authored-by: battlmonstr <battlmonstr@users.noreply.github.com>
Co-authored-by: carehabit <165479941+carehabit@users.noreply.github.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Jonathan Otto <jonathan.otto@gmail.com>
Co-authored-by: Daniel Gimenez <25278291+indanielo@users.noreply.github.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: luchenhan <168071714+luchenhan@users.noreply.github.com>
Co-authored-by: Michelangelo Riccobene <michelangelo.riccobene@gmail.com>
Co-authored-by: Marcello Ardizzone <marcelloardizzone@hotmail.it>
Co-authored-by: Anshal Shukla <shukla.anshal85@gmail.com>
Co-authored-by: mars <marshalys@gmail.com>
Co-authored-by: awskii <awskii@users.noreply.github.com>
Co-authored-by: Rachit Sonthalia <rachitsonthalia02@gmail.com>
Co-authored-by: Goran Rojovic <goran.rojovic@ethernal.tech>
Co-authored-by: Minhyuk Kim <kimminhyuk1004@gmail.com>
Co-authored-by: Igor Mandrigin <mandrigin@users.noreply.github.com>
Co-authored-by: Angus Scott <angusscott@me.com>
Co-authored-by: VBulikov <vlad.bulikov@gmail.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Scott Fairclough <scott@hexosoft.co.uk>
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.

3 participants