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

Adjust contentdb to be able to keep track of headers without a proof for later purging #2207

Open
kdeme opened this issue May 22, 2024 · 0 comments

Comments

@kdeme
Copy link
Contributor

kdeme commented May 22, 2024

Currently Headers are stored with proof before merge and without after.
Eventually we will also add proofs after merge, but there will always be the most recent headers that are not yet part of the BeaconState.historical_summaries.

Now the issue arises when these headers need to be updated by headers with their proof. The client needs to be able to recognize when a new offer comes in but for a header which was stored without proof, so that it can accept that new offer and overwrite the header without the proof (there is also the issue that node can not know upfront whether the offered header comes with or without proof).

Currently before accepting data, a Radius check + a p.dbGet is done: https://github.com/status-im/nimbus-eth1/blob/master/fluffy/network/wire/portal_protocol.nim#L442

The dbGet is already a handler that can get customized, as is currently the case for contentDb versus beaconDb.
So this would require a custom contentDb for history network, or historyDb (or at least layer above the contentDb).

Some ideas to keep track of this could be:

  • Additional table with list of headers without proof
  • Additional column for "non permanent" data (no longer simple kv)
  • Some prefix in the key
  • ...

What could however also work is a specification change:

  • Define two block header types in the network, one with and one without the proofs. When the one with proof gets offered, check if the one without is stored and purge it after receiving the new one.
  • Or have it as extra 'hasProof' flag in the content key, but keep content id derivation the same. When the flag is set, the node can accept the data and overwrite to the same key (=content id). However, as we don't store the content key, we would have to decode the stored data on each of these offers to check what is stored, which has somewhat of a potential to DoS.

Related specs issue: ethereum/portal-network-specs#239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant