erigontech / erigon

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

Why Erigon deleted all data until 20000000 block? #12689

Open fridary opened 5 days ago

fridary commented 5 days ago

Erigon version: erigon version 2.59.3-088fd8ef Chain/Network: mainnet OS & Version: Ubuntu 20.04.6 LTS, CPU E5-2695 v4, 36 cores, 192 Gb RAM Disk: NVMe HPE MT006400KWHAE 6.4 Tb

Some months ago I used --internalcl in erigon command: ExecStart=/home/root/erigon/build/bin/erigon --internalcl --datadir=/disk_sde/erigon --ws --http.api=eth,erigon,engine,web3,net,debug,trace,txpool --authrpc.jwtsecret=/home/root/erigon/jwtsecret --prune.h.before=13916166 --prune.r.before=13916166 --prune.t.before=13916166 --prune.c.before=13916166 --torrent.download.rate=128mb --rpc.batch.limit=5000

Then I changed to lighthouse: ExecStart=/home/root/erigon/build/bin/erigon --datadir=/disk_sde/erigon --ws --http.api=eth,erigon,engine,web3,net,debug,trace,txpool --authrpc.jwtsecret=/home/root/erigon/jwtsecret --prune.h.before=13916166 --prune.r.before=13916166 --prune.t.before=13916166 --prune.c.before=13916166 --torrent.download.rate=128mb --rpc.batch.limit=5000

Lighthouse command:

ExecStart=/usr/bin/lighthouse bn \
  --network mainnet \
  --port 9100 \
  --datadir /disk_sde/lighthouse \
  --http \
  --execution-endpoint http://127.0.0.1:8551 \
  --execution-jwt /home/root/erigon/jwtsecret \
  --disable-deposit-contract-sync \
  --checkpoint-sync-url https://mainnet.checkpoint.sigp.io

Problem: I am indexing ethereum blockchain to my database and blocks before 20000000 are indexed. Now, I need to do some requests again and noticed that I can not get data before 19999999 block (159 days ago), but starting from 20000000 I can. Why is this and how to fix? Some months ago I used Caplin, but now Lighthouse, don't know if it's important.

Example:

testnet = 'http://127.0.0.1:8545'

_block_number = 19928858 # 169 days ago
block = requests.post(testnet, json={"method":"eth_getBlockByNumber","params":[hex(_block_number),True],"id":1,"jsonrpc":"2.0"}, headers={"Content-Type": "application/json"}).json()
print(block)

# 19985875 block 161 days ago
_hash = '0xd18269cdb834bff00e6d3331f8f699f4ff05f514bcba739ab0e55b4625c89335'
tx = requests.post(testnet, json={"method":"eth_getTransactionByHash","params":[_hash],"id":2,"jsonrpc":"2.0"}, headers={"Content-Type": "application/json"}).json()
print(tx)

_block_number = 19999999 # 159 days ago
block = requests.post(testnet, json={"method":"eth_getBlockByNumber","params":[hex(_block_number),True],"id":3,"jsonrpc":"2.0"}, headers={"Content-Type": "application/json"}).json()
print(block)

_block_number = 20000000 # 159 days ago
block = requests.post(testnet, json={"method":"eth_getBlockByNumber","params":[hex(_block_number),True],"id":4,"jsonrpc":"2.0"}, headers={"Content-Type": "application/json"}).json()
print(block)

Result:

{'jsonrpc': '2.0', 'id': 1, 'result': None}
{'jsonrpc': '2.0', 'id': 2, 'result': None}
{'jsonrpc': '2.0', 'id': 3, 'result': None}
{'jsonrpc': '2.0', 'id': 4, 'result': {'baseFeePerGas': '0x12643ff14', 'blobGasUsed': '0x20000', 'difficulty': '0x0', 'excessBlobGas': '0x0', 'extraData': '0x6265617665726275696c642e6f7267', 'gasLimit': '0x1c9c380', 'gasUsed': '0xa9371c', 'hash': '0xd24fd73f794058a3807db926d8898c6481e902b7edb91ce0d479d6760f276183', 'logsBloom' ...

In journal I see a lot of:

nov 09 04:45:56 sirjay-pc erigon[1200629]: [WARN] [11-09|04:45:55.841] [rpc] served                             conn=127.0.0.1:46094 method=eth_call reqid=100 t=296.33µs err="execution reverted"
nov 09 04:45:56 sirjay-pc erigon[1200629]: [WARN] [11-09|04:45:56.266] [rpc] served                             conn=127.0.0.1:46272 method=eth_call reqid=259 t=270.885µs err="execution reverted"
nov 09 04:45:56 sirjay-pc erigon[1200629]: [WARN] [11-09|04:45:56.272] [rpc] served                             conn=127.0.0.1:46272 method=eth_call reqid=262 t=261.498µs err="execution reverted"
nov 09 04:45:56 sirjay-pc erigon[1200629]: [WARN] [11-09|04:45:56.278] [rpc] served                             conn=127.0.0.1:46272 method=eth_call reqid=265 t=225.8µs err="execution reverted"
nov 09 04:45:56 sirjay-pc erigon[1200629]: [WARN] [11-09|04:45:56.296] [rpc] served                             conn=127.0.0.1:46272 method=eth_call reqid=268 t=267.124µs err="execution reverted"
nov 09 04:45:56 sirjay-pc erigon[1200629]: [WARN] [11-09|04:45:56.302] [rpc] served                             conn=127.0.0.1:46272 method=eth_call reqid=271 t=286.938µs err="execution reverted"
fridary commented 4 days ago

Upd: I noticed that I can get data by block 19899999 (174 days ago), but can not starting from 19900000. So the problem is that blocks 19900000 .. 19999999 (174 days .. 160 days ago) are gone somewhere.