Skip to content

Commit bb593d1

Browse files
committed
nit
1 parent ea9affb commit bb593d1

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

core/chainio/avs_subscriber.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ func (s *AvsSubscriber) SubscribeToNewTasksV2(newTaskCreatedChan chan *servicema
6868
// Subscribe to new tasks
6969
sub, err := SubscribeToNewTasksV2Retryable(&bind.WatchOpts{}, s.AvsContractBindings.ServiceManager, internalChannel, nil)
7070
if err != nil {
71-
s.logger.Error("Primary failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.DefaultNumRetries, "err", err)
71+
s.logger.Error("Primary failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.RpcNumRetries, "err", err)
7272
return nil, err
7373
}
7474

7575
subFallback, err := SubscribeToNewTasksV2Retryable(&bind.WatchOpts{}, s.AvsContractBindings.ServiceManagerFallback, internalChannel, nil)
7676
if err != nil {
77-
s.logger.Error("Fallback failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.DefaultNumRetries, "err", err)
77+
s.logger.Error("Fallback failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.RpcNumRetries, "err", err)
7878
return nil, err
7979
}
8080
s.logger.Info("Subscribed to new AlignedLayer V2 tasks")

core/retry.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ func (e PermanentError) Is(err error) bool {
2525
}
2626

2727
const (
28-
DefaultInitialInterval = 1 * time.Second // Initial delay for retry interval.
29-
DefaultMaxInterval = 60 * time.Second // Maximum interval an individual retry may have.
30-
DefaultMaxElapsedTime = 0 * time.Second // Maximum time all retries may take. `0` corresponds to no limit on the time of the retries.
31-
DefaultRandomizationFactor float64 = 0 // Randomization (Jitter) factor used to map retry interval to a range of values around the computed interval. In precise terms (random value in range [1 - randomizationfactor, 1 + randomizationfactor]). NOTE: This is set to 0 as we do not use jitter in Aligned.
32-
DefaultMultiplier float64 = 2 // Multiplier factor computed exponential retry interval is scaled by.
33-
DefaultNumRetries uint64 = 3 // Total number of retries attempted.
34-
ChainInitialInterval = 12 * time.Second // Initial delay for retry interval for contract calls. Corresponds to 1 ethereum block.
35-
ChainMaxInterval = 2 * time.Minute // Maximum interval for an individual retry.
28+
RpcInitialInterval = 1 * time.Second // Initial delay for retry interval.
29+
RpcMaxInterval = 60 * time.Second // Maximum interval an individual retry may have.
30+
RpcMaxElapsedTime = 0 * time.Second // Maximum time all retries may take. `0` corresponds to no limit on the time of the retries.
31+
RpcRandomizationFactor float64 = 0 // Randomization (Jitter) factor used to map retry interval to a range of values around the computed interval. In precise terms (random value in range [1 - randomizationfactor, 1 + randomizationfactor]). NOTE: This is set to 0 as we do not use jitter in Aligned.
32+
RpcMultiplier float64 = 2 // Multiplier factor computed exponential retry interval is scaled by.
33+
RpcNumRetries uint64 = 3 // Total number of retries attempted.
34+
ChainInitialInterval = 12 * time.Second // Initial delay for retry interval for contract calls. Corresponds to 1 ethereum block.
35+
ChainMaxInterval = 2 * time.Minute // Maximum interval for an individual retry.
3636
)
3737

3838
type RetryConfig struct {
@@ -46,23 +46,23 @@ type RetryConfig struct {
4646

4747
func RpcRetryConfig() *RetryConfig {
4848
return &RetryConfig{
49-
InitialInterval: DefaultInitialInterval,
50-
MaxInterval: DefaultMaxInterval,
51-
MaxElapsedTime: DefaultMaxElapsedTime,
52-
RandomizationFactor: DefaultRandomizationFactor,
53-
Multiplier: DefaultMultiplier,
54-
NumRetries: DefaultNumRetries,
49+
InitialInterval: RpcInitialInterval,
50+
MaxInterval: RpcMaxInterval,
51+
MaxElapsedTime: RpcMaxElapsedTime,
52+
RandomizationFactor: RpcRandomizationFactor,
53+
Multiplier: RpcMultiplier,
54+
NumRetries: RpcNumRetries,
5555
}
5656
}
5757

5858
func ChainRetryConfig() *RetryConfig {
5959
return &RetryConfig{
6060
InitialInterval: ChainInitialInterval,
6161
MaxInterval: ChainMaxInterval,
62-
MaxElapsedTime: DefaultMaxElapsedTime,
63-
RandomizationFactor: DefaultRandomizationFactor,
64-
Multiplier: DefaultMultiplier,
65-
NumRetries: DefaultNumRetries,
62+
MaxElapsedTime: RpcMaxElapsedTime,
63+
RandomizationFactor: RpcRandomizationFactor,
64+
Multiplier: RpcMultiplier,
65+
NumRetries: RpcNumRetries,
6666
}
6767
}
6868

core/retry_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ func TestRetryWithData(t *testing.T) {
4848
MaxInterval: 2,
4949
MaxElapsedTime: 3,
5050
RandomizationFactor: 0,
51-
Multiplier: retry.DefaultMultiplier,
52-
NumRetries: retry.DefaultNumRetries,
51+
Multiplier: retry.RpcMultiplier,
52+
NumRetries: retry.RpcNumRetries,
5353
}
5454
_, err := retry.RetryWithData(function, config)
5555
if err != nil {
@@ -67,8 +67,8 @@ func TestRetry(t *testing.T) {
6767
MaxInterval: 2,
6868
MaxElapsedTime: 3,
6969
RandomizationFactor: 0,
70-
Multiplier: retry.DefaultMultiplier,
71-
NumRetries: retry.DefaultNumRetries,
70+
Multiplier: retry.RpcMultiplier,
71+
NumRetries: retry.RpcNumRetries,
7272
}
7373
err := retry.Retry(function, config)
7474
if err != nil {

0 commit comments

Comments
 (0)