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

Need help with 1.10.22 regression, in 1.10.23 I get Unhandled trie error: missing trie node #25589

Closed
Sajjon opened this issue Aug 24, 2022 · 47 comments
Labels

Comments

@Sajjon
Copy link

Sajjon commented Aug 24, 2022

Hey, this morning I started using the 1.10.22 version this morning for maybe 1 hour, and then I saw that there were reports about regression bug with it. So I followed the instructions in the release notes for 1.10.23 to use debug.setHead with a blocknumber older than when I moved from 1.10.21 to 1.10.22. I used block number 15400840 from 8 hours ago. 0d15400840 is 0xEAFF88 in hex, so I did this command

> debug.setHead("0xEAFF88")

which looked like it hanged, and then after maybe a minute, I got this error output.:

Error: Post "http://localhost:3334": EOF
	at web3.js:6365:9(45)
	at send (web3.js:5099:62(34))
	at <eval>:1:14(4)

Then I wanted to know which block I was at and if I was syncing:

> eth.syncing
{
  currentBlock: 15371819,
  healedBytecodeBytes: 0,
  healedBytecodes: 0,
  healedTrienodeBytes: 0,
  healedTrienodes: 0,
  healingBytecode: 0,
  healingTrienodes: 0,
  highestBlock: 15402202,
  startingBlock: 15402191,
  syncedAccountBytes: 0,
  syncedAccounts: 0,
  syncedBytecodeBytes: 0,
  syncedBytecodes: 0,
  syncedStorage: 0,
  syncedStorageBytes: 0
}
> eth.syncing.highestBlock - eth.syncing.currentBlock
30383

So it looks like it used some other block number than what I specified, because currentBlock was set to 15371819 and not 15400840 as I specified, which was weird.

Now I see a crazy amount of errors in log

ERROR[08-24|12:21:26.881] Unhandled trie error: missing trie node b4fd295a8de6d22dd1009b7e281451681c13a04a122d7de37a89617859548089 (path 08070a) <nil>
ERROR[08-24|12:21:26.946] Unhandled trie error: missing trie node f330119795ef1ffb240126b5cf53d34db7a4ba45f051f804b35830af25ccfb05 (path 09010904) <nil>
ERROR[08-24|12:21:26.946] Unhandled trie error: missing trie node f330119795ef1ffb240126b5cf53d34db7a4ba45f051f804b35830af25ccfb05 (path 09010904) <nil>
ERROR[08-24|12:21:27.181] Unhandled trie error: missing trie node 1e4d3aa7ac49b97d1e1bfd8f2e02be05d7627341ad14e25e9e10f82e42704f7e (path 0f0b0103) <nil>
ERROR[08-24|12:21:27.181] Unhandled trie error: missing trie node 1e4d3aa7ac49b97d1e1bfd8f2e02be05d7627341ad14e25e9e10f82e42704f7e (path 0f0b0103) <nil>
ERROR[08-24|12:21:27.274] Unhandled trie error: missing trie node d0dac8813869164c560910aee54856c50b85177ab7499601d69d6923f356373a (path 050c0c00) <nil>
ERROR[08-24|12:21:27.274] Unhandled trie error: missing trie node d0dac8813869164c560910aee54856c50b85177ab7499601d69d6923f356373a (path 050c0c00) <nil>
ERROR[08-24|12:21:27.303] Unhandled trie error: missing trie node 1e5c54aece0093e0be2eda6116dd958062f3523b2bf12b416f4668abd6e7134a (path 050e01) <nil>
ERROR[08-24|12:21:27.303] Unhandled trie error: missing trie node 1e5c54aece0093e0be2eda6116dd958062f3523b2bf12b416f4668abd6e7134a (path 050e01) <nil>
ERROR[08-24|12:21:27.346] Unhandled trie error: missing trie node 0e6f00399370f7d4b177e4deac666b54c1b146e40dc14bfafefbdfbad1ab96e2 (path 0105060b) <nil>
ERROR[08-24|12:21:27.346] Unhandled trie error: missing trie node 0e6f00399370f7d4b177e4deac666b54c1b146e40dc14bfafefbdfbad1ab96e2 (path 0105060b) <nil>
ERROR[08-24|12:21:27.418] Unhandled trie error: missing trie node 0e6f00399370f7d4b177e4deac666b54c1b146e40dc14bfafefbdfbad1ab96e2 (path 0105060b) <nil>
ERROR[08-24|12:21:27.418] Unhandled trie error: missing trie node 0e6f00399370f7d4b177e4deac666b54c1b146e40dc14bfafefbdfbad1ab96e2 (path 0105060b) <nil>
ERROR[08-24|12:21:27.490] Unhandled trie error: missing trie node f330119795ef1ffb240126b5cf53d34db7a4ba45f051f804b35830af25ccfb05 (path 09010904) <nil>
ERROR[08-24|12:21:27.490] Unhandled trie error: missing trie node f330119795ef1ffb240126b5cf53d34db7a4ba45f051f804b35830af25ccfb05 (path 09010904) <nil>
ERROR[08-24|12:21:27.514] Unhandled trie error: missing trie node 7922024350a418118480a9a08345cd717476146e5f7c68ada7399b5de05d8d36 (path 0c030b0b) <nil>
ERROR[08-24|12:21:27.514] Unhandled trie error: missing trie node 7922024350a418118480a9a08345cd717476146e5f7c68ada7399b5de05d8d36 (path 0c030b0b) <nil>
ERROR[08-24|12:21:27.547] Unhandled trie error: missing trie node 881d144514a217e25338ab52f8ae41830c149b8daa9c8e7543116af7393ed162 (path 0d020307) <nil>
ERROR[08-24|12:21:27.547] Unhandled trie error: missing trie node 881d144514a217e25338ab52f8ae41830c149b8daa9c8e7543116af7393ed162 (path 0d020307) <nil>
ERROR[08-24|12:21:27.550] Unhandled trie error: missing trie node 881d144514a217e25338ab52f8ae41830c149b8daa9c8e7543116af7393ed162 (path 0d020307) <nil>
ERROR[08-24|12:21:27.550] Unhandled trie error: missing trie node 881d144514a217e25338ab52f8ae41830c149b8daa9c8e7543116af7393ed162 (path 0d020307) <nil>
INFO [08-24|12:21:27.581] Imported new chain segment               blocks=16    txs=1791      mgas=191.093 elapsed=5.423s      mgasps=35.233  number=15,376,561 hash=99400b..d401ac age=4d1h56m  dirty=1018.49MiB
INFO [08-24|12:21:27.960] Importing heavy sidechain segment        blocks=811   start=15,376,562 end=15,377,372
INFO [08-24|12:21:28.094] Unindexed transactions                   blocks=821   txs=130,461   tail=13,026,562 elapsed=512.120ms
INFO [08-24|12:21:36.485] Imported new chain segment               blocks=13    txs=3571      mgas=242.603 elapsed=8.525s      mgasps=28.456  number=15,376,574 hash=9e3069..6e85de age=4d1h54m  dirty=1023.51MiB
INFO [08-24|12:21:44.997] Imported new chain segment               blocks=20    txs=3720      mgas=298.215 elapsed=8.511s      mgasps=35.036  number=15,376,594 hash=8d8539..b0b388 age=4d1h48m  dirty=1023.18MiB
INFO [08-24|12:21:53.875] Imported new chain segment               blocks=17    txs=4552      mgas=325.808 elapsed=8.877s      mgasps=36.699  number=15,376,611 hash=f72b3b..206d5e age=4d1h44m  dirty=1022.29MiB
ERROR[08-24|12:22:22.498] Unhandled trie error: missing trie node 17cae2616b12b1f7032d041d2a2b0e681a1416506ffed502d46b51ab48c0f3f0 (path 0e0c0107) <nil>
ERROR[08-24|12:22:22.498] Unhandled trie error: missing trie node 17cae2616b12b1f7032d041d2a2b0e681a1416506ffed502d46b51ab48c0f3f0 (path 0e0c0107) <nil>
ERROR[08-24|12:22:23.028] Unhandled trie error: missing trie node 17cae2616b12b1f7032d041d2a2b0e681a1416506ffed502d46b51ab48c0f3f0 (path 0e0c0107) <nil>
ERROR[08-24|12:22:23.029] Unhandled trie error: missing trie node 17cae2616b12b1f7032d041d2a2b0e681a1416506ffed502d46b51ab48c0f3f0 (path 0e0c0107) <nil>
ERROR[08-24|12:22:24.629] Unhandled trie error: missing trie node f9d725c99e120e0f6c1f8dc9cb3d7bab497ed646c6f8bccb6b4b9123840dc44c (path 010f0404) <nil>
ERROR[08-24|12:22:24.629] Unhandled trie error: missing trie node f9d725c99e120e0f6c1f8dc9cb3d7bab497ed646c6f8bccb6b4b9123840dc44c (path 010f0404) <nil>
ERROR[08-24|12:22:24.693] Unhandled trie error: missing trie node e5b7e37abe5e439ef607018e93729940fab123238920988e548f669d02d14eec (path 0d0b09) <nil>
ERROR[08-24|12:22:24.693] Unhandled trie error: missing trie node e5b7e37abe5e439ef607018e93729940fab123238920988e548f669d02d14eec (path 0d0b09) <nil>
ERROR[08-24|12:22:24.736] Unhandled trie error: missing trie node e5b7e37abe5e439ef607018e93729940fab123238920988e548f669d02d14eec (path 0d0b09) <nil>
ERROR[08-24|12:22:24.736] Unhandled trie error: missing trie node e5b7e37abe5e439ef607018e93729940fab123238920988e548f669d02d14eec (path 0d0b09) <nil>
ERROR[08-24|12:22:25.281] Unhandled trie error: missing trie node f9d725c99e120e0f6c1f8dc9cb3d7bab497ed646c6f8bccb6b4b9123840dc44c (path 010f0404) <nil>
ERROR[08-24|12:22:25.281] Unhandled trie error: missing trie node f9d725c99e120e0f6c1f8dc9cb3d7bab497ed646c6f8bccb6b4b9123840dc44c (path 010f0404) <nil>
ERROR[08-24|12:22:25.342] Unhandled trie error: missing trie node e5b7e37abe5e439ef607018e93729940fab123238920988e548f669d02d14eec (path 0d0b09) <nil>
ERROR[08-24|12:22:25.342] Unhandled trie error: missing trie node e5b7e37abe5e439ef607018e93729940fab123238920988e548f669d02d14eec (path 0d0b09) <nil>
ERROR[08-24|12:22:25.381] Unhandled trie error: missing trie node 10731524a3e6d4e99017a9a2245cde3acf639007ae150f77b1bb640df5e7506b (path 040f0a03) <nil>
ERROR[08-24|12:22:25.381] Unhandled trie error: missing trie node 10731524a3e6d4e99017a9a2245cde3acf639007ae150f77b1bb640df5e7506b (path 040f0a03) <nil>
ERROR[08-24|12:22:25.391] Unhandled trie error: missing trie node 6d683e09199f2e85ba9b700db06305ac344f21a2ffccb1fe2cdd8f62275dd2dc (path 050e07) <nil>
ERROR[08-24|12:22:25.391] Unhandled trie error: missing trie node 6d683e09199f2e85ba9b700db06305ac344f21a2ffccb1fe2cdd8f62275dd2dc (path 050e07) <nil>
ERROR[08-24|12:22:25.703] Unhandled trie error: missing trie node 984fc8385f7111d46c03ad478f4f433d2c01b16da4fc2102892035121c845252 (path 040a09) <nil>
ERROR[08-24|12:22:25.730] Unhandled trie error: missing trie node b7e1d3b67cd6c6e72625b629a7ea410626722cd0c3e6c5d6dea02a00e9db77b3 (path 0b0c05) <nil>
ERROR[08-24|12:22:25.730] Unhandled trie error: missing trie node b7e1d3b67cd6c6e72625b629a7ea410626722cd0c3e6c5d6dea02a00e9db77b3 (path 0b0c05) <nil>
ERROR[08-24|12:22:25.730] Unhandled trie error: missing trie node b7e1d3b67cd6c6e72625b629a7

Maybe not relevant, I also saw:

WARN [08-24|12:24:54.078] Merge is configured, but previously seen beacon client is offline. Please ensure it is operational before the transition arrives! eta=3w1d1h

But lighthouse is not running now, because of cannot start it sigp/lighthouse#3500

So what does this ocean of Unhandled trie error: missing trie node mean? Am I f**ked, do I have to do a clean sync from start (7 days)? Or is this normal, i.e. these errors will disappear onces eth.syncing goes to false? Because when checking, it looks that I'm making progress:

> eth.syncing.highestBlock - eth.syncing.currentBlock
27981
> eth.syncing.highestBlock - eth.syncing.currentBlock
27584
> eth.syncing.highestBlock - eth.syncing.currentBlock
27399
> eth.syncing.highestBlock - eth.syncing.currentBlock
27034
> eth.syncing.highestBlock - eth.syncing.currentBlock
25933
> eth.syncing.highestBlock - eth.syncing.currentBlock
24759

But I don't remember having seen Unhandled trie error: missing trie node before!

Please please help <3

System information

Geth version: 1.10.23
OS & Version: macOS Monterey 12.5.1 (21G83)

Expected behaviour

Actual behaviour

Steps to reproduce the behaviour

Backtrace

[backtrace]

When submitting logs: please submit them as text and not screenshots.

@Sajjon
Copy link
Author

Sajjon commented Aug 24, 2022

I just tried restaring geth to see what I see, I get Head state missing, repairing, what does that mean?

Full log:

INFO [08-24|12:33:53.395] Disk storage enabled for ethash caches   dir=/Users/sajjode/Library/Ethereum/geth/ethash count=3
INFO [08-24|12:33:53.396] Disk storage enabled for ethash DAGs     dir=/Users/sajjode/Library/Ethash count=2
INFO [08-24|12:33:53.398] Initialising Ethereum protocol           network=1 dbversion=8
INFO [08-24|12:33:53.437] Loaded most recent local header          number=15,378,033 hash=db6612..1c3690 td=56,803,191,999,581,582,767,893 age=3d20h28m
INFO [08-24|12:33:53.438] Loaded most recent local full block      number=15,378,033 hash=db6612..1c3690 td=56,803,191,999,581,582,767,893 age=3d20h28m
INFO [08-24|12:33:53.438] Loaded most recent local fast block      number=15,378,033 hash=db6612..1c3690 td=56,803,191,999,581,582,767,893 age=3d20h28m
INFO [08-24|12:33:53.438] Loaded last fast-sync pivot marker       number=12,467,495
WARN [08-24|12:33:53.439] Head state missing, repairing            number=15,378,033 hash=db6612..1c3690 snaproot=07944c..a49773

@garyng2000
Copy link

indeed, that debug.setHead("0xEAFF88") gives me the exact same message

Error: Post "http://localhost:3334": EOF
at web3.js:6365:9(45)
at send (web3.js:5099:62(34))
at :1:14(4)

but my journal log seems to suggest it is still syncing. just don't know what state it is. This release(.22 and .23) seems to be too rush and the 'patch' is my scary(without warning that the above command may not return immediately and not sure what exactly the above message means

@garyng2000
Copy link

garyng2000 commented Aug 24, 2022

and now my log is showing huge amount of this

ERROR[08-24|12:09:27.894] Demoting invalidated transaction hash=41b422..127396
and
now it disappear and continue syncing from the block I specify, but extremely slow.

this regression is a nightmare

