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

Allow waiting for a minimum amount of time since parent assertion was created to post a new assertion #2825

Merged
merged 10 commits into from
Jan 6, 2025
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 @@ -455,6 +459,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.StackWithMinimumGapToParentAssertion(0),
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.StackWithMinimumGapToParentAssertion(0),
}

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.StackWithMinimumGapToParentAssertion(0),
}

manager, err := challengemanager.NewChallengeStack(
Expand Down
Loading