-
Notifications
You must be signed in to change notification settings - Fork 19
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
Logic for Checking if Essential Nodes are Confirmable #630
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rauljordan
changed the title
Logic for Is Essential Confirmable
Logic for Checking if Essential Nodes are Confirmable
May 2, 2024
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #630 +/- ##
==========================================
+ Coverage 59.34% 60.00% +0.65%
==========================================
Files 48 49 +1
Lines 8231 8420 +189
==========================================
+ Hits 4885 5052 +167
- Misses 3340 3362 +22
Partials 6 6 |
…nLabs/bold into is-essential-confirmable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
As part of reimbursing challenge bonds in-protocol, our researchers at Offchain Labs have determined that honest parties may need to keep defending honest edges within subchallenges for a period of time that may extend beyond the confirmation of a challenge. Defending honest edges within a subchallenge can stop once the closest "essential edge" of an edge within the subchallenge is confirmable.
We can think of an essential edge, for purposes of this PR, as the honest root of a subchallenge, or of a top-level challenge. To check if an essential node is confirmable, all essential paths down from it to terminal edges must have a
path weight >= CHALLENGE_PERIOD
. This path weight is the sum of the local timers of edges along the path. To achieve this, we do a depth-first search of the graph to extract all essential paths. For each path, we store its weight in a min-heap. Once the min element of this heap has aweight >= CHALLENGE_PERIOD
, we know the essential edge is confirmable.This PR includes the DFS computation and a function called
IsConfirmableEssentialNode
which performs the operations above. It is tested across challenge levels and uses algorithmic utilities from the standard library. We perform DFS using a visitor stack to avoid recursion in our algorithm.Note
See the test
Test_findEssentialPaths
to understand how the algorithm works and what it is meant to output for a sample challenge tree underpaths_test.go
and alsosetupEssentialPathsTest