and now I see these Tries missing error(and the imported new chain segment is extremely slow, at this rate I would further lag behind as my other node which I haven't done the rewind is importing faster which is already like 10k block ahead and counting)

Aug 24 12:31:21 hqprdubeth startmainnet.sh[3940083]: INFO [08-24|12:31:21.226] Resuming state snapshot generation       root=e25933..59c0d5 at=004550..1aae0f accounts=190,049 slots=1,179,077 storage=93.40MiB dangling=0 elapsed=6m33.>
Aug 24 12:31:21 hqprdubeth startmainnet.sh[3940083]: INFO [08-24|12:31:21.226] Trie missing, state snapshotting paused  root=e25933..59c0d5 at=004550..1aae0f accounts=190,049 slots=1,179,077 storage=93.40MiB dangling=0 elapsed=6m33.>
Aug 24 12:31:21 hqprdubeth startmainnet.sh[3940083]: INFO [08-24|12:31:21.228] Imported new chain segment               blocks=1 txs=74  mgas=6.826  elapsed=14.535s     mgasps=0.470 number=15,393,661 hash=b86569..d8482f age=1d11h12m>
Aug 24 12:31:47 hqprdubeth startmainnet.sh[3940083]: INFO [08-24|12:31:47.648] Resuming state snapshot generation       root=f2b19b..de357b at=004550..1aae0f accounts=190,049 slots=1,179,077 storage=93.40MiB dangling=0 elapsed=7m0.3>
Aug 24 12:31:47 hqprdubeth startmainnet.sh[3940083]: INFO [08-24|12:31:47.648] Trie missing, state snapshotting paused  root=f2b19b..de357b at=004550..1aae0f accounts=190,049 slots=1,179,077 storage=93.40MiB dangling=0 elapsed=7m0.3>
Aug 24 12:31:47 hqprdubeth startmainnet.sh[3940083]: INFO [08-24|12:31:47.653] Imported new chain segment               blocks=1 txs=173 mgas=19.751 elapsed=26.424s     mgasps=0.747 number=15,393,662 hash=232236..c92d4c age=1d11h12m>

@holiman
Copy link
Contributor

holiman commented Aug 24, 2022

Trie missing, state snapshotting paused @garyng2000 yes this is borked. Did you do a sethead back? It appears it didn't go far enough. I would recommend a fresh sync, via geth ... removedb but opt to keep the ancients in place.

@RisingPaw can't say for sure without logs. "trie missing errors" -- in what context?

@garyng2000
Copy link

@RisingPaw indeed. I usually would delay my upgrade or at least test them out on a spare setup for a while. But this time it is about the merge, sigh.

@holiman, thanks. I would just sync from fresh.

@garyng2000
Copy link

and I really strongly suggest to not even mentioning that debug.setHead patch, just re-sync with the ancient data kept(based on what I see only about 1 week of data). It seems to cause my trouble.

@holiman
Copy link
Contributor

holiman commented Aug 24, 2022

@RisingPaw that's a lot of errors. I'd recommend to just resync with the ancient data kept.

@garyng2000
Copy link

geth removedb but keep the ancient data when asked

@garyng2000
Copy link

that is what I have done, and waiting the re-sync about a week behind

@cybersi
Copy link

cybersi commented Aug 24, 2022

I took me about 15 hours, to sync from scratch, so it's not that bad. The snapshot sync is now enabled by default and it helps a lot.

@Sajjon
Copy link
Author

Sajjon commented Aug 24, 2022

Trie missing, state snapshotting paused @garyng2000 yes this is borked. Did you do a sethead back? It appears it didn't go far enough. I would recommend a fresh sync, via geth ... removedb but opt to keep the ancients in place.

@RisingPaw can't say for sure without logs. "trie missing errors" -- in what context?

Am I (OP) borked too?

@gitmewai
Copy link

We are running archive nodes with --gcmode archive with SyncMode = "full" and NoPruning = true in config file. Is the archive node also affected by the 1.10.22 regression if there is no pruning action on the node?

The command geth snapshot traverse-state has been running for almost 2.5 hours on this goerli archive node and no errors reported so far. You know, it's not practical to resync an archive node from genesis.

Thanks

@c0deright
Copy link

The EOF error is most likely a timeout between geth cli and geth daemon and can be ignored. Just check the log of your daemon and you will see that geth is indeed rewinding the blockchain.

But I have these

Unhandled trie error: missing trie node 9a2047c93da8dd3f9a92a18295a3569ebb41371e6676650d239cae8561536257 (path 0c04040a) <nil>

errors, too, but geth is still syncing.

@holiman
Copy link
Contributor

holiman commented Aug 24, 2022 via email

@Sajjon
Copy link
Author

Sajjon commented Aug 24, 2022

@karalabe You wrote in another thread:

If after setHead you are seeing missing trie node errors, then the db is fried beyond recovery and you shoudl resync

But I think maybe it works for me now, maybe here is a gist with hundred log entries, and I don't see any errors anymore?

Unindexed transactions                   blocks=1     txs=39        tail=13,054,155 elapsed="313.875µs"
INFO [08-24|19:13:44.624] Generating state snapshot                root=5ad928..cd0ba1 at=0593cc..e22cb3 accounts=3,926,565            slots=17,271,639           storage=1.51GiB    dangling=0 elapsed=3m17.830s   eta=2h28m2.607s
INFO [08-24|19:13:52.626] Generating state snapshot                root=5ad928..cd0ba1 in=05ed74..370d0d at=edbbef..af99d4 accounts=4,173,799            slots=17,887,309           storage=1.56GiB    dangling=0 elapsed=3m25.832s   eta=2h24m43.708s
INFO [08-24|19:13:56.159] Aborting state snapshot generation       root=5ad928..cd0ba1 in=061039..c5fd4e at=39d3c7..b4d670 accounts=4,269,191            slots=18,208,306           storage=1.59GiB    dangling=0 elapsed=3m29.365s   eta=2h23m50.218s
INFO [08-24|19:13:56.159] Resuming state snapshot generation       root=606014..8c7dbd in=061039..c5fd4e at=39d3c7..b4d670 accounts=4,269,191            slots=18,208,306           storage=1.59GiB    dangling=0 elapsed=3m29.365s   eta=2h23m50.218s
INFO [08-24|19:13:56.190] Imported new chain segment               blocks=1     txs=208       mgas=21.150  elapsed=131.092ms   mgasps=161.338 number=15,404,155 hash=58cd64..ce066e dirty=216.45MiB
INFO [08-24|19:13:56.193] Unindexed transactions                   blocks=1     txs=402       tail=13,054,156 elapsed=2.885ms

Futhermore, when I geth attach it is not syncing anymore:

{
  currentBlock: 15404013,
  healedBytecodeBytes: 1380778,
  healedBytecodes: 169,
  healedTrienodeBytes: 311875891,
  healedTrienodes: 1088686,
  healingBytecode: 0,
  healingTrienodes: 1181,
  highestBlock: 15404111,
  startingBlock: 15400840,
  syncedAccountBytes: 44688733182,
  syncedAccounts: 181096005,
  syncedBytecodeBytes: 1570849,
  syncedBytecodes: 184,
  syncedStorage: 229585039,
  syncedStorageBytes: 50173550930
}
> eth.syncing.highestBlock - eth.syncing.currentBlock
98
> eth.syncing.highestBlock - eth.syncing.currentBlock
NaN
> eth.syncing.highestBlock - eth.syncing.currentBlock
NaN
>

So am I all good now? debug.setHead work even though I saw nasty Unhandled trie error: missing trie node until syncing was done? Or should I still resync?

@c0deright
Copy link

Same for me. I saw many missing trie node errors but as soon as geth did sync to head no more errors, even after restart of geth. Still wipe db @karalabe?

@winksaville
Copy link

@c0deright, @Sajjon, I also saw many many missing trie node on my goerli node and then it "sync'd" and it seemed OK. I then rebooted and everything continues to look good.

Since that seemed OK, I went ahead and did it on a mainnet node and it's just finished syncing, and all seem OK.

Here is the console output from eth.syncing the first one was just before it finished and a short time later we see false:

> eth.syncing
{
  currentBlock: 15404546,
  healedBytecodeBytes: 0,
  healedBytecodes: 0,
  healedTrienodeBytes: 0,
  healedTrienodes: 0,
  healingBytecode: 0,
  healingTrienodes: 0,
  highestBlock: 15404695,
  startingBlock: 15398218,
  syncedAccountBytes: 0,
  syncedAccounts: 0,
  syncedBytecodeBytes: 0,
  syncedBytecodes: 0,
  syncedStorage: 0,
  syncedStorageBytes: 0
}
> eth.syncing
false
> 

Here is the eth1.service logs when I stopped seeing the "Unhanded trie error":

Aug 24 12:37:41 hazel geth[20942]: ERROR[08-24|12:37:41.583] Unhandled trie error: missing trie node 3de83dc52d315d44bc1559e9461c93345781e1dafe2f1bd2223f89383f5f7450 (path 06) <nil>
Aug 24 12:37:41 hazel geth[20942]: ERROR[08-24|12:37:41.631] Unhandled trie error: missing trie node 5b57397796aab0c2a975f0c5d7a671374ae92683c7c096b376a1d09d3a9ffa16 (path 0a) <nil>
Aug 24 12:37:41 hazel geth[20942]: ERROR[08-24|12:37:41.631] Unhandled trie error: missing trie node 5b57397796aab0c2a975f0c5d7a671374ae92683c7c096b376a1d09d3a9ffa16 (path 0a) <nil>
Aug 24 12:37:41 hazel geth[20942]: INFO [08-24|12:37:41.638] Imported new chain segment               blocks=45   txs=6363      mgas=632.026 elapsed=6.617s    mgasps=95.510  number=15,404,695 hash=6ccbb3..39e5ba age=21m       dirty=1021.51MiB
Aug 24 12:37:41 hazel geth[20942]: WARN [08-24|12:37:41.646] Synchronisation failed, dropping peer    peer=da5f8f45b9c8f74d93465ec3833b60894636645489097de4c6e6ea2364b75031 err="action from bad peer ignored: header request failed: timeout"
Aug 24 12:37:41 hazel geth[20942]: INFO [08-24|12:37:41.871] Unindexed transactions                   blocks=175  txs=36399     tail=13,054,696 elapsed=233.003ms
Aug 24 12:37:50 hazel geth[20942]: INFO [08-24|12:37:50.713] Imported new chain segment               blocks=15   txs=3004      mgas=282.238 elapsed=2.600s    mgasps=108.518 number=15,404,710 hash=3d251a..f65cef age=17m43s    dirty=1022.99MiB
Aug 24 12:37:50 hazel geth[20942]: INFO [08-24|12:37:50.735] Unindexed transactions                   blocks=15   txs=3581      tail=13,054,711 elapsed=21.503ms
Aug 24 12:37:57 hazel geth[20942]: INFO [08-24|12:37:57.885] Imported new chain segment               blocks=41   txs=7435      mgas=705.481 elapsed=7.170s    mgasps=98.386  number=15,404,751 hash=d35855..850c16 age=7m43s     dirty=1019.27MiB
Aug 24 12:37:58 hazel geth[20942]: INFO [08-24|12:37:58.012] Unindexed transactions                   blocks=41   txs=9420      tail=13,054,752 elapsed=126.751ms
Aug 24 12:38:02 hazel geth[20942]: INFO [08-24|12:38:02.632] Imported new chain segment               blocks=32   txs=5001      mgas=460.011 elapsed=4.746s    mgasps=96.910  number=15,404,783 hash=ad71ac..5cc713 dirty=1022.51MiB
Aug 24 12:38:02 hazel geth[20942]: INFO [08-24|12:38:02.703] Unindexed transactions                   blocks=32   txs=9093      tail=13,054,784 elapsed=67.809ms
Aug 24 12:38:02 hazel geth[20942]: INFO [08-24|12:38:02.787] Imported new chain segment               blocks=2    txs=179       mgas=17.783  elapsed=155.107ms mgasps=114.650 number=15,404,785 hash=2967d7..aedaf3 dirty=1020.93MiB
Aug 24 12:38:02 hazel geth[20942]: INFO [08-24|12:38:02.792] Unindexed transactions                   blocks=2    txs=689       tail=13,054,786 elapsed=4.756ms
Aug 24 12:38:24 hazel geth[20942]: INFO [08-24|12:38:24.399] Imported new chain segment               blocks=1    txs=330       mgas=29.996  elapsed=153.239ms mgasps=195.745 number=15,404,786 hash=b6d1df..f45f6f dirty=1022.82MiB
Aug 24 12:38:24 hazel geth[20942]: INFO [08-24|12:38:24.400] Unindexed transactions                   blocks=1    txs=153       tail=13,054,787 elapsed=1.368ms
Aug 24 12:38:34 hazel geth[20942]: INFO [08-24|12:38:34.544] Imported new chain segment               blocks=1    txs=273       mgas=29.997  elapsed=246.268ms mgasps=121.806 number=15,404,787 hash=507988..2b794f dirty=1022.73MiB
Aug 24 12:38:34 hazel geth[20942]: INFO [08-24|12:38:34.548] Unindexed transactions                   blocks=1    txs=448       tail=13,054,788 elapsed=3.945ms
Aug 24 12:38:47 hazel geth[20942]: INFO [08-24|12:38:47.120] Imported new chain segment               blocks=1    txs=270       mgas=29.992  elapsed=117.827ms mgasps=254.537 number=15,404,787 hash=79f1df..b0acc7 dirty=1023.12MiB
Aug 24 12:38:52 hazel geth[20942]: INFO [08-24|12:38:52.880] Chain reorg detected                     number=15,404,786 hash=b6d1df..f45f6f drop=1 dropfrom=507988..2b794f add=2 addfrom=4668f5..25d613
Aug 24 12:38:52 hazel geth[20942]: INFO [08-24|12:38:52.889] Imported new chain segment               blocks=1    txs=307       mgas=19.036  elapsed=184.067ms mgasps=103.417 number=15,404,788 hash=4668f5..25d613 dirty=1023.55MiB
Aug 24 12:38:52 hazel geth[20942]: INFO [08-24|12:38:52.891] Unindexed transactions                   blocks=1    txs=242       tail=13,054,789 elapsed=1.937ms
Aug 24 12:39:37 hazel geth[20942]: INFO [08-24|12:39:37.850] Imported new chain segment               blocks=1    txs=365       mgas=30.022  elapsed=234.365ms mgasps=128.099 number=15,404,789 hash=32b103..c551f9 dirty=1022.57MiB
Aug 24 12:39:37 hazel geth[20942]: INFO [08-24|12:39:37.854] Unindexed transactions                   blocks=1    txs=387       tail=13,054,790 elapsed=3.508ms
Aug 24 12:39:40 hazel geth[20942]: INFO [08-24|12:39:40.093] Imported new chain segment               blocks=1    txs=114       mgas=9.922   elapsed=108.565ms mgasps=91.397  number=15,404,790 hash=b6beeb..920036 dirty=1021.70MiB

And on the beacon-chain node and we see WARN Not ready for merge and 12 seconds later we see INFO Ready for merge:

Aug 24 12:38:05 hazel lighthouse[20959]: Aug 24 19:38:05.002 WARN Not ready for merge ...
...
Aug 24 12:38:17 hazel lighthouse[20959]: Aug 24 19:38:17.011 INFO Ready for the merge

Here is the complete logs for the beacon-chain covering the same time:

Aug 24 12:37:41 hazel lighthouse[20959]: Aug 24 19:37:41.001 INFO Synced                                  slot: 4545486, block: 0x1309…c87a, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 25, service: slot_notifier
Aug 24 12:37:41 hazel lighthouse[20959]: Aug 24 19:37:41.002 WARN Not ready for merge                     info: The execution endpoint is connected and configured, however it is not yet synced, service: slot_notifier
Aug 24 12:37:47 hazel lighthouse[20959]: Aug 24 19:37:47.503 INFO New block received                      root: 0xc5f198792e240ae5bbbe46db830c4cd9b0e986cb4ce9f754c63395c2271a53e9, slot: 4545487
Aug 24 12:37:53 hazel lighthouse[20959]: Aug 24 19:37:53.001 INFO Synced                                  slot: 4545487, block: 0xc5f1…53e9, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 25, service: slot_notifier
Aug 24 12:37:53 hazel lighthouse[20959]: Aug 24 19:37:53.002 WARN Not ready for merge                     info: The execution endpoint is connected and configured, however it is not yet synced, service: slot_notifier
Aug 24 12:38:00 hazel lighthouse[20959]: Aug 24 19:38:00.171 INFO New block received                      root: 0x5ea9a1b06d41dedc4bc51f5e2e92fa432a24074c4e5ef669aabc61004d4594c1, slot: 4545488
Aug 24 12:38:05 hazel lighthouse[20959]: Aug 24 19:38:05.001 INFO Synced                                  slot: 4545488, block: 0x5ea9…94c1, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 26, service: slot_notifier
Aug 24 12:38:05 hazel lighthouse[20959]: Aug 24 19:38:05.002 WARN Not ready for merge                     info: The execution endpoint is connected and configured, however it is not yet synced, service: slot_notifier
Aug 24 12:38:05 hazel lighthouse[20959]: Aug 24 19:38:05.003 INFO Execution engine online                 service: exec
Aug 24 12:38:11 hazel lighthouse[20959]: Aug 24 19:38:11.630 INFO New block received                      root: 0x8d54b0402d80416f4ceb29cfe73a64197b7ea00523ef9ea0c9aca4d142cbc3d8, slot: 4545489
Aug 24 12:38:12 hazel lighthouse[20959]: Aug 24 19:38:12.906 INFO Sending metrics to remote endpoint      endpoint: https://beaconcha.in/, service: monitoring_client
Aug 24 12:38:16 hazel lighthouse[20959]: Aug 24 19:38:16.446 INFO Imported deposit log(s)                 new: 1, total: 424402, latest_block: 15403284, service: deposit_contract_rpc
Aug 24 12:38:17 hazel lighthouse[20959]: Aug 24 19:38:17.001 INFO Synced                                  slot: 4545489, block: 0x8d54…c3d8, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 25, service: slot_notifier
Aug 24 12:38:17 hazel lighthouse[20959]: Aug 24 19:38:17.011 INFO Ready for the merge                     current_difficulty: 57120613437982261439710, terminal_total_difficulty: 58750000000000000000000, service: slot_notifier
Aug 24 12:38:24 hazel lighthouse[20959]: Aug 24 19:38:24.077 INFO New block received                      root: 0x4b49b1750f4ec1738b3cab1f7b55cbf5b8887006ad22b40c514aeac4cd1dced3, slot: 4545490
Aug 24 12:38:29 hazel lighthouse[20959]: Aug 24 19:38:29.000 INFO Synced                                  slot: 4545490, block: 0x4b49…ced3, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 26, service: slot_notifier
Aug 24 12:38:29 hazel lighthouse[20959]: Aug 24 19:38:29.006 INFO Ready for the merge                     current_difficulty: 57120625691195076242407, terminal_total_difficulty: 58750000000000000000000, service: slot_notifier
Aug 24 12:38:35 hazel lighthouse[20959]: Aug 24 19:38:35.655 INFO New block received                      root: 0x157b393b16d0dcc545d945c46b2c6567843c7a4d473bc52e11ab63df5da2b2fb, slot: 4545491
Aug 24 12:38:41 hazel lighthouse[20959]: Aug 24 19:38:41.001 INFO Synced                                  slot: 4545491, block: 0x157b…b2fb, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 29, service: slot_notifier
Aug 24 12:38:41 hazel lighthouse[20959]: Aug 24 19:38:41.008 INFO Ready for the merge                     current_difficulty: 57120637938699754882321, terminal_total_difficulty: 58750000000000000000000, service: slot_notifier
Aug 24 12:38:47 hazel lighthouse[20959]: Aug 24 19:38:47.593 INFO New block received                      root: 0x8766f293b495d82ee12194ddd810af11682ffef5ce53f798db10a1c52fdb4fe2, slot: 4545492
Aug 24 12:38:53 hazel lighthouse[20959]: Aug 24 19:38:53.001 INFO Synced                                  slot: 4545492, block: 0x8766…4fe2, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 30, service: slot_notifier
Aug 24 12:38:53 hazel lighthouse[20959]: Aug 24 19:38:53.007 INFO Ready for the merge                     current_difficulty: 57120650186479311429179, terminal_total_difficulty: 58750000000000000000000, service: slot_notifier
Aug 24 12:38:59 hazel lighthouse[20959]: Aug 24 19:38:59.805 INFO New block received                      root: 0x097b86b69b554310cef8aa1f9ca1379c4e0e4e20e70ea83c70f332f257b2dd24, slot: 4545493
Aug 24 12:39:05 hazel lighthouse[20959]: Aug 24 19:39:05.001 INFO Synced                                  slot: 4545493, block: 0x097b…dd24, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 33, service: slot_notifier
Aug 24 12:39:05 hazel lighthouse[20959]: Aug 24 19:39:05.007 INFO Ready for the merge                     current_difficulty: 57120650186479311429179, terminal_total_difficulty: 58750000000000000000000, service: slot_notifier
Aug 24 12:39:11 hazel lighthouse[20959]: Aug 24 19:39:11.362 INFO New block received                      root: 0x01437c2e26197ac01102fc98fd195e90d5fc9ca8361ced063bfe63a0757ba090, slot: 4545494
Aug 24 12:39:12 hazel lighthouse[20959]: Aug 24 19:39:12.914 INFO Sending metrics to remote endpoint      endpoint: https://beaconcha.in/, service: monitoring_client
Aug 24 12:39:17 hazel lighthouse[20959]: Aug 24 19:39:17.001 INFO Synced                                  slot: 4545494, block: 0x0143…a090, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 29, service: slot_notifier
Aug 24 12:39:17 hazel lighthouse[20959]: Aug 24 19:39:17.003 INFO Ready for the merge                     current_difficulty: 57120650186479311429179, terminal_total_difficulty: 58750000000000000000000, service: slot_notifier
Aug 24 12:39:23 hazel lighthouse[20959]: Aug 24 19:39:23.549 INFO New block received                      root: 0x662310b1d1fde3ef62cc578b444a5fe2a94eea1afc8d49248c342bc523008022, slot: 4545495
Aug 24 12:39:29 hazel lighthouse[20959]: Aug 24 19:39:29.001 INFO Synced                                  slot: 4545495, block: 0x6623…8022, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 28, service: slot_notifier
Aug 24 12:39:29 hazel lighthouse[20959]: Aug 24 19:39:29.006 INFO Ready for the merge                     current_difficulty: 57120650186479311429179, terminal_total_difficulty: 58750000000000000000000, service: slot_notifier
Aug 24 12:39:35 hazel lighthouse[20959]: Aug 24 19:39:35.832 INFO New block received                      root: 0xcb9ab452c704a40294653dde96f758dc8e996e43314fd41d6a2951b536be4e4f, slot: 4545496
Aug 24 12:39:41 hazel lighthouse[20959]: Aug 24 19:39:41.001 INFO Synced                                  slot: 4545496, block: 0xcb9a…4e4f, epoch: 142046, finalized_epoch: 142044, finalized_root: 0x05f3…8163, exec_hash: n/a, peers: 28, service: slot_notifier
Aug 24 12:39:41 hazel lighthouse[20959]: Aug 24 19:39:41.004 INFO Ready for the merge                     current_difficulty: 57120674658941076926435, terminal_total_difficulty: 58750000000000000000000, service: slot_notifier

So @karalabe, same q, is the db wipe needed?

@alex88
Copy link

alex88 commented Aug 25, 2022

Even when a db wipe, after the State sync in progress ended I'm getting lots of these logs:

Imported new block headers               count=1    elapsed=5.222ms      number=15,406,079 hash=6fbd0c..b303fe
State heal in progress                   accounts=3766@198.00KiB       slots=224@17.64KiB          codes=6@72.00KiB         nodes=30061@11.21MiB pending=41491
Unexpected trienode heal packet          peer=dfbd782c reqid=5,352,399,348,225,992,007
Unexpected trienode heal packet          peer=e7b4ee21 reqid=4,783,303,500,655,206,990
Unexpected trienode heal packet          peer=8b5a6c65 reqid=4,331,723,279,535,021,208
Imported new block headers               count=1    elapsed=5.869ms      number=15,406,080 hash=156276..cc1651
Unexpected trienode heal packet          peer=cda4b3d3 reqid=7,945,169,409,859,770,559
Imported new block headers               count=2    elapsed=5.191ms      number=15,406,082 hash=b0e798..6d233b
Unexpected trienode heal packet          peer=4ce74c2f reqid=5,664,668,594,071,610,051
Unexpected trienode heal packet          peer=ecd785d3 reqid=115,536,799,573,859,131
Unexpected trienode heal packet          peer=e9e64d3a reqid=2,658,483,760,195,569,180
State heal in progress                   accounts=3825@201.19KiB       slots=224@17.64KiB          codes=6@72.00KiB         nodes=30582@11.37MiB pending=42173
State heal in progress                   accounts=3935@207.01KiB       slots=224@17.64KiB          codes=6@72.00KiB         nodes=31252@11.59MiB pending=43237
Unexpected trienode heal packet          peer=f65d3d68 reqid=5,004,796,167,503,447,278
Unexpected trienode heal packet          peer=26653bbc reqid=7,918,807,320,170,735,492
Unexpected trienode heal packet          peer=4ce74c2f reqid=6,754,713,326,928,148,598
Unexpected trienode heal packet          peer=ecd785d3 reqid=6,256,785,757,804,213,597
Imported new block headers               count=1    elapsed=5.505ms      number=15,406,083 hash=22e020..eddbd5
Downloader queue stats                   receiptTasks=0     blockTasks=0     itemSize=308.57KiB throttle=850
Imported new block headers               count=1    elapsed=5.232ms      number=15,406,084 hash=8c8613..a5c8f7
State heal in progress                   accounts=4061@213.48KiB       slots=224@17.64KiB          codes=6@72.00KiB         nodes=31982@11.83MiB pending=43790
Unexpected trienode heal packet          peer=f65d3d68 reqid=1,315,505,038,391,565,705

with the pending value increasing instead of decreasing.

@c0deright
Copy link

I deleted everything in chaindata/ but kept chaindata/ancients untouched. After the sync of the last 7 days I got

State heal in progress
Unexpected trienode heal packet
Unexpected bytecode heal packet

but eventually it reached Rebuilding state snapshot and then all the trienode/heal messages disappeared and geth reached the usual state (pruning active):

Imported new chain segment               blocks=1
Unindexed transactions                   blocks=1

@garyng2000
Copy link

state heal in progress, how long it would take ? this really is a nightmare now.

@geomad
Copy link

geomad commented Aug 25, 2022

I had the same issue, and I opted to removedb, but not ancient.
Now I'm syncing but I'm getting lots of "unexpected storange ranges packets", "unexpected bytecode packet" and "unexpected account range" WARNS.
Is this normal or should I do a clean resync by deleting ancients as well?

@garyng2000
Copy link

I think it is probably better to remove everything. a single account state heal took 1 hour(since my last post) and I don't know how many are there that need this. This is not a super fast machine but not slow either(nvme, standard intel server CPU, not VM and the CPU usage is very low so it seems to be all about graining slowly).

@holiman
Copy link
Contributor

holiman commented Aug 25, 2022

I think it is probably better to remove everything.

No. It's better to remove chaindata but leave ancients in place. It saves ~300GB of download.

The "unexpected xxx packets" thing is not directly related, although there might inefficiencies (#25600) we can improve upon.

@holiman
Copy link
Contributor

holiman commented Aug 25, 2022

a single account state heal took 1 hour(since my last post) and I don't know how many are there that need this.

There's no such thing -- state heal heals the entire trie. I don't know what it could have been that happened during that hour ? Maybe it simply finished the state heal (i.e: completed sync) in that hour?

The generation of snapshot data is a post-sync operation, when it's doing that you're already in sync.

@garyng2000
Copy link

but it seems that it is still not in normal mode where I should see the normal message of

Aug 25 06:54:45 hqprdubada startmainnet.sh[2723248]: INFO [08-25|06:54:45.646] Imported new chain segment blocks=1 txs=49 mgas=3.414 elap

still seeing import header and that state heal which the account # changed after about an hour to another one and I don't know where that would be done

@garyng2000
Copy link

garyng2000 commented Aug 25, 2022

like this(that 24088 is increasing but it can stay the same for an hour before it changes, if there are 1M accounts, it would take how many hours but I don't know the meaning of it)

Aug 25 13:59:13 hqprdubeth startmainnet.sh[3945015]: INFO [08-25|13:59:13.377] State heal in progress accounts=24088@1.21MiB slots=7672@612.17KiB codes=55@509.58KiB nodes=665,196@298.98MiB pending=128,150

twelve hours later, this is what I am seeing so it seems that it is fixing the account one at a time and no way to tell how many more remains. probably better to just scrap the whole thing and sync from fresh ! As it is still not in normal state AFAICT

Aug 26 01:20:40 hqprdubeth startmainnet.sh[3945015]: INFO [08-26|01:20:40.850] State heal in progress accounts=137,843@7.32MiB slots=96077@7.24MiB codes=254@2.05MiB nodes=2,388,175@962.15MiB pending=88563

syncing: {
currentBlock: 15412385,
healedBytecodeBytes: 2150002,
healedBytecodes: 254,
healedTrienodeBytes: 1015310728,
healedTrienodes: 2400585,
healingBytecode: 0,
healingTrienodes: 4192,
highestBlock: 15412460,
startingBlock: 15312742,
syncedAccountBytes: 44692712980,
syncedAccounts: 183966641,
syncedBytecodeBytes: 4191239478,
syncedBytecodes: 646245,
syncedStorage: 763860220,
syncedStorageBytes: 163710644801
},

@m0n5t3r
Copy link

m0n5t3r commented Aug 26, 2022

I got it working eventually; what worked for me:

  • geth snapshot prune-state
  • remove db, but keep ancients (with geth removedb) - the beacon node started reporting it's ready for the merge roughly 11h later, even if geth was still saying it's syncing state (it was 95-ish percent done, finished about 40m later)

Did anyone have any success with rewinding the chain? if there was a corruption introduced at some point in time it should have been possible to do debug.setHead and have it resync from there, but it didn't work for me (rewinding 10-ish blocks didn't help, rewinding a few hundred blocks simply hanged forever).

Hopefully nothing explodes during the merge 🤞

@Sajjon
Copy link
Author

Sajjon commented Aug 26, 2022

My Geth client seems to be working as well, I did NOT delete any db, just did the setHead, saw nasty errors, waited and some restary later all good.

Lighthouse reports ready for merge 🥳

@winksaville
Copy link

I too was successful using just debug.setHead. I used to twice on a goerli node and mainnet node.

@rjl493456442
Copy link
Member

My Geth client seems to be working as well, I did NOT delete any db, just did the setHead, saw nasty errors, waited and some restary later all good.

Lighthouse reports ready for merge 🥳

Would you care to run a geth snapshot traverse-state? Since your node are reporting missing nodes all the time, I guess your node maybe broken. This command will detect the broken state, but it might take 2-3 days to traverse the entire state if the state is totally complete.

@Sajjon
Copy link
Author

Sajjon commented Aug 28, 2022

My Geth client seems to be working as well, I did NOT delete any db, just did the setHead, saw nasty errors, waited and some restary later all good.

Lighthouse reports ready for merge 🥳

Would you care to run a geth snapshot traverse-state? Since your node are reporting missing nodes all the time, I guess your node maybe broken. This command will detect the broken state, but it might take 2-3 days to traverse the entire state if the state is totally complete.

Can I do this while geth is running @rjl493456442 ??

EDIT: Apparently not, I get Fatal: Failed to create the protocol stack: datadir already used by another process if I have it running simultaneously. I guess I will fallback to lighthouse2 and my infura eth1 client during snapshot traverse-state.

@Sajjon
Copy link
Author

Sajjon commented Aug 28, 2022

@rjl493456442 is it possible to get some kind of time estimate based on 15 min of running?

INFO [08-28|19:40:11.558] Maximum peer count                       ETH=50 LES=0 total=50
INFO [08-28|19:40:11.560] Set global gas cap                       cap=50,000,000
INFO [08-28|19:40:11.560] Allocated cache and file handles         database=/Users/sajjode/Library/Ethereum/geth/chaindata cache=512.00MiB handles=5120 readonly=true
INFO [08-28|19:40:17.472] Found legacy ancient chain path          location=/Users/sajjode/Library/Ethereum/geth/chaindata/ancient
INFO [08-28|19:40:17.477] Opened ancient database                  database=/Users/sajjode/Library/Ethereum/geth/chaindata/ancient readonly=true
INFO [08-28|19:40:17.481] Start traversing the state               root=119034..32f081 number=15,429,180
INFO [08-28|19:40:17.484] Traversing state                         accounts=1 slots=0 codes=0 elapsed=2.762ms
INFO [08-28|19:40:27.388] Traversing state                         accounts=2948 slots=7156 codes=410 elapsed=9.906s
INFO [08-28|19:40:35.388] Traversing state                         accounts=11294 slots=11608 codes=1522 elapsed=17.906s
INFO [08-28|19:40:43.388] Traversing state                         accounts=16102 slots=18812 codes=2219 elapsed=25.906s
INFO [08-28|19:40:51.388] Traversing state                         accounts=26038 slots=24834 codes=3508 elapsed=33.906s
INFO [08-28|19:41:18.667] Traversing state                         accounts=28665 slots=72714 codes=3846 elapsed=1m1.186s
INFO [08-28|19:41:26.667] Traversing state                         accounts=36007 slots=79835 codes=4821 elapsed=1m9.186s
INFO [08-28|19:41:38.353] Traversing state                         accounts=39143 slots=103,744 codes=5259 elapsed=1m20.872s
INFO [08-28|19:41:46.585] Traversing state                         accounts=47417 slots=111,395 codes=6355 elapsed=1m29.104s
INFO [08-28|19:41:54.585] Traversing state                         accounts=53391 slots=119,685 codes=7188 elapsed=1m37.104s
INFO [08-28|19:42:02.769] Traversing state                         accounts=65233 slots=126,153 codes=8764 elapsed=1m45.288s
INFO [08-28|19:42:10.769] Traversing state                         accounts=78110 slots=131,708 codes=10421 elapsed=1m53.288s
INFO [08-28|19:42:27.158] Traversing state                         accounts=81454 slots=152,962 codes=10874 elapsed=2m9.678s
INFO [08-28|19:42:38.961] Traversing state                         accounts=87551 slots=166,416 codes=11700 elapsed=2m21.481s
INFO [08-28|19:42:46.962] Traversing state                         accounts=96543 slots=173,505 codes=12894 elapsed=2m29.482s
INFO [08-28|19:42:54.963] Traversing state                         accounts=105,326 slots=180,771 codes=14011 elapsed=2m37.483s
INFO [08-28|19:43:14.183] Traversing state                         accounts=112,344 slots=205,074 codes=14910 elapsed=2m56.703s
INFO [08-28|19:43:27.092] Traversing state                         accounts=118,158 slots=220,054 codes=15692 elapsed=3m9.612s
INFO [08-28|19:43:35.115] Traversing state                         accounts=125,982 slots=227,673 codes=16712 elapsed=3m17.635s
INFO [08-28|19:43:59.216] Traversing state                         accounts=131,629 slots=258,964 codes=17449 elapsed=3m41.736s
INFO [08-28|19:44:07.216] Traversing state                         accounts=137,835 slots=267,196 codes=18277 elapsed=3m49.737s
INFO [08-28|19:44:15.217] Traversing state                         accounts=143,033 slots=275,736 codes=18939 elapsed=3m57.738s
INFO [08-28|19:44:23.218] Traversing state                         accounts=156,710 slots=280,779 codes=20804 elapsed=4m5.739s
INFO [08-28|19:44:31.218] Traversing state                         accounts=162,005 slots=290,194 codes=21474 elapsed=4m13.739s
INFO [08-28|19:45:15.757] Traversing state                         accounts=172,972 slots=392,323 codes=22975 elapsed=4m58.279s
INFO [08-28|19:54:50.691] Traversing state                         accounts=183,152 slots=1,158,743 codes=24375 elapsed=14m33.221s
INFO [08-28|19:55:02.516] Traversing state                         accounts=187,707 slots=1,174,824 codes=25005 elapsed=14m45.046s
INFO [08-28|19:55:10.516] Traversing state                         accounts=192,028 slots=1,183,042 codes=25592 elapsed=14m53.047s
INFO [08-28|19:55:18.735] Traversing state                         accounts=204,198 slots=1,188,672 codes=27214 elapsed=15m1.266s
INFO [08-28|19:55:28.468] Traversing state                         accounts=210,213 slots=1,198,678 codes=28025 elapsed=15m10.998s
INFO [08-28|19:55:41.727] Traversing state                         accounts=218,837 slots=1,218,761 codes=29182 elapsed=15m24.258s
INFO [08-28|19:55:52.906] Traversing state                         accounts=221,783 slots=1,231,728 codes=29566 elapsed=15m35.437s
INFO [08-28|19:56:01.341] Traversing state                         accounts=233,397 slots=1,237,641 codes=31072 elapsed=15m43.872s
INFO [08-28|19:56:09.888] Traversing state                         accounts=239,331 slots=1,247,596 codes=31860 elapsed=15m52.419s
INFO [08-28|19:56:21.547] Traversing state                         accounts=247,612 slots=1,259,402 codes=32958 elapsed=16m4.078s
INFO [08-28|19:56:30.536] Traversing state                         accounts=250,312 slots=1,271,122 codes=33289 elapsed=16m13.068s
INFO [08-28|19:56:38.536] Traversing state                         accounts=257,566 slots=1,278,403 codes=34252 elapsed=16m21.068s

Can I make it go faster somehow? Increasing cache? This is a Mac Mini M1 with 16 GB RAM

@rjl493456442
Copy link
Member

@Sajjon if your state is totally complete, then it will take ~3 days to finish.

Aug 27 04:49:51 bench03.ethdevops.io brave_tu INFO [08-26|20:49:51.330] State is complete                        accounts=180,241,491 slots=769,680,456 codes=24,026,919 elapsed=61h16m40.702s

I guess if you can run a day without any error, then your state should be fine.

Now I have some hunch about this missing trie node issue, not 100% sure yet, but I guess it's not broken state.

@Sajjon
Copy link
Author

Sajjon commented Aug 29, 2022

@rjl493456442 successfully running for 23 hours now, I will let it run for 24 hours more at least and write an update then.

@rjl493456442
Copy link
Member

rjl493456442 commented Aug 31, 2022

@Sajjon thanks for your help! And I think there is nothing wrong right? I think you can stop the checking and recover your node!

I think I have figured out the issue for missing trie node. It's irrelevant with state integrity, namely your node should be safe.

And it's a long existent issue, just be surfaced by a recent change(printed as log).

@Sajjon
Copy link
Author

Sajjon commented Aug 31, 2022

@rjl493456442 I'm still letting it run, it has been running for ~65 hours now:

INFO [08-31|12:23:44.610] Traversing state                         accounts=58,447,219 slots=257,488,926 codes=7,792,365 elapsed=64h43m27.161s
INFO [08-31|12:24:13.911] Traversing state                         accounts=58,448,538 slots=257,552,160 codes=7,792,536 elapsed=64h43m56.462s
INFO [08-31|12:24:21.912] Traversing state                         accounts=58,451,940 slots=257,560,036 codes=7,792,996 elapsed=64h44m4.462s
INFO [08-31|12:24:43.394] Traversing state                         accounts=58,452,742 slots=257,583,349 codes=7,793,115 elapsed=64h44m25.945s
INFO [08-31|12:24:51.646] Traversing state                         accounts=58,455,219 slots=257,590,826 codes=7,793,431 elapsed=64h44m34.196s
INFO [08-31|12:25:02.525] Traversing state                         accounts=58,459,716 slots=257,600,850 codes=7,794,018 elapsed=64h44m45.076s
INFO [08-31|12:25:12.195] Traversing state                         accounts=58,466,884 slots=257,607,667 codes=7,794,989 elapsed=64h44m54.746s
INFO [08-31|12:25:20.195] Traversing state                         accounts=58,470,243 slots=257,614,834 codes=7,795,447 elapsed=64h45m2.746s
INFO [08-31|12:25:33.268] Traversing state                         accounts=58,474,005 slots=257,631,566 codes=7,795,958 elapsed=64h45m15.819s
INFO [08-31|12:25:47.971] Traversing state                         accounts=58,477,445 slots=257,648,812 codes=7,796,413 elapsed=64h45m30.522s
INFO [08-31|12:25:55.971] Traversing state                         accounts=58,487,416 slots=257,652,403 codes=7,797,736 elapsed=64h45m38.522s
INFO [08-31|12:26:10.718] Traversing state                         accounts=58,489,983 slots=257,668,845 codes=7,798,079 elapsed=64h45m53.269s
INFO [08-31|12:26:21.125] Traversing state                         accounts=58,494,957 slots=257,679,435 codes=7,798,713 elapsed=64h46m3.676s
INFO [08-31|12:26:29.125] Traversing state                         accounts=58,501,163 slots=257,685,062 codes=7,799,597 elapsed=64h46m11.676s
INFO [08-31|12:26:43.441] Traversing state                         accounts=58,504,218 slots=257,698,925 codes=7,799,960 elapsed=64h46m25.992s
INFO [08-31|12:26:51.443] Traversing state                         accounts=58,508,428 slots=257,705,228 codes=7,800,542 elapsed=64h46m33.994s

Is there a point in letting it complete? Maybe it will complete in 24 hours @rjl493456442 ?

@rjl493456442
Copy link
Member

@Sajjon I am almost certain that your node is good.

accounts=180,241,491 there are around 180M accounts in total, and your node just checked 58M. I don't think you need to run another 3 days. Let's just stop it.

holiman pushed a commit that referenced this issue Aug 31, 2022
It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly.

Recently there are a few tickets #25613 #25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top.

Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing.

Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state.

The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR.
@rjl493456442
Copy link
Member

This issue is identified, it's not critical at all, you can either run 1.10.23 ignore the logs, or run the latest master.

sidhujag pushed a commit to syscoin/go-ethereum that referenced this issue Sep 2, 2022
It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly.

Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top.

Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing.

Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state.

The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR.
@Sajjon
Copy link
Author

Sajjon commented Sep 8, 2022

@rjl493456442 Now I see Error in block freeze operation err="block receipts missing, can't freeze block 15400841", that sounds bad...?

So do I need to removedb and resync from scratch?

Here are some more lines in geth log:

INFO [09-08|09:16:40.150] Unindexed transactions                   blocks=1    txs=231     tail=13,145,252 elapsed=1.517ms
INFO [09-08|09:16:43.154] Imported new chain segment               blocks=1    txs=22      mgas=3.152   elapsed=66.354ms    mgasps=47.500  number=15,495,252 hash=619041..a5cdf4 dirty=1021.28MiB
INFO [09-08|09:16:43.155] Unindexed transactions                   blocks=1    txs=80      tail=13,145,253 elapsed="580.333µs"
INFO [09-08|09:16:46.157] Imported new chain segment               blocks=1    txs=28      mgas=1.832   elapsed=49.963ms    mgasps=36.672  number=15,495,253 hash=568e8b..ed3de1 dirty=1019.45MiB
INFO [09-08|09:16:46.160] Unindexed transactions                   blocks=1    txs=427     tail=13,145,254 elapsed=3.050ms
INFO [09-08|09:16:49.814] Imported new chain segment               blocks=1    txs=75      mgas=9.047   elapsed=63.565ms    mgasps=142.332 number=15,495,254 hash=85aa45..af0ff2 dirty=1019.98MiB
INFO [09-08|09:16:49.816] Unindexed transactions                   blocks=1    txs=226     tail=13,145,255 elapsed=2.129ms
ERROR[09-08|09:16:49.922] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:17:14.271] Imported new chain segment               blocks=1    txs=225     mgas=19.735  elapsed=546.946ms   mgasps=36.081  number=15,495,255 hash=0d799a..702882 dirty=1021.77MiB
INFO [09-08|09:17:14.272] Unindexed transactions                   blocks=1    txs=87      tail=13,145,256 elapsed="985.416µs"
INFO [09-08|09:17:20.111] Imported new chain segment               blocks=1    txs=67      mgas=8.094   elapsed=87.611ms    mgasps=92.386  number=15,495,256 hash=125e6b..481c97 dirty=1019.83MiB
INFO [09-08|09:17:20.112] Unindexed transactions                   blocks=1    txs=109     tail=13,145,257 elapsed="733.25µs"
INFO [09-08|09:17:26.303] Imported new chain segment               blocks=1    txs=76      mgas=5.558   elapsed=66.384ms    mgasps=83.717  number=15,495,257 hash=ee1865..aa4f98 dirty=1019.94MiB
INFO [09-08|09:17:26.306] Unindexed transactions                   blocks=1    txs=374     tail=13,145,258 elapsed=2.755ms
INFO [09-08|09:17:40.013] Imported new chain segment               blocks=1    txs=252     mgas=28.427  elapsed=161.146ms   mgasps=176.405 number=15,495,258 hash=052c18..cc8a5d dirty=1020.49MiB
INFO [09-08|09:17:40.016] Unindexed transactions                   blocks=1    txs=397     tail=13,145,259 elapsed=2.327ms
ERROR[09-08|09:17:49.924] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:18:44.214] Imported new chain segment               blocks=1    txs=479     mgas=29.981  elapsed=641.382ms   mgasps=46.744  number=15,495,259 hash=e912e6..814cef age=1m4s      dirty=1023.82MiB
INFO [09-08|09:18:44.215] Unindexed transactions                   blocks=1    txs=174     tail=13,145,260 elapsed=1.724ms
ERROR[09-08|09:18:49.929] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:19:01.945] Imported new chain segment               blocks=1    txs=269     mgas=29.995  elapsed=312.686ms   mgasps=95.926  number=15,495,260 hash=e72e2a..4cdaa8 dirty=1022.09MiB
INFO [09-08|09:19:01.949] Unindexed transactions                   blocks=1    txs=563     tail=13,145,261 elapsed=4.298ms
INFO [09-08|09:19:08.443] Imported new chain segment               blocks=1    txs=221     mgas=19.487  elapsed=130.210ms   mgasps=149.655 number=15,495,261 hash=a094fb..a25df3 dirty=1022.88MiB
INFO [09-08|09:19:08.445] Unindexed transactions                   blocks=1    txs=411     tail=13,145,262 elapsed=2.715ms
INFO [09-08|09:19:14.354] Imported new chain segment               blocks=1    txs=52      mgas=5.300   elapsed=83.791ms    mgasps=63.249  number=15,495,262 hash=ad3c21..e706ab dirty=1020.63MiB
INFO [09-08|09:19:14.354] Unindexed transactions                   blocks=1    txs=43      tail=13,145,263 elapsed="512.459µs"
INFO [09-08|09:19:32.874] Imported new chain segment               blocks=1    txs=254     mgas=17.538  elapsed=111.988ms   mgasps=156.608 number=15,495,263 hash=1ff527..e43297 dirty=1021.59MiB
INFO [09-08|09:19:32.874] Unindexed transactions                   blocks=1    txs=27      tail=13,145,264 elapsed="244.125µs"
ERROR[09-08|09:19:49.951] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:19:55.591] Imported new chain segment               blocks=1    txs=257     mgas=22.678  elapsed=145.924ms   mgasps=155.409 number=15,495,264 hash=496826..44cd0d dirty=1023.61MiB
INFO [09-08|09:19:55.594] Unindexed transactions                   blocks=1    txs=390     tail=13,145,265 elapsed=2.227ms
INFO [09-08|09:20:03.431] Imported new chain segment               blocks=1    txs=86      mgas=6.456   elapsed=79.287ms    mgasps=81.429  number=15,495,265 hash=ec32cb..5f678e dirty=1022.35MiB
INFO [09-08|09:20:03.433] Unindexed transactions                   blocks=1    txs=392     tail=13,145,266 elapsed=2.237ms
INFO [09-08|09:20:11.888] Imported new chain segment               blocks=1    txs=139     mgas=9.914   elapsed=90.136ms    mgasps=109.990 number=15,495,266 hash=c24198..48a919 dirty=1021.33MiB
INFO [09-08|09:20:11.890] Unindexed transactions                   blocks=1    txs=254     tail=13,145,267 elapsed=2.100ms
INFO [09-08|09:20:22.687] Imported new chain segment               blocks=1    txs=110     mgas=8.462   elapsed=79.731ms    mgasps=106.132 number=15,495,267 hash=5940af..cce06a dirty=1021.84MiB
INFO [09-08|09:20:22.688] Unindexed transactions                   blocks=1    txs=204     tail=13,145,268 elapsed=1.353ms
INFO [09-08|09:20:37.370] Imported new chain segment               blocks=1    txs=242     mgas=20.028  elapsed=141.411ms   mgasps=141.631 number=15,495,268 hash=af4b5d..a3b77e dirty=1021.95MiB
INFO [09-08|09:20:37.374] Unindexed transactions                   blocks=1    txs=65      tail=13,145,269 elapsed=3.154ms
INFO [09-08|09:20:44.666] Imported new chain segment               blocks=1    txs=154     mgas=19.725  elapsed=97.564ms    mgasps=202.170 number=15,495,269 hash=b29d40..afe084 dirty=1023.23MiB
INFO [09-08|09:20:44.667] Unindexed transactions                   blocks=1    txs=130     tail=13,145,270 elapsed=1.229ms
ERROR[09-08|09:20:49.957] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:21:46.431] Imported new chain segment               blocks=1    txs=32      mgas=2.482   elapsed=60.172ms    mgasps=41.244  number=15,495,270 hash=f36fa4..28e1a5 age=1m2s      dirty=1021.16MiB
INFO [09-08|09:21:46.433] Unindexed transactions                   blocks=1    txs=67      tail=13,145,271 elapsed=1.411ms
ERROR[09-08|09:21:49.962] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:22:15.428] Imported new chain segment               blocks=1    txs=467     mgas=29.987  elapsed=185.890ms   mgasps=161.317 number=15,495,271 hash=5b791a..223254 dirty=1021.70MiB
INFO [09-08|09:22:15.429] Unindexed transactions                   blocks=1    txs=160     tail=13,145,272 elapsed=1.438ms
INFO [09-08|09:22:27.531] Imported new chain segment               blocks=1    txs=361     mgas=29.954  elapsed=161.891ms   mgasps=185.026 number=15,495,272 hash=512e34..abf652 dirty=1022.01MiB
INFO [09-08|09:22:27.534] Unindexed transactions                   blocks=1    txs=399     tail=13,145,273 elapsed=2.769ms
INFO [09-08|09:22:32.752] Imported new chain segment               blocks=1    txs=300     mgas=29.994  elapsed=190.809ms   mgasps=157.192 number=15,495,273 hash=c85ff8..89fbd4 dirty=1022.76MiB
INFO [09-08|09:22:32.753] Unindexed transactions                   blocks=1    txs=52      tail=13,145,274 elapsed="324.416µs"
ERROR[09-08|09:22:49.965] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:22:50.212] Imported new chain segment               blocks=1    txs=276     mgas=29.987  elapsed=196.277ms   mgasps=152.781 number=15,495,274 hash=953587..c86277 dirty=1022.09MiB
INFO [09-08|09:22:50.217] Unindexed transactions                   blocks=1    txs=353     tail=13,145,275 elapsed=4.087ms
INFO [09-08|09:23:46.333] Imported new chain segment               blocks=1    txs=333     mgas=29.997  elapsed=283.713ms   mgasps=105.731 number=15,495,275 hash=50ed3f..7b833a dirty=1022.76MiB
INFO [09-08|09:23:46.336] Unindexed transactions                   blocks=1    txs=190     tail=13,145,276 elapsed=2.195ms
ERROR[09-08|09:23:49.967] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:24:12.424] Imported new chain segment               blocks=1    txs=264     mgas=29.990  elapsed=297.372ms   mgasps=100.849 number=15,495,276 hash=0a5561..5c5ff2 dirty=1023.65MiB
INFO [09-08|09:24:12.425] Unindexed transactions                   blocks=1    txs=38      tail=13,145,277 elapsed="637.541µs"
INFO [09-08|09:24:19.139] Imported new chain segment               blocks=1    txs=41      mgas=4.107   elapsed=64.939ms    mgasps=63.243  number=15,495,277 hash=d889c2..ff1844 dirty=1023.10MiB
INFO [09-08|09:24:19.142] Unindexed transactions                   blocks=1    txs=386     tail=13,145,278 elapsed=2.888ms
INFO [09-08|09:24:28.178] Imported new chain segment               blocks=1    txs=107     mgas=7.871   elapsed=122.455ms   mgasps=64.275  number=15,495,278 hash=26a416..1138ad dirty=1022.45MiB
INFO [09-08|09:24:28.179] Unindexed transactions                   blocks=1    txs=156     tail=13,145,279 elapsed="930.916µs"
ERROR[09-08|09:24:49.972] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:25:04.174] Imported new chain segment               blocks=1    txs=311     mgas=30.025  elapsed=560.864ms   mgasps=53.534  number=15,495,279 hash=4bb6ac..9004ce dirty=1023.26MiB
INFO [09-08|09:25:04.180] Unindexed transactions                   blocks=1    txs=312     tail=13,145,280 elapsed=4.554ms
INFO [09-08|09:25:13.613] Imported new chain segment               blocks=1    txs=292     mgas=29.999  elapsed=556.917ms   mgasps=53.865  number=15,495,280 hash=2b18ef..5d2b9c dirty=1021.63MiB
INFO [09-08|09:25:13.617] Unindexed transactions                   blocks=1    txs=443     tail=13,145,281 elapsed=4.372ms
INFO [09-08|09:25:23.116] Imported new chain segment               blocks=1    txs=237     mgas=22.558  elapsed=314.507ms   mgasps=71.723  number=15,495,281 hash=d695c1..6ed749 dirty=1021.19MiB
INFO [09-08|09:25:23.122] Unindexed transactions                   blocks=1    txs=351     tail=13,145,282 elapsed=5.600ms
INFO [09-08|09:25:37.022] Imported new chain segment               blocks=1    txs=138     mgas=11.558  elapsed=92.214ms    mgasps=125.336 number=15,495,282 hash=b739fb..dbf886 dirty=1022.18MiB
INFO [09-08|09:25:37.024] Unindexed transactions                   blocks=1    txs=422     tail=13,145,283 elapsed=2.005ms
INFO [09-08|09:25:49.339] Imported new chain segment               blocks=1    txs=159     mgas=17.933  elapsed=103.302ms   mgasps=173.601 number=15,495,283 hash=8dc2db..696af2 dirty=1023.35MiB
INFO [09-08|09:25:49.340] Unindexed transactions                   blocks=1    txs=71      tail=13,145,284 elapsed="304.042µs"
ERROR[09-08|09:25:49.976] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:26:06.160] Imported new chain segment               blocks=1    txs=126     mgas=13.309  elapsed=147.804ms   mgasps=90.046  number=15,495,284 hash=62bb93..46d97a dirty=1021.58MiB
INFO [09-08|09:26:06.161] Unindexed transactions                   blocks=1    txs=78      tail=13,145,285 elapsed="449.542µs"
INFO [09-08|09:26:07.747] Imported new chain segment               blocks=1    txs=72      mgas=6.774   elapsed=56.306ms    mgasps=120.311 number=15,495,285 hash=b98e81..023837 dirty=1022.10MiB
INFO [09-08|09:26:07.749] Unindexed transactions                   blocks=1    txs=318     tail=13,145,286 elapsed=1.920ms
INFO [09-08|09:26:14.315] Downloader queue stats                   receiptTasks=0 blockTasks=0 itemSize=64.96KiB  throttle=4036
INFO [09-08|09:26:14.486] Imported new chain segment               blocks=2    txs=75      mgas=9.641   elapsed=171.003ms   mgasps=56.378  number=15,495,287 hash=c12733..433e99 dirty=1020.07MiB
INFO [09-08|09:26:14.505] Unindexed transactions                   blocks=2    txs=166     tail=13,145,288 elapsed=19.09ms
ERROR[09-08|09:26:49.980] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
ERROR[09-08|09:27:49.983] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:27:51.621] Imported new chain segment               blocks=1    txs=383     mgas=29.981  elapsed=572.654ms   mgasps=52.354  number=15,495,288 hash=bdddab..899516 age=1m38s     dirty=1020.91MiB
INFO [09-08|09:27:51.623] Unindexed transactions                   blocks=1    txs=180     tail=13,145,289 elapsed=1.581ms
INFO [09-08|09:28:06.318] Imported new chain segment               blocks=1    txs=356     mgas=30.029  elapsed=222.986ms   mgasps=134.668 number=15,495,289 hash=f47d2b..f2ff99 dirty=1023.20MiB
INFO [09-08|09:28:06.319] Unindexed transactions                   blocks=1    txs=97      tail=13,145,290 elapsed="398µs"
INFO [09-08|09:28:11.280] Imported new chain segment               blocks=1    txs=54      mgas=3.016   elapsed=85.765ms    mgasps=35.163  number=15,495,290 hash=539d4c..6e4d23 dirty=1023.31MiB
INFO [09-08|09:28:11.282] Unindexed transactions                   blocks=1    txs=406     tail=13,145,291 elapsed=2.220ms
INFO [09-08|09:28:20.300] Imported new chain segment               blocks=1    txs=273     mgas=29.998  elapsed=249.527ms   mgasps=120.217 number=15,495,291 hash=6af107..a9377b dirty=1023.33MiB
INFO [09-08|09:28:20.300] Unindexed transactions                   blocks=1    txs=158     tail=13,145,292 elapsed="737.125µs"
INFO [09-08|09:28:31.523] Imported new chain segment               blocks=1    txs=220     mgas=22.268  elapsed=172.031ms   mgasps=129.443 number=15,495,292 hash=0cde0c..4da53c dirty=1023.79MiB
INFO [09-08|09:28:31.543] Unindexed transactions                   blocks=1    txs=103     tail=13,145,293 elapsed=19.929ms
INFO [09-08|09:26:14.505] Unindexed transactions                   blocks=2    txs=166     tail=13,145,288 elapsed=19.09ms
ERROR[09-08|09:26:49.980] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
ERROR[09-08|09:27:49.983] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"INFO [09-08|09:28:46.595] Imported new chain segment               blocks=1    txs=124     mgas=11.182  elapsed=143.813ms   mgasps=77.752  number=15,495,293 hash=11afb6..3874a5 dirty=1022.85MiB
INFO [09-08|09:28:46.596] Unindexed transactions                   blocks=1    txs=95      tail=13,145,294 elapsed=1.017ms
ERROR[09-08|09:28:49.993] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:29:25.636] Imported new chain segment               blocks=1    txs=341     mgas=29.981  elapsed=297.834ms   mgasps=100.665 number=15,495,294 hash=77b543..b57f3a dirty=1021.71MiB
INFO [09-08|09:29:25.637] Unindexed transactions                   blocks=1    txs=257     tail=13,145,295 elapsed=1.284ms
INFO [09-08|09:29:30.306] Chain reorg detected                     number=15,495,293 hash=11afb6..3874a5 drop=1 dropfrom=77b543..b57f3a add=1 addfrom=f3d7e3..c1ca77
INFO [09-08|09:29:30.312] Imported new chain segment               blocks=1    txs=284     mgas=25.810  elapsed=97.581ms    mgasps=264.501 number=15,495,294 hash=f3d7e3..c1ca77 dirty=1022.21MiB
INFO [09-08|09:29:30.682] Chain reorg detected                     number=15,495,293 hash=11afb6..3874a5 drop=1 dropfrom=f3d7e3..c1ca77 add=2 addfrom=b26050..2aa7be
INFO [09-08|09:29:30.695] Imported new chain segment               blocks=1    txs=115     mgas=7.863   elapsed=75.749ms    mgasps=103.803 number=15,495,295 hash=b26050..2aa7be dirty=1021.09MiB
INFO [09-08|09:29:30.716] Unindexed transactions                   blocks=1    txs=378     tail=13,145,296 elapsed=20.962ms
ERROR[09-08|09:29:49.998] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:30:04.284] Imported new chain segment               blocks=1    txs=120     mgas=15.899  elapsed=91.305ms    mgasps=174.131 number=15,495,296 hash=be8884..2e6ded dirty=1022.71MiB
INFO [09-08|09:30:04.286] Unindexed transactions                   blocks=1    txs=181     tail=13,145,297 elapsed=1.591ms
INFO [09-08|09:30:20.704] Imported new chain segment               blocks=1    txs=462     mgas=29.487  elapsed=192.403ms   mgasps=153.258 number=15,495,297 hash=92fe18..6cb207 dirty=1022.57MiB
INFO [09-08|09:30:20.722] Unindexed transactions                   blocks=1    txs=34      tail=13,145,298 elapsed=18.583ms
INFO [09-08|09:30:48.951] Imported new chain segment               blocks=1    txs=326     mgas=23.046  elapsed=155.247ms   mgasps=148.445 number=15,495,298 hash=f538cc..b2cdf0 dirty=1022.90MiB
INFO [09-08|09:30:48.952] Unindexed transactions                   blocks=1    txs=185     tail=13,145,299 elapsed=1.110ms
ERROR[09-08|09:30:50.002] Error in block freeze operation          err="block receipts missing, can't freeze block 15400841"
INFO [09-08|09:30:56.592] Imported new chain segment               blocks=1    txs=116     mgas=6.628   elapsed=77.824ms    mgasps=85.161  number=15,495,299 hash=e89ad4..0c86a4 dirty=1022.48MiB
INFO [09-08|09:30:56.593] Unindexed transactions                   blocks=1    txs=178     tail=13,145,300 elapsed="885.667µs"
INFO [09-08|09:31:10.867] Imported new chain segment               blocks=1    txs=23      mgas=1.420   elapsed=41.215ms    mgasps=34.444  number=15,495,300 hash=201da1..4d3f69 dirty=1021.14MiB
INFO [09-08|09:31:10.869] Unindexed transactions                   blocks=1    txs=313     tail=13,145,301 elapsed=1.755ms

