Skip to content

Commit

Permalink
Allow waiting for a minimum amount of time since parent assertion was…
Browse files Browse the repository at this point in the history
… created to post a new assertion
  • Loading branch information
ganeshvanahalli committed Dec 9, 2024
1 parent c1fa951 commit 5eb9704
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func ConfigDefaultL1NonSequencerTest() *Config {
config.Staker = legacystaker.TestL1ValidatorConfig
config.Staker.Enable = false
config.BlockValidator.ValidationServerConfigs = []rpcclient.ClientConfig{{URL: ""}}
config.Bold.MinimumGapToParentAssertion = 0

return &config
}
Expand All @@ -230,6 +231,7 @@ func ConfigDefaultL2Test() *Config {
config.Staker.Enable = false
config.BlockValidator.ValidationServerConfigs = []rpcclient.ClientConfig{{URL: ""}}
config.TransactionStreamer = DefaultTransactionStreamerConfig
config.Bold.MinimumGapToParentAssertion = 0

return &config
}
Expand Down
7 changes: 6 additions & 1 deletion staker/bold/bold_staker.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ type BoldConfig struct {
// How often to scan for newly created assertions onchain.
AssertionScanningInterval time.Duration `koanf:"assertion-scanning-interval"`
// How often to confirm assertions onchain.
AssertionConfirmingInterval time.Duration `koanf:"assertion-confirming-interval"`
AssertionConfirmingInterval time.Duration `koanf:"assertion-confirming-interval"`
// How long to wait since parent assertion was created to post a new assertion
MinimumGapToParentAssertion time.Duration `koanf:"minimum-gap-to-parent-assertion"`
API bool `koanf:"api"`
APIHost string `koanf:"api-host"`
APIPort uint16 `koanf:"api-port"`
Expand Down Expand Up @@ -98,6 +100,7 @@ var DefaultBoldConfig = BoldConfig{
AssertionPostingInterval: time.Minute * 15,
AssertionScanningInterval: time.Minute,
AssertionConfirmingInterval: time.Minute,
MinimumGapToParentAssertion: time.Minute, // Correct default?
API: false,
APIHost: "127.0.0.1",
APIPort: 9393,
Expand All @@ -121,6 +124,7 @@ func BoldConfigAddOptions(prefix string, f *flag.FlagSet) {
f.Duration(prefix+".assertion-posting-interval", DefaultBoldConfig.AssertionPostingInterval, "assertion posting interval")
f.Duration(prefix+".assertion-scanning-interval", DefaultBoldConfig.AssertionScanningInterval, "scan assertion interval")
f.Duration(prefix+".assertion-confirming-interval", DefaultBoldConfig.AssertionConfirmingInterval, "confirm assertion interval")
f.Duration(prefix+".minimum-gap-to-parent-assertion", DefaultBoldConfig.MinimumGapToParentAssertion, "minimum duration to wait since the parent assertion was created to post a new assertion")
f.Duration(prefix+".check-staker-switch-interval", DefaultBoldConfig.CheckStakerSwitchInterval, "how often to check if staker can switch to bold")
f.Bool(prefix+".api", DefaultBoldConfig.API, "enable api")
f.String(prefix+".api-host", DefaultBoldConfig.APIHost, "bold api host")
Expand Down Expand Up @@ -448,6 +452,7 @@ func newBOLDChallengeManager(
challengemanager.StackWithPollingInterval(scanningInterval),
challengemanager.StackWithPostingInterval(postingInterval),
challengemanager.StackWithConfirmationInterval(confirmingInterval),
challengemanager.StackWithMinimumGapToParentAssertion(config.MinimumGapToParentAssertion),
challengemanager.StackWithTrackChallengeParentAssertionHashes(config.TrackChallengeParentAssertionHashes),
challengemanager.StackWithHeaderProvider(l1Reader),
}
Expand Down
1 change: 1 addition & 0 deletions system_tests/bold_challenge_protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ func testChallengeProtocolBOLD(t *testing.T, spawnerOpts ...server_arb.SpawnerOp
challengemanager.StackWithMode(modes.MakeMode),
challengemanager.StackWithPostingInterval(time.Second * 3),
challengemanager.StackWithPollingInterval(time.Second),
challengemanager.StackWithMinimumGapToParentAssertionCreationTime(0),

Check failure on line 420 in system_tests/bold_challenge_protocol_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

undefined: challengemanager.StackWithMinimumGapToParentAssertionCreationTime

Check failure on line 420 in system_tests/bold_challenge_protocol_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

undefined: challengemanager.StackWithMinimumGapToParentAssertionCreationTime
challengemanager.StackWithAverageBlockCreationTime(time.Second),
}

Expand Down
1 change: 1 addition & 0 deletions system_tests/bold_new_challenge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ func startBoldChallengeManager(t *testing.T, ctx context.Context, builder *NodeB
challengemanager.StackWithPostingInterval(time.Second * 3),
challengemanager.StackWithPollingInterval(time.Second),
challengemanager.StackWithAverageBlockCreationTime(time.Second),
challengemanager.StackWithMinimumGapToParentAssertionCreationTime(0),

Check failure on line 347 in system_tests/bold_new_challenge_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

undefined: challengemanager.StackWithMinimumGapToParentAssertionCreationTime

Check failure on line 347 in system_tests/bold_new_challenge_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

undefined: challengemanager.StackWithMinimumGapToParentAssertionCreationTime
}

challengeManager, err := challengemanager.NewChallengeStack(
Expand Down
1 change: 1 addition & 0 deletions system_tests/overflow_assertions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ func TestOverflowAssertions(t *testing.T) {
challengemanager.StackWithPostingInterval(time.Second),
challengemanager.StackWithPollingInterval(time.Millisecond * 500),
challengemanager.StackWithAverageBlockCreationTime(time.Second),
challengemanager.StackWithMinimumGapToParentAssertionCreationTime(0),

Check failure on line 227 in system_tests/overflow_assertions_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

undefined: challengemanager.StackWithMinimumGapToParentAssertionCreationTime

Check failure on line 227 in system_tests/overflow_assertions_test.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

undefined: challengemanager.StackWithMinimumGapToParentAssertionCreationTime
}

manager, err := challengemanager.NewChallengeStack(
Expand Down

0 comments on commit 5eb9704

Please sign in to comment.