TrueBlocks / trueblocks-core

The main repository for the TrueBlocks system
https://trueblocks.io
GNU General Public License v3.0
1.04k stars 197 forks source link

Detecting tracing on partial archive node. #3754

Open dreadedhamish opened 4 months ago

dreadedhamish commented 4 months ago

Summary of a discord discussion: https://discord.com/channels/570963863428661248/811272718224719892/1229934212967039006

Partial archive nodes on Erigon are archive nodes that only cover a specified block range, so they index everything but only for blocks after X, and/or before Y, or in the last Z blocks.

When chifra tries to detect whether tracing is enabled on a node it currently checks for traces on block 1, which might not be in the range that is archived.

@dszlachta suggested a workaround by manually editing this file: https://github.com/TrueBlocks/trueblocks-core/blob/master/src/apps/chifra/pkg/rpc/is_node.go#L41

@tjayrush - Do you know if there's some way to query for 'firstArchivedBlock`? In most cases this would be block 1 (or 0). In your case (with a "partial archive") it would return 19,00,000. We don't really care which block we check, just that we check the first available one. (It would be an easy fix if there was such a query on the RPC, but I doubt there is.)

@dreadedhamish - There is nothing in the erigon API to get first block. It might be easiest to add some options to trueBlocks.toml (beginTrace & endTrace).

alternatively there is the command: for a regular install: ./build/bin/integration print_stages --datadir= --chain=gnosis docker after exec'ing in: integration print_stages --datadir= --chain=gnosis That will print out information on stages and their pruning status, and then one key line: prune distance: --prune.r.older=90000 --prune.h.before=17232999 --prune.t.before=17232999 --prune.c.before=17232999 You'd have to look out for prune.t.before= or prune.t.after= with block number, and prune.t.older= number of blocks.

@tjayrush - I don't love using an Erigon specific endpoint, although it won't be the first time. Reth probably does it differently.

tjayrush commented 4 months ago

Thanks for this, at least now the issue won't get lost.

Upshot: we need to implement chifra scrape --touch block. The endpoint is there, it's just not implemented. Should be relatively easy.