@Sajjon
Copy link
Author

Sajjon commented Sep 8, 2022

I deleted the database, but keep ancients, and sync with --syncmode snap, and wow that was fast! Only took 12 hours, instead of many days!

@rjl493456442 snapsyncmode should work for Geth acting as an Execution to my Consensus Client (Lighthouse) right? 😬

@rjl493456442
Copy link
Member

Yes, snap sync is the default sync mode we used nowadays.

Regarding the missing receipts error, there is not enough information to dig it out honestly. It's the second report we received about it. You can also add your report here #25680

@rjl493456442
Copy link
Member

Will close this ticket since the original one is resolved.

HanWang233 pushed a commit to Meshee-Team/go-ethereum that referenced this issue Sep 11, 2022
It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly.

Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top.

Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing.

Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state.

The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR.
blakehhuynh pushed a commit to blakehhuynh/go-ethereum that referenced this issue Oct 3, 2022
It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly.

Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top.

Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing.

Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state.

The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR.
gitteri pushed a commit to paxosglobal/go-ethereum that referenced this issue Oct 3, 2022
* 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

* 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)

* 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)

* build: upgrade -dlgo version to Go 1.18.3

* 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>

* all: remove version field from rpc.API

* 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>

* 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)

* 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

* deps: update goleveldb

* 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>

