Skip to content

Commit

Permalink
Remove the random delay
Browse files Browse the repository at this point in the history
We can add it back if we decide that multiple validators colliding in a
congested parent chain is an actual problem. But, for now, we think the delay is
not really solving the problem, and just adding time to getting challenges
opened.
  • Loading branch information
eljobe committed Nov 20, 2024
1 parent 50f13bc commit fc4197f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
13 changes: 0 additions & 13 deletions challenge-manager/challenges.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"crypto/rand"
"fmt"
"math/big"
"time"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/log"
Expand All @@ -26,18 +25,6 @@ import (
// challenge committing to the correct assertion to rival one or more incorrect
// assertions.
func (m *Manager) HandleCorrectRival(ctx context.Context, riv protocol.AssertionHash) error {
// Generate a random integer between 0 and max delay seconds to wait before
// challenging.
// This is to avoid all validators challenging at the same time.
mds := 1 // default max delay seconds to 1 to avoid panic
if m.MaxDelaySeconds() > 1 {
mds = m.MaxDelaySeconds()
}
randSecs, err := randUint64(uint64(mds))
if err != nil {
return err
}
time.Sleep(time.Duration(randSecs) * time.Second)
challengeSubmitted, err := m.ChallengeAssertion(ctx, riv)
if err != nil {
return err
Expand Down
7 changes: 0 additions & 7 deletions challenge-manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ type Manager struct {
newBlockNotifier *events.Producer[*gethtypes.Header]
notifyOnNumberOfBlocks uint64
mode types.Mode
maxDelaySeconds int
claimedAssertionsInChallenge *threadsafe.LruSet[protocol.AssertionHash]
headBlockSubscriptions bool
// API
Expand Down Expand Up @@ -171,12 +170,6 @@ func (m *Manager) IsClaimedByChallenge(assertionHash protocol.AssertionHash) boo
return m.claimedAssertionsInChallenge.Has(assertionHash)
}

// MaxDelaySeconds returns the maximum number of seconds that the challenge
// manager will wait open a challenge.
func (m *Manager) MaxDelaySeconds() int {
return m.maxDelaySeconds
}

// TrackEdge spawns an edge tracker for an edge if it is not currently being
// tracked.
func (m *Manager) TrackEdge(ctx context.Context, edge protocol.SpecEdge) error {
Expand Down

0 comments on commit fc4197f

Please sign in to comment.