-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat(proof/service)!: check that proof height is less than available threshold #36
feat(proof/service)!: check that proof height is less than available threshold #36
Conversation
Codecov Report
@@ Coverage Diff @@
## main #36 +/- ##
==========================================
- Coverage 67.09% 64.63% -2.46%
==========================================
Files 6 6
Lines 392 410 +18
==========================================
+ Hits 263 265 +2
- Misses 95 109 +14
- Partials 34 36 +2
|
e88d586
to
361a4a1
Compare
68f2d43
to
1a1e62b
Compare
75f2af4
to
7822259
Compare
We work with height here, so independently of the block time 20 its high enough value to mitigate false negatives.
I don't think so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan here to use the syncer head? If so, then I think this should be fine. Should we also sanity-check for heights that are too low
(far away from networkHead in the backwards direction) ? Maybe this is a question for john and ismail
|
Yes. We will use syncer Head. |
I don't think so, no. Any valid fraud proof in the history of the locally-canonical chain should cause the node to halt. |
Could you not induce fraud through a long-range attack, that would halt the node (eclipse it) but is not the canonical chain, because of forward syncing (we don't have backward syncing yet )? This can happen because we handle 2 valid headers as FIFO, not as fraud. |
This is possible, assuming we don't have backward sync and celestiaorg/go-header#108 is not merged. But we should not introduce complexity here for something that will be obsolete soon after mainnet. |
i am not sure whether this check is really useful as in the current logic right after this check we try to get the extended header for this future FP and ignore validation anyways. This will be useful, if the logic where to store any future FPs (wrt current node's canonical chain or local head). @vgonkivs |
The problem here is when we try to get the extended header, it can block and wait until the header is available. And that header can be requested in far future which becomes a DOS vector. This check prevents that |
This reminds me this, and we may want to keep that logic in some form of HeaderService inside of go-header. Rollkit will also need it. (not soon) |
The thing is that our store will be blocked on this call, waiting for the height. The pubsub has an internal buffered channel(32 msgs iirc) for handling the events, so if we will stuck on this step. It will be pretty easy for an attacker to create a 32 fp from the future so our proof service will be stuck. The main purpose of this fix is to skip FPs that are bigger than the chain head. |
How can we store future FPs(with height more than the canonical chain has)? In case if local head is less than the chain head, then we will wait until the node syncs to this height to fetch the header. |
Well first you'd be making a fork, and that would be detectable and rejected by the node before it would accept fraud proofs. Fraud proofs only need to be checked against the local-canonical fork. |
Overview
Fixes #35
TBD:
headThreshold
configurable because different networks can have different block time?Checklist