* params: change Merge config to print simpler message

This fixes ethereum#25366

* 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

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

* build: upgrade -dlgo version to Go 1.18.5

* 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

* 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

* core: remove unused bc ChainContext in applyTransaction

* 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

* params: begin v1.10.24 release cycle

* params: begin go-ethereum v1.11 release cycle

* internal/ethapi: rename debug getters to match spec (ethereum#25176)

Some small fixes to get the existing debug methods to conform to the spec. Mainly dropping the encoding information from the method name as it should be deduced from the debug context and allowing the method to be invoked by either block number or block hash. It also adds the method debug_getTransaction which returns the raw tx bytes by tx hash. This is pretty much equivalent to the eth_getRawTransactionByHash method.

* accounts/abi/bind: add const for tx fee elasticity multiplier (ethereum#25504)


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

* all: remove duplicate word in comments (ethereum#25618)

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

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

* cmd/geth: fix legacy receipt detection for empty db (ethereum#25609)

* build: fix ignored errors (ethereum#25591)

* docs: specify execution client (ethereum#25566)


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

* ethclient: add 'finalized' and 'safe' block number support (ethereum#25580)

* node: change JWT error status to 401 Unauthorized (ethereum#25629)

* node: fix regression in TestJWT (ethereum#25635)

* all: move genesis initialization to blockchain (ethereum#25523)

* all: move genesis initialization to blockchain

* core: add one more check

* core: fix tests

* eth/catalyst: adjust eta for themerge (ethereum#25601)

* eth/catalyst: adjust eta for themerge

* squash

* squash

* eth/catalyst: address review concerns

* mobile: close node on error (ethereum#25643)

* graphql: return correct logs for tx (ethereum#25612)

* graphql: fix tx logs

* minor

* Use optimized search for selecting tx logs

* trie: fix grammar in comment (ethereum#25648)

* trie: cleanup stateTrie (ethereum#25640)

It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly.

Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top.

Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing.

Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state.

The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR.

* eth/catalyst: prevent division by zero (ethereum#25654)

eth/catalyst: prevent diff by zero

* trie: better error reporting (ethereum#25645)

* core/state: filter out nil trie for copy (ethereum#25575)

* eth/protocols/snap: fix problems due to idle-but-busy peers

* mobile: register filter APIs (ethereum#25642)

This fixes a regression introduced in PR ethereum#25459.

* README.md: improve grammar (ethereum#25646)


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

* eth/tracers/js: fill in log.refund field (ethereum#25661)

For some reason, an accessor method for this field exists in JS, but
the value was never actually assigned.

* eth/fetcher: throttle peers which deliver many invalid transactions (ethereum#25573)

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

* node, rpc: add JWT auth support in client (ethereum#24911)

This adds a generic mechanism for 'dial options' in the RPC client,
and also implements a specific dial option for the JWT authentication
mechanism used by the engine API. Some real tests for the server-side
authentication handling are also added.

Co-authored-by: Joshua Gutow <jgutow@optimism.io>
Co-authored-by: Felix Lange <fjl@twurst.com>

* rpc: check that "version" is "2.0" in request objects (ethereum#25570)

The JSON-RPC spec requires the "version" field to be exactly "2.0",
so we should verify that. This change is not backwards-compatible with
sloppy client implementations, but I decided to go ahead with it anyway
because the failure will be caught via the returned error.

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

* trie: fix unhandled error in test (ethereum#25628)

* eth/tracers/js: improve integer types in log object (ethereum#25668)

All fields related to gas must be represented as uint64. Depth is
internally tracked as int, so it makes sense to also store it as int.

* trie: check childrens' existence concurrently for snap heal

* core, light, trie: remove DiskDB function from trie database (ethereum#25690)

* params: update chts (ethereum#25707)

* core/vm: rename RANDOM to PREVRANDAO (ethereum#25691)

See: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4399.md

>  This EIP supplants the semantics of the return value of existing DIFFICULTY (0x44) opcode and renames the opcode to PREVRANDAO (0x44).

* all: cleanup tests (ethereum#25641)

Follow-up to PR ethereum#25523 to cleanup all relevant tests.

* eth, les: rework chain tracer (ethereum#25143)

This PR simplifies the logic of chain tracer and also adds the unit tests.

The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen.

And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state.


Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* eth/tracer: fix broken test (ethereum#25715)

* trie: update comments + err check for preimages (ethereum#25672)

This PR includes minor updates to comments in trie/committer that reference insertion to the db, and adds an err != nil check for the return value of preimages.commit.

* 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>

* p2p/msgrate: be more lenient when calculating 'mean' (ethereum#25653)

The p2p msgrate tracker is a thing which tries to estimate some mean round-trip times. However, it did so in a very curious way: if a node had 200 peers, it would sort their 200 respective rtt estimates, and then it would pick item number 2 as the mean. So effectively taking third fastest and calling it mean. This probably works "ok" when the number of peers are low (there are other factors too, such as ttlScaling which takes some of the edge off this) -- however when the number of peers is high, it becomes very skewed.

This PR instead bases the 'mean' on the square root of the length of the list. Still pretty harsh, but a bit more lenient.

* rpc: improve error codes for internal server errors (ethereum#25678)

This changes the error code returned by the RPC server in certain situations:

- handler panic: code -32603
- result marshaling error: code -32603
- attempt to subscribe via HTTP: code -32001

In all of the above cases, the server previously returned the default error
code -32000.

Co-authored-by: Nicholas Zhao <nicholas.zhao@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* core: place a cap on reorglogs (ethereum#25711)

This PR makes the event-sending for deleted and new logs happen in batches, to prevent OOM situation due to large reorgs. 

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

* build: upgrade to go 1.19 (ethereum#25726)

This changes the CI / release builds to use the latest Go version. It also
upgrades golangci-lint to a newer version compatible with Go 1.19.

In Go 1.19, godoc has gained official support for links and lists. The
syntax for code blocks in doc comments has changed and now requires a
leading tab character. gofmt adapts comments to the new syntax
automatically, so there are a lot of comment re-formatting changes in this
PR. We need to apply the new format in order to pass the CI lint stage with
Go 1.19.

With the linter upgrade, I have decided to disable 'gosec' - it produces
too many false-positive warnings. The 'deadcode' and 'varcheck' linters
have also been removed because golangci-lint warns about them being
unmaintained. 'unused' provides similar coverage and we already have it
enabled, so we don't lose much with this change.

* p2p/discover/v5wire: reject packets smaller than 63 bytes (ethereum#25740)

* core: preallocate maps in TxPool helper methods (ethereum#25737)

* accounts/abi: fix typo in error message (ethereum#25742)

* graphql: fixes missing tx logs (ethereum#25745)

* graphql: fix tx logs

* graphql: refactor test service setup

* graphql: add test for tx logs

* cmd/geth: add a verkle subcommand (ethereum#25718)

* cmd/geth: add a verkle subcommand

* fix copyright year

* remove unused command parameters

* check that the output file was successfully written to

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

* cmd/geth: goimports fix

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

* node: fix HTTP server always force closing (ethereum#25755)


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

* core: fix log order in "Imported new chain segment" (ethereum#25768)

* node: fix lint issue in rpcstack.go (ethereum#25774)

* les/catalyst/api: add support for ExchangeTransitionConfigurationV1 (ethereum#25752)

This method is missing in light client mode and breaks consensus clients
that require a valid response.

* 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>

* trie: handle more batch commit errors in Database (ethereum#25674)

* core/rawdb: fix leak of backoff timer (ethereum#25776)

* crypto/bls12381: docfix of g1 Affine (ethereum#25729)

bls12381: docfix of g1 Affine.

* internal/ethapi: return error when requesting invalid trie key (ethereum#25762)

This change makes eth_getProof and eth_getStorageAt return an error when
the argument contains invalid hex in storage keys.

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

* core: don't cache zero nonce in txNoncer (ethereum#25603)

This changes the nonce cache used by TxPool to not store cached
nonces for non-existing accounts.

* core: more compact bad block report (ethereum#25714)

This shortens the chain config summary in bad block reports,
and adds go-ethereum version information as well.

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

* core: move build version reading to its own package (ethereum#25806)

This fixes the build with Go 1.17, which does not have BuildInfo.Settings yet.

* eth: fix a rare datarace on CHT challenge reply / shutdown

* core/vm: return copy of input slice in identity precompile, avoid returndata copy (ethereum#25183)

* core/vm: return copy of input slice in identity precompile.  don't deep copy return data slice upon call completion

* make use of common.CopyBytes

* core/blockchain: downgrade tx indexing and unindexing logs  (ethereum#25832)

core/blockchain: downgrade tx indexing and unindexing logs from info to debug

If a user has a finite tx lookup limit, they will see an "unindexing" info level log each time a block is imported. This information might help a user understand that they are removing the index each block and some txs may not be retrievable by hash, but overall it is generally more of a nuisance than a benefit. This change downgrades the log to a debug log.

* eth/tracers: fix trace config for `TraceCall` (ethereum#25821)

Co-authored-by:  AtomicAzzaz  <AtomicAzzaz@users.noreply.github.com>
Co-authored-by:  ewile <ewile@users.noreply.github.com>

* eth/catalyst: add locking around newpayload (ethereum#25816)

Sometimes we get stuck on db compaction, and the CL re-issues the "same" command to us multiple times. Each request get stuck on the same place, in the middle of the handler.

This changes makes it so we do not reprocess the same payload, but instead detects it early.

* eth/catalyst: make tests run faster (ethereum#25818)

* cmd/utils: make --authrpc.jwtsecret a DirectoryFlag (ethereum#25849)


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

* eth/protocols/snap: make log messages more clear that sync is ongoing (ethereum#25837)

* eth/protocols/snap: make log messages more clear that sync is ongoing

* Update sync.go

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

* .github: add CL client to issue template (ethereum#25814)

* p2p: add channel buffers to avoid goroutine leaks in tests (ethereum#24929)

* internal/version: use gitCommit injection in version handling code (ethereum#25851)

This changes the CI build to store the git commit and date into package
internal/version instead of package main. Doing this essentially merges our
two ways of tracking the go-ethereum version into a single place, achieving
two objectives:

- Bad block reports, which use version.Info(), will now have the git commit
  information even when geth is built in an environment such as
  launchpad.net where git access is unavailable.

- For geth builds created by `go build ./cmd/geth` (i.e. not using `go run
  build/ci.go install`), git information stored by the go tool is now used
  in the p2p node name as well as in `geth version` and `geth
  version-check`.

* cmd/abigen: change --exc to exclude by type name (ethereum#22620)

The abigen exclusion pattern, previously on the form "path:type", now supports wildcards. Examples "*:type" to exclude a named type in all files, or "/path/to/foo.sol:*" all types in foo.sol.

* tests, les, eth: remove mentions of deprecated Morden testnet (ethereum#23570)

* remove morden

* Update commons.go

* Update handler.go

* empty commit to make appveyor happy

* all: clean up the configs for pruner and snapshotter (ethereum#22396)

This PR cleans up the configurations for pruner and snapshotter by passing a config struct.

And also, this PR disables the snapshot background generation if the chain is opened in "read-only" mode. The read-only mode is necessary in some cases. For example, we have a list of commands to open the etheruem node in "read-only" mode, like export-chain. In these cases, the snapshot background generation is non expected and should be banned explicitly.

* cmd/puppeth, cmd/utils: finalize removal of gasTarget flag (ethereum#24370)

This PR fully removes the --miner.gastarget flag, as previously it was only hidden from the geth --help command, but could still be used.

* core/types: improve accuracy of header.Size() (ethereum#25859)

The header.Size() method did not take the basefee into account.

* eth/tracers: pad memory slice on OOB case (ethereum#25213)

* eth/tracers: pad memory slice on oob case

* eth/tracers/js: fix testfailure due to err msg capitalization

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

* cmd/faucet: fix readme typos (ethereum#25867)

* Fix: typos

Fix: typos

* Undo change

Undo change

* core: fix datarace in txpool, fixes ethereum#25870 and ethereum#25869  (ethereum#25872)

core: fix datarace in txpool pendingnoce, fixes ethereum#25870

* eth/downloader, les/downloader: fix subtle flaw in queue delivery (ethereum#25861)

* fix queue.deliver

* les/downloader: fix queue.deliver

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

* core/vm: better handle error on eip activation check (ethereum#25131)

* core/vm: correct logic for eip check of NewEVMInterpreter

* refactor

* cmd/geth: make dumpgenesis load genesis datadir if it exists (ethereum#25135)

`geth dumpgenesis` currently does not respect the content of the data directory. Instead, it outputs the genesis block created by command-line flags. This PR fixes it to read the genesis from the database, if the database already exists.


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

* tests: fix state test error checking (ethereum#25702)

Some tests define an 'expectException' error but the tests runner does not check for conditions where this test value is filled (error expected) but in which no error is returned by the test runner.

An example of this scenario is GeneralStateTests/stTransactionTest/HighGasPrice.json, which expects a 'TR_NoFunds' error, but the test runner does not return any error.

Signed-off-by: meows <b5c6@protonmail.com>

* eth/tracers: use gencodec for native tracers (ethereum#25637)

The call tracer and prestate tracer store data JSON-encoded in memory. In order to support alternative encodings (specifically RLP), it's better to keep data a native format during tracing. This PR does marshalling at the end, using gencodec.

OBS! 
This PR changes the call tracer result slightly:

-  Order of type and value fields are changed (should not matter). 
-  Output fields are completely omitted when they're empty (no more output: "0x"). Previously, this was only _sometimes_ omitted (e.g. when call ended in a non-revert error) and otherwise 0x when the output was actually empty.

* cmd, core, eth, les, light: track deleted nodes (ethereum#25757)

* cmd, core, eth, les, light: track deleted nodes

* trie: add docs

* trie: address comments

* cmd, core, eth, les, light, trie: trie id

* trie: add tests

* trie, core: updates

* trie: fix imports

* trie: add utility print-method for nodeset

* trie: import err

* trie: fix go vet warnings

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

* eth: return state error via GetEVM (ethereum#25876)

* make vmError more useful

* fix for review

* Update api.go

* revert calling site

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

* eth/downloader: make flakey test less flakey (ethereum#25879)

* ethclient/gethclient: fix bugs in override object encoding (ethereum#25616)

This fixes a bug where contract code would be overridden to empty code ("0x")
when the Code field of OverrideAccount was left nil. The change also cleans up
the encoding of overrides to only send necessary fields, and improves documentation.

Fixes ethereum#25615

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

* trie, eth/protocols/snap: less tiny db-writes during trie-healing (ethereum#25681)

This PR prevent making tiny writes during state healing, by only performing the batch-write if the accumulated data is large enough to be meaningful.

* accounts/abi/bind/backends: fix AdjustTime to respect Fork (ethereum#25225)

* tests: report mgas/s metric in evm benchmarks (ethereum#25700)

* test(state): report mgas/s metric in EVM benchmark

* revert testdata submodule update

* aggregate mgas/s results

* calculate elapsed time better

* tests: benchmarks - handle access list + take refund into account

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

* core/vm: minor trivial clean up (ethereum#25880)

* dropped `vm.keccakState` for `crypto.KeccakState`

* cleaned up `OpCode.IsPush()`

* eth/tracers: fix a bug in prestateTracer (ethereum#25884)

* internal/ethapi: handle odd length hex in decodeHash (ethereum#25883)

This change adds zero-padding (prefix) of odd nibbles in the decodeHash function. 

Co-authored-by: ty <ty@oncoder.com>

* core: rework tx indexer (ethereum#25723)

This PR reworks tx indexer a bit. Compared to the original version, one scenario is no longer handled - upgrading  from legacy geth without indexer support. 

The tx indexer was introduced in 2020 and have been present through hardforks, so it can be assumed that all Geth nodes have tx indexer already. So we can simplify the tx indexer logic a bit:

-    If the tail flag is not present, it means node is just initialized may or may not with an ancient store attached. In this case all blocks are regarded as unindexed
-   If the tail flag is present, it means blocks below tail are unindexed, blocks above tail are indexed

This change also address some weird cornercases that could make the indexer not work after a crash.

* accounts/abi: return toGoType error immediately (ethereum#25565)

* eth/tracers: remove revertReasonTracer, add revert reason to callTracer (ethereum#25508)

* eth/tracers: add revertReason to callTracer

* update callframe gen json

* add revertal to calltrace test

* accounts/abi/bind: parse ABI only once on bind (ethereum#25574)

* accounts/abi/bind: parse ABI once on bind

* accounts/abi/bind: suppress 'imported and not used' error for abi package

* internal/flags: fix issue with stringslice migration (ethereum#25830)

This fixes a cornercase bug where the flag migration would mess
up the value of StringSlice flags.

* cmd/geth, cmd/utils: geth attach with custom headers (ethereum#25829)

This PR makes it possible to set custom headers, in particular for two scenarios: 

- geth attach
- geth commands which can use --remotedb, e..g geth db inspect

The ability to use custom headers is typically useful for connecting to cloud-apis, e.g. providing an infura- or alchemy key, or for that matter access-keys for environments behind cloudflare.  

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

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

* fix duplicated test

* add back tests

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: meows <b5c6@protonmail.com>
Co-authored-by: Zachinquarantine <Zachinquarantine@protonmail.com>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: int88 <106391185+int88@users.noreply.github.com>
Co-authored-by: willian.eth <willian@ufpa.br>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
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: Seungbae.yu <72970043+dbadoy@users.noreply.github.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: スパイク <1311798+spkjp@users.noreply.github.com>
Co-authored-by: Brion <4777457+cifer76@users.noreply.github.com>
Co-authored-by: Marius Kjærstad <mkjaerstad@protonmail.com>
Co-authored-by: Philip Fan <fanwengang@hotmail.com>
Co-authored-by: Ikko Ashimine <eltociear@gmail.com>
Co-authored-by: Jens W <8270201+DragonDev1906@users.noreply.github.com>
Co-authored-by: Jens <jmw.1906@gmx.de>
Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
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: xinbenlv <zzn@zzn.im>
Co-authored-by: uji <49834542+uji@users.noreply.github.com>
Co-authored-by: Marius Kjærstad <sandakersmann@users.noreply.github.com>
Co-authored-by: Rachel Bousfield <nfranks@protonmail.com>
Co-authored-by: Jakub Freebit <49676311+jakub-freebit@users.noreply.github.com>
Co-authored-by: xternet <majewski.post@gmail.com>
Co-authored-by: protolambda <proto@protolambda.com>
Co-authored-by: Joshua Gutow <jgutow@optimism.io>
Co-authored-by: Amir Hossein <77993374+Kamandlou@users.noreply.github.com>
Co-authored-by: Nicholas <nicholas.zhaoyu@gmail.com>
Co-authored-by: Nicholas Zhao <nicholas.zhao@gmail.com>
Co-authored-by: Benjamin Prosnitz <bprosnitz@gmail.com>
Co-authored-by: Nicolas Gotchac <ngotchac@gmail.com>
Co-authored-by: pinkiebell <40266861+pinkiebell@users.noreply.github.com>
Co-authored-by: George Carder <georgercarder@gmail.com>
Co-authored-by: makcandrov <108467407+makcandrov@users.noreply.github.com>
Co-authored-by: AtomicAzzaz  <AtomicAzzaz@users.noreply.github.com>
Co-authored-by: ewile <ewile@users.noreply.github.com>
Co-authored-by: Boqin@MetaSecureLabs <Bobbqqin@gmail.com>
Co-authored-by: Sebastian Stammler <stammler.s@gmail.com>
Co-authored-by: omahs <73983677+omahs@users.noreply.github.com>
Co-authored-by: Leon <316032931@qq.com>
Co-authored-by: meowsbits <b5c6@protonmail.com>
Co-authored-by: Janko Simonovic <simonovic86@gmail.com>
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
Co-authored-by: TY <45994721+tylerK1294@users.noreply.github.com>
Co-authored-by: ty <ty@oncoder.com>
Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org>
Co-authored-by: Mikhail Vazhnov <michael.vazhnov@gmail.com>
Co-authored-by: susannapaxos <86749396+susannapaxos@users.noreply.github.com>
@holiman
Copy link
Contributor

holiman commented Oct 11, 2022 via email

roberto-bayardo added a commit to mdehoog/go-ethereum that referenced this issue Nov 4, 2022
* 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

* params: begin v1.10.24 release cycle

* params: begin go-ethereum v1.11 release cycle

* internal/ethapi: rename debug getters to match spec (ethereum#25176)

Some small fixes to get the existing debug methods to conform to the spec. Mainly dropping the encoding information from the method name as it should be deduced from the debug context and allowing the method to be invoked by either block number or block hash. It also adds the method debug_getTransaction which returns the raw tx bytes by tx hash. This is pretty much equivalent to the eth_getRawTransactionByHash method.

* accounts/abi/bind: add const for tx fee elasticity multiplier (ethereum#25504)


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

* all: remove duplicate word in comments (ethereum#25618)

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

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

* cmd/geth: fix legacy receipt detection for empty db (ethereum#25609)

* build: fix ignored errors (ethereum#25591)

* docs: specify execution client (ethereum#25566)


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

* ethclient: add 'finalized' and 'safe' block number support (ethereum#25580)

* node: change JWT error status to 401 Unauthorized (ethereum#25629)

* node: fix regression in TestJWT (ethereum#25635)

* all: move genesis initialization to blockchain (ethereum#25523)

* all: move genesis initialization to blockchain

* core: add one more check

* core: fix tests

* eth/catalyst: adjust eta for themerge (ethereum#25601)

* eth/catalyst: adjust eta for themerge

* squash

* squash

* eth/catalyst: address review concerns

* mobile: close node on error (ethereum#25643)

* graphql: return correct logs for tx (ethereum#25612)

* graphql: fix tx logs

* minor

* Use optimized search for selecting tx logs

* trie: fix grammar in comment (ethereum#25648)

* eth/protocols/snap: fix problems due to idle-but-busy peers

* trie: cleanup stateTrie (ethereum#25640)

It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly.

Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top.

Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing.

Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state.

The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR.

* eth/catalyst: prevent division by zero (ethereum#25654)

eth/catalyst: prevent diff by zero

* trie: better error reporting (ethereum#25645)

* core/state: filter out nil trie for copy (ethereum#25575)

* mobile: register filter APIs (ethereum#25642)

This fixes a regression introduced in PR ethereum#25459.

* README.md: improve grammar (ethereum#25646)


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

* eth/tracers/js: fill in log.refund field (ethereum#25661)

For some reason, an accessor method for this field exists in JS, but
the value was never actually assigned.

* eth/fetcher: throttle peers which deliver many invalid transactions (ethereum#25573)

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

* node, rpc: add JWT auth support in client (ethereum#24911)

This adds a generic mechanism for 'dial options' in the RPC client,
and also implements a specific dial option for the JWT authentication
mechanism used by the engine API. Some real tests for the server-side
authentication handling are also added.

Co-authored-by: Joshua Gutow <jgutow@optimism.io>
Co-authored-by: Felix Lange <fjl@twurst.com>

* rpc: check that "version" is "2.0" in request objects (ethereum#25570)

The JSON-RPC spec requires the "version" field to be exactly "2.0",
so we should verify that. This change is not backwards-compatible with
sloppy client implementations, but I decided to go ahead with it anyway
because the failure will be caught via the returned error.

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

* trie: fix unhandled error in test (ethereum#25628)

* eth/tracers/js: improve integer types in log object (ethereum#25668)

All fields related to gas must be represented as uint64. Depth is
internally tracked as int, so it makes sense to also store it as int.

* trie: check childrens' existence concurrently for snap heal

* core, light, trie: remove DiskDB function from trie database (ethereum#25690)

* params: update chts (ethereum#25707)

* core/vm: rename RANDOM to PREVRANDAO (ethereum#25691)

See: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4399.md

>  This EIP supplants the semantics of the return value of existing DIFFICULTY (0x44) opcode and renames the opcode to PREVRANDAO (0x44).

* all: cleanup tests (ethereum#25641)

Follow-up to PR ethereum#25523 to cleanup all relevant tests.

* eth, les: rework chain tracer (ethereum#25143)

This PR simplifies the logic of chain tracer and also adds the unit tests.

The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen.

And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state.


Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* eth/tracer: fix broken test (ethereum#25715)

* trie: update comments + err check for preimages (ethereum#25672)

This PR includes minor updates to comments in trie/committer that reference insertion to the db, and adds an err != nil check for the return value of preimages.commit.

* 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>

* p2p/msgrate: be more lenient when calculating 'mean' (ethereum#25653)

The p2p msgrate tracker is a thing which tries to estimate some mean round-trip times. However, it did so in a very curious way: if a node had 200 peers, it would sort their 200 respective rtt estimates, and then it would pick item number 2 as the mean. So effectively taking third fastest and calling it mean. This probably works "ok" when the number of peers are low (there are other factors too, such as ttlScaling which takes some of the edge off this) -- however when the number of peers is high, it becomes very skewed.

This PR instead bases the 'mean' on the square root of the length of the list. Still pretty harsh, but a bit more lenient.

* rpc: improve error codes for internal server errors (ethereum#25678)

This changes the error code returned by the RPC server in certain situations:

- handler panic: code -32603
- result marshaling error: code -32603
- attempt to subscribe via HTTP: code -32001

In all of the above cases, the server previously returned the default error
code -32000.

Co-authored-by: Nicholas Zhao <nicholas.zhao@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* core: place a cap on reorglogs (ethereum#25711)

This PR makes the event-sending for deleted and new logs happen in batches, to prevent OOM situation due to large reorgs. 

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

* build: upgrade to go 1.19 (ethereum#25726)

This changes the CI / release builds to use the latest Go version. It also
upgrades golangci-lint to a newer version compatible with Go 1.19.

In Go 1.19, godoc has gained official support for links and lists. The
syntax for code blocks in doc comments has changed and now requires a
leading tab character. gofmt adapts comments to the new syntax
automatically, so there are a lot of comment re-formatting changes in this
PR. We need to apply the new format in order to pass the CI lint stage with
Go 1.19.

With the linter upgrade, I have decided to disable 'gosec' - it produces
too many false-positive warnings. The 'deadcode' and 'varcheck' linters
have also been removed because golangci-lint warns about them being
unmaintained. 'unused' provides similar coverage and we already have it
enabled, so we don't lose much with this change.

* p2p/discover/v5wire: reject packets smaller than 63 bytes (ethereum#25740)

* core: preallocate maps in TxPool helper methods (ethereum#25737)

* accounts/abi: fix typo in error message (ethereum#25742)

* graphql: fixes missing tx logs (ethereum#25745)

* graphql: fix tx logs

* graphql: refactor test service setup

* graphql: add test for tx logs

* cmd/geth: add a verkle subcommand (ethereum#25718)

* cmd/geth: add a verkle subcommand

* fix copyright year

* remove unused command parameters

* check that the output file was successfully written to

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

* cmd/geth: goimports fix

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

* node: fix HTTP server always force closing (ethereum#25755)


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

* core: fix log order in "Imported new chain segment" (ethereum#25768)

* node: fix lint issue in rpcstack.go (ethereum#25774)

* les/catalyst/api: add support for ExchangeTransitionConfigurationV1 (ethereum#25752)

This method is missing in light client mode and breaks consensus clients
that require a valid response.

* 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>

* trie: handle more batch commit errors in Database (ethereum#25674)

* core/rawdb: fix leak of backoff timer (ethereum#25776)

* crypto/bls12381: docfix of g1 Affine (ethereum#25729)

bls12381: docfix of g1 Affine.

* internal/ethapi: return error when requesting invalid trie key (ethereum#25762)

This change makes eth_getProof and eth_getStorageAt return an error when
the argument contains invalid hex in storage keys.

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

* core: don't cache zero nonce in txNoncer (ethereum#25603)

This changes the nonce cache used by TxPool to not store cached
nonces for non-existing accounts.

* core: more compact bad block report (ethereum#25714)

This shortens the chain config summary in bad block reports,
and adds go-ethereum version information as well.

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

* core: move build version reading to its own package (ethereum#25806)

This fixes the build with Go 1.17, which does not have BuildInfo.Settings yet.

* eth: fix a rare datarace on CHT challenge reply / shutdown

* core/vm: return copy of input slice in identity precompile, avoid returndata copy (ethereum#25183)

* core/vm: return copy of input slice in identity precompile.  don't deep copy return data slice upon call completion

* make use of common.CopyBytes

* core/blockchain: downgrade tx indexing and unindexing logs  (ethereum#25832)

core/blockchain: downgrade tx indexing and unindexing logs from info to debug

If a user has a finite tx lookup limit, they will see an "unindexing" info level log each time a block is imported. This information might help a user understand that they are removing the index each block and some txs may not be retrievable by hash, but overall it is generally more of a nuisance than a benefit. This change downgrades the log to a debug log.

* eth/tracers: fix trace config for `TraceCall` (ethereum#25821)

Co-authored-by:  AtomicAzzaz  <AtomicAzzaz@users.noreply.github.com>
Co-authored-by:  ewile <ewile@users.noreply.github.com>

* eth/catalyst: add locking around newpayload (ethereum#25816)

Sometimes we get stuck on db compaction, and the CL re-issues the "same" command to us multiple times. Each request get stuck on the same place, in the middle of the handler.

This changes makes it so we do not reprocess the same payload, but instead detects it early.

* eth/catalyst: make tests run faster (ethereum#25818)

* cmd/utils: make --authrpc.jwtsecret a DirectoryFlag (ethereum#25849)


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

* eth/protocols/snap: make log messages more clear that sync is ongoing (ethereum#25837)

* eth/protocols/snap: make log messages more clear that sync is ongoing

* Update sync.go

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

* .github: add CL client to issue template (ethereum#25814)

* p2p: add channel buffers to avoid goroutine leaks in tests (ethereum#24929)

* internal/version: use gitCommit injection in version handling code (ethereum#25851)

This changes the CI build to store the git commit and date into package
internal/version instead of package main. Doing this essentially merges our
two ways of tracking the go-ethereum version into a single place, achieving
two objectives:

- Bad block reports, which use version.Info(), will now have the git commit
  information even when geth is built in an environment such as
  launchpad.net where git access is unavailable.

- For geth builds created by `go build ./cmd/geth` (i.e. not using `go run
  build/ci.go install`), git information stored by the go tool is now used
  in the p2p node name as well as in `geth version` and `geth
  version-check`.

* cmd/abigen: change --exc to exclude by type name (ethereum#22620)

The abigen exclusion pattern, previously on the form "path:type", now supports wildcards. Examples "*:type" to exclude a named type in all files, or "/path/to/foo.sol:*" all types in foo.sol.

* tests, les, eth: remove mentions of deprecated Morden testnet (ethereum#23570)

* remove morden

* Update commons.go

* Update handler.go

* empty commit to make appveyor happy

* all: clean up the configs for pruner and snapshotter (ethereum#22396)

This PR cleans up the configurations for pruner and snapshotter by passing a config struct.

And also, this PR disables the snapshot background generation if the chain is opened in "read-only" mode. The read-only mode is necessary in some cases. For example, we have a list of commands to open the etheruem node in "read-only" mode, like export-chain. In these cases, the snapshot background generation is non expected and should be banned explicitly.

* cmd/puppeth, cmd/utils: finalize removal of gasTarget flag (ethereum#24370)

This PR fully removes the --miner.gastarget flag, as previously it was only hidden from the geth --help command, but could still be used.

* core/types: improve accuracy of header.Size() (ethereum#25859)

The header.Size() method did not take the basefee into account.

* eth/tracers: pad memory slice on OOB case (ethereum#25213)

* eth/tracers: pad memory slice on oob case

* eth/tracers/js: fix testfailure due to err msg capitalization

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

* cmd/faucet: fix readme typos (ethereum#25867)

* Fix: typos

Fix: typos

* Undo change

Undo change

* core: fix datarace in txpool, fixes ethereum#25870 and ethereum#25869  (ethereum#25872)

core: fix datarace in txpool pendingnoce, fixes ethereum#25870

* eth/downloader, les/downloader: fix subtle flaw in queue delivery (ethereum#25861)

* fix queue.deliver

* les/downloader: fix queue.deliver

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

* core/vm: better handle error on eip activation check (ethereum#25131)

* core/vm: correct logic for eip check of NewEVMInterpreter

* refactor

* cmd/geth: make dumpgenesis load genesis datadir if it exists (ethereum#25135)

`geth dumpgenesis` currently does not respect the content of the data directory. Instead, it outputs the genesis block created by command-line flags. This PR fixes it to read the genesis from the database, if the database already exists.


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

* tests: fix state test error checking (ethereum#25702)

Some tests define an 'expectException' error but the tests runner does not check for conditions where this test value is filled (error expected) but in which no error is returned by the test runner.

An example of this scenario is GeneralStateTests/stTransactionTest/HighGasPrice.json, which expects a 'TR_NoFunds' error, but the test runner does not return any error.

Signed-off-by: meows <b5c6@protonmail.com>

* eth/tracers: use gencodec for native tracers (ethereum#25637)

The call tracer and prestate tracer store data JSON-encoded in memory. In order to support alternative encodings (specifically RLP), it's better to keep data a native format during tracing. This PR does marshalling at the end, using gencodec.

OBS! 
This PR changes the call tracer result slightly:

-  Order of type and value fields are changed (should not matter). 
-  Output fields are completely omitted when they're empty (no more output: "0x"). Previously, this was only _sometimes_ omitted (e.g. when call ended in a non-revert error) and otherwise 0x when the output was actually empty.

* cmd, core, eth, les, light: track deleted nodes (ethereum#25757)

* cmd, core, eth, les, light: track deleted nodes

* trie: add docs

* trie: address comments

* cmd, core, eth, les, light, trie: trie id

* trie: add tests

* trie, core: updates

* trie: fix imports

* trie: add utility print-method for nodeset

* trie: import err

* trie: fix go vet warnings

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

* eth: return state error via GetEVM (ethereum#25876)

* make vmError more useful

* fix for review

* Update api.go

* revert calling site

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

* eth/downloader: make flakey test less flakey (ethereum#25879)

* ethclient/gethclient: fix bugs in override object encoding (ethereum#25616)

This fixes a bug where contract code would be overridden to empty code ("0x")
when the Code field of OverrideAccount was left nil. The change also cleans up
the encoding of overrides to only send necessary fields, and improves documentation.

Fixes ethereum#25615

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

* trie, eth/protocols/snap: less tiny db-writes during trie-healing (ethereum#25681)

This PR prevent making tiny writes during state healing, by only performing the batch-write if the accumulated data is large enough to be meaningful.

* accounts/abi/bind/backends: fix AdjustTime to respect Fork (ethereum#25225)

* tests: report mgas/s metric in evm benchmarks (ethereum#25700)

* test(state): report mgas/s metric in EVM benchmark

* revert testdata submodule update

* aggregate mgas/s results

* calculate elapsed time better

* tests: benchmarks - handle access list + take refund into account

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

* core/vm: minor trivial clean up (ethereum#25880)

* dropped `vm.keccakState` for `crypto.KeccakState`

* cleaned up `OpCode.IsPush()`

* eth/tracers: fix a bug in prestateTracer (ethereum#25884)

* internal/ethapi: handle odd length hex in decodeHash (ethereum#25883)

This change adds zero-padding (prefix) of odd nibbles in the decodeHash function. 

Co-authored-by: ty <ty@oncoder.com>

* core: rework tx indexer (ethereum#25723)

This PR reworks tx indexer a bit. Compared to the original version, one scenario is no longer handled - upgrading  from legacy geth without indexer support. 

The tx indexer was introduced in 2020 and have been present through hardforks, so it can be assumed that all Geth nodes have tx indexer already. So we can simplify the tx indexer logic a bit:

-    If the tail flag is not present, it means node is just initialized may or may not with an ancient store attached. In this case all blocks are regarded as unindexed
-   If the tail flag is present, it means blocks below tail are unindexed, blocks above tail are indexed

This change also address some weird cornercases that could make the indexer not work after a crash.

* accounts/abi: return toGoType error immediately (ethereum#25565)

* eth/tracers: remove revertReasonTracer, add revert reason to callTracer (ethereum#25508)

* eth/tracers: add revertReason to callTracer

* update callframe gen json

* add revertal to calltrace test

* accounts/abi/bind: parse ABI only once on bind (ethereum#25574)

* accounts/abi/bind: parse ABI once on bind

* accounts/abi/bind: suppress 'imported and not used' error for abi package

* internal/flags: fix issue with stringslice migration (ethereum#25830)

This fixes a cornercase bug where the flag migration would mess
up the value of StringSlice flags.

* cmd/geth, cmd/utils: geth attach with custom headers (ethereum#25829)

This PR makes it possible to set custom headers, in particular for two scenarios: 

- geth attach
- geth commands which can use --remotedb, e..g geth db inspect

The ability to use custom headers is typically useful for connecting to cloud-apis, e.g. providing an infura- or alchemy key, or for that matter access-keys for environments behind cloudflare.  

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

* core/types: add a testcase to TestLegacyReceiptDecoding (ethereum#25909)

add a testcase to TestLegacyReceiptDecoding

* eth/protocols/snap: serve snap requests when possible (ethereum#25644)

This PR makes it so that the snap server responds to trie heal requests when possible, even if the snapshot does not exist. The idea being that it might prolong the lifetime of a state root, so we don't have to pivot quite as often.

* eth, miner: add timeout for building sealing block (ethereum#25407)

* eth, miner: add timeout for building sealing block

* eth, cmd, miner: add newpayloadtimeout flag

* eth, miner, cmd: address comments

* eth, miner: minor fixes

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

* all: fix docstrings

* core: fix linter complaint (ethereum#25927)

* eth/tracers: add diffMode to prestateTracer (ethereum#25422)

Backwards compatibility warning: The result will from now on omit empty fields instead
of including a zero value (e.g. no more `balance: '0x'`).

The prestateTracer will now take an option `diffMode: bool`. In this mode
the tracer will output the pre state and post data for the modified parts of state.
Read-only accesses will be completely omitted. Creations (be it account or slot)
will be signified by omission in the `pre` list and inclusion in `post`. Whereas
deletion (be it account or slot) will be signified by inclusion in `pre` and omission
in `post` list.

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

* eth/traces: add state limit (ethereum#25812)

This PR introduces a new mechanism in chain tracer for preventing creating too many trace states.

The workflow of chain tracer can be divided into several parts:

- state creator generates trace state in a thread
- state tracer retrieves the trace state and applies the tracing on top in another thread
- state collector gathers all result from state tracer and stream to users

It's basically a producer-consumer model here, while if we imagine that the state producer generates states too fast, then it will lead to accumulate lots of unused states in memory. Even worse, in path-based state scheme it will only keep the latest 128 states in memory, and the newly generated state will invalidate the oldest one by marking it as stale.

The solution for fixing it is to limit the speed of state generation. If there are over 128 states un-consumed in memory, then the creation will be paused until the states are be consumed properly.

* core/bloombits: speed up windows-test (ethereum#25844)

core/bloombits: remove micro-sleep

* core, ethclient/gethclient: improve flaky tests (ethereum#25918)

* ethclient/gethclient: improve time-sensitive flaky test

* eth/catalyst: fix (?) flaky test

* core: stop blockchains in tests after use

* core: fix dangling blockchain instances

* core: rm whitespace

* eth/gasprice, eth/tracers, consensus/clique: stop dangling blockchains in tests

* all: address review concerns

* core: goimports

* eth/catalyst: fix another time-sensitive test

* consensus/clique: add snapshot test run function

* core: rename stop() to stopWithoutSaving()

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

* node: prevent exposing engine API on unauthenticated endpoint (ethereum#25939)

* node: prevent exposing engine API on unauthenticated endpoint

* node: improve RPC setup

* eth/filters: fix for eth_getLogs failing with finalized- and safe tag  (ethereum#25922)

Prior to this change, f.begin (and possibly end) stay negative, leading to strange results later in the code. With this change, filters using "safe" and "finalized" block produce results consistent w/ the overall behavior of this RPC method.

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

* cmd/geth: fix help output issues (ethereum#25941)

This update resolves an issue where StringSliceFlag would not be
rendered correctly in help output + mention that -H can be used multiple times

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

* accounts/usbwallet: support Ledger Nano S Plus and FTS (ethereum#25933)

* usbwallet support Ledger Nano S Plus

* accounts/usbwallet: add definitions + ref to ledger docs

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

* all: fix spelling mistakes (ethereum#25961)

* cmd/geth, core: fix typo in comment (ethereum#25954)

* fix typo on comment

* typo "can't accept"

* core/rawdb: provide more info on 'gap in the chain' error (ethereum#25938)

* core/types: add more context around ErrInvalidChainID (ethereum#25367)

This changes the error message for mismatching chain ID to show
the given and expected value. Callers expecting this error must be
changed to use errors.Is.

* common/math: optimized modexp (+ fuzzer) (ethereum#25525)

This adds a 
* core/vm, tests: optimized modexp + fuzzer

* common/math: modexp optimizations

* core/vm: special case base 1 in big modexp

* core/vm: disable fastexp

* tests/fuzzers/modexp: gofmt (ethereum#25972)

* node: drop support for static & trusted node list files (ethereum#25610)

This changes the node setup to ignore datadir files

    static-nodes.json
    trusted-nodes.json

When these files are present, it an error will be printed to the log.

* accounts/keystore: faster tests (ethereum#25827)

This PR removes some optimistic tests -- a'la "do something,
wait a while, and hope it has trickled through and continue" -- and
instead uses some introspection to ensure that prerequisites are met.

* eth/protocols/eth: fix typo in log message (ethereum#25969)

* eth/filters, ethclient/gethclient: add fullTx option to pending tx filter (ethereum#25186)

This PR adds a way to subscribe to the _full_ pending transactions, as opposed to just being notified about hashes. 

In use cases where client subscribes to newPendingTransactions and gets txhashes only to then request the actual transaction, the caller can now shortcut that flow and obtain the transactions directly. 


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

* go.mod: upgrade github.com/dop251/goja (ethereum#25955)

This upgrade pulls in a fix to handling of 'continue' in loops.

* eth/tracers: fix the issue of panic in prestate with diffmode (ethereum#25957)

In some cases, inner contract creation may not be successful, and an inner contract was not created. This PR fixes a crash that could occur when doing tracing in such situations.

* Revert "go.mod: upgrade github.com/dop251/goja" (ethereum#25975)

Revert "go.mod: upgrade github.com/dop251/goja (ethereum#25955)"

This reverts commit 9207e34.

* common/math, tests/fuzzers: use big.Int clone (ethereum#26006)

* common/math, tests/fuzzers: use big.Int clone

* common/math: license

* cmd/utils: enable snapshot generation in import-mode (ethereum#25990)

This PR fixes a regression causing snapshots not to be generated in "geth --import" mode.  It also fixes the geth export command to be truly readonly, and adds a new test for geth export.

* core/rawdb: refactor db key prefix (ethereum#26000)

Co-authored-by: seven <seven@nodereal.io>

* core/rawdb: open meta file in read only mode (ethereum#26009)

* internal/ethapi, accounts/abi/backends: use error defined in core (ethereum#26012)

Co-authored-by: seven <seven@nodereal.io>

* eth/tracers: fix the issue prestate missing existing contract state (ethereum#25996)

The prestate tracer did not report accounts that existed at a given address prior to a contract being created at that address.

Signed-off-by: Delweng <delweng@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* eth/tracers: simplify test framework (ethereum#25973)

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

* all: refactor txpool into it's own package in prep for 4844

* core/types: rename tx files to group them better together

* core, eth: for types with accurate size calcs, return uint64, not float (ethereum#26046)

* core, eth: for types with accurate size calcs, return uint64, not float

* core/types: proper tx size tests

* core/types: extend tx size test with decoded sizes, fix error

* core/txpool: fix linter

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

* build: upgrade -dlgo version to Go 1.19.2

* accounts/scwallet: fix keycard data signing error (ethereum#25331)

accounts/scwallet: fix keycard data signing

* build: make ios work again (ethereum#26052)

* core/vm: use optimized bigint (ethereum#26021)

* 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

* core/rawdb: refactor db inspector for extending multiple ancient store (ethereum#25896)

This PR ports a few changes from PBSS:

- Fix the snapshot generator waiter in case the generation is not even initialized
- Refactor db inspector for ancient store

* cmd/evm: calc base fee if parent data is present (ethereum#26051)

Currently, in order to chain together sequential valid t8n transitions the caller must manually calculate the block base fee. This PR adds support for the necessary parent fee market data to calculate the base fee for the current transition.

Concretely, env is extended to accept the following:

    parentBaseFee
    parentGasUsed
    parentGasLimit

Example usage can be found in ./cmd/evm/testdata/25.

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

* eth/tracers: fix gasUsed for native and JS tracers (ethereum#26048)

* eth/tracers: fix gasUsed in call tracer

* fix js tracers gasUsed

* fix legacy prestate tracer

* fix restGas in test

* drop intrinsicGas field from js tracers

* cmd, eth: implement full-sync tester (ethereum#26035)

This PR adds a parameter to startup, --synctarget. The synctarget flag is a developer-flag, that can be useful in some scenarios as a replacement for a CL node. It defines a fixed block sync target:

geth --syncmode=full --synctarget=./block_15816882.hex_rlp 

The --synctarget is only made available during syncmode=full

* rpc: update docstring (ethereum#26072)

Co-authored-by: seven <seven@nodereal.io>

* Fix trace call for inner reverts (ethereum#25971)

Inner call reverts will now return the reason similar to the top-level call. Separately, if top-level call is of type CREATE and it fails, its `to` field will now be cleared to `0x00...00` instead of being set to the created address.

* eth: implement eth/68 (ethereum#25980)

* eth: implement eth/68

* eth/protocols/eth: added tx size to announcement

* eth/protocols/eth: check equal lengths on receiving announcement

* eth/protocols/eth: add +1 to tx size because of the type byte

* eth: happy lint, add eth68 tests, enable eth68

* eth: various nitpick fixes on eth/68

* eth/protocols/eth: fix announced tx size wrt type byte

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* eth/tracers: add withLog to callTracer (ethereum#25991)

In some cases, it is desirable to capture what is triggered by each trace, when using the `callTracer`. For example: call `USDT.transfer` will trigger a `Transfer(from, to, value)` event.

This PR adds the option to capture logs to the call tracer, by specifying `{"withLog": true}` in the tracerconfig. 
Any logs belonging to failed/reverted call-scopes are removed from the output, to prevent interpretation mistakes.

Signed-off-by: Delweng <delweng@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* eth/tracers: prestateTracer - exclude unchanged storage slots in diffMode (ethereum#25944)

Fixes ethereum#25943

* accounts/abi: return error on fixed bytes with size larger than 32 bytes (ethereum#26075)

* fixed bytes with size larger than 32 bytes is not allowed

* add testcase

* consensus/ethash: fix typo (ethereum#26016)

fix typo

* docs/postmortems: remove wrong parentheses (ethereum#26066)

Removed parentheses in line 71 because line 80 doesn't have them either.

* miner, eth: implement recommit mechanism for payload building (ethereum#25836)

* miner, eth: implement recommit for payload building

* miner: address comments from marius

* miner: fail early if core.NewBlockChain fails (ethereum#26079)

don't ignore errors returned by core.NewBlockChain when initializing tests

* p2p/discover: fix handling of distance 256 in lookupDistances (ethereum#26087)

Noticed that lookupDistances for FINDNODE requests didn't consider 256 a valid
distance. This is actually part of the example in the comment above the
function, surprised that wasn't tested before.

* rlp: add more tests for nil pointer / optional field encoding (ethereum#26077)

* rpc: handle wrong HTTP batch response length (ethereum#26064)

* cmd/clef: add `list-accounts` and `list-wallets` to CLI (ethereum#26080)

This commit adds support for two new commands to clef, making it possible to list accounts / wallets from the command-line-interface. 

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

* merge devnet-v3 with latest master, part 1

* crypto/bls12381: docs - fix broken links to references (ethereum#26095)

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: meows <b5c6@protonmail.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: zhiqiangxu <652732310@qq.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: xinbenlv <zzn@zzn.im>
Co-authored-by: Abirdcfly <fp544037857@gmail.com>
Co-authored-by: uji <49834542+uji@users.noreply.github.com>
Co-authored-by: Marius Kjærstad <sandakersmann@users.noreply.github.com>
Co-authored-by: Rachel Bousfield <nfranks@protonmail.com>
Co-authored-by: Seungbae Yu <dbadoy4874@gmail.com>
Co-authored-by: Jakub Freebit <49676311+jakub-freebit@users.noreply.github.com>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: xternet <majewski.post@gmail.com>
Co-authored-by: protolambda <proto@protolambda.com>
Co-authored-by: Joshua Gutow <jgutow@optimism.io>
Co-authored-by: Amir Hossein <77993374+Kamandlou@users.noreply.github.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: Nicholas <nicholas.zhaoyu@gmail.com>
Co-authored-by: Nicholas Zhao <nicholas.zhao@gmail.com>
Co-authored-by: Benjamin Prosnitz <bprosnitz@gmail.com>
Co-authored-by: Nicolas Gotchac <ngotchac@gmail.com>
Co-authored-by: pinkiebell <40266861+pinkiebell@users.noreply.github.com>
Co-authored-by: George Carder <georgercarder@gmail.com>
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: makcandrov <108467407+makcandrov@users.noreply.github.com>
Co-authored-by: AtomicAzzaz  <AtomicAzzaz@users.noreply.github.com>
Co-authored-by: ewile <ewile@users.noreply.github.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Boqin@MetaSecureLabs <Bobbqqin@gmail.com>
Co-authored-by: Sebastian Stammler <stammler.s@gmail.com>
Co-authored-by: Zachinquarantine <Zachinquarantine@protonmail.com>
Co-authored-by: omahs <73983677+omahs@users.noreply.github.com>
Co-authored-by: Leon <316032931@qq.com>
Co-authored-by: meowsbits <b5c6@protonmail.com>
Co-authored-by: Janko Simonovic <simonovic86@gmail.com>
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
Co-authored-by: TY <45994721+tylerK1294@users.noreply.github.com>
Co-authored-by: ty <ty@oncoder.com>
Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org>
Co-authored-by: Mikhail Vazhnov <michael.vazhnov@gmail.com>
Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
Co-authored-by: jin <35813306+lochjin@users.noreply.github.com>
Co-authored-by: Paul <41552663+molecula451@users.noreply.github.com>
Co-authored-by: Jens W <8270201+DragonDev1906@users.noreply.github.com>
Co-authored-by: s7v7nislands <s7v7nislands@gmail.com>
Co-authored-by: seven <seven@nodereal.io>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: Marius Kjærstad <mkjaerstad@protonmail.com>
Co-authored-by: vdwijden <115323661+vdwijden@users.noreply.github.com>
Co-authored-by: Sebastian Supreme <106926150+SebastianSupreme@users.noreply.github.com>
Co-authored-by: Jordan Krage <jmank88@gmail.com>
Co-authored-by: Joseph Cook <33655003+jmcook1186@users.noreply.github.com>
roberto-bayardo added a commit to mdehoog/go-ethereum that referenced this issue Nov 16, 2022
* merge devnet-v3 with latest master (#43)

* 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

* params: begin v1.10.24 release cycle

* params: begin go-ethereum v1.11 release cycle

* internal/ethapi: rename debug getters to match spec (ethereum#25176)

Some small fixes to get the existing debug methods to conform to the spec. Mainly dropping the encoding information from the method name as it should be deduced from the debug context and allowing the method to be invoked by either block number or block hash. It also adds the method debug_getTransaction which returns the raw tx bytes by tx hash. This is pretty much equivalent to the eth_getRawTransactionByHash method.

* accounts/abi/bind: add const for tx fee elasticity multiplier (ethereum#25504)


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

* all: remove duplicate word in comments (ethereum#25618)

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

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

* cmd/geth: fix legacy receipt detection for empty db (ethereum#25609)

* build: fix ignored errors (ethereum#25591)

* docs: specify execution client (ethereum#25566)


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

* ethclient: add 'finalized' and 'safe' block number support (ethereum#25580)

* node: change JWT error status to 401 Unauthorized (ethereum#25629)

* node: fix regression in TestJWT (ethereum#25635)

* all: move genesis initialization to blockchain (ethereum#25523)

* all: move genesis initialization to blockchain

* core: add one more check

* core: fix tests

* eth/catalyst: adjust eta for themerge (ethereum#25601)

* eth/catalyst: adjust eta for themerge

* squash

* squash

* eth/catalyst: address review concerns

* mobile: close node on error (ethereum#25643)

* graphql: return correct logs for tx (ethereum#25612)

* graphql: fix tx logs

* minor

* Use optimized search for selecting tx logs

* trie: fix grammar in comment (ethereum#25648)

* eth/protocols/snap: fix problems due to idle-but-busy peers

* trie: cleanup stateTrie (ethereum#25640)

It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly.

Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top.

Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing.

Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state.

The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR.

* eth/catalyst: prevent division by zero (ethereum#25654)

eth/catalyst: prevent diff by zero

* trie: better error reporting (ethereum#25645)

* core/state: filter out nil trie for copy (ethereum#25575)

* mobile: register filter APIs (ethereum#25642)

This fixes a regression introduced in PR ethereum#25459.

* README.md: improve grammar (ethereum#25646)


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

* eth/tracers/js: fill in log.refund field (ethereum#25661)

For some reason, an accessor method for this field exists in JS, but
the value was never actually assigned.

* eth/fetcher: throttle peers which deliver many invalid transactions (ethereum#25573)

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

* node, rpc: add JWT auth support in client (ethereum#24911)

This adds a generic mechanism for 'dial options' in the RPC client,
and also implements a specific dial option for the JWT authentication
mechanism used by the engine API. Some real tests for the server-side
authentication handling are also added.

Co-authored-by: Joshua Gutow <jgutow@optimism.io>
Co-authored-by: Felix Lange <fjl@twurst.com>

* rpc: check that "version" is "2.0" in request objects (ethereum#25570)

The JSON-RPC spec requires the "version" field to be exactly "2.0",
so we should verify that. This change is not backwards-compatible with
sloppy client implementations, but I decided to go ahead with it anyway
because the failure will be caught via the returned error.

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

* trie: fix unhandled error in test (ethereum#25628)

* eth/tracers/js: improve integer types in log object (ethereum#25668)

All fields related to gas must be represented as uint64. Depth is
internally tracked as int, so it makes sense to also store it as int.

* trie: check childrens' existence concurrently for snap heal

* core, light, trie: remove DiskDB function from trie database (ethereum#25690)

* params: update chts (ethereum#25707)

* core/vm: rename RANDOM to PREVRANDAO (ethereum#25691)

See: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4399.md

>  This EIP supplants the semantics of the return value of existing DIFFICULTY (0x44) opcode and renames the opcode to PREVRANDAO (0x44).

* all: cleanup tests (ethereum#25641)

Follow-up to PR ethereum#25523 to cleanup all relevant tests.

* eth, les: rework chain tracer (ethereum#25143)

This PR simplifies the logic of chain tracer and also adds the unit tests.

The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen.

And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state.


Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* eth/tracer: fix broken test (ethereum#25715)

* trie: update comments + err check for preimages (ethereum#25672)

This PR includes minor updates to comments in trie/committer that reference insertion to the db, and adds an err != nil check for the return value of preimages.commit.

* 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>

* p2p/msgrate: be more lenient when calculating 'mean' (ethereum#25653)

The p2p msgrate tracker is a thing which tries to estimate some mean round-trip times. However, it did so in a very curious way: if a node had 200 peers, it would sort their 200 respective rtt estimates, and then it would pick item number 2 as the mean. So effectively taking third fastest and calling it mean. This probably works "ok" when the number of peers are low (there are other factors too, such as ttlScaling which takes some of the edge off this) -- however when the number of peers is high, it becomes very skewed.

This PR instead bases the 'mean' on the square root of the length of the list. Still pretty harsh, but a bit more lenient.

* rpc: improve error codes for internal server errors (ethereum#25678)

This changes the error code returned by the RPC server in certain situations:

- handler panic: code -32603
- result marshaling error: code -32603
- attempt to subscribe via HTTP: code -32001

In all of the above cases, the server previously returned the default error
code -32000.

Co-authored-by: Nicholas Zhao <nicholas.zhao@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>

* core: place a cap on reorglogs (ethereum#25711)

This PR makes the event-sending for deleted and new logs happen in batches, to prevent OOM situation due to large reorgs. 

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

* build: upgrade to go 1.19 (ethereum#25726)

This changes the CI / release builds to use the latest Go version. It also
upgrades golangci-lint to a newer version compatible with Go 1.19.

In Go 1.19, godoc has gained official support for links and lists. The
syntax for code blocks in doc comments has changed and now requires a
leading tab character. gofmt adapts comments to the new syntax
automatically, so there are a lot of comment re-formatting changes in this
PR. We need to apply the new format in order to pass the CI lint stage with
Go 1.19.

With the linter upgrade, I have decided to disable 'gosec' - it produces
too many false-positive warnings. The 'deadcode' and 'varcheck' linters
have also been removed because golangci-lint warns about them being
unmaintained. 'unused' provides similar coverage and we already have it
enabled, so we don't lose much with this change.

* p2p/discover/v5wire: reject packets smaller than 63 bytes (ethereum#25740)

* core: preallocate maps in TxPool helper methods (ethereum#25737)

* accounts/abi: fix typo in error message (ethereum#25742)

* graphql: fixes missing tx logs (ethereum#25745)

* graphql: fix tx logs

* graphql: refactor test service setup

* graphql: add test for tx logs

* cmd/geth: add a verkle subcommand (ethereum#25718)

* cmd/geth: add a verkle subcommand

* fix copyright year

* remove unused command parameters

* check that the output file was successfully written to

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

* cmd/geth: goimports fix

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

* node: fix HTTP server always force closing (ethereum#25755)


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

* core: fix log order in "Imported new chain segment" (ethereum#25768)

* node: fix lint issue in rpcstack.go (ethereum#25774)

* les/catalyst/api: add support for ExchangeTransitionConfigurationV1 (ethereum#25752)

This method is missing in light client mode and breaks consensus clients
that require a valid response.

* 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>

* trie: handle more batch commit errors in Database (ethereum#25674)

* core/rawdb: fix leak of backoff timer (ethereum#25776)

* crypto/bls12381: docfix of g1 Affine (ethereum#25729)

bls12381: docfix of g1 Affine.

* internal/ethapi: return error when requesting invalid trie key (ethereum#25762)

This change makes eth_getProof and eth_getStorageAt return an error when
the argument contains invalid hex in storage keys.

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

* core: don't cache zero nonce in txNoncer (ethereum#25603)

This changes the nonce cache used by TxPool to not store cached
nonces for non-existing accounts.

* core: more compact bad block report (ethereum#25714)

This shortens the chain config summary in bad block reports,
and adds go-ethereum version information as well.

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

* core: move build version reading to its own package (ethereum#25806)

This fixes the build with Go 1.17, which does not have BuildInfo.Settings yet.

* eth: fix a rare datarace on CHT challenge reply / shutdown

* core/vm: return copy of input slice in identity precompile, avoid returndata copy (ethereum#25183)

* core/vm: return copy of input slice in identity precompile.  don't deep copy return data slice upon call completion

* make use of common.CopyBytes

* core/blockchain: downgrade tx indexing and unindexing logs  (ethereum#25832)

core/blockchain: downgrade tx indexing and unindexing logs from info to debug

If a user has a finite tx lookup limit, they will see an "unindexing" info level log each time a block is imported. This information might help a user understand that they are removing the index each block and some txs may not be retrievable by hash, but overall it is generally more of a nuisance than a benefit. This change downgrades the log to a debug log.

* eth/tracers: fix trace config for `TraceCall` (ethereum#25821)

Co-authored-by:  AtomicAzzaz  <AtomicAzzaz@users.noreply.github.com>
Co-authored-by:  ewile <ewile@users.noreply.github.com>

* eth/catalyst: add locking around newpayload (ethereum#25816)

Sometimes we get stuck on db compaction, and the CL re-issues the "same" command to us multiple times. Each request get stuck on the same place, in the middle of the handler.

This changes makes it so we do not reprocess the same payload, but instead detects it early.

* eth/catalyst: make tests run faster (ethereum#25818)

* cmd/utils: make --authrpc.jwtsecret a DirectoryFlag (ethereum#25849)


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

* eth/protocols/snap: make log messages more clear that sync is ongoing (ethereum#25837)

* eth/protocols/snap: make log messages more clear that sync is ongoing

* Update sync.go

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

* .github: add CL client to issue template (ethereum#25814)

* p2p: add channel buffers to avoid goroutine leaks in tests (ethereum#24929)

* internal/version: use gitCommit injection in version handling code (ethereum#25851)

This changes the CI build to store the git commit and date into package
internal/version instead of package main. Doing this essentially merges our
two ways of tracking the go-ethereum version into a single place, achieving
two objectives:

- Bad block reports, which use version.Info(), will now have the git commit
  information even when geth is built in an environment such as
  launchpad.net where git access is unavailable.

- For geth builds created by `go build ./cmd/geth` (i.e. not using `go run
  build/ci.go install`), git information stored by the go tool is now used
  in the p2p node name as well as in `geth version` and `geth
  version-check`.

* cmd/abigen: change --exc to exclude by type name (ethereum#22620)

The abigen exclusion pattern, previously on the form "path:type", now supports wildcards. Examples "*:type" to exclude a named type in all files, or "/path/to/foo.sol:*" all types in foo.sol.

* tests, les, eth: remove mentions of deprecated Morden testnet (ethereum#23570)

* remove morden

* Update commons.go

* Update handler.go

* empty commit to make appveyor happy

* all: clean up the configs for pruner and snapshotter (ethereum#22396)

This PR cleans up the configurations for pruner and snapshotter by passing a config struct.

And also, this PR disables the snapshot background generation if the chain is opened in "read-only" mode. The read-only mode is necessary in some cases. For example, we have a list of commands to open the etheruem node in "read-only" mode, like export-chain. In these cases, the snapshot background generation is non expected and should be banned explicitly.

* cmd/puppeth, cmd/utils: finalize removal of gasTarget flag (ethereum#24370)

This PR fully removes the --miner.gastarget flag, as previously it was only hidden from the geth --help command, but could still be used.

* core/types: improve accuracy of header.Size() (ethereum#25859)

The header.Size() method did not take the basefee into account.

* eth/tracers: pad memory slice on OOB case (ethereum#25213)

* eth/tracers: pad memory slice on oob case

* eth/tracers/js: fix testfailure due to err msg capitalization

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

* cmd/faucet: fix readme typos (ethereum#25867)

* Fix: typos

Fix: typos

* Undo change

Undo change

* core: fix datarace in txpool, fixes ethereum#25870 and ethereum#25869  (ethereum#25872)

core: fix datarace in txpool pendingnoce, fixes ethereum#25870

* eth/downloader, les/downloader: fix subtle flaw in queue delivery (ethereum#25861)

* fix queue.deliver

* les/downloader: fix queue.deliver

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

* core/vm: better handle error on eip activation check (ethereum#25131)

* core/vm: correct logic for eip check of NewEVMInterpreter

* refactor

* cmd/geth: make dumpgenesis load genesis datadir if it exists (ethereum#25135)

`geth dumpgenesis` currently does not respect the content of the data directory. Instead, it outputs the genesis block created by command-line flags. This PR fixes it to read the genesis from the database, if the database already exists.


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

* tests: fix state test error checking (ethereum#25702)

Some tests define an 'expectException' error but the tests runner does not check for conditions where this test value is filled (error expected) but in which no error is returned by the test runner.

An example of this scenario is GeneralStateTests/stTransactionTest/HighGasPrice.json, which expects a 'TR_NoFunds' error, but the test runner does not return any error.

Signed-off-by: meows <b5c6@protonmail.com>

* eth/tracers: use gencodec for native tracers (ethereum#25637)

The call tracer and prestate tracer store data JSON-encoded in memory. In order to support alternative encodings (specifically RLP), it's better to keep data a native format during tracing. This PR does marshalling at the end, using gencodec.

OBS! 
This PR changes the call tracer result slightly:

-  Order of type and value fields are changed (should not matter). 
-  Output fields are completely omitted when they're empty (no more output: "0x"). Previously, this was only _sometimes_ omitted (e.g. when call ended in a non-revert error) and otherwise 0x when the output was actually empty.

* cmd, core, eth, les, light: track deleted nodes (ethereum#25757)

* cmd, core, eth, les, light: track deleted nodes

* trie: add docs

* trie: address comments

* cmd, core, eth, les, light, trie: trie id

* trie: add tests

* trie, core: updates

* trie: fix imports

* trie: add utility print-method for nodeset

* trie: import err

* trie: fix go vet warnings

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

* eth: return state error via GetEVM (ethereum#25876)

* make vmError more useful

* fix for review

* Update api.go

* revert calling site

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

* eth/downloader: make flakey test less flakey (ethereum#25879)

* ethclient/gethclient: fix bugs in override object encoding (ethereum#25616)

This fixes a bug where contract code would be overridden to empty code ("0x")
when the Code field of OverrideAccount was left nil. The change also cleans up
the encoding of overrides to only send necessary fields, and improves documentation.

Fixes ethereum#25615

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

* trie, eth/protocols/snap: less tiny db-writes during trie-healing (ethereum#25681)

This PR prevent making tiny writes during state healing, by only performing the batch-write if the accumulated data is large enough to be meaningful.

* accounts/abi/bind/backends: fix AdjustTime to respect Fork (ethereum#25225)

* tests: report mgas/s metric in evm benchmarks (ethereum#25700)

* test(state): report mgas/s metric in EVM benchmark

* revert testdata submodule update

* aggregate mgas/s results

* calculate elapsed time better

* tests: benchmarks - handle access list + take refund into account

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

* core/vm: minor trivial clean up (ethereum#25880)

* dropped `vm.keccakState` for `crypto.KeccakState`

* cleaned up `OpCode.IsPush()`

* eth/tracers: fix a bug in prestateTracer (ethereum#25884)

* internal/ethapi: handle odd length hex in decodeHash (ethereum#25883)

This change adds zero-padding (prefix) of odd nibbles in the decodeHash function. 

Co-authored-by: ty <ty@oncoder.com>

* core: rework tx indexer (ethereum#25723)

This PR reworks tx indexer a bit. Compared to the original version, one scenario is no longer handled - upgrading  from legacy geth without indexer support. 

The tx indexer was introduced in 2020 and have been present through hardforks, so it can be assumed that all Geth nodes have tx indexer already. So we can simplify the tx indexer logic a bit:

-    If the tail flag is not present, it means node is just initialized may or may not with an ancient store attached. In this case all blocks are regarded as unindexed
-   If the tail flag is present, it means blocks below tail are unindexed, blocks above tail are indexed

This change also address some weird cornercases that could make the indexer not work after a crash.

* accounts/abi: return toGoType error immediately (ethereum#25565)

* eth/tracers: remove revertReasonTracer, add revert reason to callTracer (ethereum#25508)

* eth/tracers: add revertReason to callTracer

* update callframe gen json

* add revertal to calltrace test

* accounts/abi/bind: parse ABI only once on bind (ethereum#25574)

* accounts/abi/bind: parse ABI once on bind

* accounts/abi/bind: suppress 'imported and not used' error for abi package

* internal/flags: fix issue with stringslice migration (ethereum#25830)

This fixes a cornercase bug where the flag migration would mess
up the value of StringSlice flags.

* cmd/geth, cmd/utils: geth attach with custom headers (ethereum#25829)

This PR makes it possible to set custom headers, in particular for two scenarios: 

- geth attach
- geth commands which can use --remotedb, e..g geth db inspect

The ability to use custom headers is typically useful for connecting to cloud-apis, e.g. providing an infura- or alchemy key, or for that matter access-keys for environments behind cloudflare.  

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

* core/types: add a testcase to TestLegacyReceiptDecoding (ethereum#25909)

add a testcase to TestLegacyReceiptDecoding

* eth/protocols/snap: serve snap requests when possible (ethereum#25644)

This PR makes it so that the snap server responds to trie heal requests when possible, even if the snapshot does not exist. The idea being that it might prolong the lifetime of a state root, so we don't have to pivot quite as often.

* eth, miner: add timeout for building sealing block (ethereum#25407)

* eth, miner: add timeout for building sealing block

* eth, cmd, miner: add newpayloadtimeout flag

* eth, miner, cmd: address comments

* eth, miner: minor fixes

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

* all: fix docstrings

* core: fix linter complaint (ethereum#25927)

* eth/tracers: add diffMode to prestateTracer (ethereum#25422)

Backwards compatibility warning: The result will from now on omit empty fields instead
of including a zero value (e.g. no more `balance: '0x'`).

The prestateTracer will now take an option `diffMode: bool`. In this mode
the tracer will output the pre state and post data for the modified parts of state.
Read-only accesses will be completely omitted. Creations (be it account or slot)
will be signified by omission in the `pre` list and inclusion in `post`. Whereas
deletion (be it account or slot) will be signified by inclusion in `pre` and omission
in `post` list.

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

* eth/traces: add state limit (ethereum#25812)

This PR introduces a new mechanism in chain tracer for preventing creating too many trace states.

The workflow of chain tracer can be divided into several parts:

- state creator generates trace state in a thread
- state tracer retrieves the trace state and applies the tracing on top in another thread
- state collector gathers all result from state tracer and stream to users

It's basically a producer-consumer model here, while if we imagine that the state producer generates states too fast, then it will lead to accumulate lots of unused states in memory. Even worse, in path-based state scheme it will only keep the latest 128 states in memory, and the newly generated state will invalidate the oldest one by marking it as stale.

The solution for fixing it is to limit the speed of state generation. If there are over 128 states un-consumed in memory, then the creation will be paused until the states are be consumed properly.

* core/bloombits: speed up windows-test (ethereum#25844)

core/bloombits: remove micro-sleep

* core, ethclient/gethclient: improve flaky tests (ethereum#25918)

* ethclient/gethclient: improve time-sensitive flaky test

* eth/catalyst: fix (?) flaky test

* core: stop blockchains in tests after use

* core: fix dangling blockchain instances

* core: rm whitespace

* eth/gasprice, eth/tracers, consensus/clique: stop dangling blockchains in tests

* all: address review concerns

* core: goimports

* eth/catalyst: fix another time-sensitive test

* consensus/clique: add snapshot test run function

* core: rename stop() to stopWithoutSaving()

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

* node: prevent exposing engine API on unauthenticated endpoint (ethereum#25939)

* node: prevent exposing engine API on unauthenticated endpoint

* node: improve RPC setup

* eth/filters: fix for eth_getLogs failing with finalized- and safe tag  (ethereum#25922)

Prior to this change, f.begin (and possibly end) stay negative, leading to strange results later in the code. With this change, filters using "safe" and "finalized" block produce results consistent w/ the overall behavior of this RPC method.

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

* cmd/geth: fix help output issues (ethereum#25941)

This update resolves an issue where StringSliceFlag would not be
rendered correctly in help output + mention that -H can be used multiple times

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

* accounts/usbwallet: support Ledger Nano S Plus and FTS (ethereum#25933)

* usbwallet support Ledger Nano S Plus

* accounts/usbwallet: add definitions + ref to ledger docs

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

* all: fix spelling mistakes (ethereum#25961)

* cmd/geth, core: fix typo in comment (ethereum#25954)

* fix typo on comment

* typo "can't accept"

* core/rawdb: provide more info on 'gap in the chain' error (ethereum#25938)

* core/types: add more context around ErrInvalidChainID (ethereum#25367)

This changes the error message for mismatching chain ID to show
the given and expected value. Callers expecting this error must be
changed to use errors.Is.

* common/math: optimized modexp (+ fuzzer) (ethereum#25525)

This adds a 
* core/vm, tests: optimized modexp + fuzzer

* common/math: modexp optimizations

* core/vm: special case base 1 in big modexp

* core/vm: disable fastexp

* tests/fuzzers/modexp: gofmt (ethereum#25972)

* node: drop support for static & trusted node list files (ethereum#25610)

This changes the node setup to ignore datadir files

    static-nodes.json
    trusted-nodes.json

When these files are present, it an error will be printed to the log.

* accounts/keystore: faster tests (ethereum#25827)

This PR removes some optimistic tests -- a'la "do something,
wait a while, and hope it has trickled through and continue" -- and
instead uses some introspection to ensure that prerequisites are met.

* eth/protocols/eth: fix typo in log message (ethereum#25969)

* eth/filters, ethclient/gethclient: add fullTx option to pending tx filter (ethereum#25186)

This PR adds a way to subscribe to the _full_ pending transactions, as opposed to just being notified about hashes. 

In use cases where client subscribes to newPendingTransactions and gets txhashes only to then request the actual transaction, the caller can now shortcut that flow and obtain the transactions directly. 


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

* go.mod: upgrade github.com/dop251/goja (ethereum#25955)

This upgrade pulls in a fix to handling of 'continue' in loops.

* eth/tracers: fix the issue of panic in prestate with diffmode (ethereum#25957)

In some cases, inner contract creation may not be successful, and an inner contract was not created. This PR fixes a crash that could occur when doing tracing in such situations.

* Revert "go.mod: upgrade github.com/dop251/goja" (ethereum#25975)

Revert "go.mod: upgrade github.com/dop251/goja (ethereum#25955)"

This reverts commit 9207e34.

* common/math, tests/fuzzers: use big.Int clone (ethereum#26006)

* common/math, tests/fuzzers: use big.Int clone

* common/math: license

* cmd/utils: enable snapshot generation in import-mode (ethereum#25990)

This PR fixes a regression causing snapshots not to be generated in "geth --import" mode.  It also fixes the geth export command to be truly readonly, and adds a new test for geth export.

* core/rawdb: refactor db key prefix (ethereum#26000)

Co-authored-by: seven <seven@nodereal.io>

* core/rawdb: open meta file in read only mode (ethereum#26009)

* internal/ethapi, accounts/abi/backends: use error defined in core (ethereum#26012)

Co-authored-by: seven <seven@nodereal.io>

* eth/tracers: fix the issue prestate missing existing contract state (ethereum#25996)

The prestate tracer did not report accounts that existed at a given address prior to a contract being created at that address.

Signed-off-by: Delweng <delweng@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* eth/tracers: simplify test framework (ethereum#25973)

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

* all: refactor txpool into it's own package in prep for 4844

* core/types: rename tx files to group them better together

* core, eth: for types with accurate size calcs, return uint64, not float (ethereum#26046)

* core, eth: for types with accurate size calcs, return uint64, not float

* core/types: proper tx size tests

* core/types: extend tx size test with decoded sizes, fix error

* core/txpool: fix linter

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

* build: upgrade -dlgo version to Go 1.19.2

* accounts/scwallet: fix keycard data signing error (ethereum#25331)

accounts/scwallet: fix keycard data signing

* build: make ios work again (ethereum#26052)

* core/vm: use optimized bigint (ethereum#26021)

* 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

* core/rawdb: refactor db inspector for extending multiple ancient store (ethereum#25896)

This PR ports a few changes from PBSS:

- Fix the snapshot generator waiter in case the generation is not even initialized
- Refactor db inspector for ancient store

* cmd/evm: calc base fee if parent data is present (ethereum#26051)

Currently, in order to chain together sequential valid t8n transitions the caller must manually calculate the block base fee. This PR adds support for the necessary parent fee market data to calculate the base fee for the current transition.

Concretely, env is extended to accept the following:

    parentBaseFee
    parentGasUsed
    parentGasLimit

Example usage can be found in ./cmd/evm/testdata/25.

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

* eth/tracers: fix gasUsed for native and JS tracers (ethereum#26048)

* eth/tracers: fix gasUsed in call tracer

* fix js tracers gasUsed

* fix legacy prestate tracer

* fix restGas in test

* drop intrinsicGas field from js tracers

* cmd, eth: implement full-sync tester (ethereum#26035)

This PR adds a parameter to startup, --synctarget. The synctarget flag is a developer-flag, that can be useful in some scenarios as a replacement for a CL node. It defines a fixed block sync target:

geth --syncmode=full --synctarget=./block_15816882.hex_rlp 

The --synctarget is only made available during syncmode=full

* rpc: update docstring (ethereum#26072)

Co-authored-by: seven <seven@nodereal.io>

* Fix trace call for inner reverts (ethereum#25971)

Inner call reverts will now return the reason similar to the top-level call. Separately, if top-level call is of type CREATE and it fails, its `to` field will now be cleared to `0x00...00` instead of being set to the created address.

* eth: implement eth/68 (ethereum#25980)

* eth: implement eth/68

* eth/protocols/eth: added tx size to announcement

* eth/protocols/eth: check equal lengths on receiving announcement

* eth/protocols/eth: add +1 to tx size because of the type byte

* eth: happy lint, add eth68 tests, enable eth68

* eth: various nitpick fixes on eth/68

* eth/protocols/eth: fix announced tx size wrt type byte

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>

* eth/tracers: add withLog to callTracer (ethereum#25991)

In some cases, it is desirable to capture what is triggered by each trace, when using the `callTracer`. For example: call `USDT.transfer` will trigger a `Transfer(from, to, value)` event.

This PR adds the option to capture logs to the call tracer, by specifying `{"withLog": true}` in the tracerconfig. 
Any logs belonging to failed/reverted call-scopes are removed from the output, to prevent interpretation mistakes.

Signed-off-by: Delweng <delweng@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>

* eth/tracers: prestateTracer - exclude unchanged storage slots in diffMode (ethereum#25944)

Fixes ethereum#25943

* accounts/abi: return error on fixed bytes with size larger than 32 bytes (ethereum#26075)

* fixed bytes with size larger than 32 bytes is not allowed

* add testcase

* consensus/ethash: fix typo (ethereum#26016)

fix typo

* docs/postmortems: remove wrong parentheses (ethereum#26066)

Removed parentheses in line 71 because line 80 doesn't have them either.

* miner, eth: implement recommit mechanism for payload building (ethereum#25836)

* miner, eth: implement recommit for payload building

* miner: address comments from marius

* miner: fail early if core.NewBlockChain fails (ethereum#26079)

don't ignore errors returned by core.NewBlockChain when initializing tests

* p2p/discover: fix handling of distance 256 in lookupDistances (ethereum#26087)

Noticed that lookupDistances for FINDNODE requests didn't consider 256 a valid
distance. This is actually part of the example in the comment above the
function, surprised that wasn't tested before.

* rlp: add more tests for nil pointer / optional field encoding (ethereum#26077)

* rpc: handle wrong HTTP batch response length (ethereum#26064)

* cmd/clef: add `list-accounts` and `list-wallets` to CLI (ethereum#26080)

This commit adds support for two new commands to clef, making it possible to list accounts / wallets from the command-line-interface. 

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

* merge devnet-v3 with latest master, part 1

* crypto/bls12381: docs - fix broken links to references (ethereum#26095)

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: meows <b5c6@protonmail.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: zhiqiangxu <652732310@qq.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: xinbenlv <zzn@zzn.im>
Co-authored-by: Abirdcfly <fp544037857@gmail.com>
Co-authored-by: uji <49834542+uji@users.noreply.github.com>
Co-authored-by: Marius Kjærstad <sandakersmann@users.noreply.github.com>
Co-authored-by: Rachel Bousfield <nfranks@protonmail.com>
Co-authored-by: Seungbae Yu <dbadoy4874@gmail.com>
Co-authored-by: Jakub Freebit <49676311+jakub-freebit@users.noreply.github.com>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: xternet <majewski.post@gmail.com>
Co-authored-by: protolambda <proto@protolambda.com>
Co-authored-by: Joshua Gutow <jgutow@optimism.io>
Co-authored-by: Amir Hossein <77993374+Kamandlou@users.noreply.github.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: Nicholas <nicholas.zhaoyu@gmail.com>
Co-authored-by: Nicholas Zhao <nicholas.zhao@gmail.com>
Co-authored-by: Benjamin Prosnitz <bprosnitz@gmail.com>
Co-authored-by: Nicolas Gotchac <ngotchac@gmail.com>
Co-authored-by: pinkiebell <40266861+pinkiebell@users.noreply.github.com>
Co-authored-by: George Carder <georgercarder@gmail.com>
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: makcandrov <108467407+makcandrov@users.noreply.github.com>
Co-authored-by: AtomicAzzaz  <AtomicAzzaz@users.noreply.github.com>
Co-authored-by: ewile <ewile@users.noreply.github.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Boqin@MetaSecureLabs <Bobbqqin@gmail.com>
Co-authored-by: Sebastian Stammler <stammler.s@gmail.com>
Co-authored-by: Zachinquarantine <Zachinquarantine@protonmail.com>
Co-authored-by: omahs <73983677+omahs@users.noreply.github.com>
Co-authored-by: Leon <316032931@qq.com>
Co-authored-by: meowsbits <b5c6@protonmail.com>
Co-authored-by: Janko Simonovic <simonovic86@gmail.com>
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
Co-authored-by: TY <45994721+tylerK1294@users.noreply.github.com>
Co-authored-by: ty <ty@oncoder.com>
Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org>
Co-authored-by: Mikhail Vazhnov <michael.vazhnov@gmail.com>
Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
Co-authored-by: jin <35813306+lochjin@users.noreply.github.com>
Co-authored-by: Paul <41552663+molecula451@users.noreply.github.com>
Co-authored-by: Jens W <8270201+DragonDev1906@users.noreply.github.com>
Co-authored-by: s7v7nislands <s7v7nislands@gmail.com>
Co-authored-by: seven <seven@nodereal.io>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: Marius Kjærstad <mkjaerstad@protonmail.com>
Co-authored-by: vdwijden <115323661+vdwijden@users.noreply.github.com>
Co-authored-by: Sebastian Supreme <106926150+SebastianSupreme@users.noreply.github.com>
Co-authored-by: Jordan Krage <jmank88@gmail.com>
Co-authored-by: Joseph Cook <33655003+jmcook1186@users.noreply.github.com>

* remove legacy kzg verification, put all initialization on top (#44)

* add header & block fields for Withdrawals (#45)

* add header & block fields for Withdrawals

* Update cmd/evm/internal/t8ntool/block.go

Co-authored-by: Inphi <mlaw2501@gmail.com>

Co-authored-by: Inphi <mlaw2501@gmail.com>

* use go-kzg PolyLinComb instead of local impl

* make verify_kzg_proof apis more closely mimic the specs (#46)

* move more low-level kzg stuff into kzg_new (#48)

* start using custom types from the 4844 spec

* move ComputePowers into kzg_new

* 1) move BlobsToKZGCommitment functionality into kzg_new and make it more closely follow the spec.

2) Remove the BlobsBatch stuff which seems only to be for legacy benchmarking.

* Replace kzg-related data_blob.go type methods Parse, ComputeCommitment, and
Point, so we can move methods that depend on them into the kzg package.

* Remove ComputeCommitments which is unused.

* Add BytesToBLSField go kzg_new, use it instead of hashToFr

* Update KZG library according to latest consensus spec changes (#49)

* Replace kzg-related data_blob.go type methods Parse, ComputeCommitment, and
Point, so we can move methods that depend on them into the kzg package.

* Remove ComputeCommitments which is unused.

* Migrate remaining EIP-4844 consensus spec code into kzg_new,
updated to include the latest consensus spec updates.

* Start implementing a bytes API with appropriate interfaces

Also fix incorrect hash type (Keccac -> Sha256) when
computing versioned hash.

* pure bytes API for VerifyKZGProof per 3097, and move kzg_new back into kzg.go now that updates are near complete

* rename verifyBlobs validateBlobTransactionWrapper per updated spec, and make implementation more closely follow it

* fix tests & type bug in kzg verification

* more consensus layer support in kzg package

* remove aggregated proof from blobs bundle

* propagate malformed blob errors when processing a sent transaction so that these get rejected

* move more CL eip-4844 methods from prysm to shared lib (#50)

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: meows <b5c6@protonmail.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: zhiqiangxu <652732310@qq.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: xinbenlv <zzn@zzn.im>
Co-authored-by: Abirdcfly <fp544037857@gmail.com>
Co-authored-by: uji <49834542+uji@users.noreply.github.com>
Co-authored-by: Marius Kjærstad <sandakersmann@users.noreply.github.com>
Co-authored-by: Rachel Bousfield <nfranks@protonmail.com>
Co-authored-by: Seungbae Yu <dbadoy4874@gmail.com>
Co-authored-by: Jakub Freebit <49676311+jakub-freebit@users.noreply.github.com>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: xternet <majewski.post@gmail.com>
Co-authored-by: protolambda <proto@protolambda.com>
Co-authored-by: Joshua Gutow <jgutow@optimism.io>
Co-authored-by: Amir Hossein <77993374+Kamandlou@users.noreply.github.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: Nicholas <nicholas.zhaoyu@gmail.com>
Co-authored-by: Nicholas Zhao <nicholas.zhao@gmail.com>
Co-authored-by: Benjamin Prosnitz <bprosnitz@gmail.com>
Co-authored-by: Nicolas Gotchac <ngotchac@gmail.com>
Co-authored-by: pinkiebell <40266861+pinkiebell@users.noreply.github.com>
Co-authored-by: George Carder <georgercarder@gmail.com>
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
Co-authored-by: makcandrov <108467407+makcandrov@users.noreply.github.com>
Co-authored-by: AtomicAzzaz  <AtomicAzzaz@users.noreply.github.com>
Co-authored-by: ewile <ewile@users.noreply.github.com>
Co-authored-by: Delweng <delweng@gmail.com>
Co-authored-by: Boqin@MetaSecureLabs <Bobbqqin@gmail.com>
Co-authored-by: Sebastian Stammler <stammler.s@gmail.com>
Co-authored-by: Zachinquarantine <Zachinquarantine@protonmail.com>
Co-authored-by: omahs <73983677+omahs@users.noreply.github.com>
Co-authored-by: Leon <316032931@qq.com>
Co-authored-by: meowsbits <b5c6@protonmail.com>
Co-authored-by: Janko Simonovic <simonovic86@gmail.com>
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
Co-authored-by: lmittmann <lmittmann@users.noreply.github.com>
Co-authored-by: TY <45994721+tylerK1294@users.noreply.github.com>
Co-authored-by: ty <ty@oncoder.com>
Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org>
Co-authored-by: Mikhail Vazhnov <michael.vazhnov@gmail.com>
Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
Co-authored-by: jin <35813306+lochjin@users.noreply.github.com>
Co-authored-by: Paul <41552663+molecula451@users.noreply.github.com>
Co-authored-by: Jens W <8270201+DragonDev1906@users.noreply.github.com>
Co-authored-by: s7v7nislands <s7v7nislands@gmail.com>
Co-authored-by: seven <seven@nodereal.io>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: Marius Kjærstad <mkjaerstad@protonmail.com>
Co-authored-by: vdwijden <115323661+vdwijden@users.noreply.github.com>
Co-authored-by: Sebastian Supreme <106926150+SebastianSupreme@users.noreply.github.com>
Co-authored-by: Jordan Krage <jmank88@gmail.com>
Co-authored-by: Joseph Cook <33655003+jmcook1186@users.noreply.github.com>
Co-authored-by: Inphi <mlaw2501@gmail.com>
MoonShiesty pushed a commit to MoonShiesty/go-ethereum that referenced this issue Aug 30, 2023
It's a trivial PR to hide the error log when the trie node is not found in the database. The idea for this change is for all TryXXX functions, the error is already returned and we don't need to fire a log explicitly.

Recently there are a few tickets ethereum#25613 ethereum#25589 reporting that the trie nodes are missing because of debug.SetHead. The root cause is after resetting, the chain rewinds to a historical point and re-imports the blocks on top.

Since the node is already synced and started to accept transactions previously, these transactions are still kept in the txpool and verified by txpool with a live state. This live state is constructed based on the live trie database, which is changed fast by node referencing and de-referencing.

Unfortunately, when we construct a live state(like the state in txpool), we don't reference the state we have. The blockchain will garbage collect the intermediate version nodes in another thread which leads the broken live state.

The best solution for this is to forcibly obtain a reference for all live states we create and call release function once it's used up. But it might end up with more junks persisted into disk. Will try to find an elegant solution later in the following PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

12 participants