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/rawdb: simple legacy receipt converter #24028

Merged
merged 10 commits into from
Mar 23, 2022

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Dec 1, 2021

This is a slower but simpler version of #23454. I still plan to add in batch reading.

}
for _, f := range files {
// This will replace the index + table files up to and including the switchover file.
if err := os.Rename(filepath.Join(migrationPath, f.Name()), filepath.Join(ancientsPath, f.Name())); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing to be aware of, which I find pretty counter-intuitive, is that f.Name() doesn't return the canonical filename, but "the name of the file as presented to Open".

	f, _ := os.Open("/tmp/foo")
	fmt.Printf("name: %v", f.Name())

prints out

name: /tmp/foo

So it looks to me like this shouldn't work, but I haven't tested it, maybe it does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is counter-intuitive...however in this case it works because ioutil.ReadDir returns a list of fs.FileInfo which is a bit different than os.File struct.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, maybe add some comments about the file name? So that next time we won't be confused.

Copy link
Member

Choose a reason for hiding this comment

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

The behavior of Os.Rename depends on the operator system. We may need to handle at least windows explicitly.

For example, go-leveldb uses this code for windows
https://github.com/syndtr/goleveldb/blob/master/leveldb/storage/file_storage_windows.go#L66

But I never test it :P

// with the item as argument. If `fn` returns an error the iteration stops
// and that error will be returned.
func (t *freezerTable) forEach(fn func(uint64, []byte) error) error {
items := atomic.LoadUint64(&t.items)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be neat to somehow prevent write operations while forEach is executing. t.RetrieveItems is safe, in itself, but since we're iterating over a wider range, it would be even better to have a mutex guarantee across the entire range, not just per-batch.
Not sure how to solve that.

Incidentally: this forEach function doesn't have to be part of freezerTable, right? It could be implemented on the caller-side too, couldn't it? Then it would be protected by the freezer writelock, and not exposed to any other callers.

Just speculatng here...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes a mutex guarantee is kinda tricky here since it possibly takes a long time. I made it a method of freezerTable thinking it might be useful for other purposes where there isn't concurrent access to the table (e.g. InitDatabaseFromFreezer). For now I changed it into an anonymous function defined in MigrateTable. There its clear that no other goroutine is accessing the table and the writelock is also taken.

In the meanwhile I'll think over how we can handle locking better

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine as you've done now, having it anonymous and protected by f.writeLock.

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.

Code looks good to me, I haven't actually tested it the functionality on a live dataset.

@fjl fjl self-assigned this Dec 7, 2021
@fjl fjl changed the title cmd,core: Simple legacy receipt converter core/rawdb: simple legacy receipt converter Dec 14, 2021
@s1na
Copy link
Contributor Author

s1na commented Dec 17, 2021

For a few weeks now I've been trying to generate a realistic dataset, by doing a full sync with an old version. I did that till block 7688456 (May 2019 which is roughly when receipts were modified). Then changed to v1.9.0 and synced further till 9,069,000 (Istanbul HF). Then I updated to a more recent version (I think v1.9.10) which for some reason switched sync to fast sync automatically and anyway got things in a situation where I have only till block 8,979,001 in the ancients. I tried migration on that dataset:

INFO [12-16|15:09:23.203] Starting migration                       ancients=8,979,001 firstLegacy=46147
INFO [12-16|15:09:23.206] Processing legacy elements               number=0
INFO [12-16|15:09:27.026] Processing legacy elements               number=500,000
INFO [12-16|15:09:41.922] Processing legacy elements               number=1,000,000
INFO [12-16|15:10:04.826] Processing legacy elements               number=1,500,000
INFO [12-16|15:10:32.580] Processing legacy elements               number=2,000,000
INFO [12-16|15:11:02.757] Processing legacy elements               number=2,500,000
INFO [12-16|15:11:32.961] Processing legacy elements               number=3,000,000
INFO [12-16|15:12:19.584] Processing legacy elements               number=3,500,000
INFO [12-16|15:14:46.302] Processing legacy elements               number=4,000,000
INFO [12-16|15:22:02.437] Processing legacy elements               number=4,500,000
INFO [12-16|15:32:57.499] Processing legacy elements               number=5,000,000
INFO [12-16|15:43:57.339] Processing legacy elements               number=5,500,000
INFO [12-16|15:57:31.337] Processing legacy elements               number=6,000,000
INFO [12-16|16:08:47.485] Processing legacy elements               number=6,500,000
INFO [12-16|16:18:34.338] Processing legacy elements               number=7,000,000
INFO [12-16|16:29:08.083] Processing legacy elements               number=7,500,000
INFO [12-16|16:34:51.004] Processing legacy elements               number=8,000,000
INFO [12-16|16:37:30.997] Processing legacy elements               number=8,500,000
INFO [12-16|16:40:29.258] Migration finished                       duration=1h31m6.054413489s

Running freezer-compare:

INFO [12-17|08:22:12.022] Starting comparison                      ancients=8,979,001 ancients2=13,630,078 kind=receipts
INFO [12-17|08:26:40.100] Comparison finished                      duration=4m28.078147641s

Regarding size:

ubuntu@geth-sync-test:~$ du -h ~/datadir-receipts/geth/chaindata/ancient
136G    /home/ubuntu/datadir-receipts/geth/chaindata/ancient
ubuntu@geth-sync-test:~$ du -h ~/datadir-receipts/geth/chaindata/ancient-migrated/
106G    /home/ubuntu/datadir-receipts/geth/chaindata/ancient-migrated/

The legacy ancients dir has 32 receipt files whereas the migrated one has 16.

@s1na
Copy link
Contributor Author

s1na commented Jan 7, 2022

I added a check on geth startup which warns users when they have legacy receipts in their freezer.

core/types/legacy.go Outdated Show resolved Hide resolved
core/rawdb/table.go Outdated Show resolved Hide resolved
core/rawdb/database.go Outdated Show resolved Hide resolved
core/rawdb/freezer.go Outdated Show resolved Hide resolved
core/rawdb/freezer.go Outdated Show resolved Hide resolved
}
for _, f := range files {
// This will replace the index + table files up to and including the switchover file.
if err := os.Rename(filepath.Join(migrationPath, f.Name()), filepath.Join(ancientsPath, f.Name())); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Yes, maybe add some comments about the file name? So that next time we won't be confused.

}
for _, f := range files {
// This will replace the index + table files up to and including the switchover file.
if err := os.Rename(filepath.Join(migrationPath, f.Name()), filepath.Join(ancientsPath, f.Name())); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

The behavior of Os.Rename depends on the operator system. We may need to handle at least windows explicitly.

For example, go-leveldb uses this code for windows
https://github.com/syndtr/goleveldb/blob/master/leveldb/storage/file_storage_windows.go#L66

But I never test it :P

cmd/geth/dbcmd.go Outdated Show resolved Hide resolved
cmd/geth/dbcmd.go Outdated Show resolved Hide resolved
cmd/geth/dbcmd.go Outdated Show resolved Hide resolved
@s1na
Copy link
Contributor Author

s1na commented Jan 13, 2022

@rjl493456442 I don't know why I can't directly reply to your comment above. Do you remember at the top of your head what exactly the windows issue with os.Rename is? I added a test which seems to pass on CI. It also tests the case where a file needs to be replaced which I saw someone reporting. The other thing I saw is this might not work when window explorer has that dir open which seems more minor.

Anyhow I don't know if the CI image is representative, something I could do is run windows on a VM and execute the test.

@rjl493456442
Copy link
Member

@s1na I never test this os.rename behavior on windows. I thought it might be something so that go-leveldb handles it differently with its own syscall.

But yes, if the os.rename can work perfectly on windows, then I think it's totally fine to use it directly.

@holiman
Copy link
Contributor

holiman commented Jan 21, 2022

From discussion last week: the check that is performed on every node at startup, iterating through the first 40K blocks (on mainnet) to find the first receipt and check legacy, should be improved (since it affects the boot phase of all users).
For this check, it's sufficient to look at the indices-structure and figure out the first non-empty block, without actually loading the data.

Otherwise this LGTM. @fjl did you have anything to add -- I left that call early ?

@s1na
Copy link
Contributor Author

s1na commented Jan 21, 2022

@holiman we had another discussion with Felix and the conclusion was the best approach is not to do the initial check at all when users have an up-to-date freezer. We could possibly use Gary's freezer versioning schema for this. I want to look into how exactly he does versioning and if that would suit the purpose here.

@holiman
Copy link
Contributor

holiman commented Mar 10, 2022

We could possibly use Gary's freezer versioning schema for this. I want to look into how exactly he does versioning and if that would suit the purpose here.

I don't think that will help you. I still think we should just do this:

For this check, it's sufficient to look at the indices-structure and figure out the first non-empty block, without actually loading the data.

Alternatively: for mainnet, just load up block whatever block was the first with a tx in it, and check it. Wham-bam done.

@fjl
Copy link
Contributor

fjl commented Mar 10, 2022

This mainnet idea is pretty good and will fix 99% of cases.

core/rawdb: use forEach in migrate

core/rawdb: batch reads in forEach

core/rawdb: make forEach anonymous fn

cmd/geth: check for legacy receipts on node startup

fix err msg

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

fix log

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

fix some review comments

add warning to cmd

drop isLegacy fn from migrateTable params

add test for windows rename

test replacing in windows case
@s1na
Copy link
Contributor Author

s1na commented Mar 18, 2022

So I tried out the versioning stuff here: s1na/go-ethereum@legacy-converter-simple...legacy-converter-simple-version

I had to expose two new methods on ethdb.Database for reading and setting the version.

@@ -167,7 +168,8 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
firstIdx := uint64(0)
// Hack to speed up check for mainnet because we know
// the first non-empty block.
if cfg.Eth.NetworkId == 1 {
ghash := rawdb.ReadCanonicalHash(eth.ChainDb(), 0)
if cfg.Eth.NetworkId == 1 && ghash == params.MainnetGenesisHash {
Copy link
Contributor

Choose a reason for hiding this comment

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

Whenever we check for "Is Mainnet?", we usually only care about the genesis hash, not checking the networkid. I think we can ignore the network id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there any downsides to checking it nevertheless?

@holiman
Copy link
Contributor

holiman commented Mar 21, 2022

Regarding the versioning. I'm not sure.

I had misremembered, and didn't think about the fact that the versioning is per table. So having version=2 be specific for the receipts type, but mean nothing in particular for other types feels a bit wrong.
Seems to me like we're abusing the versioning -- instead of having the versioning define the syntax of how data is stored , we're using it to version the inner content of the data itself.

}
return nil
}
if table.itemOffset > 0 || table.itemHidden > 0 {
Copy link
Member

Choose a reason for hiding this comment

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

Any specific reason for rejecting this type of table? It's ok to keep this checking but would be nice to get rid of it eventually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this quick check to make sure the table hasn't been tail-trimmed. Because the migration process will not fully work for such a table right now and need some tweaks. I'll add a todo comment

core/rawdb/freezer.go Show resolved Hide resolved
core/rawdb/freezer.go Outdated Show resolved Hide resolved
@rjl493456442
Copy link
Member

Re-version, perhaps it's unnecessary? The cost is we need to load a few receipts in database in each restart(the number can be a few thousands receipts) but for computer the cost is acceptable?

I think a quick hack is to also define the firstIndex for other testnets(rinkeby, goerli, ropsten) and get rid of this logic when the migration is not needed? I admit it's a "dirty" hack but for most of people this does nothing essentially.

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 merged commit fd4f60f into ethereum:master Mar 23, 2022
@holiman holiman added this to the 1.10.17 milestone Mar 23, 2022
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Mar 24, 2022
* cmd,core: add simple legacy receipt converter

core/rawdb: use forEach in migrate

core/rawdb: batch reads in forEach

core/rawdb: make forEach anonymous fn

cmd/geth: check for legacy receipts on node startup

fix err msg

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

fix log

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

fix some review comments

add warning to cmd

drop isLegacy fn from migrateTable params

add test for windows rename

test replacing in windows case

* minor fix

* sanity check for tail-deletion

* add log before moving files around

* speed-up hack for mainnet

* fix mainnet check, use networkid instead

* check mainnet genesis

* review fixes

* resume previous migration attempt

* core/rawdb: lint fix

Co-authored-by: Martin Holst Swende <martin@swende.se>
holiman pushed a commit that referenced this pull request May 26, 2022
In #24028 we flagged a warning when finding legacy receipts in the freezer. This PR nudges users a bit more strongly by preventing geth from starting in this case until receipts have been migrated.

It also adds a flag --ignore-legacy-receipts which when present allows geth to start normally.
JacekGlen pushed a commit to JacekGlen/go-ethereum that referenced this pull request May 26, 2022
* cmd,core: add simple legacy receipt converter

core/rawdb: use forEach in migrate

core/rawdb: batch reads in forEach

core/rawdb: make forEach anonymous fn

cmd/geth: check for legacy receipts on node startup

fix err msg

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

fix log

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

fix some review comments

add warning to cmd

drop isLegacy fn from migrateTable params

add test for windows rename

test replacing in windows case

* minor fix

* sanity check for tail-deletion

* add log before moving files around

* speed-up hack for mainnet

* fix mainnet check, use networkid instead

* check mainnet genesis

* review fixes

* resume previous migration attempt

* core/rawdb: lint fix

Co-authored-by: Martin Holst Swende <martin@swende.se>
abdulrabbani00 added a commit to cerc-io/go-ethereum that referenced this pull request Jun 15, 2022
commit 23bee16
Author: Péter Szilágyi <peterke@gmail.com>
Date:   Wed Jun 15 15:35:32 2022 +0300

    params: release Geth v1.10.19

commit d78d302
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Wed Jun 15 14:35:53 2022 +0200

    node: add info message when JWT secret is loaded (ethereum#25095)

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

commit d8f9638
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Wed Jun 15 13:10:38 2022 +0200

    cmd, params: implement Gray Glacier hard-fork (EIP-5133) (ethereum#25088)

    * cmd/geth, params: implement Gray Glacier (EIP-5133)

    * cmd/evm: add gray glacier tests

    * params: nitpicks

    * params: fixes

commit 3060216
Author: rjl493456442 <garyrong0905@gmail.com>
Date:   Wed Jun 15 18:56:47 2022 +0800

    eth: introduce eth67 protocol (ethereum#24093)

    The new protocol version removes support for GetNodeData.
    See https://eips.ethereum.org/EIPS/eip-4938 for more information.

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

commit 3273ad1
Author: lightclient <14004106+lightclient@users.noreply.github.com>
Date:   Wed Jun 15 09:29:23 2022 +0200

    eth: add missing period at end of sentences (ethereum#25058)

    eth: add missing periods on end of comments

commit bc013bc
Author: lmittmann <lmittmann@users.noreply.github.com>
Date:   Tue Jun 14 14:09:48 2022 +0200

    all: prefer `new(big.Int)` over `big.NewInt(0)` (ethereum#25087)

    minor performance improvement: `big.NewInt(0).Xxx` -> `new(big.Int).Xxx`

commit 8cfd121
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Tue Jun 14 14:08:43 2022 +0200

    common: improve pretty duration regex (ethereum#25073)

    * common: improve pretty duration regex

    * common: improve pretty duration regex

commit 6ad620d
Author: s7v7nislands <s7v7nislands@gmail.com>
Date:   Tue Jun 14 19:47:11 2022 +0800

    cmd/ethkey: use accounts.TextHash (ethereum#25069)

commit 1cf58c7
Author: lightclient <14004106+lightclient@users.noreply.github.com>
Date:   Tue Jun 14 12:59:05 2022 +0200

    readme,eth: remove references to eth.wiki (ethereum#25086)

commit f74bb3a
Author: Ivan Aracki <aracki.ivan@gmail.com>
Date:   Tue Jun 14 10:24:29 2022 +0200

    cmd/utils: update --ropsten description (ethereum#25078)

commit a907d7e
Author: Martin Holst Swende <martin@swende.se>
Date:   Mon Jun 13 16:24:45 2022 +0200

    all: more linters (ethereum#24783)

    This enables the following linters

    - typecheck
    - unused
    - staticcheck
    - bidichk
    - durationcheck
    - exportloopref
    - gosec

    WIth a few exceptions.

    - We use a deprecated protobuf in trezor. I didn't want to mess with that, since I cannot meaningfully test any changes there.
    - The deprecated TypeMux is used in a few places still, so the warning for it is silenced for now.
    - Using string type in context.WithValue is apparently wrong, one should use a custom type, to prevent collisions between different places in the hierarchy of callers. That should be fixed at some point, but may require some attention.
    - The warnings for using weak random generator are squashed, since we use a lot of random without need for cryptographic guarantees.

commit eb94896
Author: Gustavo Silva <GustavoRSSilva@users.noreply.github.com>
Date:   Fri Jun 10 16:47:06 2022 +0100

    Chore:  Minimal gramatical errors (signleton -> singleton) (ethereum#25057)

    core: fix typos

commit 3f5b5ec
Author: Luozhu <70309026+LuozhuZhang@users.noreply.github.com>
Date:   Fri Jun 10 16:57:32 2022 +0800

    internal/ethapi: fix typo in comment (ethereum#25056)

    typo error: keccack256 -> keccak256

commit 594e321
Author: int88 <106391185+int88@users.noreply.github.com>
Date:   Thu Jun 9 00:40:37 2022 +0800

    core/evm: fix error in comment (ethereum#25040)

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

commit f503718
Author: henridf <henri@dubfer.com>
Date:   Wed Jun 8 18:32:07 2022 +0200

    core/types: improve LogForStorage and ReceiptForStorage comments (ethereum#25032)

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

commit 6160296
Author: Rajaram Gaunker <zimbabao@gmail.com>
Date:   Wed Jun 8 09:31:43 2022 -0700

    core/types: remove unused field 'td' in Block (ethereum#25010)

commit b60a08d
Author: Martin Holst Swende <martin@swende.se>
Date:   Wed Jun 8 15:36:25 2022 +0200

    eth/catalyst: remove unauthenticated 'engine' api (ethereum#24997)

    Removes engine from any unauthenticated RPC service.

commit c4dab8c
Merge: 138f0d7 106a162
Author: Péter Szilágyi <peterke@gmail.com>
Date:   Wed Jun 8 16:34:43 2022 +0300

    Merge pull request ethereum#25044 from karalabe/rpc-histograms

    rpc: swap out timer metrics to histograms

commit 106a162
Author: Péter Szilágyi <peterke@gmail.com>
Date:   Wed Jun 8 16:24:33 2022 +0300

    rpc: swap out timer metrics to histograms

commit 138f0d7
Author: Håvard Anda Estensen <haavard.ae@gmail.com>
Date:   Tue Jun 7 17:27:21 2022 +0200

    p2p: use errors.Is for error comparison (ethereum#24882)

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

commit 41e7548
Author: Péter Szilágyi <peterke@gmail.com>
Date:   Tue Jun 7 13:49:07 2022 +0300

    eth, les, params: log chain config a bit saner (ethereum#24904)

    Previously on Geth startup we just logged the chain config is a semi-json-y format. Whilst that worked while we had a handful of hard-forks defined, currently it's kind of unwieldy.

    This PR converts that original data dump and converts it into a user friendly - alas multiline - log output.

commit 450f5da
Author: Seungbae.yu <72970043+dbadoy@users.noreply.github.com>
Date:   Tue Jun 7 19:46:27 2022 +0900

    accounts: increase parseURL test coverage (ethereum#25033)

    accounts/url: add test logic what check null string to parseURL()

commit 403624a
Author: Martin Holst Swende <martin@swende.se>
Date:   Tue Jun 7 12:15:22 2022 +0200

    p2p/discover: fix panicky test (ethereum#25038)

commit 5e8fa1d
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Tue Jun 7 09:06:34 2022 +0200

    tests/fuzzers/bls12381: fix blst pairing (ethereum#25037)

    * tests/fuzzers/bls12381: fix blst pairing

    * tests/fuzzers/bls12381: only build on gofuzz

    * tests/fuzzers/bls12381: remove unused code

    * tests/fuzzers/bls12381: remove unused code

commit 84b3272
Author: lwh <lwhile521@gmail.com>
Date:   Tue Jun 7 14:38:54 2022 +0800

    accounts/abi/bind: fix duplicate field names in the generated go struct (ethereum#24924)

    * accounts/abi/bind: fix duplicate field names in the generated go struct ethereum#24627

    * accounts, cmd/abigen: resolve name conflicts

    * ci lint, accounts/abi: remove unused function overloadedArgName

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

commit d9566e3
Author: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Date:   Tue Jun 7 08:31:19 2022 +0200

    eth/filters: fix getLogs for pending block (ethereum#24949)

    * eth/filters: fix pending for getLogs

    * add pending method to test backend

    * fix block range validation

commit 7e9514b
Author: Martin Holst Swende <martin@swende.se>
Date:   Tue Jun 7 08:11:01 2022 +0200

    params: update ropsten terminal total difficulty block (ethereum#25018)

commit 6b3e6cb
Author: aaronbuchwald <aaron.buchwald56@gmail.com>
Date:   Tue Jun 7 02:02:04 2022 -0400

    trie: move locking into trieDB insert method (ethereum#25030)

    Move locking into trieDB insert function

commit 096daa9
Author: Ikko Ashimine <eltociear@gmail.com>
Date:   Tue Jun 7 00:55:16 2022 +0900

    eth/tracers: fix typo in 4byte_tracer_legacy.js (ethereum#25020)

    indentifier -> identifier

commit 10da980
Author: lightclient <14004106+lightclient@users.noreply.github.com>
Date:   Mon Jun 6 17:33:05 2022 +0200

    eth/api: use `hexutil.Bytes` for account range method (ethereum#25024)

    eth/api: use hexutil.Bytes for range at methods

commit 22defa5
Author: rjl493456442 <garyrong0905@gmail.com>
Date:   Mon Jun 6 23:14:55 2022 +0800

    all: introduce trie owner notion (ethereum#24750)

    * cmd, core/state, light, trie, eth: add trie owner notion

    * all: refactor

    * tests: fix goimports

    * core/state/snapshot: fix ineffasigns

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

commit c375ee9
Author: Martin Holst Swende <martin@swende.se>
Date:   Mon Jun 6 17:09:39 2022 +0200

    cmd/geth, core/state/snapshot: rework journal loading, implement account-check (ethereum#24765)

    * cmd/geth, core/state/snapshot: rework journal loading, implement account-check

    * core/state/snapshot, cmd/geth: polish code (#37)

    * core/state/snapshot: minor nits

    * core/state/snapshot: simplify error logic

    * cmd/geth: go format

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

commit d6b5574
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Mon Jun 6 17:01:59 2022 +0200

    tests/fuzzers/bls12381: fix blst deserializing (ethereum#25036)

    * tests/fuzzers/bls12381: fix blst deserializing

    * tests/fuzzers/bls12381: fix blst deserializing

commit 997f1c4
Author: Paweł Bylica <chfast@gmail.com>
Date:   Fri Jun 3 10:40:14 2022 +0200

    core/vm: optimize jumpdest analysis (ethereum#23500)

    core/vm: optimize PUSH opcode discrimination

commit b453767
Author: s7v7nislands <s7v7nislands@gmail.com>
Date:   Fri Jun 3 15:25:25 2022 +0800

    go.mod: clean up (ethereum#25017)

commit 5bc4e8f
Author: Jonathan Le Brun <42697488+icyfry@users.noreply.github.com>
Date:   Thu Jun 2 20:26:44 2022 +0200

    go.mod: set go version to 1.17 (ethereum#24926)

    set go version to 1.17

commit 490c45c
Author: Ivan Kuznetsov <me@jeiwan.ru>
Date:   Fri Jun 3 01:25:12 2022 +0700

    consensus/misc: reduce allocations and improve comments in CalcBaseFee (ethereum#24958)

    * consensus/misc: reduce allocations in CalcBaseFee

    * consensus/misc: add formulas of CalcBaseFee

commit 6f075bf
Author: Martin Holst Swende <martin@swende.se>
Date:   Thu Jun 2 20:21:35 2022 +0200

    node: make jwt test less dependent on time (ethereum#25016)

commit 2227589
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Thu Jun 2 13:15:17 2022 +0200

    eth/catalyst: return 0x0 on Invalid block on top of pow block (ethereum#25006)

commit 3c6d6f7
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Thu Jun 2 13:13:28 2022 +0200

    tests/fuzzers/bls12381: Add BLST to fuzzing support (ethereum#24249)

    * tests/fuzzers/bls12381: added blst library

    * go.mod: added blst dependency

    * tests/fuzzers/bls12381: stuff

    * tests/fuzzers/bls12381: added blst to pairing fuzzer

commit d8a2305
Author: Martin Holst Swende <martin@swende.se>
Date:   Thu Jun 2 11:39:36 2022 +0200

    eth/tracers: add support for block overrides in debug_traceCall (ethereum#24871)

    This PR adds support for block overrides when doing debug_traceCall.

    - Previously, debug_traceCall against pending erroneously used a common.Hash{} stateroot when looking up the state, meaning that a totally empty state was used -- so it always failed,
    - With this change, we reject executing debug_traceCall against pending.
    - And we add ability to override all evm-visible header fields.

commit f9806dc
Author: rjl493456442 <garyrong0905@gmail.com>
Date:   Wed Jun 1 17:03:24 2022 +0800

    core: fix canonical hash marker update (ethereum#24996)

    * core: fix reorg

    * core: revert change for memory efficiency

    * core: revert changes

commit 8c0c043
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Tue May 31 11:11:50 2022 +0200

    core/beacon: prevent invalid logsBloom length panic (ethereum#24946)

    * core/beacon: prevent invalid logsBloom length panic

    * core/beacon: prevent negative baseFeePerGas

    * Update core/beacon/types.go

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

    * eth/catalys: go format

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

commit 03157b6
Author: Boqin Qin(秦 伯钦) <Bobbqqin@gmail.com>
Date:   Tue May 31 02:35:37 2022 +0800

    eth/filters: use buffered channel to avoid goroutine leak (ethereum#24928)

commit 2140aab
Author: Martin Holst Swende <martin@swende.se>
Date:   Mon May 30 14:45:27 2022 +0200

    contracs/checkpointoracle: fix directives (ethereum#24944)

    contracts/checkpointoracle: redefine go-generate logic

commit 93fe175
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Mon May 30 13:28:15 2022 +0200

    eth/catalyst: fix edge case in NewPayload (ethereum#24955)

    Fixes an issue where we would accept a NewPayload where the grandparent is already post ttd, and the parent still has a Difficulty

commit 8845227
Author: Harry Kalodner <harry.kalodner@gmail.com>
Date:   Mon May 30 07:00:23 2022 -0400

    consensus/clique: fix race condition (ethereum#24957)

    * consensus/clique: remove race condition

    * consensus/clique: fix one more signer data race

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

commit a10660b
Author: rjl493456442 <garyrong0905@gmail.com>
Date:   Mon May 30 18:37:42 2022 +0800

    cmd/geth: extend traverseRawState command (ethereum#24954)

    This PR adds node verification into traverseRawState command, so corrupted trie nodes can also be detected.

commit 86af788
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Mon May 30 08:42:06 2022 +0200

    core: use less memory during reorgs (ethereum#24616)

    This PR significantly reduces the memory consumption of a long reorg

commit be97427
Author: Marius van der Wijden <m.vanderwijden@live.de>
Date:   Fri May 27 08:23:55 2022 +0200

    params: set emergency ropsten TTD to 100_000_000_000_000_000_000_000 (ethereum#24975)

commit 0287e1a
Author: Martin Holst Swende <martin@swende.se>
Date:   Thu May 26 09:26:37 2022 +0200

    cmd/abigen: accept combined-json via stdin (ethereum#24960)

commit 0559a9a
Author: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Date:   Thu May 26 09:22:10 2022 +0200

    cmd/geth: exit when freezer has legacy receipts (ethereum#24943)

    In ethereum#24028 we flagged a warning when finding legacy receipts in the freezer. This PR nudges users a bit more strongly by preventing geth from starting in this case until receipts have been migrated.

    It also adds a flag --ignore-legacy-receipts which when present allows geth to start normally.

commit d575a2d
Author: Felix Lange <fjl@twurst.com>
Date:   Wed May 25 14:44:52 2022 +0200

    params: begin v1.10.19 release cycle
dmarzzz pushed a commit to blocknative/go-ethereum that referenced this pull request Jun 27, 2022
* params: begin v1.10.18 release cycle

* rlp: fix typo in comment (ethereum#24595)

Co-authored-by: Yong Yang <yangyong775654@163.com>

* core/state/snapshot: clean up the generation code (ethereum#24479)

* go.mod : upnp 1.0.3 stable version (ethereum#24573)

* internal/ethapi: add refund to StructLogRes (ethereum#24567)

* internal/ethapi: add refund to StructLogRes

* Update internal/ethapi/api.go

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

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

* eth/tracers/logger: use omitempty to reduce log bloat  (ethereum#24547)

Makes the evm json output less verbose: omitting output of `memory` and `returndata` in case they are empty.

* common/compiler: add extra include paths to solidity compiler (ethereum#24541)

This PR adds a ExtraAllowedPath field to Solidity and exposes two APIs: CompileSource and CompileFiles, which were hidden inside CompileSolidityString and CompileSolidity before.

* core: verify genesis extradata for clique (ethereum#24470)

* Add extra-data checks for clique genesis

* Update genesis.go

* Update genesis.go

* core: simplify clique genesis check

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

* eth: change snapshot extension registration failure to warning instead of error (ethereum#24475)

* core: Change Snapshot extension registration failed to Debug

* Update eth/handler.go

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

* trie, les, tests, core: implement trie tracer (ethereum#24403)

Trie tracer is an auxiliary tool to capture all deleted nodes
which can't be captured by trie.Committer. The deleted nodes
can be removed from the disk later.

* core,eth: implement tx-level hooks for tracers (ethereum#24510)

* core,eth: add empty tx logger hooks

* core,eth: add initial and remaining gas to tx hooks

* store tx gasLimit in js tracer

* use gasLimit to compute intrinsic cost for js tracer

* re-use rules in transitiondb

* rm logs

* rm logs

* Mv some fields from Start to TxStart

* simplify sender lookup in prestate tracer

* mv env to TxStart

* Revert "mv env to TxStart"

This reverts commit 656939634b9aff19f55a1cd167345faf8b1ec310.

* Revert "simplify sender lookup in prestate tracer"

This reverts commit ab65bce48007cab99e68232e7aac2fe008338d50.

* Revert "Mv some fields from Start to TxStart"

This reverts commit aa50d3d9b2559addc80df966111ef5fb5d0c1b6b.

* fix intrinsic gas for prestate tracer

* add comments

* refactor

* fix test case

* simplify consumedGas calc in prestate tracer

* eth: clarify the error string on getlogs failure (ethereum#24617)

This PR makes the errors we spit out a bit more clear about what block is problematic.

* eth/downloader: retrieve pivot header from local chain if necessary (ethereum#24610)

* eth/downloader: retrieve pivot header from local chain if necessary

* eth/downloader: improve readability

* eth/downloader: update fix

* eth/downloader: add beacon sync tests

* eth/downloader: remove duplicated code

* README: update free space required (ethereum#24636)

* rpc: fixed a typo (ethereum#24642)

* eth/fetcher: if peers never respond, drop them

* eth/tracers: refactor traceTx to separate out struct logging (ethereum#24326)

* eth/tracers: refactor traceTx to separate out struct logging

review fix

Update eth/tracers/api.go

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

Mv ExecutionResult type to logger package

review fix

impl GetResult for StructLogger

make formatLogs private

confused exit and end..

account for intrinsicGas in structlogger, fix TraceCall test

Add Stop method to logger

Simplify traceTx

Fix test

rm logger from blockchain test

account for refund in structLogger

* use tx hooks in struct logger

* minor

* avoid executionResult in struct logger

* revert blockchain test changes

* README: remove mentions of fast sync (ethereum#24656)

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

* core/state/snapshot: remove noop map item assignment

* cmd/geth: inspect snapshot dangling storage (ethereum#24643)

* cmd/geth: inspect snapshot dangling storage

* cmd/geth: make verify-state invoke verify-dangling

* accounts/abi: handle tuple arrays in ParseSelector (ethereum#24587)

Closes ethereum#24571

* all: use T.TempDir to create temporary test directories (ethereum#24633)

This commit replaces ioutil.TempDir with t.TempDir in tests. The
directory created by t.TempDir is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using ioutil.TempDir
had to be removed manually by calling os.RemoveAll, which is omitted in
some tests. The error handling boilerplate e.g.

	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}

is also tedious, but t.TempDir handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

* les: fix panic in ultralight client sync (ethereum#24641)

* log: modify lock defer unlock order in sync handler (ethereum#24667)

This modifies the order of Lock() defer Unlock() to follow the more
typically used pattern.

* build/deb: update Debian control file to remove unencrypted git protocol (ethereum#24676)

* core/types: make "miner" optional in Header JSON (ethereum#24666)

"miner" is not set for pending block responses in some cases.

Fixes ethereum#24632

* cmd: set DefaultGasLimit to 30M (ethereum#24680)

* cmd: set DefaultGasLimit to 30M, rem deprec. Flag

* cmd: revert flag deprecation

* core: fix benchmark panic (ethereum#24657)

This PR fixes a few panics in the chain marker benchmarks. The root
cause for panic is in chain marker the genesis header/block is not
accessible, while it's expected to be obtained in tests. So this PR
avoids touching genesis header at all to avoid panic.

* abi/base: return error for pending call error (ethereum#24649)

If a pending contract call errors, return that error right away rather
than ignoring it to allow an error somewhere else. This is helpful for
callers to know if perhaps a call failed because of the context deadline
being expired. This change mirrors the behavior of non-pending contract
calls.

* build: add imports for go generate tools (ethereum#24682)

This adds a tools.go file to import all command packages used for
go:generate. Doing so makes it possible to execute go-based code
generators using 'go run', locking in the tool version using go.mod.

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

* eth/tracers: make txhash blockhash accessible to native tracers (ethereum#24679)

* cmd/geth: support bigints for --override.terminaltotaldifficulty (ethereum#24646)


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

* eth/downloader: remove stale beacon headers as backfilling progresses (ethereum#24670)

* eth/downloader: remove stale beacon headers as backfilling progresses

* eth/downloader: remove leftover from a previous design

* eth/downloader: do partial beacon cleanups if chain is large

* eth/downloader: linter != heart

* build: upgrade -dlgo version to Go 1.18.1 (ethereum#24689)

* build: upgrade -dlgo version to Go 1.18.1

* build: upgrade -dlgo version for macOS to Go 1.18.1

* eth/downloader: resolve local header by hash for beacon sync (ethereum#24691)

* eth/downlaoder: resolve local header by hash for beacon sync

* eth/downloader: fix error message

* eth/downloader: cap the reverse header resolving

* eth/downloader: re-enable tests

* eth/downloader: add warning logs

* go.mod: upgrade btcec and add 'chainhash' module requirement (ethereum#24700)

See ethereum#24554 and btcsuite/btcd#1839

This is an attempt to resolve a Go module dependency issue that arises
when both 'github.com/btcsuite/btcd/btcec/v2' and the older, non-v2
btcd module are required as dependencies.

* trie: remove unused makeHashNode (ethereum#24702)

* core/vm: fix typo (ethereum#24714)

Was just browsing the code and found this.

* eth/downloader: fix typo in downloader.go (ethereum#24704)

synchornization -> synchronization

* eth/tracers/logger: remove unnecessary comparisons in accessList.equal (ethereum#24663)

This change removes extraneous/unnecessary checks for equality
when comparing 2 accessList values A and B. Given that we validate that
their lengths of A and B are equal, if so and if every element in A is
in B, reflexively every element in B is already in A. If that weren't
the case and an element g existed in A but not in B, that would mean
that there is an extra element and hence a mathematical contradiction.

Fixes ethereum#24658

* README.md: update Go min required version to 1.16 (ethereum#24713)

* .github: update CODEOWNERS (ethereum#24743)

* internal/flags: fix godoc (ethereum#24734)

* cmd/faucet: fix genesis flag and improve documentation (ethereum#24735)

* cmd/evm: ensure input length is even (ethereum#24721)

* cmd/evm: ensure input length is even

* cmd/evm: minor nit + lintfix

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

* fix typo (ethereum#24731)

* mobile: fix receipt encoding to json (ethereum#24701)

* p2p: fix type of DiscSubprotocolError (ethereum#24747)

It was 'int' accidentally, should be DiscReason instead.

* all: use 'embed' instead of go-bindata (ethereum#24744)

* cmd/geth, core/state/snapshot: fix flaw in dangling-storage check + inspect difflayers (ethereum#24677)

This PR fixes the flaw that @rjl493456442 found in https://github.com/ethereum/go-ethereum/pull/#issuecomment-1093817551 , namely, that the snapshot iterator uses the combined (disk + difflayers) 'view', wheres the raw iterator uses only the disk 'view'.

This PR instead splits up the work: one phase is iterating the disk layer data, another phase is loading the journalled difflayers and performing the same check there.

* cmd/*: refactor get flag value (ethereum#24761)

* consensus/ethash: fix typos in var names (ethereum#24745)

* internal/ethapi: add db operations to api (ethereum#24739)

Adds `debug_dbGet` method to rpc api

* core/types: fix unhandled errors in TestTransactionCoding (ethereum#24692)

* cmd/utils: utilize beacon wrapper in makechain (ethereum#24620)

* cmd/utils: utilize beacon wrapper in makechain

* cmd/utils: fix fake-pow to also be wrapped in beacon

* consensus/misc: correct error message

* all: use common.FileExist for checking file existence (ethereum#24748)

* ethclient/gethclient: return storage proofs in GetProof (ethereum#24697)

Storage proofs were being unmarshalled from the RPC form to the go struct, but were not being included in the final returned struct.

* eth/filters: remove unused struct fields (ethereum#24782)

* cmd/clef: fixups to the python clef poc (ethereum#24440)

This PR fixes up the example python clef wrapper. The poc is intended to demonstrate how to wite a UI for clef, and had severely bitrotted.
With these changes, it "works" in the sense that all the built-in tests triggers the intended python callbacks (no errors about method not found). It does not "work" in the sense that the wrapper can be used as an actual UI. It will auto-reject any signing requests, for example.

* cmd/evm: make evm t8n handle post-merge transitions (ethereum#24546)

This adds the ability to run --state.fork=Merged, and have post-merge rules apply. When doing so, it also requires the input env to contain currentRandom, and enforces the currentDifficulty to be omitted or zero.

* cmd: group network and db path flags together (ethereum#24698)

This PR groups all built-in network flags together and list them in the command as a whole.

And all database path flags(datadir, ancient) are also grouped, since usually these two are
used together.

* accounts: fix typo in comments (ethereum#24805)

* docker: speed up docker image build (ethereum#24796)

This PR improves the docker build speed for repeated builds where go.mod and go.sum do no change, by placing the downloaded dependencies in a lower layer

* cmd/utils: double limit on free-disk monitor (ethereum#24781)

This PR doubles the limit on which to trigger automatic shutdown, and also changes the timer to run once every 30s instead of 60s.

* build: fix formatted logs (ethereum#24807)

Changed `log.Fatal` to `log.Fatalf()` as it has a parameter...

* build: ppa build for jammy (ubuntu 22.04)

* graphql: add rawReceipt field to transaction type (ethereum#24738)

* graphql: add tx receiptsRLP field

* use MarshalBinary

Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>

* update schema

Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>

* rename to rawReceipt

* indent fix

Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>

* eth/filters: fix code comment (ethereum#24799)

* cmd/geth: fix init genesis for dev (ethereum#24693)

* cmd/geth: fix init genesis for dev

* use ancient flag for init genesis cmd

* cmd, eth: fix required blocks regression

* core: fix WriteBlockAndSetHead documentation (ethereum#24818)

* core: recover state when beacon sets canonical head if it's missing (ethereum#24613)

* core: recover the state in SetChainHead if the head state is missing

* core: disable test logging

* core: address comment from martin

* core: improve log level in case state is recovered

* core, eth, les, light: rename SetChainHead to SetCanonical

* eth/protocols/eth: fix godoc comments (ethereum#24810)


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

* eth/filters: remove explicit continue label in filterLogs (ethereum#24795)

The loop label can be removed because this 'continue' statement
is not in a nested loop.

* p2p/simulations: escape mockerType value from request (ethereum#24822)


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

* p2p/simulations: fix typo in network_test.go (ethereum#24824)

* miner: discard interrupted blocks (ethereum#24638)

During mining, when a new head arrives and interrupts the block building, the block being built should not be commited (but discarded). Committing the interrupted block introduces unnecessary delay, and possibly causes miner to mine on the previous head, which could result in higher uncle rate.

* core/rawdb: untie freezer and ancient chain data (ethereum#24684)

Previously freezer has only been used for storing ancient chain data, while obviously it can be used more. This PR unties the chain data and freezer, keep the minimal freezer structure and move all other logic (like incrementally freezing block data) into a separate structure called ChainFreezer.

This PR also extends the database interface by adding a new ancient store function AncientDatadir which can return the root directory of ancient store. The ancient root directory can be used when we want to open some other ancient-stores (e.g. reverse diff freezer).

* core/vm: implement EIP-3855: PUSH0 instruction (ethereum#24039)

* core/vm: Implement PUSH0

* Move PUSH0 to enable3855

* Add method doc

* eth/fetcher: avoid hang in tests (partial fix for ethereum#23331) (ethereum#23351)

* eth/fetcher: fix test to avoid hanging. Partial fix for ethereum#23331

* eth/filters: avoid dangling goroutines

* eth/fetcher: revert closing of proceed

* signer/fourbyte: import new signatures (ethereum#22865)

* abi: fix checks when all fields are indexed (ethereum#24792)

This PR fixes abi checks in the edge case where all arguments are indexed

* core/state/snapshot: fix race condition (ethereum#24685)

Fixes three race conditions found through fuzzing by David Theodore

* all: replace strings.Replace with string.ReplaceAll (ethereum#24835)

* internal: drop TestSignCliqueBlock (ethereum#24837)

* signer/fourbyte: remove offending signatures (ethereum#24842)

* core/vm: update benchmark to use Errorf instead of Sprintf (ethereum#24845)

* eth/protocols/snap: sort trienode heal requests by path (ethereum#24779)

* sort snap trienode heal requests

* eth/protocols/snap: remove debug code

* eth/protocols/snap: simplify sort, generate pathsets later

* eth/protocols/snap: review concern

* eth/protocols/snap: renamings

* eth/protocols/snap: add comments in Merge

* eth/protocols/snap: remove variable 'last' in Merge

* eth/protocols/snap: fix lint flaws in test

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

* cmd/geth: print info banner for --dev mode (ethereum#24759)


Co-authored-by: nedifi <nedifi@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* core/vm: clean up some dead functions (ethereum#24851)

* core/vm: separate opcode group for 0x20 range (ethereum#24850)

* ethclient: add PeerCount method (ethereum#24849)

* adding peer count function

* Update ethclient.go

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

* core/vm: optimize Memory.Set32 (ethereum#24847)

* core/vm: remove unnecessary memset for Memory.Set32

* core/vm: optimize Memory.Set32

* graphql: fix long literal passed in a variable (ethereum#24864)

* core/vm: for tracing, do not report post-op memory

* internal/ethapi: add debug_getRawReceipts RPC method (ethereum#24773)

Adds a method to retrieve all the binary encoded receipts from a block

* params: set ropsten TTD for TheMerge (ethereum#24876)

* cmd/utils: add deprecation warning for Rinkeby

* core/asm: use strings.Builder and fix godoc issues (ethereum#24861)

* all: replace uses of ioutil with io and os (ethereum#24869)

* cmd/geth: update vulnerabilities.json testdata (ethereum#24856)

* core/vm: reduce overhead in instructions-benchmark (ethereum#24860)

* core/vm: reduce footprint of OP benchmark

* core/vm: for opBenchmark, add code to detect inputs mutation

* Update core/vm/instructions_test.go

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

* core/vm: opBenchmark, stop timer before sanity-test code

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

* eth: fix flaky test, don't attach empty slots/proofs (ethereum#24885)

* eth/protocols/snap: don't include empty snapshot slot slice

This PR fixes the snapshot storage serving handler. In snap protocol
the response is capped by the response size. Server can cutdown the
response if the accumulated byte size exceeds the local hard limit.

It means we can meet a special scenario that there is no storage slot
included for a requested account, but we attach the proof for this
account by mistake.

So in the prover side, when it meets a empty storage response but with
a valid proof proves there are some more slots left in the trie, then
requestor will reject this response and disconnect with server.

In this PR, if there is no storage slot served for the requested account,
then no proof should be attached as well.

* eth/protocols/snap: loosen restrictions for flaky tests

* eth/catalyst: fix flaky test in catalyst

* graphql: add raw fields to block and tx (ethereum#24816)

* eth/catalyst: set the correct LatestValidHash (ethereum#24855)

* eth/catalyst: set the correct LatestValidHash

* eth/catalyst: core: return LVH during reorg, rework invalid teminal block

* eth/catalyst: nitpicks

* cmd/geth: add `db check-state-content` to verify integrity of trie nodes (ethereum#24840)

This PR adds db tooling (geth db check-state-content)  to verify the integrity of trie nodes. It iterates through the 32-byte key space in the database, which is expected to contain RLP-encoded trie nodes, addressed by hash.

* all: use strings.EqualFold for string comparison (ethereum#24890)

* all: replace non-trivial uses of package ioutil with os (ethereum#24886)


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

* ethdb/remotedb, cmd: add support for remote (readonly) databases (ethereum#24836)

* ethdb/remotedb, cmd: add support for remote (readonly) databases

* ethdb/remotedb: minor changes

* ethdb/remotedb: close the conn

* cmd, ethdb: add rpc accessor for ancient data

* internal/ethapi: license

* ethdb/remotedb: linter fixes

* core, eth, internal, rpc: implement final block (ethereum#24282)

* eth: core: implement finalized block

* eth/catalyst: fix final block

* eth/catalyst: update finalized head gauge

* internal/jsre/deps: updated web3.js to allow for finalized block

* eth/catalyst: make sure only one thread can call fcu

* eth/catalyst: nitpicks

* eth/catalyst: use plain mutex

* eth: nitpicks

* eth/catalyst, miner: build the execution payload async (ethereum#24866)

* eth/catalyst: build the execution payload async

* miner: added comment, added test case

* eth/catalyst: miner: move async block production to miner

* eth/catalyst, miner: support generate seal block async

* miner: rework GetSealingBlockAsync to use a passed channel

* miner: apply rjl's diff

* eth/catalyst: nitpicks

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

* eth/tracers/js: goja tracer (ethereum#23773)

This adds a JS tracer runtime environment based on the Goja VM. The new
runtime replaces the duktape runtime, which will be removed soon.

Goja is implemented in Go and is faster for cases where the Go <-> JS
transition overhead dominates overall performance. It is faster because
duktape is written in C, and the transition cost includes the cost of using
cgo. Another reason for using Goja is that go-duktape is not maintained
anymore.

We expect the performace of JS tracing to be at least as good or better with
this change.

* params: update goerli bootnodes (ethereum#24900)

* params: update goerli bootnodes

* params: use ip for enodes

* params: fix broken linter

* ethdb/remotedb: fix flawed check in Has/HasAncient

* core: fix the order of address in queue (ethereum#24907)

reverse the order of address in queue

* tests: update reference tests (ethereum#24899)

* tests: update reference tests

* tests: fix flaw in state test execution

* f

* eth/tracers/js: add memory.length method (ethereum#24887)

* eth/catalyst: update implementation to spec (ethereum#24802)

* eth/catalyst: return invalid payload attributes error

* eth/catalyst: implement LVH as specified, add tests

* eth/catalyst: return current block hash not header hash

* eth/catalyst: fix test

* eth/catalyst: bring error codes in line with spec

* core, eth, les, rpc: polish catalyst errors, add context

* build/bot: add mac build script (ethereum#24917)

* build/bot: remove xctool invocation in macos build script (ethereum#24918)

* build/bot: add ppa-build.sh (ethereum#24919)

* build/bot: avoid install of python-bzrlib, python-paramiko in PPA build (ethereum#24921)

* build/bot: create .ssh directory in ppa-build.sh (ethereum#24922)

* core/state/snapshot: detect and clean up dangling storage snapshot in generation (ethereum#24811)

* core/state/snapshot: check dangling storages when generating snapshot

* core/state/snapshot: polish

* core/state/snapshot: wipe the last part of the dangling storages

* core/state/snapshot: fix and add tests

* core/state/snapshot: fix comment

* README: remove mentions of fast sync (ethereum#24656)

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

* core, cmd: expose dangling storage detector for wider usage

* core/state/snapshot: rename variable

* core, ethdb: use global iterators for snapshot generation

* core/state/snapshot: polish

* cmd, core/state/snapshot: polish

* core/state/snapshot: polish

* Update core/state/snapshot/generate.go

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

* ethdb: extend db test suite and fix memorydb iterator

* ethdb/dbtest: rollback changes

* ethdb/memorydb: simplify iteration

* core/state/snapshot: update dangling counter

* core/state/snapshot: release iterators

* core/state/snapshot: update metrics

* core/state/snapshot: update time metrics

* metrics/influxdb: temp solution to present counter meaningfully, remove it

* add debug log, revert later

* core/state/snapshot: fix iterator panic

* all: customized snapshot iterator for backward iteration

* core, ethdb: polish

* core/state/snapshot: remove debug log

* core/state/snapshot: address comments from peter

* core/state/snapshot: reopen the iterator at the next position

* ethdb, core/state/snapshot: address comment from peter

* core/state/snapshot: reopen exhausted iterators

Co-authored-by: Tbnoapi <63448616+nuoomnoy02@users.noreply.github.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* accounts/abi: validate fieldnames, fixes ethereum#24930 (ethereum#24932)

* common/compiler, cmd/abigen: remove solc/vyper compiler integration

* eth/tracers/js: drop duktape engine (ethereum#24934)

ethereum#23773 added a JS tracer which uses Goja as its engine. In this PR I remove the previous tracer which used duktape as well as remove the dependencies.

This PR also comes with 2 fixes in the Goja tracer and one small behavioural change:

    I had handled errors in the native Go functions by panicing. My oversight was that Goja only handles panics with a Goja.Value as argument. The difference is panic(goja.Value) allows JS to catch the exception whereas Interrupt(error) doesn't.
    There was a race in how I handled Stop.
    Because of 1. some of the methods that simply return nil on error (like memory.slice) now throw an exception.

* signer/core: always pad clique header extra data with space for sealer's signature (ethereum#24941)

* signer/core: always pad clique header extra data with space for sealer's signature

* capitalize comment

* go.mod: upgrade to btcsuite/btcd/btcec v2.2.0 (ethereum#24939)

This should fully resolve dependency conflict issues in modules
that also depend on btcsuite/btcd v0.22.0.

* params: update CHTs for Geth 1.10.18

* all: update license headers and AUTHORS from git history (ethereum#24947)

* AUTHORS: remove one more duplicate entry (ethereum#24950)

* go.mod: upgrade to docker v1.6.2 (ethereum#24956)

This upgrade is necessary to silence a Dependabot warning.

* params: go-ethereum v1.10.18 stable

* params: begin v1.10.19 release cycle

* cmd/geth: exit when freezer has legacy receipts (ethereum#24943)

In ethereum#24028 we flagged a warning when finding legacy receipts in the freezer. This PR nudges users a bit more strongly by preventing geth from starting in this case until receipts have been migrated.

It also adds a flag --ignore-legacy-receipts which when present allows geth to start normally.

* cmd/abigen: accept combined-json via stdin (ethereum#24960)

* params: set emergency ropsten TTD to 100_000_000_000_000_000_000_000 (ethereum#24975)

* core: use less memory during reorgs (ethereum#24616)

This PR significantly reduces the memory consumption of a long reorg

* cmd/geth: extend traverseRawState command (ethereum#24954)

This PR adds node verification into traverseRawState command, so corrupted trie nodes can also be detected.

* consensus/clique: fix race condition (ethereum#24957)

* consensus/clique: remove race condition

* consensus/clique: fix one more signer data race

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

* eth/catalyst: fix edge case in NewPayload (ethereum#24955)

Fixes an issue where we would accept a NewPayload where the grandparent is already post ttd, and the parent still has a Difficulty

* contracs/checkpointoracle: fix directives (ethereum#24944)

contracts/checkpointoracle: redefine go-generate logic

* eth/filters: use buffered channel to avoid goroutine leak (ethereum#24928)

* core/beacon: prevent invalid logsBloom length panic (ethereum#24946)

* core/beacon: prevent invalid logsBloom length panic

* core/beacon: prevent negative baseFeePerGas

* Update core/beacon/types.go

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

* eth/catalys: go format

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

* core: fix canonical hash marker update (ethereum#24996)

* core: fix reorg

* core: revert change for memory efficiency

* core: revert changes

* eth/tracers: add support for block overrides in debug_traceCall (ethereum#24871)

This PR adds support for block overrides when doing debug_traceCall.

- Previously, debug_traceCall against pending erroneously used a common.Hash{} stateroot when looking up the state, meaning that a totally empty state was used -- so it always failed,
- With this change, we reject executing debug_traceCall against pending.
- And we add ability to override all evm-visible header fields.

* tests/fuzzers/bls12381: Add BLST to fuzzing support (ethereum#24249)

* tests/fuzzers/bls12381: added blst library

* go.mod: added blst dependency

* tests/fuzzers/bls12381: stuff

* tests/fuzzers/bls12381: added blst to pairing fuzzer

* eth/catalyst: return 0x0 on Invalid block on top of pow block (ethereum#25006)

* node: make jwt test less dependent on time (ethereum#25016)

* consensus/misc: reduce allocations and improve comments in CalcBaseFee (ethereum#24958)

* consensus/misc: reduce allocations in CalcBaseFee

* consensus/misc: add formulas of CalcBaseFee

* go.mod: set go version to 1.17 (ethereum#24926)

set go version to 1.17

* go.mod: clean up (ethereum#25017)

* core/vm: optimize jumpdest analysis (ethereum#23500)

core/vm: optimize PUSH opcode discrimination

* tests/fuzzers/bls12381: fix blst deserializing (ethereum#25036)

* tests/fuzzers/bls12381: fix blst deserializing

* tests/fuzzers/bls12381: fix blst deserializing

* cmd/geth, core/state/snapshot: rework journal loading, implement account-check (ethereum#24765)

* cmd/geth, core/state/snapshot: rework journal loading, implement account-check

* core/state/snapshot, cmd/geth: polish code (#37)

* core/state/snapshot: minor nits

* core/state/snapshot: simplify error logic

* cmd/geth: go format

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

* all: introduce trie owner notion (ethereum#24750)

* cmd, core/state, light, trie, eth: add trie owner notion

* all: refactor

* tests: fix goimports

* core/state/snapshot: fix ineffasigns

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

* eth/api: use `hexutil.Bytes` for account range method (ethereum#25024)

eth/api: use hexutil.Bytes for range at methods

* eth/tracers: fix typo in 4byte_tracer_legacy.js (ethereum#25020)

indentifier -> identifier

* trie: move locking into trieDB insert method (ethereum#25030)

Move locking into trieDB insert function

* params: update ropsten terminal total difficulty block (ethereum#25018)

* eth/filters: fix getLogs for pending block (ethereum#24949)

* eth/filters: fix pending for getLogs

* add pending method to test backend

* fix block range validation

* accounts/abi/bind: fix duplicate field names in the generated go struct (ethereum#24924)

* accounts/abi/bind: fix duplicate field names in the generated go struct ethereum#24627

* accounts, cmd/abigen: resolve name conflicts

* ci lint, accounts/abi: remove unused function overloadedArgName

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

* tests/fuzzers/bls12381: fix blst pairing (ethereum#25037)

* tests/fuzzers/bls12381: fix blst pairing

* tests/fuzzers/bls12381: only build on gofuzz

* tests/fuzzers/bls12381: remove unused code

* tests/fuzzers/bls12381: remove unused code

* p2p/discover: fix panicky test (ethereum#25038)

* accounts: increase parseURL test coverage (ethereum#25033)

accounts/url: add test logic what check null string to parseURL()

* eth, les, params: log chain config a bit saner (ethereum#24904)

Previously on Geth startup we just logged the chain config is a semi-json-y format. Whilst that worked while we had a handful of hard-forks defined, currently it's kind of unwieldy. 

This PR converts that original data dump and converts it into a user friendly - alas multiline - log output.

* p2p: use errors.Is for error comparison (ethereum#24882)


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

* rpc: swap out timer metrics to histograms

* eth/catalyst: remove unauthenticated 'engine' api (ethereum#24997)

Removes engine from any unauthenticated RPC service.

* core/types: remove unused field 'td' in Block (ethereum#25010)

* core/types: improve LogForStorage and ReceiptForStorage comments (ethereum#25032)


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

* core/evm: fix error in comment (ethereum#25040)


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

* internal/ethapi: fix typo in comment (ethereum#25056)

typo error: keccack256 -> keccak256

* Chore:  Minimal gramatical errors (signleton -> singleton) (ethereum#25057)

core: fix typos

* all: more linters (ethereum#24783)

This enables the following linters

- typecheck
- unused
- staticcheck
- bidichk
- durationcheck
- exportloopref
- gosec

WIth a few exceptions.

- We use a deprecated protobuf in trezor. I didn't want to mess with that, since I cannot meaningfully test any changes there.
- The deprecated TypeMux is used in a few places still, so the warning for it is silenced for now.
- Using string type in context.WithValue is apparently wrong, one should use a custom type, to prevent collisions between different places in the hierarchy of callers. That should be fixed at some point, but may require some attention.
- The warnings for using weak random generator are squashed, since we use a lot of random without need for cryptographic guarantees.

* cmd/utils: update --ropsten description (ethereum#25078)

* readme,eth: remove references to eth.wiki (ethereum#25086)

* cmd/ethkey: use accounts.TextHash (ethereum#25069)

* common: improve pretty duration regex (ethereum#25073)

* common: improve pretty duration regex

* common: improve pretty duration regex

* all: prefer `new(big.Int)` over `big.NewInt(0)` (ethereum#25087)

minor performance improvement: `big.NewInt(0).Xxx` -> `new(big.Int).Xxx`

* eth: add missing period at end of sentences (ethereum#25058)

eth: add missing periods on end of comments

* eth: introduce eth67 protocol (ethereum#24093)

The new protocol version removes support for GetNodeData.
See https://eips.ethereum.org/EIPS/eip-4938 for more information.

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

* cmd, params: implement Gray Glacier hard-fork (EIP-5133) (ethereum#25088)

* cmd/geth, params: implement Gray Glacier (EIP-5133)

* cmd/evm: add gray glacier tests

* params: nitpicks

* params: fixes

* node: add info message when JWT secret is loaded (ethereum#25095)


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

* params: release Geth v1.10.19

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: flowerofdream <775654398@qq.com>
Co-authored-by: Yong Yang <yangyong775654@163.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
Co-authored-by: zhiqiangxu <652732310@qq.com>
Co-authored-by: Guruprasad Kamath <48196632+gurukamath@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Nic Jansma <nic@nicj.net>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
Co-authored-by: Tatsuya Shimoda <tacoo@users.noreply.github.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Tbnoapi <63448616+nuoomnoy02@users.noreply.github.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Tangui Clairet <tangui.clairet@gmail.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: Vaibhaw <kvaibhaw99@gmail.com>
Co-authored-by: JoeGruffins <34998433+JoeGruffins@users.noreply.github.com>
Co-authored-by: Marius Kjærstad <sandakersmann@users.noreply.github.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: Enrique Ortiz <hi@enriqueortiz.dev>
Co-authored-by: Ikko Ashimine <eltociear@gmail.com>
Co-authored-by: Emmanuel T Odeke <odeke@ualberta.ca>
Co-authored-by: Koosha K <koosha--@users.noreply.github.com>
Co-authored-by: s7v7nislands <s7v7nislands@gmail.com>
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: Nikita Kozhemyakin <enginegl.ec@gmail.com>
Co-authored-by: henopied <13500516+henopied@users.noreply.github.com>
Co-authored-by: John Difool <johndifoolpi@gmail.com>
Co-authored-by: tia-99 <67107070+tia-99@users.noreply.github.com>
Co-authored-by: Joshua Gutow <jbgutow@gmail.com>
Co-authored-by: hero5512 <lvshuaino@gmail.com>
Co-authored-by: nujabes403 <nujabes403@gmail.com>
Co-authored-by: EXEC <execvy@gmail.com>
Co-authored-by: Evgeny Kolyakov <freaker2k7@users.noreply.github.com>
Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
Co-authored-by: milesvant <milesvant@gmail.com>
Co-authored-by: ImanSharaf <78227895+ImanSharaf@users.noreply.github.com>
Co-authored-by: Mateusz Morusiewicz <11313015+Ruteri@users.noreply.github.com>
Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
Co-authored-by: Rachel Franks <nfranks@protonmail.com>
Co-authored-by: ||= nil <103940716+nedifi@users.noreply.github.com>
Co-authored-by: nedifi <nedifi@users.noreply.github.com>
Co-authored-by: Felipe Strozberg <48066928+FelStroz@users.noreply.github.com>
Co-authored-by: Qian Bin <cola.tin.com@gmail.com>
Co-authored-by: Håvard Anda Estensen <haavard.ae@gmail.com>
Co-authored-by: Afr Schoe <58883403+q9f@users.noreply.github.com>
Co-authored-by: zhaochonghe <41711151+zhaochonghe@users.noreply.github.com>
Co-authored-by: Eduard S <eduardsanou@posteo.net>
Co-authored-by: Austin Roberts <austin.roberts@rivet.cloud>
Co-authored-by: Harry Kalodner <harry.kalodner@gmail.com>
Co-authored-by: Boqin Qin(秦 伯钦) <Bobbqqin@gmail.com>
Co-authored-by: Ivan Kuznetsov <me@jeiwan.ru>
Co-authored-by: Jonathan Le Brun <42697488+icyfry@users.noreply.github.com>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: lwh <lwhile521@gmail.com>
Co-authored-by: Seungbae.yu <72970043+dbadoy@users.noreply.github.com>
Co-authored-by: Rajaram Gaunker <zimbabao@gmail.com>
Co-authored-by: henridf <henri@dubfer.com>
Co-authored-by: int88 <106391185+int88@users.noreply.github.com>
Co-authored-by: Luozhu <70309026+LuozhuZhang@users.noreply.github.com>
Co-authored-by: Gustavo Silva <GustavoRSSilva@users.noreply.github.com>
Co-authored-by: Ivan Aracki <aracki.ivan@gmail.com>
Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
cp-wjhan pushed a commit to cp-yoonjin/go-wemix that referenced this pull request Nov 16, 2022
* cmd,core: add simple legacy receipt converter

core/rawdb: use forEach in migrate

core/rawdb: batch reads in forEach

core/rawdb: make forEach anonymous fn

cmd/geth: check for legacy receipts on node startup

fix err msg

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

fix log

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

fix some review comments

add warning to cmd

drop isLegacy fn from migrateTable params

add test for windows rename

test replacing in windows case

* minor fix

* sanity check for tail-deletion

* add log before moving files around

* speed-up hack for mainnet

* fix mainnet check, use networkid instead

* check mainnet genesis

* review fixes

* resume previous migration attempt

* core/rawdb: lint fix

Co-authored-by: Martin Holst Swende <martin@swende.se>
holiman pushed a commit that referenced this pull request Dec 3, 2022
This PR drops the legacy receipt types, the freezer-migrate command and the startup check. The previous attempt #22852 at this failed because there were users who still had legacy receipts in their db, so it had to be reverted #23247. Since then we added a command to migrate legacy dbs #24028.

As of the last hardforks all users either must have done the migration, or used the --ignore-legacy-receipts flag which will stop working now.
0xTomoyo pushed a commit to 0xTomoyo/go-ethereum that referenced this pull request Dec 12, 2022
* params: begin v1.10.19 release cycle

* cmd/geth: exit when freezer has legacy receipts (ethereum#24943)

In ethereum#24028 we flagged a warning when finding legacy receipts in the freezer. This PR nudges users a bit more strongly by preventing geth from starting in this case until receipts have been migrated.

It also adds a flag --ignore-legacy-receipts which when present allows geth to start normally.

* cmd/abigen: accept combined-json via stdin (ethereum#24960)

* params: set emergency ropsten TTD to 100_000_000_000_000_000_000_000 (ethereum#24975)

* core: use less memory during reorgs (ethereum#24616)

This PR significantly reduces the memory consumption of a long reorg

* cmd/geth: extend traverseRawState command (ethereum#24954)

This PR adds node verification into traverseRawState command, so corrupted trie nodes can also be detected.

* consensus/clique: fix race condition (ethereum#24957)

* consensus/clique: remove race condition

* consensus/clique: fix one more signer data race

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

* eth/catalyst: fix edge case in NewPayload (ethereum#24955)

Fixes an issue where we would accept a NewPayload where the grandparent is already post ttd, and the parent still has a Difficulty

* contracs/checkpointoracle: fix directives (ethereum#24944)

contracts/checkpointoracle: redefine go-generate logic

* eth/filters: use buffered channel to avoid goroutine leak (ethereum#24928)

* core/beacon: prevent invalid logsBloom length panic (ethereum#24946)

* core/beacon: prevent invalid logsBloom length panic

* core/beacon: prevent negative baseFeePerGas

* Update core/beacon/types.go

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

* eth/catalys: go format

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

* core: fix canonical hash marker update (ethereum#24996)

* core: fix reorg

* core: revert change for memory efficiency

* core: revert changes

* eth/tracers: add support for block overrides in debug_traceCall (ethereum#24871)

This PR adds support for block overrides when doing debug_traceCall.

- Previously, debug_traceCall against pending erroneously used a common.Hash{} stateroot when looking up the state, meaning that a totally empty state was used -- so it always failed,
- With this change, we reject executing debug_traceCall against pending.
- And we add ability to override all evm-visible header fields.

* tests/fuzzers/bls12381: Add BLST to fuzzing support (ethereum#24249)

* tests/fuzzers/bls12381: added blst library

* go.mod: added blst dependency

* tests/fuzzers/bls12381: stuff

* tests/fuzzers/bls12381: added blst to pairing fuzzer

* eth/catalyst: return 0x0 on Invalid block on top of pow block (ethereum#25006)

* node: make jwt test less dependent on time (ethereum#25016)

* consensus/misc: reduce allocations and improve comments in CalcBaseFee (ethereum#24958)

* consensus/misc: reduce allocations in CalcBaseFee

* consensus/misc: add formulas of CalcBaseFee

* go.mod: set go version to 1.17 (ethereum#24926)

set go version to 1.17

* go.mod: clean up (ethereum#25017)

* core/vm: optimize jumpdest analysis (ethereum#23500)

core/vm: optimize PUSH opcode discrimination

* tests/fuzzers/bls12381: fix blst deserializing (ethereum#25036)

* tests/fuzzers/bls12381: fix blst deserializing

* tests/fuzzers/bls12381: fix blst deserializing

* cmd/geth, core/state/snapshot: rework journal loading, implement account-check (ethereum#24765)

* cmd/geth, core/state/snapshot: rework journal loading, implement account-check

* core/state/snapshot, cmd/geth: polish code (ethereum#37)

* core/state/snapshot: minor nits

* core/state/snapshot: simplify error logic

* cmd/geth: go format

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

* all: introduce trie owner notion (ethereum#24750)

* cmd, core/state, light, trie, eth: add trie owner notion

* all: refactor

* tests: fix goimports

* core/state/snapshot: fix ineffasigns

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

* eth/api: use `hexutil.Bytes` for account range method (ethereum#25024)

eth/api: use hexutil.Bytes for range at methods

* eth/tracers: fix typo in 4byte_tracer_legacy.js (ethereum#25020)

indentifier -> identifier

* trie: move locking into trieDB insert method (ethereum#25030)

Move locking into trieDB insert function

* params: update ropsten terminal total difficulty block (ethereum#25018)

* eth/filters: fix getLogs for pending block (ethereum#24949)

* eth/filters: fix pending for getLogs

* add pending method to test backend

* fix block range validation

* accounts/abi/bind: fix duplicate field names in the generated go struct (ethereum#24924)

* accounts/abi/bind: fix duplicate field names in the generated go struct ethereum#24627

* accounts, cmd/abigen: resolve name conflicts

* ci lint, accounts/abi: remove unused function overloadedArgName

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

* tests/fuzzers/bls12381: fix blst pairing (ethereum#25037)

* tests/fuzzers/bls12381: fix blst pairing

* tests/fuzzers/bls12381: only build on gofuzz

* tests/fuzzers/bls12381: remove unused code

* tests/fuzzers/bls12381: remove unused code

* p2p/discover: fix panicky test (ethereum#25038)

* accounts: increase parseURL test coverage (ethereum#25033)

accounts/url: add test logic what check null string to parseURL()

* eth, les, params: log chain config a bit saner (ethereum#24904)

Previously on Geth startup we just logged the chain config is a semi-json-y format. Whilst that worked while we had a handful of hard-forks defined, currently it's kind of unwieldy. 

This PR converts that original data dump and converts it into a user friendly - alas multiline - log output.

* p2p: use errors.Is for error comparison (ethereum#24882)


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

* rpc: swap out timer metrics to histograms

* eth/catalyst: remove unauthenticated 'engine' api (ethereum#24997)

Removes engine from any unauthenticated RPC service.

* core/types: remove unused field 'td' in Block (ethereum#25010)

* core/types: improve LogForStorage and ReceiptForStorage comments (ethereum#25032)


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

* core/evm: fix error in comment (ethereum#25040)


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

* internal/ethapi: fix typo in comment (ethereum#25056)

typo error: keccack256 -> keccak256

* Chore:  Minimal gramatical errors (signleton -> singleton) (ethereum#25057)

core: fix typos

* all: more linters (ethereum#24783)

This enables the following linters

- typecheck
- unused
- staticcheck
- bidichk
- durationcheck
- exportloopref
- gosec

WIth a few exceptions.

- We use a deprecated protobuf in trezor. I didn't want to mess with that, since I cannot meaningfully test any changes there.
- The deprecated TypeMux is used in a few places still, so the warning for it is silenced for now.
- Using string type in context.WithValue is apparently wrong, one should use a custom type, to prevent collisions between different places in the hierarchy of callers. That should be fixed at some point, but may require some attention.
- The warnings for using weak random generator are squashed, since we use a lot of random without need for cryptographic guarantees.

* cmd/utils: update --ropsten description (ethereum#25078)

* readme,eth: remove references to eth.wiki (ethereum#25086)

* cmd/ethkey: use accounts.TextHash (ethereum#25069)

* common: improve pretty duration regex (ethereum#25073)

* common: improve pretty duration regex

* common: improve pretty duration regex

* all: prefer `new(big.Int)` over `big.NewInt(0)` (ethereum#25087)

minor performance improvement: `big.NewInt(0).Xxx` -> `new(big.Int).Xxx`

* eth: add missing period at end of sentences (ethereum#25058)

eth: add missing periods on end of comments

* eth: introduce eth67 protocol (ethereum#24093)

The new protocol version removes support for GetNodeData.
See https://eips.ethereum.org/EIPS/eip-4938 for more information.

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

* cmd, params: implement Gray Glacier hard-fork (EIP-5133) (ethereum#25088)

* cmd/geth, params: implement Gray Glacier (EIP-5133)

* cmd/evm: add gray glacier tests

* params: nitpicks

* params: fixes

* node: add info message when JWT secret is loaded (ethereum#25095)


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

* params: release Geth v1.10.19

* params: begin v1.10.20 release cycle

* internal/ethapi: add comment explaining return of nil instead of error (ethereum#25097)


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

* tests/fuzzers/rlp: avoid very large input (ethereum#25109)

The oss-fuzz engine crashes due to stack overflow decoding a large nested
structure into a interface{}. This PR limits the size of the input data, so
should avoid such crashes.

* node: make jwt tests less time-dependent (ethereum#25120)

* cmd/faucet: more verbose message about private posts (ethereum#25129)

* cmd/faucet: Add error message for private posts

Fixes ethereum#22631

* grammar

* internal/ethapi: remove SignAndSendTransaction (ethereum#25111)

* cmd/faucet: add sepolia network support (ethereum#25128)

cmd/faucet: Add Sepolia network support to faucet

* trie: fix size accounting in cleaner (ethereum#25007)

Decrease children size instead of dirties size when marking dirties as cleaned up in trie cleaner

* all: remove concept of public/private API definitions (ethereum#25053)

* internal/ethapi: rename PublicEthereumAPI to EthereumAPI

* eth: rename PublicEthereumAPI to EthereumAPI

* internal/ethapi: rename PublicTxPoolAPI to TxPoolAPI

* internal/ethapi: rename PublicAccountAPI to EthereumAccountAPI

* internal/ethapi: rename PrivateAccountAPI to PersonalAccountAPI

* internal/ethapi: rename PublicBlockChainAPI to BlockChainAPI

* internal/ethapi: rename PublicTransactionPoolAPI to TransactionAPI

* internal/ethapi: rename PublicDebugAPI to DebugAPI

* internal/ethapi: move PrivateDebugAPI methods to DebugAPI

* internal/ethapi: rename PublicNetAPI to NetAPI

* les: rename PrivateLightServerAPI to LightServerAPI

* les: rename PrivateLightAPI to LightAPI

* les: rename PrivateDebugAPI to DebugAPI

* les: rename PublicDownloaderAPI to DownloaderAPI

* eth,les: rename PublicFilterAPI to FilterAPI

* eth: rename PublicMinerAPI to MinerAPI

* eth: rename PublicDownloaderAPI to DownloaderAPI

* eth: move PrivateMinerAPI methods to MinerAPI

* eth: rename PrivateAdminAPI to AdminAPI

* eth: rename PublicDebugAPI to DebugAPI

* eth: move PrivateDebugAPI methods to DebugAPI

* node: rename publicAdminAPI to adminAPI

* node: move privateAdminAPI methods to adminAPI

* node: rename publicWeb3API to web3API

* eth,internal/ethapi: sync comments with previous renamings

* cmd/geth: drop geth js command (ethereum#25000)

* cmd/geth: drop js command

* cmd: simplify ipc path determination for attach

* Add deprecation warning for js

* rm testdata for exec

* fix account unlock test cases

* Update cmd/geth/consolecmd.go

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

* fix

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

* README,rpc: remove mention of "shh" RPC API (ethereum#25137)

* eth, miner: retrieve mining state from live database (ethereum#25139)

* miner: retrieve mining state from live database

* eth/catalyst: ignore stale fcu events from cl

* core: fix typo in txpool (ethereum#25149)

Fix typo in txPool truncateQueue comment

* go.mod: upgrade to latest goleveldb (ethereum#25067)


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

* eth/tracers: optimize goja buffer conversion (ethereum#25156)

This changes the []byte <-> Uint8Array conversion to use an
ArrayBuffer, avoiding inefficient copying of the slice data in Goja.

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

* eth: fix typo (ethereum#25161)

* internal/ethapi: always return chain id (ethereum#25166)

The error was introduced in PR ethereum#21686, but there is no good reason to enforce sync
in this method, and it causes issues with EL/CL integration.

* internal/ethapi: add note about eth_chainId compatibility with EIP-695 (ethereum#25168)


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

* all: remove `public` field from `rpc.API` (ethereum#25059)

all: remove public field from rpc.API

* all: remove version field from rpc.API

* cmd: migrate to urfave/cli/v2 (ethereum#24751)

This change updates our urfave/cli dependency to the v2 branch of the library.
There are some Go API changes in cli v2:

- Flag values can now be accessed using the methods ctx.Bool,
  ctx.Int, ctx.String, ... regardless of whether the flag is 'local' or
  'global'.

- v2 has built-in support for flag categories. Our home-grown category
  system is removed and the categories of flags are assigned as part of
  the flag definition.

For users, there is only one observable difference with cli v2: flags must now
strictly appear before regular arguments. For example, the following command is
now invalid:

   geth account import mykey.json --password file.txt

Instead, the command must be invoked as follows:

   geth account import --password file.txt mykey.json

* params: set TTD for sepolia testnet (ethereum#25179)

* cmd/geth, p2p: add support for custom discovery UDP port (ethereum#24979)

This adds a new flag to set the discovery port to be different from
the TCP listener port.

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

* fix: linter warning (ethereum#25192)

* core/rawdb: fix typo in comment (ethereum#25191)

* core/rawdb: simplify TestDiskSeek to use memorydb (ethereum#25182)

* cmd/utils: fix applying bootstrap nodes from config file (ethereum#25174)

* internal/ethapi: return chain id for EIP-155 legacy txs (ethereum#25155)

* common: increase StorageSize test coverage (ethereum#25188)

* consensus/beacon: check that only the latest pow block is valid ttd block (ethereum#25187)

* consensus/beacon: check that only the latest pow block is valid ttd block

* consensus/beacon: move verification to async function

* consensus/beacon: fix verifyTerminalPoWBlock, add test cases

* consensus/beacon: cosmetic changes

* consensus/beacon: apply karalabe's fixes

* build: fix auto-completion scripts and include them in .deb package (ethereum#25195)


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

* build: upgrade to golangci-lint v1.46.2 (ethereum#25202)

This upgrade is required to fix lint issues with urfave/cli/v2, which
uses generics when built with Go 1.18

* build/deb: fix auto-completion install paths (ethereum#25204)

* params: go-ethereum v1.10.20 stable

* params: begin v1.10.21 release cycle

* common/prque: fix typo

* eth/catalyst: disallow importing blocks via newPayload during snap sync (ethereum#25210)

* eth/catalyst: disallow importing blocks via newPayload during snap sync

* eth/catalyst: make tests pass by using full sync only

* eth/catalysts: make the import delay a bit cleaner

* eth/catalyst: fix typo

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

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

* Replace fmt.Errorf with errors.New in abi argument (ethereum#25181)

Replace unnecessary fmt.Errorf with errors.New in accounts/abi/argument.go

* all: change format `0x%x` to `%#x` (ethereum#25221)

* consensus/beacon: copy td value so we can modify it (ethereum#25230)

* consensus/beacon: copy td value so we can modify it

* consensus/beacon: copy td value so we can modify it

* core: allow external code to set the block validator for malicious tests (ethereum#25119)

* core: don't validate state

* core: allow external validator

* core: revert

* core: comments

* Update blockchain_reader.go

* core: move SetValidator to blockchain.go

* core: rename method

* core: apply ttd override to uninitialized db (ethereum#25136)

* core: apply ttd override to genesis block

* core: apply overrides properly

* signer/core/apitypes: support primitive types int96/uint96 (ethereum#25105)

I have a EIP712 typehash using uint96, but it's currently not supported
by go-ethereum. This change fixes it.

* cmd/geth, cmd/devp2p: fix some cli parsing issues (ethereum#25234)

* cmd/geth: add some missing argument count checks

* internal/flags: skip cmds with no action func in MigrateGlobalFlags

* internal/flags: add Merge

* cmd/devp2p: re-add listener config flags in discv4 commands

* core: allow external processor (ethereum#25233)

* consensus/beacon: verify timestamp is greater than parent timestamp (ethereum#25236)

* go.mod: updated logfmt dependency (ethereum#25231)

This fixes an issue in abigen tests with go 1.17.

* internal/ethapi: add basefee to block overrides (ethereum#25219)

* build: upgrade -dlgo version to Go 1.18.3

* trie: fix typo in comment (ethereum#25241)

paralallel -> parallel

* core/types: fix typo in comment (ethereum#25249)

* internal/ethapi: fix chain ID check to return all non-zero IDs (ethereum#25244)

* rpc: add graceful shutdown timeout for HTTP server (ethereum#25258)

This change ensures the HTTP server will always terminate within
at most 5s, even when all connections are busy and do not become
idle.

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

* p2p/discover: fix typos in comments (ethereum#25272)

* core, eth: pre-allocate map in storage copy (ethereum#25279)

* eth/tracers: add initial revertReasonTracer tracer (ethereum#25265)

Adds a native tracer that returns that in case of failure returns the error message or the revert reason of a transaction.

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

* params: enable DNS discovery on Sepolia too

* internal/build: add a timestamp to the tar archive folder

* build: upgrade -dlgo version to Go 1.18.4

* accounts/abi: fix typo in comment (ethereum#25271)

* accounts/abi/bind/backends: return hash of new blocks (ethereum#25163)


Co-authored-by: Jens <jmw.1906@gmx.de>

* internal/ethapi: error if tx args includes chain id that doesn't match local (ethereum#25157)

* internal/ethapi: error if tx args includes chain id that doesn't match local

* internal/ethapi: simplify code a bit

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* core: remove lock in BlockChain.ExportN (ethereum#25254)

* Remove locking in (*BlockChain).ExportN

Since ExportN is read-only, it shouldn't need the lock. (?)

* Add hash check to detect reorgs during export.

* fix check order

* Update blockchain.go

* Update blockchain.go

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

* core: prevent negative fee during RPC calls (ethereum#25214)

During RPC calls such as eth_call and eth_estimateGas, st.evm.Config.NoBaseFee is set
which allows the gas price to be below the base fee. This results the tip being negative,
and balance being subtracted from the coinbase instead of added to it, which results in a
potentially negative coinbase balance interestingly. This can't happen during normal chain
processing as outside of RPC calls the gas price is required to be at least the base fee,
as NoBaseFee is false.

This change prevents this behavior by disabling fee payment when the fee is not set.

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

* core, les, eth: port snap sync changes (ethereum#24898)

core, eth, les, trie: rework snap sync

* tests: only activate merge on london rules (ethereum#25239)

* trie: fix 'gosimple' lint issue (ethereum#25309)

* p2p/discover: apply netrestrict in discv5 response handler (ethereum#25304)

* cmd/geth: remove redundant 0x in dbGet/dbDelete (ethereum#25315)

* accounts/abi: substitude arg%d to the range keyword (ethereum#25307)

* accounts/abi: substitude arg%d to the range keyword

* support more keywords

* review feedback

* params: Add Shanghai and Cancun blocks (ethereum#25305)

* params: Add Shangai and Cancun blocks

* fix copy/paste error

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

* fix typo in Shanghai name

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

* params: change Merge config to print simpler message

This fixes ethereum#25366

* cmd/puppeth: remove support for exporting non-Geth genesis configurations (ethereum#25329)

* cmd/puppeth: remove support for exporting non-Geth genesis configurations

* remove unused function

* params: set goerli TTD to 10_790_000 (ethereum#25324)

* signer/core: add canonical TypedData hashing methods (ethereum#25283)

* deps: update goleveldb

* params: set sepolia mergeNetsplitBlock to 1735371 (ethereum#25372)

* cmd/geth: eth/catalyst: enable authrpc by default (ethereum#25152)

* cmd/geth: eth/catalyst: enable authrpc by default

* eth/catalyst: rename catalyst -> Engine API in logs

* eth/catalyst: don't panic

* eth/catalyst: better warning for ttd not configured (ethereum#25394)

* cmd: use flags.Merge for grouping flags (ethereum#25392)

* consensus/beacon: fix typo in comment (ethereum#25391)

* p2p/netutil: minor code cosmetic

Signed-off-by: Abirdcfly <fp544037857@gmail.com>

* eth, internal, light: fix error string capitalization (ethereum#25364)

* light: fix differTries err message in tests (ethereum#25358)

* all: add whitespace linter (ethereum#25312)

* golangci: typo

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

* golangci: add whietspace

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

* *: rm whitesapce using golangci-lint

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

* cmd/puppeth: revert accidental resurrection

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* eth/tracers/js: fix capitalization in tests

* eth: support bubbling up bad blocks from sync to the engine API (ethereum#25190)

* eth: support bubbling up bad blocks from sync to the engine API

* eth/catalyst: fix typo

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

* eth/catalyst: fix typo

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

* Update eth/catalyst/api.go

* eth/catalyst: when forgetting bad hashes, also forget descendants

* eth/catalyst: minor bad block tweaks for resilience

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

* core: eth: rpc: implement safe rpc block (ethereum#25165)

* core: eth: rpc: implement safe rpc block

* core: fix setHead, panics

* go.mod: downgrade leveldb (ethereum#25413)

* params: go-ethereum v1.10.21 stable

* params: begin v1.10.22 release cycle

* core, trie, eth, cmd: rework preimage store (ethereum#25287)

* core, trie, eth, cmd: rework preimage store

* trie: address comment

* eth/catalyst: fix NewPayload warn log when dropping due to snap sync

* node: set JWT expiry to 60 seconds (ethereum#25416)

* node: set JWT expiry to 60 seconds

* node: rename var

* eth/catalyst: return syncing not accepted (ethereum#25414)

* eth/catalyst: return syncing not accepted

* eth/catalyst: fix test

* eth/catalyst: return 0x0 if latestvalid is pow block (ethereum#25423)

* eth/catalyst: return 0x0 if latestvalid is pow block

* eth/catalyst: return 0x0 if latestvalid is pow block

* eth/catalyst: fix header retrieval, fix sign check

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* ethereum, ethclient: add FeeHistory support (ethereum#25403)


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

* all: use AbsTime.Add instead of conversion (ethereum#25417)

* cm/puppeth: fix crash when of ethstats specifier doesn't contain `:` (ethereum#25405)


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

* eth: fix typo in comment (ethereum#25327)

* common/compiler: json unmarshalling error checks (ethereum#25449)

complier/solidity:add json.Unmarshal err check

* cmd, core, eth, les, params: add merge-passed chain config (ethereum#24538)

* cmd, core, eth, les, params: add merge-passed chain config

* eth/catalyst, params: add various warning on malfunctioning beacons

* eth/catalyst: fix warning for beacons without transition exchanges

* eth: fix typo in catalyst api (ethereum#25460)

eth: fix typo

* build: upgrade -dlgo version to Go 1.18.5

* eth/gasprice/feehistory: support finalized block (ethereum#25442)

* consensus/ethash: remove temp files created during DAG generation (ethereum#25381)

This makes it remove not only the actual DAG file, but also the temporary file
which the DAG data is written to while generating.

* cmd/devp2p/internal/ethtest: update tests for eth/67 (ethereum#25306)

* node, rpc: add ReadHeaderTimeout config option (ethereum#25338)

This change makes http.Server.ReadHeaderTimeout configurable separately
from ReadTimeout for RPC servers. The default is set to the same as
ReadTimeout, which in order to cause no change in existing deployments.

* core/types: fix typo in comment (ethereum#25359)

* core: preallocate batch size in bloomIndexer (ethereum#25289)

This change reduces allocations when committing bloombits indexes
by creating the database batch with a larger initial size.

* internal/ethapi: don't estimate gas if no limit provided in eth_createAccessList (ethereum#25467)

Because the goal of eth_createAccessList is providing the caller with the largest-possible
access list, it's generally not important that the gas limit used by the tracer will match the usage
of the call exactly. Avoiding the gas estimation step is a performance improvement. As long as the
call does not branch based on gas limit, the returned access list will be accurate.

* graphql: embed *Resolver instead of backend interface (ethereum#25468)

This creates some infrastructure to share resources between graphql
API objects.

* node: remove noop path.Join (ethereum#25475)

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

* core, trie: rework trie committer (ethereum#25320)

* all: rework trie and trie committer

* all: get rid of internal cache in trie

* all: fixes

* trie: polish

* core, trie: address comments

* trie: fix imports

* core/state: address comments

* core/state/snapshot: polish

* trie: remove unused code

* trie: update tests

* trie: don't set db as nil

* trie: address comments

* trie: unskip test

* core: use TryGetAccount to read what TryUpdateAccount has written (ethereum#25458)

* core: use TryGetAccount to read where TryUpdateAccount has been used to write

* Gary's review feedback

* implement Gary's suggestion

* fix bug + rename NewSecure into NewStateTrie

* trie: add backwards-compatibility aliases for SecureTrie

* Update database.go

* make the linter happy

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

* cmd, core, ethdb, node: move chain freezer one folder deeper (ethereum#25487)

* cmd, core, ethdb, node: create chain freezer in a sub folder

* core/rawdb: remove unused code

* core, ethdb, node: add AncientDatadir API back

* cmd, core: extend freezer info dump for sub-ancient-store

* core/rawdb: rework freezer inspector

* core/rawdb: address comments from Peter

* core/rawdb: fix build issue

* eth/downloader: fix log errors of queue_test.go (ethereum#25494)

* core: fix uncle creation in TestFastVsFullChains (ethereum#25476)


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

* eth: formatted error nit (ethereum#25499)

* eth/tracers: add onlyTopCall option to callTracer (ethereum#25430)

This PR allows users to pass in a config object directly to the tracers. Previously only the struct logger was configurable.

It also adds an option to the call tracer which if enabled makes it ignore any subcall and collect only information about the top-level call. See ethereum#25419 for discussion.

The tracers will silently ignore if they are passed a config they don't care about.

* all: cleanup the APIs for initializing genesis (ethereum#25473)

* all: polish tests

* core: apply feedback from Guillaume

* core: fix comment

* core: remove unused bc ChainContext in applyTransaction

* signer/rules: register clef api properly when rules are used (ethereum#25455)

signer/rules: register clef api properly when rules are used, fixes ethereum#25298

* build: add static linking support (ethereum#25492)

This adds support for building statically-linked executables using ci.go.

Static linking is enabled by default in Docker builds, making it possible to
use the geth executable in any Docker image, regardless of the Linux
distribution the Dockerfile is based on.

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

* accounts/abi: display name in "method/event not found" error (ethereum#25512)

* internal/ethapi: rework setDefaults for tx args so fee logic is separate (ethereum#25197)


Co-authored-by: bobpkr <bob.p@krustuniverse.com>

* core/genesis: remove calaverasAllocData (ethereum#25516)

core/genesis: calaverasAllocData no longer used

* params: set ttdpassed on goerli (ethereum#25519)

* params: set mainnet terminal total difficulty for the merge (ethereum#25528)

* params: set mainnet ttd to 58_750_000_000_000_000_000_000

* params: set mainnet ttd to 58_750_000_000_000_000_000_000

* core, trie: flush preimages to db on blockchain close (ethereum#25533)

* core, trie: flush preimages to db on database close

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

* rename Close to CommitPreimages for clarity

* core, trie: nitpick fixes

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

* core/state, trie, light: add a TryDeleteAccount method (ethereum#25531)

* core/state, trie, light: Add a DeleteAccount method

* review feedback

* Update database.go

* pr triage feedback

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

* core: make tx journal check and open atomic (ethereum#25530)

* core: reduce system call about `os`

* avoid deprecated method

* cmd. core: save preimages on genesis creation (ethereum#25538)

force preimage dump for genesis

* rlp/rlpgen: fix error handling when target type not found (ethereum#25547)

typ will be nil when lookupStructType returns an error. cfg.Type should be used instead.

* trie: improve node rlp decoding performance (ethereum#25357)

This avoids copying the input []byte while decoding trie nodes. In most
cases, particularly when the input slice is provided by the underlying
database, this optimization is safe to use.

For cases where the origin of the input slice is unclear, the copying version
is retained. The new code performs better even when the input must be
copied, because it is now only copied once in decodeNode.

* all: fix some typos (ethereum#25551)

* Fix some typos

* Fix some mistakes

* Revert 4byte.json

* Fix an incorrect fix

* Change files to fails

* internal/ethapi: fix comment typo (ethereum#25548)

* accounts/abi/bind/backends: typo fix (ethereum#25549)

* eth, les: unlock downloader peerSet if there's an error (ethereum#25546)

Unlock peerSet if there's an error in the downloader

* cmd/geth: parse uint64 value with ParseUint instead of Atoi (ethereum#25545)

Parse uint64 value with ParseUint instead of Atoi

* consensus/beacon: check ttd reached on pos blocks (ethereum#25552)

* consensus/beacon: check ttd reached on pos blocks

* consensus/beacon: check ttd reached on pos blocks

* consensus/beacon: check ttd reached on pos blocks

* eth/filters: add global block logs cache (ethereum#25459)

This adds a cache for block logs which is shared by all filters. The cache
size of is configurable using the `--cache.blocklogs` flag.

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

* accounts/abi: fix set function (ethereum#25477)

* accounts/abi: fix set function

* don't break things

* update test

* internal/ethapi: fix build regression (ethereum#25555)

* eth/fetcher: don't spend too much time on transaction inclusion (ethereum#25524)

* eth/fetcher: introduce some lag in tx fetching

* eth/fetcher: change conditions a bit

* eth/fetcher: use per-batch quota check

* eth/fetcher: fix some comments

* eth/fetcher: address review concerns

* eth/fetcher: fix panic + add warn log

* eth/fetcher: fix log

* eth/fetcher: fix log

* cmd/devp2p/internal/ethtest: fix ignorign tx announcements from prev. tests

* cmd/devp2p/internal/ethtest: fix TestLargeTxRequest

This increases the number of tx relay messages the test waits for. Since
go-ethereum now processes incoming txs in smaller batches, the
announcement messages it sends are also smaller.

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

* Revert "eth/fetcher: don't spend too much time on transaction inclusion" (ethereum#25567)

Revert "eth/fetcher: don't spend too much time on transaction inclusion (ethereum#25524)"

This reverts commit 0ce494b.

* eth/catalyst: warn less frequently if no beacon client is available (ethereum#25569)

* eth/catalyst: warn less frequently if no beacon client is available

* eth/catalyst: tweak warning frequency a bit

* eth/catalyst: some more tweaks

* Update api.go

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

* params: release go-ethereum v1.10.22

* params: begin v1.10.23 release cycle

* core, eth/downloader: handle spurious junk bodies from racey rollbacks (ethereum#25578)

* eth/downloader: handle junkbodies/receipts in the beacon sync

* core: check for header presence when checking for blocks

* core/state, trie: fix trie flush order for proper pruning

* consensus/beacon: don't ignore errors

* params: release Geth v1.10.23

* graphql: return correct logs for tx (ethereum#25612)

* graphql: fix tx logs

* minor

* Use optimized search for selecting tx logs

* graphql: fixes missing tx logs (ethereum#25745)

* graphql: fix tx logs

* graphql: refactor test service setup

* graphql: add test for tx logs

* Release Geth v1.10.24

* params: set TerminalTotalDifficultyPassed to true (ethereum#25769)

* params: set TerminalTotalDifficultyPassed to true

* Update params/config.go

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

* params: release Geth v1.10.25

* eth/protocols/snap: fix problems due to idle-but-busy peers (ethereum#25651)

* eth/protocols/snap: throttle trie heal requests when peers DoS us (ethereum#25666)

* eth/protocols/snap: throttle trie heal requests when peers DoS us

* eth/protocols/snap: lower heal throttle log to debug

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

* eth/protocols/snap: fix comment

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

* trie: check childrens' existence concurrently for snap heal (ethereum#25694)

* eth: fix a rare datarace on CHT challenge reply / shutdown (ethereum#25831)

* eth/filters: change filter block to be by-ref (ethereum#26054)

This PR changes the block field in the filter to be a pointer, to disambiguate between empty hash and no hash

* rpc: handle wrong HTTP batch response length (ethereum#26064)

* params: release geth v1.10.26 stable

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Harry Kalodner <harry.kalodner@gmail.com>
Co-authored-by: Boqin Qin(秦 伯钦) <Bobbqqin@gmail.com>
Co-authored-by: Ivan Kuznetsov <me@jeiwan.ru>
Co-authored-by: Jonathan Le Brun <42697488+icyfry@users.noreply.github.com>
Co-authored-by: s7v7nislands <s7v7nislands@gmail.com>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: Ikko Ashimine <eltociear@gmail.com>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: lwh <lwhile521@gmail.com>
Co-authored-by: Seungbae.yu <72970043+dbadoy@users.noreply.github.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Håvard Anda Estensen <haavard.ae@gmail.com>
Co-authored-by: Rajaram Gaunker <zimbabao@gmail.com>
Co-authored-by: henridf <henri@dubfer.com>
Co-authored-by: int88 <106391185+int88@users.noreply.github.com>
Co-authored-by: Luozhu <70309026+LuozhuZhang@users.noreply.github.com>
Co-authored-by: Gustavo Silva <GustavoRSSilva@users.noreply.github.com>
Co-authored-by: Ivan Aracki <aracki.ivan@gmail.com>
Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
Co-authored-by: Kosuke Taniguchi <73885532+TaniguchiKosuke@users.noreply.github.com>
Co-authored-by: Zachinquarantine <Zachinquarantine@protonmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: willian.eth <willian@ufpa.br>
Co-authored-by: zeim839 <50573884+zeim839@users.noreply.github.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Ruohui Wang <nomaru@outlook.com>
Co-authored-by: Andre Patta <andre_luis@outlook.com>
Co-authored-by: スパイク <1311798+spkjp@users.noreply.github.com>
Co-authored-by: Marius Kjærstad <mkjaerstad@protonmail.com>
Co-authored-by: Brion <4777457+cifer76@users.noreply.github.com>
Co-authored-by: Philip Fan <fanwengang@hotmail.com>
Co-authored-by: Jens W <8270201+DragonDev1906@users.noreply.github.com>
Co-authored-by: Jens <jmw.1906@gmx.de>
Co-authored-by: henridf <henridf@gmail.com>
Co-authored-by: Lee Bousfield <ljbousfield@gmail.com>
Co-authored-by: Ha ĐANG <dvietha@gmail.com>
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: Nikhil Suri <nikhilsuri@comcast.net>
Co-authored-by: Abirdcfly <fp544037857@gmail.com>
Co-authored-by: Eval EXEC <execvy@gmail.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Rithwik Babu <rithwikbabu2020@gmail.com>
Co-authored-by: Henry <101552941+henry-0@users.noreply.github.com>
Co-authored-by: Manoj Kumar <mnjkmr398@gmail.com>
Co-authored-by: Tristan-Wilson <87238672+Tristan-Wilson@users.noreply.github.com>
Co-authored-by: yong <33920876+yzhaoyu@users.noreply.github.com>
Co-authored-by: Seungbae Yu <dbadoy4874@gmail.com>
Co-authored-by: ycyraum <ycyraum@fastmail.com>
Co-authored-by: 0xe3b0c4 <110295932+0xe3b0c4@users.noreply.github.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: bobpkr <bob.p@krustuniverse.com>
Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com>
Co-authored-by: zhiqiangxu <652732310@qq.com>
Co-authored-by: Jordan Krage <jmank88@gmail.com>
cp-wjhan pushed a commit to cp-yoonjin/go-wemix that referenced this pull request Jun 2, 2023
In ethereum#24028 we flagged a warning when finding legacy receipts in the freezer. This PR nudges users a bit more strongly by preventing geth from starting in this case until receipts have been migrated.

It also adds a flag --ignore-legacy-receipts which when present allows geth to start normally.
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
This PR drops the legacy receipt types, the freezer-migrate command and the startup check. The previous attempt ethereum#22852 at this failed because there were users who still had legacy receipts in their db, so it had to be reverted ethereum#23247. Since then we added a command to migrate legacy dbs ethereum#24028.

As of the last hardforks all users either must have done the migration, or used the --ignore-legacy-receipts flag which will stop working now.
holiman pushed a commit that referenced this pull request Aug 20, 2024
These are the leftovers from #24028.
davidtaikocha added a commit to taikoxyz/taiko-geth that referenced this pull request Oct 3, 2024
* params: release Geth v1.14.5

* params: begin v1.14.6 release cycle

* cmd/evm/internal/t8ntool: remove unused parameter (#29930)

* go.mod : tidy

* cmd/clef, cmd/evm: fix markdown issues in README (#29954)

* cmd/geth: remove unused param (#29952)

* p2p/discover: add missing lock when calling tab.handleAddNode (#29960)

* p2p: use package slices to sort in PeersInfo (#29957)

* core: initialize developer genesis beacon root contract with 0 balance (#29963)

* core, rlp: remove duplicated words (#29964)

* cmd, core: prefetch reads too from tries if requested (#29807)

* cmd/utils, consensus/beacon, core/state: when configured via stub  flag: prefetch all reads from account/storage tries, terminate prefetcher synchronously.

* cmd, core/state: fix nil panic, fix error handling, prefetch nosnap too

* core/state: expand prefetcher metrics for reads and writes separately

* cmd/utils, eth: fix noop collect witness flag

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* core/state: rename all the AccessList receivers to 'al' (#29921)

rename all the receivers to 'al'

* ethconfig: regenerate config (#29970)

* cmd/devp2p: fix log output (#29972)

* .github: disable cache in actions run (#29926)

* p2p/simulations: update doc of HTTP endpoints (#29894)

* all: fix inconsistent receiver name and add lint rule for it (#29974)

* .golangci.yml: enable check for consistent receiver name

* beacon/light/sync: fix receiver name

* core/txpool/blobpool: fix receiver name

* core/types: fix receiver name

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

* signer/core/apitypes: fix receiver name

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

* log: fix receiver name

* accounts: avoid duplicate regex compilation (#29943)

* fix: Optimize regular initialization

* modify var name

* variable change to private types

* core/state, eth/protocols, trie, triedb/pathdb:  remove unused error from trie Commit (#29869)

* core/state, eth/protocols, trie, triedb/pathdb:  remove unused error return from trie Commit

* move set back to account-trie-update block scoping for easier readability

* address review

* undo tests submodule change

* trie:  panic if BatchSerialize returns an error in Verkle trie Commit

* trie: verkle comment nitpicks

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* beacon/light: fix shutdown issues (#29946)

* beacon/light/request: add server test for event after unsubscribe

* beacon/light/api: fixed double stream.Close()

* beacon/light/request: add checks for nil event callback function

* beacon/light/request: unlock server mutex while unsubscribing from parent

* trie/triedb: add Reader to backend interface (#29988)

* core/state/snapshot: add a missing lock (#30001)

* upgrade lock usage

* revert unnecessary change

* go.mod: update Pebble to sort out a deleted upstream dependency (#30010)

* log: fix some functions comments (#29907)

updates some docstrings
---------

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

* trie, triedb/pathdb: prealloc capacity for map and slice (#29986)

* triedb/pathdb: use maps.Clone and maps.Keys (#29985)

* common/math: fix out of bounds access in json unmarshalling (#30014)


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

* core/state/snapshot: acquire the lock on Release (#30011)

* core/state/snapshot: acquire the lock on release

* core/state/snapshot: only acquire read-lock when iterating

* cmd/geth, ethdb/pebble: improve database statistic (#29948)

* cmd/geth, ethdb/pebble: polish method naming and code comment

* implement db stat for pebble

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

* cmd, core, ethdb: fix function description

---------

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

* trie: don't reset tracer at the end of Commit (#30024)

* trie: don't reset tracer at the end of Commit

* Update trie.go

---------

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

* common: using `ParseUint` instead of `ParseInt` (#30020)

Since Decimal is defined as unsiged `uint64`, we should use `strconv.ParseUint` instead of `strconv.ParseInt` during unmarshalling.

---------

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

* core/txpool/blobpool: change rw-lock to r-lock (#29989)

* trie/trienode: avoid unnecessary copy (#30019)

* avoid unnecessary copy

* delete the never used function ProofList

* eth/protocols/snap, trie/trienode: polish the code

---------

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

* p2p/rlpx: 2KB maximum size for handshake messages (#30029)


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

* core/state/snapshot: tiny fixes (#29995)

* Revert "core/state/snapshot: tiny fixes" (#30039)

Revert "core/state/snapshot: tiny fixes (#29995)"

This reverts commit e0e45dbc32501d7917edb07083aa1c34ab7b0fb4.

* p2p/discover: improve flaky revalidation tests (#30023)

* cmd/blsync: use debug.Setup for logging configuration (#30065)

* .github: add lightclient as codeowner to relevant packages (#30062)

* accounts/keystore: use t.TempDir in test (#30052)

* internal/debug: remove unnecessary log level assignment (#30044)

Log level is specified in L259 so it's unnecessary to specify it for handlers (L234, L236).

* all: stateless witness builder and (self-)cross validator (#29719)

* all: add stateless verifications

* all: simplify witness and integrate it into live geth

---------

Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* core/txpool/blobpool: avoid use *map as parameter. (#30048)

* trie/trienode: remove unnecessary check in Summary (#30047)

* eth/tracers,trie: remove unnecessary check (#30071)

* trie: relocate state execution logic into pathdb package (#29861)

* triedb/pathdb: fix flaky test in pathdb (#29901)

* core/txpool/blobpool: improve newPriceHeap function (#30050)


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

* cmd/evm/internal/t8ntool: log writeTraceResult error message (#30038)

* all: replace division with right shift if possible (#29911)

* rpc: truncate call error data logs (#30028)


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

* accounts/usbwallet/trezor: upgrade to generate with protoc 27.1 (#30058)

* build:  add check for stale generated files (#30037)


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

* core/state: fix inconsistent verkle test error messages (#29753)

* accounts/abi: embed Go template instead of string literal (#30098)

refactor(accounts/abi): use embed pkg to split default template to file

* params: release Geth v1.14.6

* params: begin v1.14.7 release cycle

* params: release Geth v1.14.6

* build: upgrade -dlgo version to Go 1.22.5 (#30112)

* crypto: remove hardcoded value for secp256k1.N (#30126)

* go.mod: update uint256 to 1.3.0 (#30134)

* eth/catalyst: fix params in failure log (#30131)

* core/txpool/blobpool: revert #29989, WLock on Nonce (#30142)

* params: go-ethereum v1.14.7 stable

* params: begin v1.14.8 release cycle

* core/state: fix prefetcher for verkle (#29760)

* core/txpool/blobpool: use nonce from argument instead of tx.Nonce() (#30148)

This does not change the behavior here as the nonce in the argument is
tx.Nonce(). This commit helps to make the function easier to read and avoid
capturing the tx in the function.

* trie: add RollBackAccount function to verkle trees (#30135)

* p2p: fix ip change log parameter (#30158)

* cmd/utils: fix typo in flag description (#30127)

* core/types: don't modify signature V when reading large chainID (#30157)

* SECURITY.md: correct PGP key block formatting (#30123)

* all: simplify tests using t.TempDir() (#30150)

* eth/catalyst: fix (*SimulatedBeacon).AdjustTime() conversion (#30138)

* trie, triedb: remove unnecessary child resolver interface (#30167)

* core/txpool/legacypool: use maps.Keys and maps.Copy (#30091)

* core/state: don't compute verkle storage tree roots (#30130)

* core/rawdb, triedb, cmd: create an isolated disk namespace for verkle (#30105)

* core, triedb/pathdb, cmd: define verkle state ancient store

* core/rawdb, triedb: add verkle namespace in pathdb

* p2p/discover: remove type encPubkey (#30172)

The pubkey type was moved to package v4wire a long time ago. Remaining uses of
encPubkey were probably left in due to laziness.

* go.mod: upgrade to btcsuite/btcd/btcec v2.3.4 (#30181)

* ethdb: remove snapshot (#30189)

* eth/gasprice: remove default from config (#30080)

* eth/gasprice: remove default from config

* eth/gasprice: sanitize startPrice

* rpc: use stable object in notifier test (#30193)

This makes the test resilient to changes of types.Header -- otherwise the test needs to be
updated each time the header structure is modified.

* core/state: remove useless metrics (#30184)

Originally, these metrics were added to track the largest storage wiping.
Since account self-destruction was deprecated with the Cancun fork,
these metrics have become meaningless.

* rpc: show more error detail for `invalidMessageError` (#30191)

Here we add distinct error messages for network timeouts and JSON parsing errors.
Note this specifically applies to HTTP connections serving a single RPC request.

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

* core/tracing: update latest release version (#30211)

* core/txpool: use the cached address in ValidateTransactionWithState (#30208)

The address recover is executed and cached in ValidateTransaction already. It's
expected that the cached one is returned in ValidateTransaction. However,
currently, we use the wrong function signer.Sender instead of types.Sender which
will do all the address recover again.

* core/state: check db error after intermediate call (#30171)

This pull request adds an additional error check after statedb.IntermediateRoot,
ensuring that no errors occur during this call. This step is essential, as the call might
encounter database errors.

* cmd/utils: allow configurating blob pool from flags (#30203)

Currently, we have 3 flags to configure blob pool. However, we don't
read these flags and set the blob pool configuration in eth config
accordingly. This commit adds a function to check if these flags are
provided and set blob pool configuration based on them.

* core/state: fix SetStorage override behavior (#30185)

This pull request fixes the broken feature where the entire storage set is overridden.

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

A fix has been applied in this pull request, which re-creates a new state object with all
account metadata inherited.

* triedb/pathdb: print out all trie owner and hash information (#30200)

This pull request explicitly prints out the full hash for debugging
purpose.

* beacon/types, cmd/devp2p, p2p/enr: clean up uses of fmt.Errorf (#30182)

* eth/tracers, internal/ethapi: remove unnecessary map pointer in state override (#30094)

* internal/ethapi: fix state override test (#30228)

Looks like #30094 became a bit stale after #30185 was merged and now we
have a stale ref to a state override object causing CI to fail on
master.

* p2p/nat: return correct port for ExtIP NAT (#30234)

Return the actually requested external port instead of 0 in the
AddMapping implementation for `--nat extip:<IP>`.

* p2p: fix flaky test TestServerPortMapping (#30241)

The test specifies `ListenAddr: ":0"`, which means a random ephemeral
port will be chosen for the TCP listener by the OS. Additionally, since
no `DiscAddr` was specified, the same port that is chosen automatically
by the OS will also be used for the UDP listener in the discovery UDP
setup. This sometimes leads to test failures if the TCP listener picks a
free TCP port that is already taken for UDP. By specifying `DiscAddr:
":0"`, the UDP port will be chosen independently from the TCP port,
fixing the random failure.

See issue #29830.

Verified using
```
cd p2p
go test -c -race
stress ./p2p.test -test.run=TestServerPortMapping
...
5m0s: 4556 runs so far, 0 failures
```

The issue described above can technically lead to sporadic failures on
systems that specify a listen address via the `--port` flag of 0 while
not setting `--discovery.port`. Since the default is using port `30303`
and using a random ephemeral port is likely not used much to begin with,
not addressing the root cause might be acceptable.

* p2p/discover: schedule revalidation also when all nodes are excluded (#30239)

## Issue

If `nextTime` has passed, but all nodes are excluded, `get` would return
`nil` and `run` would therefore not invoke `schedule`. Then, we schedule
a timer for the past, as neither `nextTime` value has been updated. This
creates a busy loop, as the timer immediately returns.

## Fix

With this PR, revalidation will be also rescheduled when all nodes are
excluded.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>

* miner: remove outdated comment (#30248)

* eth/downloader: correct sync mode logging to show old mode (#30219)

This PR fixes an issue in the setMode method of beaconBackfiller where the
log message was not displaying the previous mode correctly. The log message
now shows both the old and new sync modes.

* all: remove deprecated protobuf dependencies (#30232)

The package `github.com/golang/protobuf/proto` is deprecated in favor
`google.golang.org/protobuf/proto`. We should update the codes to
recommended package.

Signed-off-by: Icarus Wu <icaruswu66@qq.com>

* accounts/abi/bind: add accessList support to base bond contract (#30195)

Adding the correct accessList parameter when calling a contract can
reduce gas consumption. However, the current version only allows adding
the accessList manually when constructing the transaction. This PR can
provide convenience for saving gas.

* internal/debug: remove memsize (#30253)

Removing because memsize will very likely be broken by Go 1.23. See
https://github.com/fjl/memsize/issues/4

* eth/downloader: gofmt (#30261)

Fixes a regression introduced in
https://github.com/ethereum/go-ethereum/pull/30219

* cmd/evm: don't overwrite sender account (#30259)

Fixes #30254 

It seems like the removed CreateAccount call is very old and not needed anymore.
After removing it, setting a sender that does not exist in the state doesn't seem to cause
an issue.

* eth/catalyst: get params.ExcessBlobGas but check with params.BlobGasUsed (#30267)

Seems it is checked with the wrong argument

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

* params: remove unused les parameters (#30268)

* core/vm/runtime: ensure tracer benchmark calls `OnTxStart` (#30257)

The struct-based tracing added in #29189 seems to have caused an issue
with the benchmark `BenchmarkTracerStepVsCallFrame`. On master we see
the following panic:

```console
BenchmarkTracerStepVsCallFrame
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x40 pc=0x1019782f0]

goroutine 37 [running]:
github.com/ethereum/go-ethereum/eth/tracers/js.(*jsTracer).OnOpcode(0x140004c4000, 0x0, 0x10?, 0x989680, 0x1, {0x101ea2298, 0x1400000e258}, {0x1400000e258?, 0x14000155928?, 0x10173020c?}, ...)
        /Users/matt/dev/go-ethereum/eth/tracers/js/goja.go:328 +0x140
github.com/ethereum/go-ethereum/core/vm.(*EVMInterpreter).Run(0x14000307da0, 0x140003cc0d0, {0x0, 0x0, 0x0}, 0x0)
 ...
FAIL    github.com/ethereum/go-ethereum/core/vm/runtime 0.420s
FAIL
```

The issue seems to be that `OnOpcode` expects that `OnTxStart` has
already been called to initialize the `env` value in the tracer. The JS
tracer uses it in `OnOpcode` for the `GetRefund()` method.

This patch resolves the issue by reusing the `Call` method already
defined in `runtime_test.go` which correctly calls `OnTxStart`.

* ethclient: support networkID in hex format (#30263)

Some chains’ network IDs use hexadecimal such as Optimism ("0xa" instead
of "10"), so when converting the string to big.Int, we cannot specify
base 10; otherwise, it will encounter errors with hexadecimal network
IDs.

* core/vm: improved stack swap performance (#30249)

This PR adds the methods `Stack.swap1..16()` that faster than `Stack.swap(1..16)`. 

Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>

* signer/core: improve performance of isPrimitiveTypeValid function (#30274) (#30277)

Precomputes valid primitive types into a map to use for validation, thus removing sprintf.

* core/vm: use uint64 in memory for indices everywhere (#30252)

Consistently use `uint64` for indices in `Memory` and drop lots of type
conversions from `uint64` to `int64`.

---------

Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>

* build: upgrade -dlgo version to Go 1.22.6 (#30273)

* tests: fix TransactionTest to actually run (#30272)

Due to https://github.com/ethereum/tests/releases/tag/v10.1, the format
of the TransactionTest changed, but it was not properly addressed, causing the test
to pass unexpectedly.

---------

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

* eth/downloader, core/types: take withdrawals-size into account in downloader queue (#30276)

Fixes a slight miscalculation in the downloader queue, which was not accurately taking block withdrawals into account when calculating the size of the items in the queue

* cmd/evm: fix evm basefee (#30281)

fixes #30279 -- previously we did not use the basefee from the genesis, and instead the defaults were used from `runtime.go/setDefaults`-function

* go.mod: update uint256 to 1.3.1 (#30280)

Release notes: https://github.com/holiman/uint256/releases/tag/v1.3.1

* beacon/engine, consensus/beacon: use params.MaximumExtraDataSize instead of hard-coded value (#29721)


Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: lightclient <lightclient@protonmail.com>

* p2p/simulations: remove packages (#30250)

Looking at the history of these packages over the past several years, there
haven't been any meaningful contributions or usages:
https://github.com/ethereum/go-ethereum/commits/master/p2p/simulations?before=de6d5976794a9ed3b626d4eba57bf7f0806fb970+35

Almost all of the commits are part of larger refactors or low-hanging-fruit contributions.
Seems like it's not providing much value and taking up team + contributor time.

* eth/protocols/snap: cleanup dangling account trie nodes due to incomplete storage (#30258)

This pull request fixes #30229.
 
During snap sync, large storage will be split into several pieces and
synchronized concurrently. Unfortunately, the tradeoff is that the respective
merkle trie of each storage chunk will be incomplete due to the incomplete
boundaries. The trie nodes on these boundaries will be discarded, and any
dangling nodes on disk will also be removed if they fall on these paths,
ensuring the state healer won't be blocked.

However, the dangling account trie nodes on the path from the root to the
associated account are left untouched. This means the dangling account trie
nodes could potentially stop the state healing and break the assumption that the
entire subtrie should exist if the subtrie root exists. We should consider the
account trie node as the ancestor of the corresponding storage trie node.

In the scenarios described in the above ticket, the state corruption could occur
if there is a dangling account trie node while some storage trie nodes are
removed due to synchronization redo.

The fixing idea is pretty straightforward, the trie nodes on the path from root
to account should all be explicitly removed if an incomplete storage trie
occurs. Therefore, a `delete` operation has been added into `gentrie` to
explicitly clear the account along with all nodes on this path. The special
thing is that it's a cross-trie clearing. In theory, there may be a dangling
node at any position on this account key and we have to clear all of them.

* params: release go-ethereum v1.14.8 stable

* params: begin v1.14.9 release cycle

* go.mod: remove github.com/julienschmidt/httprouter (#30290)

* build: run 'go mod tidy' check as part of lint (#30291)

* core/txpool/blobpool: fix error message (#30247)

the validation process only checks for 'less than', which is
inconsistent with the error output

* go.mod: upgrade to pebble v1.1.2 (#30297)

Includes a fix for MIPS32 support.

Pebble release:
https://github.com/cockroachdb/pebble/releases/tag/v1.1.2
Key fix for mips32:
https://github.com/cockroachdb/pebble/commit/9f3904a705d60b9832febb6c6494183d92c8f556
(also the only change from v1.1.1.

* core: only compute state root once (#30299)

This PR refactors the genesis initialization a bit, s.th. we only
compute the blockhash once instead of twice as before (during hashAlloc
and flushAlloc)

This will significantly reduce the amount of memory allocated during
genesis init

---------

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

* .golangci.yml: remove lint warning for TxLookupLimit

* eth/fetcher: always expect transaction metadata in announcement (#30288)

This pull request drops the legacy transaction retrieval support from before
eth68, adding the restrictions that transaction metadata must be provided
along with the transaction announment.

* eth/ethconfig: remove LES server config (#30298)

* eth/tracers/js: add coinbase addr to ctx (#30231)

Add coinbase address to javascript tracer context.

This PR adds the `coinbase` address to `jsTracer.ctx`, allowing access
to the coinbase address (fee receipient) in custom JavaScript tracers.

Example usage:

```javascript
result: function(ctx) {
  return toAddress(ctx.coinbase);
}
```

This change enables custom tracers to access coinbase address,
previously unavailable, enhancing their capabilities to match built-in
tracers.

* eth: dial nodes from discv5 (#30302)

Here I am adding a discv5 nodes source into the p2p dial iterator. It's
an improved version of #29533.

Unlike discv4, the discv5 random nodes iterator will always provide full
ENRs. This means we can apply filtering to the results and will only try
dialing nodes which explictly opt into the eth protocol with a matching
chain.

I have also removed the dial iterator from snap. We don't have an
official DNS list for snap anymore, and I doubt anyone else is running
one. While we could potentially filter for snap on discv5, there will be
very few nodes announcing it, and the extra iterator would just stall
the dialer.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>

* beacon/light: handle endpoint URL more gracefully (#30306)

blsync was failing if the light endpoint it was provided ended with a
`/`. This change should handle the joining more gracefully.

* core: remove withdrawal length check for state processor (#30286)

The withdrawal length is already verified by the beacon consensus package, so the check in the state processor is a duplicate.

* vm: simplify error handling in `vm.EVM.create()` (#30292)

To allow all error paths in `vm.EVM.create()` to consume the necessary
gas, there is currently a pattern of gating code on `if err == nil`
instead of returning as soon as the error occurs. The same behaviour can
be achieved by abstracting the gated code into a method that returns
immediately on error, improving readability and thus making it easier to
understand and maintain.

* internal/build: include git-date on detached head (#30320)

When we are building in detached head, we cannot easily obtain the same information as we can if we're in non-detached head.

However, one thing we _can_ obtain is the git-hash and git-date. Currently, we omit to include the git-date into the build-info, which causes problem for reproducable builds which are on a detached head.

This change fixes it to include the date-info always.

* build: remove mantic from ppa builds (#30322)

removes ppa-build for ubuntu `mantic`

* gitignore: ignore upload-artefacts (#30325)

Our `WriteArchive`, used by ci builder, creates files in the repo root,in order to upload. After we've built the amd64-builds, we create the uploads, and cause the repo to be flagged as dirty for the remaining builds.

This change fixes it by adding the artefacts to gitignore. Closes #30324

* eth/catalyst: ensure period zero mode leaves no pending txs in pool (#30264)

closes #29475, replaces #29657, #30104 

Fixes two issues. First is a deadlock where the txpool attempts to reorg, but can't complete because there are no readers left for the new txs subscription. Second, resolves a problem with on demand mode where txs may be left pending when there are more pending txs than block space.

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

* accounts/abi: handle ABIs with contract type parameter (#30315)

convert parameter of type contract to the basic `address` type
---------

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

* core/rawdb: drop MigrateTable (#30331)

These are the leftovers from #24028.

* core/vm: reuse Memory instances (#30137)

This PR adds a sync.Pool to reuse instances of Memory in EVMInterpreter.

* build: attempt at reproducible builds (#30321)

This PR implements the conclusions from
https://github.com/ethereum/go-ethereum/issues/28987#issuecomment-2296075028,
that is:

Building with `--strip-all` as a ld-flag to the cgo linker, to remove
symbols. Without that, some spurious reference to a temporary file is
included into the kzg-related library.

Building with `--build-id=none`, to avoid putting a `build id` into the file.

* all: update to go version 1.23.0 (#30323)

This PR updates the version of go used in builds and docker to
1.23.0. Release notes: https://go.dev/doc/go1.23

More importantly, following our policy of maintaining the last two
versions (which now becomes 1.23 and 1.22), we can now make use of
the things that were introduced in 1.22: https://go.dev/doc/go1.22

Go 1.22 makes two changes to “for” loops.
- each iteration creates new variables, 
- for loops may range over integers

Other than that, some interesting library changes and other stuff.

* rpc: add timeout to rpc client Unsubscribe (#30318)

Fixes #30156

This adds a repro of the linked issue. I fixed it by adding a timeout
when issuing the call to unsubscribe.

* cmd/devp2p: require dns:read, dns:edit permissions for cloudflare deploy  (#30326)

This PR adds the `dns:read` and `dns:edit` permissions to the required
set of permissions checked before deploying an ENR tree to Cloudflare.
These permissions are necessary for a successful publish.

**Background**:
The current logic for `devp2p dns to-cloudflare` checks for `zone:edit`
and `zone:read` permissions. However, when running the command with only
these two permissions, the following error occurs:
```
wrong permissions on zone REMOVED-ZONE: map[#zone:edit:false #zone:read:true]
```

Adding `zone:read` and `zone:edit` to the API token led to a different
error:
```
INFO [08-19|14:06:16.782] Retrieving existing TXT records on pos-nodes.hardfork.dev
Authentication error (10000)
```

This suggested that additional permissions were required. I added
`dns:read`, but encountered another error:
```
INFO [08-19|14:11:42.342] Retrieving existing TXT records on pos-nodes.hardfork.dev
INFO [08-19|14:11:42.851] Updating DNS entries
failed to publish REMOVED.pos-nodes.hardfork.dev: Authentication error (10000)
```

Finally, after adding both `dns:read` and `dns:edit` permissions, the
command executed successfully with the following output:
```
INFO [08-19|14:13:07.677] Checking Permissions on zone REMOVED-ZONE
INFO [08-19|14:13:08.014] Retrieving existing TXT records on pos-nodes.hardfork.dev
INFO [08-19|14:13:08.440] Updating DNS entries
INFO [08-19|14:13:08.440] "Updating pos-nodes.hardfork.dev from \"enrtree-root:v1 e=FSED3EDKEKRDDFMCLP746QY6CY l=FDXN3SN67NA5DKA4J2GOK7BVQI seq=1 sig=Glja2c9RviRqOpaaHR0MnHsQwU76nJXadJwFeiXpp8MRTVIhvL0LIireT0yE3ETZArGEmY5Ywz3FVHZ3LR5JTAE\" to \"enrtree-root:v1 e=AB66M4ULYD5OYN4XFFCPVZRLUM l=FDXN3SN67NA5DKA4J2GOK7BVQI seq=1 sig=H8cqDzu0FAzBplK4g3yudhSaNtszIebc2aj4oDm5a5ZE5PAg-xpCnQgVE_53CsgsqQpalD9byafx_FrUT61sagA\""
INFO [08-19|14:13:16.932] Updated DNS entries                      new=32 updated=1 untouched=100
INFO [08-19|14:13:16.932] Deleting stale DNS entries
INFO [08-19|14:13:24.663] Deleted stale DNS entries                count=31
```

With this PR, the required permissions for deploying an ENR tree to
Cloudflare now include `zone:read`, `zone:edit`, `dns:read`, and
`dns:edit`. The initial check now includes all of the necessary
permissions and indicates in the error message which permissions are
missing:
```
INFO [08-19|14:17:20.339] Checking Permissions on zone REMOVED-ZONE
wrong permissions on zone REMOVED-ZONE: map[#dns_records:edit:false #dns_records:read:false #zone:edit:false #zone:read:true]
```

* all: clean up goerli flag and config (#30289)

Co-authored-by: lightclient <lightclient@protonmail.com>

* cmd/utils,p2p: enable discv5 by default (#30327)

* travis.yml: use focal for builds (#30319)

* trie: use go-verkle helper for speedier (*VerkleTrie).RollBackAccount (#30242)

This is a performance improvement on the account-creation rollback code
required for the archive node to support verkle. It uses the utility
function `DeleteAtStem` to remove code and account data per-group
instead of doing it leaf by leaf.

It also fixes an index bug, as code is chunked in 31-byte chunks, so
comparing with the code size should use 31 as its stride.

---------

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

* eth/protocols/eth: handle zero-count header requests (#30305)

Proper fix for handling `count=0` get header requests. 

https://en.wikipedia.org/wiki/Count_Zero

* eth/tracers: avoid panic in state test runner (#30332)

Make tracers more robust by handling `nil` receipt as input. 
Also pass in a receipt with gas used in the state test runner.
Closes https://github.com/ethereum/go-ethereum/issues/30117.

---------

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

* build: fix hash for go1.23.0.linux-riscv64.tar.gz (#30335)

build: fix hash for go1.23.0.linux-riscv64.tar.gz

* build: make go buildid static (#30342)

The previous clearing of buildid did fully work, turns out we need to
set it in `ldflags`

The go buildid is the only remaining hurdle for reproducible builds, see
https://github.com/ethereum/go-ethereum/issues/28987#issuecomment-2306412590

This PR changes the go build id application note to say literally `none`

https://github.com/golang/go/issues/33772#issuecomment-528176001:

> This difference is due to the .note.go.buildid section added by the
linker. It can be set to something static e.g. -ldflags=-buildid= (empty
string) to gain reproducibility.

* trie: avoid un-needed map copy (#30343)

This change avoids the an unnecessary map copy if the preimage recording is not enabled.

* beacon/blsync: better error information in test (#30336)

this change reports the error instead of ignoring it

* beacon/light/sync: basic tests for rangeLock (#30269)

adds simple tests for lock and firstUnlocked method from rangeLock
type

---------

Co-authored-by: lightclient <lightclient@protonmail.com>

* build: debug travis build (#30344)

debugging travis build pipeline

* gitignore: ignore build signatures (#30346)

Ignore files are generated during signing of download-binaries, which 'dirty' the vcs for subsequent builds.

* doc: update 2021-08-22-split-postmortem (#30351)

Update 2021-08-22-split-postmortem

* core: implement EIP-2935 (#29465)

https://eips.ethereum.org/EIPS/eip-2935

---------

Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Ignacio Hagopian <jsign.uy@gmail.com>
Co-authored-by: Martin HS <martin@swende.se>

* core: add metrics for state access (#30353)

This pull request adds a few more performance metrics, specifically:

- The average time cost of an account read
- The average time cost of a storage read
- The rate of account reads
- The rate of storage reads

* core/state: fix trie prefetcher for verkle (#30354)

This pull request fixes the panic issue in prefetcher once the verkle is
activated.

* p2p/discover: fix Write method in metered connection (#30355)

`WriteToUDP` was never called, since `meteredUdpConn` exposed directly
all the methods from the underlying `UDPConn` interface.

This fixes the `discover/egress` metric never being updated.

* accounts/abi/bind, ethclient/simulated: check SendTransaction error in tests (#30349)

In few tests the returned error from `SendTransaction` is not being
checked. This PR checks the returned err in tests.

Returning errors also revealed tx in `TestCommitReturnValue` is not
actually being sent, and returns err ` only replay-protected (EIP-155)
transactions allowed over RPC`. Fixed the transaction by using the
`testTx` function.

* core/state: semantic journalling (part 1) (#28880)

This is a follow-up to #29520, and a preparatory PR to a more thorough
change in the journalling system.

### API methods instead of `append` operations

This PR hides the journal-implementation details away, so that the
statedb invokes methods like `JournalCreate`, instead of explicitly
appending journal-events in a list. This means that it's up to the
journal whether to implement it as a sequence of events or
aggregate/merge events.

### Snapshot-management inside the journal 

This PR also makes it so that management of valid snapshots is moved
inside the journal, exposed via the methods `Snapshot() int` and
`RevertToSnapshot(revid int, s *StateDB)`.


### SetCode

JournalSetCode journals the setting of code: it is implicit that the
previous values were "no code" and emptyCodeHash. Therefore, we can
simplify the setCode journal.

### Selfdestruct

The self-destruct journalling is a bit strange: we allow the
selfdestruct operation to be journalled several times. This makes it so
that we also are forced to store whether the account was already
destructed.

What we can do instead, is to only journal the first destruction, and
after that only journal balance-changes, but not journal the
selfdestruct itself.

This simplifies the journalling, so that internals about state
management does not leak into the journal-API.

### Preimages

Preimages were, for some reason, integrated into the journal management,
despite not being a consensus-critical data structure. This PR undoes
that.

---------

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

* signer/core/apitypes: support fixed size arrays for EIP-712 typed data (#30175)

When attempting to hash a typed data struct that includes a type
reference with a fixed-size array, the validation process fails.
According to EIP-712, arrays can be either fixed-size or dynamic,
denoted by `Type[n]` or `Type[]` respectively, although it appears this
currently isn't supported.

This change modifies  the validation logic to accommodate types
containing fixed-size arrays.

* consensus/beacon, core/types: add verkle witness builder (#30129)

This PR adds the bulk verkle witness+proof production at the end of block
production. It reads all data from the tree in one swoop and produces
a verkle proof.

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

* trie, core/state: Nyota EIP-6800 & EIP-4762 spec updates (#30357)

This PR implements changes related to
[EIP-6800](https://eips.ethereum.org/EIPS/eip-6800) and
[EIP-4762](https://eips.ethereum.org/EIPS/eip-4762) spec updates.

A TL;DR of the changes is that `Version`, `Balance`, `Nonce` and
`CodeSize` are encoded in a single leaf named `BasicData`. For more
details, see the [_Header Values_ table in
EIP-6800](https://eips.ethereum.org/EIPS/eip-6800#header-values).

The motivation for this was simplifying access event patterns, reducing
code complexity, and, as a side effect, saving gas since fewer leaf
nodes must be accessed.

---------

Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* Include tracerConfig in created tracing test (#30364)

Fixes the tracer test filler for when there is tracerConfig.

* core/state: pull the verkle trie from prefetcher for empty storage root (#30369)

This pull request fixes a flaw in prefetcher.

In verkle tree world, both accounts and storage slots are committed into
a single tree instance for state hashing. If the prefetcher is activated, we will
try to pull the trie for the prefetcher for performance speedup. 

However, we had a special logic to skip pulling storage trie if the
storage root is empty. While it's true for merkle as we have nothing to
do with an empty storage trie, it's totally wrong for verkle. The consequences
for skipping pulling is the storage changes are committed into trie A, while the
account changes are committed into trie B (pulled from the prefetcher), boom.

* funding.json: add funding information file (#30385)

Adds a list of funding identifiers.

* all: implement EIP-6110, execution layer triggered deposits (#29431)

This PR implements EIP-6110: Supply validator deposits on chain. It also sketches
out the base for Prague in the engine API types.

* all: remove forkchoicer and reorgNeeded (#29179)

This PR changes how sidechains are handled. 

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

If during the InsertChain, the existing chain is not canonical anymore, we mark it as a sidechain and send the SideChainEvents normally.

* core: fix compilation error (#30394)

un-borks a compilation error from a recent merge to master

* all: remove funding verifier (#30391)

Now that verification is done, we can remove the funding information.

* node: fix flaky jwt-test (#30388)

This PR fixes a flaky jwt-test. 

The test is a jwt "from one second in the future". The test passes; the
reason for this is that the CI-system is slow, and by the time the jwt
is actually evaluated, that second has passed, and it's no longer
future.

Alternative to #30380

* build: increase go test timeout (#30398)

This increases the timeout for the go tests on ci, this should prevent
travis from erroring.

see:
https://app.travis-ci.com/github/ethereum/go-ethereum/jobs/625803693

* core/state: state reader abstraction (#29761)

This pull request introduces a state.Reader interface for state
accessing.

The interface could be implemented in various ways. It can be pure trie
only reader, or the combination of trie and state snapshot. What's more,
this interface allows us to have more flexibility in the future, e.g.
the
archive reader (for accessing archive state).

Additionally, this pull request removes the following metrics

- `chain/snapshot/account/reads`
- `chain/snapshot/storage/reads`

* core/state: get rid of field pointer in journal (#30361)

This pull request replaces the field pointer in journal entry with the
field itself, specifically the address of mutated account.

While it will introduce the extra allocation cost, but it's easier for
code reading. Let's measure the overhead overall to see if the change is
acceptable or not.

* build: upgrade -dlgo version to Go 1.23.1 (#30404)

New security fix:
https://groups.google.com/g/golang-announce/c/K-cEzDeCtpc

* internal/ethapi: eth_multicall (#27720)

This is a successor PR to #25743. This PR is based on a new iteration of
the spec: https://github.com/ethereum/execution-apis/pull/484.

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

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

## Breaking changes

This PR includes the following breaking changes:

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

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/fetcher: fix blob transaction propagation (#30125)

This PR fixes an issue with blob transaction propagation due to the blob
transation txpool rejecting transactions with gapped nonces. The
specific changes are:

- fetch transactions from a peer in the order they were announced to
minimize nonce-gaps (which cause blob txs to be rejected

- don't wait on fetching blob transactions after announcement is
received, since they are not broadcast

Testing:
- unit tests updated to reflect that fetch order should always match tx
announcement order
- unit test added to confirm blob transactions are scheduled immediately
for fetching
  - running the PR on an eth mainnet full node without incident so far

---------

Signed-off-by: Roberto Bayardo <bayardo@alum.mit.edu>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>

* core/state/snapshot: port changes from 29995 (#30040)

#29995 has been reverted due to an unexpected flaw in the state snapshot
process.

Specifically, it attempts to stop the state snapshot generation, which
could potentially
cause the system to halt if the generation is not currently running.

This pull request ports the changes made in #29995 and fixes the flaw.

* beacon/engine/types: remove PayloadV4 (#30415)

h/t @MariusVanDerWijden for finding and fixing this on devnet 3.

I made the mistake of thinking `PayloadVersion` was correlated with the
`GetPayloadVX` method, but it actually tracks which version of
`PayloadAttributes` were passed to `forkchoiceUpdated`. So far, Prague
does not necessitate a new version of fcu, so there is no need for
`PayloadV4`.

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

* core/vm: remove panic when address is not present (#30414)

Remove redundant address presence check in `makeGasSStoreFunc`.

This PR simplifies the `makeGasSStoreFunc` function by removing the
redundant check for address presence in the access list. The updated
code now only checks for slot presence, streamlining the logic and
eliminating unnecessary panic conditions.

This change removes the unnecessary address presence check, simplifying
the code and improving maintainability without affecting functionality.
The previous panic condition was intended as a canary during the testing
phases (i.e. _YOLOv2_) and is no longer needed.

* beacon/light/api: fixed blsync update query (#30421)

This PR fixes what https://github.com/ethereum/go-ethereum/pull/30306/
broke. Escaping the `?` in the event sub query was fixed in that PR but
it was still escaped in the `updates` request. This PR adds a URL params
argument to `httpGet` and fixes `updates` query formatting.

* eth/filters: prevent concurrent access in test (#30401)

use a mutex to prevent concurrent access to the api.filters map during `TestPendingTxFilterDeadlock` test

* core/rawdb: more accurate description of freezer in docs (#30393)

fixes https://github.com/ethereum/go-ethereum/issues/29793

* core/state, core/vm: Nyota contract create init simplification (#30409)

Implementation of [this EIP-4762
update](https://github.com/ethereum/EIPs/pull/8867).

---------

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Tanishq Jasoria <jasoriatanishq@gmail.com>

* p2p/enode: add quic ENR entry (#30283)

Add `quic` entry to the ENR as proposed in
https://github.com/ethereum/consensus-specs/pull/3644

---------

Co-authored-by: lightclient <lightclient@protonmail.com>

* core/tracing: fix copy/paste error+comments in reason listing (#30431)

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>

* core/txpool/blobpool: avoid possible zero index panic (#30430)

This situation(`len(txs) == 0`) rarely occurs, but if it does, it will
panic.

---------

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

* core/rawdb: remove unused transition status state accessors (#30433)

* internal: run tests in parallel (#30381)

Continuation of https://github.com/ethereum/go-ethereum/pull/28546

* core/types: more easily extensible tx signing (#30372)

This change makes the code slightly easier for downstream-projects to extend with more signer-types, but if functionalily equivalent to the previous code.

* core, trie: prealloc capacity for maps (#30437)

- preallocate capacity for map
- avoid `reinject` adding empty value
- use `maps.Copy`

* core/tracing: fix typo in comment (#30443)

minor fix

* core/tracing: add verkle gas change reasons to changelog (#30444)

Add changes from #30409 and #29338 to changelog.

---------

Co-authored-by: Martin HS <martin@swende.se>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>

* Revert "core/rawdb: remove unused transition status state accessors" (#30449)

Reverts ethereum/go-ethereum#30433

* params: release go-ethereum v1.14.9 stable (#30455)

* params: begin v1.14.10 release cycle (#30457)

* genesis: fix dev mode alloc (#30460)

Balance being null causes `getGenesisState` to fail as the balance field
is required in json marshaling of an account.

* core: minor fix for the log wrapper with debug purpose (#30454)

After this PR, https://github.com/ethereum/go-ethereum/pull/28187, the
way to set the default logger is different. This PR only updates the way
to set logger in some test cases' comments that existed in the codebase
(since this commit
https://github.com/ethereum/go-ethereum/commit/b63e3c37a6). Although I
am not sure if it a good way to leave the code in the comment, it truly
makes me more efficiently to debug and fix the failing test cases.

* ethdb/pebble: handle errors (#30367)

* .github: add release maintainers to params/ CODEOWNERS (#30458)

* build: fix macos builds by working around travis osx flaw (#30479)

This should fix https://github.com/ethereum/go-ethereum/issues/30471.
See investigation in https://github.com/ethereum/go-ethereum/pull/30478
for more background.

* beacon, core, eth, miner: integrate witnesses into production Geth (#30069)

This PR integrates witness-enabled block production, witness-creating
payload execution and stateless cross-validation into the `engine` API.
The purpose of the PR is to enable the following use-cases (for API
details, please see next section):

- Cross validating locally created blocks:
- Call `forkchoiceUpdatedWithWitness` instead of `forkchoiceUpdated` to
trigger witness creation too.
- Call `getPayload` as before to retrieve the new block and also the
above created witness.
- Call `executeStatelessPayload` against another client to
cross-validate the block.

- Cross validating locally processed blocks:
- Call `newPayloadWithWitness` instead of `newPayload` to trigger
witness creation too.
- Call `executeStatelessPayload` against another client to
cross-validate the block.

- Block production for stateless clients (local or MEV builders):
- Call `forkchoiceUpdatedWithWitness` instead of `forkchoiceUpdated` to
trigger witness creation too.
- Call `getPayload` as before to retrieve the new block and also the
above created witness.
- Propagate witnesses across the consensus libp2p network for stateless
Ethereum.

- Stateless validator validation:
- Call `executeStatelessPayload` with the propagated witness to
statelessly validate the block.

*Note, the various `WithWitness` methods could also *just be* an
additional boolean flag on the base methods, but this PR wanted to keep
the methods separate until a final consensus is reached on how to
integrate in production.*

---

The following `engine` API types are introduced:

```go
// StatelessPayloadStatusV1 is the result of a stateless payload execution.
type StatelessPayloadStatusV1 struct {
	Status          string      `json:"status"`
	StateRoot       common.Hash `json:"stateRoot"`
	ReceiptsRoot    common.Hash `json:"receiptsRoot"`
	ValidationError *string     `json:"validationError"`
}
```

- Add `forkchoiceUpdatedWithWitnessV1,2,3` with same params and returns
as `forkchoiceUpdatedV1,2,3`, but triggering a stateless witness
building if block production is requested.
- Extend `getPayloadV2,3` to return `executionPayloadEnvelope` with an
additional `witness` field of type `bytes` iff created via
`forkchoiceUpdatedWithWitnessV2,3`.
- Add `newPayloadWithWitnessV1,2,3,4` with same params and returns as
`newPayloadV1,2,3,4`, but triggering a stateless witness creation during
payload execution to allow cross validating it.
- Extend `payloadStatusV1` with a `witness` field of type `bytes` if
returned by `newPayloadWithWitnessV1,2,3,4`.
- Add `executeStatelessPayloadV1,2,3,4` with same base params as
`newPayloadV1,2,3,4` and one more additional param (`witness`) of type
`bytes`. The method returns `statelessPayloadStatusV1`, which mirrors
`payloadStatusV1` but replaces `latestValidHash` with `stateRoot` and
`receiptRoot`.

* travis: work around travis/osx/go1.23 setup bug (#30491)

This is a work-around for a strange issue with travis, specifically,
`os=osx, go: 1.23.1`. When this is used, the actual go that ends up
being used is `go1.19.4 darwin/amd64 `.

Using `which go`, it told me that the `go` in the path was a softlink at
`/Users/travis/gopath/bin/go1.23.1 `. However, this was not true: using
`command -v go`, it told me that the actual `go` that was used is a
softlink at `/usr/local/bin/go`.

This change rewrites the `/usr/local/bin/go` softlink to point to the
binary at `/Users/travis/gopath/bin/go1.23.1`, so we get the right
go-version.

* cmd/utils: fix `setEtherbase` (#30488)

Make `setEtherbase` fall thorugh and handle `miner.pending.feeRecipient` after showing deprecation-warning for `miner.etherbase`-flag.

* core/state: fix comment of `mode` (#30490)

* core/state: commit snapshot only if the base layer exists (#30493)

This pull request skips the state snapshot update if the base layer is
not existent, eliminating the numerous warning logs after an unclean
shutdown.

Specifically, Geth will rewind its chain head to a historical block
after unclean shutdown and state snapshot will be remained as unchanged
waiting for recovery. During this period of time, the snapshot is unusable
and all state updates should be ignored/skipped for state snapshot update.

* internal/ethapi/api: for simulated calls, set gaspool to max value if global gascap is 0 (#30474)

In #27720, we introduced RPC global gas cap. A value of `0` means an unlimited gas cap. However, this was not the case for simulated calls. This PR fixes the behaviour.

* core/rawdb: make sure specified state scheme is valid (#30499)

This change exits with error if user provided a `--state.scheme` which is neither `hash` nor `path`

* feat(repo): `geth/v1.14.9` upstream merge

* internal/ethapi: fix gascap 0 for eth_simulateV1 (#30496)

Similar to #30474.

* core/tracing, core/vm: add ContractCode to the OpContext (#30466)

Extends the opcontext interface to include accessor for code being executed in current context. While it is possible to get the code via `statedb.GetCode`, that approach doesn't work for initcode.

* core/vm: more benchmarks for bls g1/g2-multiexp precompiles (#30459)

This change adds more comprehensive benchmarks with a wider-variety of input sizes for g1 and g2 multi exponentiation.

* p2p/discover: fix flaky tests writing to test.log after completion (#30506)

This PR fixes two tests, which had a tendency to sometimes write to the `*testing.T` `log` facility after the test function had completed, which is not allowed. This PR fixes it by using waitgroups to ensure that the handler/logwriter terminates before the test exits.

closes #30505

* deps: update supranational/blst (#30504)

This update should only affect the fuzzers, as far as I know. But it
seems like it might also fix some arm/macos compilation issue in
https://github.com/ethereum/go-ethereum/issues/30494

Closes #30494 (I think)

* core/txpool, eth/catalyst: ensure gas tip retains current value upon rollback (#30495)

Here we move the method that drops all transactions by temporarily increasing the fee
into the TxPool itself. It's better to have it there because we can set it back to the
configured value afterwards. This resolves a TODO in the simulated backend.

* feat(repo): Fix bug merge 1.14.9 (#320)

* fix lint

* fix bug

* update generation files

* core/txpool/blobpool: revert part of #30437, return all reinject-addresses

* core/txpool/blobpool: add test to check internal shuffling

* Revert "core/txpool, eth/catalyst:  ensure gas tip retains current value upon rollback" (#30521)

Reverts ethereum/go-ethereum#30495

You are free to create a proper Clear method if that's the best way. But
one that does a proper cleanup, not some hacky call to set gas which
screws up logs, metrics and everything along the way. Also doesn't work
for legacy pool local transactions.

The current code had a hack in the simulated code, now we have a hack in
live txpooling code. No, that's not acceptable. I want the live code to
be proper, meaningful API, meaningful comments, meaningful
implementation.

* params: release Geth v1.14.10

* params: begin v1.14.11 release cycle

* feat: merge 1.14.10

* fix(taiko): Fix bug merge 1.14.9 (#325)

* fix bug

* fix bug

* p2p/discover: add config option for disabling FINDNODE liveness check (#30512)

This is for fixing Prysm integration tests.

* core/txpool/blobpool: use types.Sender instead of signer.Sender (#30473)

Use types.Sender(signer, tx) to utilize the transaction's sender cache
and avoid repeated address recover.

* build: use buildx to build multi-platform docker images (#30530)

* eth/catalyst: use setcanonical instead of sethead in simulated fork (#30465)

Fixes https://github.com/ethereum/go-ethereum/issues/30448

* cmd/geth: remove deprecated lightchaindata db (#30527)

This PR removes the dependencies on `lightchaindata` db as the light
protocol has been deprecated and removed from the codebase.

* fix: fix lint errors

* internal/ethapi: remove td field from block (#30386)

implement https://github.com/ethereum/execution-apis/pull/570

* params: go-ethereum v1.14.11 stable

* feat(repo): `geth/v1.14.11` upstream merge

* feat(repo): `geth/v1.14.11` upstream merge

---------

Signed-off-by: Icarus Wu <icaruswu66@qq.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: Roberto Bayardo <bayardo@alum.mit.edu>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Gealber Morales <48373523+Gealber@users.noreply.github.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: kukuru909 <kukuru909@gmail.com>
Co-authored-by: Ha DANG <dvietha@gmail.com>
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: TinyFoxy <tiny.fox@foxmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: maskpp <maskpp266@gmail.com>
Co-authored-by: bugmaker9371 <167614621+bugmaker9371@users.noreply.github.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: jackyin <648588267@qq.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: Zoro <40222601+BabyHalimao@users.noreply.github.com>
Co-authored-by: Dean Eigenmann <7621705+decanus@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: prpeh <prpeh@proton.me>
Co-authored-by: Halimao <1065621723@qq.com>
Co-authored-by: psogv0308 <psogv0308@gmail.com>
Co-authored-by: David Theodore <29786815+infosecual@users.noreply.github.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
Co-authored-by: lilasxie <thanklilas@163.com>
Co-authored-by: gitglorythegreat <t4juu3@proton.me>
Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org>
Co-authored-by: Hteev Oli <gethorz@proton.me>
Co-authored-by: winniehere <winnie050812@qq.com>
Co-authored-by: Marius Kjærstad <sandakersmann@users.noreply.github.com>
Co-authored-by: zhiqiangxu <652732310@qq.com>
Co-authored-by: Aayush Rajasekaran <arajasek94@gmail.com>
Co-authored-by: minh-bq <97180373+minh-bq@users.noreply.github.com>
Co-authored-by: Nathan Jo <162083209+qqqeck@users.noreply.github.com>
Co-authored-by: Jeremy Schlatter <jeremy@jeremyschlatter.com>
Co-authored-by: Danyal Prout <me@dany.al>
Co-authored-by: JeukHwang <92910273+JeukHwang@users.noreply.github.com>
Co-authored-by: Jordan Krage <jmank88@gmail.com>
Co-authored-by: Alexander Mint <webinfo.alexander@gmail.com>
Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
Co-authored-by: yukionfire <yukionfire@qq.com>
Co-authored-by: caseylove <casey4love@foxmail.com>
Co-authored-by: dknopik <107140945+dknopik@users.noreply.github.com>
Co-authored-by: Marius G <90795310+bearpebble@users.noreply.github.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: Seungmin Kim <a7965344@gmail.com>
Co-authored-by: Icarus Wu <icaruswu66@qq.com>
Co-authored-by: ysh0566 <ysh0566@qq.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: stevemilk <wangpeculiar@gmail.com>
Co-authored-by: Zhihao Lin <3955922+kkqy@users.noreply.github.com>
Co-authored-by: lmittmann <3458786+lmittmann@users.noreply.github.com>
Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
Co-authored-by: llkhacquan <3724362+llkhacquan@users.noreply.github.com>
Co-authored-by: taiking <c.tsujiyan727@gmail.com>
Co-authored-by: Artyom Aminov <artjoma@users.noreply.github.com>
Co-authored-by: Shude Li <islishude@gmail.com>
Co-authored-by: Zoo <zoosilence@gmail.com>
Co-authored-by: Adrian Sutton <adrian@oplabs.co>
Co-authored-by: Dylan Vassallo <dylan.vassallo@hotmail.com>
Co-authored-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
Co-authored-by: chen4903 <108803001+chen4903@users.noreply.github.com>
Co-authored-by: John Hilliard <jhilliard@polygon.technology>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: Karl Bartel <karl.bartel@clabs.co>
Co-authored-by: Oksana <107276324+Ocheretovich@users.noreply.github.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Ignacio Hagopian <jsign.uy@gmail.com>
Co-authored-by: Nicolas Gotchac <ngotchac@gmail.com>
Co-authored-by: markus <55011443+mdymalla@users.noreply.github.com>
Co-authored-by: Roberto Bayardo <bayardo@alum.mit.edu>
Co-authored-by: Tanishq Jasoria <jasoriatanishq@gmail.com>
Co-authored-by: Guillaume Michel <guillaumemichel@users.noreply.github.com>
Co-authored-by: Håvard Anda Estensen <haavard.ae@gmail.com>
Co-authored-by: piersy <pierspowlesland@gmail.com>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
Co-authored-by: Szupingwang <cara4bear@gmail.com>
Co-authored-by: Karol Chojnowski <karolchojnowski95@gmail.com>
Co-authored-by: Ng Wei Han <47109095+weiihann@users.noreply.github.com>
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.

6 participants