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

Fix missing prune log index #9968

Merged
merged 3 commits into from
Apr 17, 2024
Merged

Fix missing prune log index #9968

merged 3 commits into from
Apr 17, 2024

Conversation

somnathb1
Copy link
Contributor

Existing prune had some confusing logic (thanks to me).

In PR, change the logic to:
if receipt, or any individual log in the receipt contains an address in noPruneContracts the entire log must be stored and indexed.

Also fixes a regression that logs were not getting indexed - this was due to

if l.BlockNumber < pruneBlock && cfg.noPruneContracts != nil && !cfg.noPruneContracts[l.Address] {

Since the individual log object didn't have the block number - something that shouldn't matter.
In PR, change the logic to:
Use blockNum from outer loop

@somnathb1 somnathb1 enabled auto-merge (squash) April 17, 2024 12:52
@somnathb1 somnathb1 merged commit e3b87dd into devel Apr 17, 2024
7 checks passed
@somnathb1 somnathb1 deleted the pruneIndexFix branch April 17, 2024 12:58
@tolbrino
Copy link

@somnathb1 Does this change require an Erigon node to re-sync entirely for the index to be generated properly?

@somnathb1
Copy link
Contributor Author

somnathb1 commented Apr 18, 2024

This will go in the next release notes too:

2 suggestions alongside to improve database space usage and indexing.
Stop the node, upgrade thorax/erigon:devel docker image. Then

integration stage_log_index --reset --datadir=<your_datadir>

Then restart and let it sync to the tip.

Optional: Improve disk usage
Stop the node and

mdbx_to_mdbx --chaindata=<your_datadir>/chaindata --chaindata.to=<your_datadir>/chaindata2 --datadir=<any_random_location_for_temp_files>
mv chaindata chaindataOld
mv chaindata2 chaindata

Then restart. The new chaindata should be about 1/2 - 1/3 of the size of the old (Bonus!). If all goes well, you can delete chaindataOld

To do the extra commands with docker image, you can always do

docker run -it -v <your_datadir>:/data --entrypoint sh thorax/erigon:devel


Then the value of datadir for integration and mdbx commands is /data on the docker shell, where you can run the above.
Also, just a reminder, 2.58 originally synced node cannot see much benefit on upgrading (it was also in the release notes of 2.59) The above suggestion would work when upgrading from 2.59.x

@ghost ghost mentioned this pull request Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eth_getLogs has buggy topics/address index on pruned node - does not return logs when filtered
3 participants