erigontech / erigon

Ethereum implementation on the efficiency frontier https://erigon.gitbook.io
GNU Lesser General Public License v3.0
3.12k stars 1.11k forks source link

Why is Erigon executing all blocks since the beginning even when pruning is enabled? #7137

Closed NicolasWent closed 1 year ago

NicolasWent commented 1 year ago

Hello,

I have started Erigon with the following command: erigon --datadir=~/ethereum --snapshots=true --prune=hrtc --torrent.download.rate=512mb --torrent.upload.rate=256mb

After some time, I got this output:

INFO[03-19|18:29:38.339] [7/15 Execution] Executed blocks         number=10889889 blk/s=54.7 tx/s=9472.3 Mgas/s=665.4 gasState=0.08 batch=107.0MB alloc=4.8GB sys=7.5GB
INFO[03-19|18:29:40.022] [LightClient] P2P                        peers=8
WARN[03-19|18:29:40.079] Could not send beacon block to ETH1      err="missing attestation data"
INFO[03-19|18:29:43.378] [downloader] error sending packet: write udp4 0.0.0.0:42069->172.13.72.239:42069: sendto: operation not permitted torrent_log_type=unknown or=NIL
INFO[03-19|18:29:44.678] [downloader] error sending packet: write udp4 0.0.0.0:42069->100.2.1.41:42069: sendto: operation not permitted torrent_log_type=unknown or=NIL
INFO[03-19|18:29:46.811] [downloader] error sending packet: write udp4 0.0.0.0:42069->100.2.1.41:42069: sendto: operation not permitted torrent_log_type=unknown or=NIL
WARN[03-19|18:29:52.062] Could not send beacon block to ETH1      err="missing attestation data"
INFO[03-19|18:29:52.811] [downloader] error sending packet: write udp4 0.0.0.0:42069->172.13.72.239:42069: sendto: operation not permitted torrent_log_type=unknown or=NIL
INFO[03-19|18:29:53.478] [downloader] error sending packet: write udp4 0.0.0.0:42069->100.2.1.41:42069: sendto: operation not permitted torrent_log_type=unknown or=NIL
INFO[03-19|18:29:57.811] [downloader] error sending packet: write udp4 0.0.0.0:42069->172.13.72.239:42069: sendto: operation not permitted torrent_log_type=unknown or=NIL
INFO[03-19|18:29:58.351] [7/15 Execution] Executed blocks         number=10890998 blk/s=55.4 tx/s=9851.2 Mgas/s=674.3 gasState=0.10 batch=143.7MB alloc=4.1GB sys=7.5GB

So if I understood correctly, Erigon is currently in the stage [7/15 Execution], and currently at block 10889889.

But I enabled pruning (as you see in my command). So I was wondering, why is Erigon executing all blocks since the beginning even if I enabled pruning to have only 90000 latest blocks?

dreadedhamish commented 1 year ago

Pruning syncs the whole chain then prunes. Think about a tree in your garden that get's pruned - it grows and then you prune it. There is no ability to start processing at a certain block.

AskAlexSharov commented 1 year ago

@dreadedhamish no, pruned node of erigon doesn't save (doesn't generate) most of historical data - it means nothing to prune after initial sync of pruned node.

2 independent things:

  1. History: prune - is about "how much of history to store" (history and historical indices: all that --prune=hrtc letters are about various historical data).
  2. LatestsState and it's MerkleTrie: is not related to history (different tables in db). And pruned and un-pruned nodes need to get "latest state" somewhere: or by downloading it or by exec blocks. Current version of Erigon can't download it (word "download" need read as: some nodes need produce such snapshots and seed them).

Future major version of Erigon will able to do it

dreadedhamish commented 1 year ago

@AskAlexSharov

OK - so what stages aren't executed when pruning? I tried pruning using just the last 10000 blocks and it looked to process the whole blockchain.

shunpg commented 4 months ago

@NicolasWent I thought the same thing, have you solved it?