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

Delete Inherited Timer Code, Unskip Tests #702

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,004 changes: 2,002 additions & 2,002 deletions MODULE.bazel.lock
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like something strange is going on with every PR having a big diff that pushes back and forth these lines in the MODULE.bazel.lock file. Any thoughts on what's happening here?

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
Loading