Skip to content

Commit

Permalink
Delete Inherited Timer Code, Unskip Tests (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan authored Nov 25, 2024
1 parent 46b0b50 commit 9d2c8c6
Show file tree
Hide file tree
Showing 8 changed files with 2,231 additions and 2,620 deletions.
4,004 changes: 2,002 additions & 2,002 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

18 changes: 0 additions & 18 deletions challenge-manager/chain-watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,24 +465,6 @@ func (w *Watcher) IsConfirmableEssentialEdge(
return confirmable, essentialPaths, timer, err
}

func (w *Watcher) ComputeRootInheritedTimer(
ctx context.Context,
challengedAssertionHash protocol.AssertionHash,
) (protocol.InheritedTimer, error) {
chal, ok := w.challenges.TryGet(challengedAssertionHash)
if !ok {
return 0, fmt.Errorf(
"could not get challenge for top level assertion %#x",
challengedAssertionHash,
)
}
blockHeaderNumber, err := w.chain.Backend().HeaderU64(ctx)
if err != nil {
return 0, err
}
return chal.honestEdgeTree.ComputeRootInheritedTimer(ctx, challengedAssertionHash, blockHeaderNumber)
}

func (w *Watcher) AllowTrackingEdgeWithParentHash(parentHash protocol.AssertionHash) bool {
if len(w.trackChallengeParentAssertionHashes) == 0 {
return true
Expand Down
15 changes: 2 additions & 13 deletions challenge-manager/chain-watcher/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,8 @@ func TestWatcher_processEdgeAddedEvent(t *testing.T) {
})
require.NoError(t, err)

chal, ok := watcher.challenges.TryGet(assertionHash)
_, ok := watcher.challenges.TryGet(assertionHash)
require.Equal(t, true, ok)

// Expect it to exist and be unrivaled for 10 blocks if we query at block number = 10,
// plus the number of blocks the top level assertion was unrivaled (5).
blockNumber := uint64(10)
resp, err := chal.honestEdgeTree.ComputeRootInheritedTimer(ctx, assertionHash, blockNumber)
require.NoError(t, err)
require.Equal(t, resp, protocol.InheritedTimer(blockNumber+assertionUnrivaledBlocks))
}

type mockHonestEdge struct {
Expand Down Expand Up @@ -313,10 +306,6 @@ func TestWatcher_AddVerifiedHonestEdge(t *testing.T) {

err := watcher.AddVerifiedHonestEdge(ctx, honest)
require.NoError(t, err)
chal, ok := watcher.challenges.TryGet(assertionHash)
_, ok := watcher.challenges.TryGet(assertionHash)
require.Equal(t, true, ok)
blockNum := uint64(20)
resp, err := chal.honestEdgeTree.ComputeRootInheritedTimer(ctx, assertionHash, blockNum)
require.NoError(t, err)
require.Equal(t, blockNum-createdAt+assertionUnrivaledBlocks, uint64(resp))
}
2 changes: 0 additions & 2 deletions challenge-manager/challenge-tree/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go_library(
srcs = [
"add_edge.go",
"ancestors.go",
"inherited_timer.go",
"local_timer.go",
"paths.go",
"tree.go",
Expand All @@ -30,7 +29,6 @@ go_test(
srcs = [
"ancestors_test.go",
"compute_ancestors_test.go",
"inherited_timer_test.go",
"local_timer_test.go",
"paths_edge_cases_test.go",
"paths_test.go",
Expand Down
138 changes: 0 additions & 138 deletions challenge-manager/challenge-tree/inherited_timer.go

This file was deleted.

Loading

0 comments on commit 9d2c8c6

Please sign in to comment.