Skip to content

Commit 1a702fe

Browse files
committed
change var name
1 parent 635448f commit 1a702fe

5 files changed

Lines changed: 39 additions & 39 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.RpcNumRetries, "err", err)
71+
s.logger.Error("Primary failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.EthCallNumRetries, "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.RpcNumRetries, "err", err)
77+
s.logger.Error("Fallback failed to subscribe to new AlignedLayer V2 tasks after %d retries", retry.EthCallNumRetries, "err", err)
7878
return nil, err
7979
}
8080
s.logger.Info("Subscribed to new AlignedLayer V2 tasks")

core/chainio/retryable.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (w *AvsWriter) BatchesStateRetryable(opts *bind.CallOpts, arg0 [32]byte) (s
7171
Responded bool
7272
RespondToTaskFeeLimit *big.Int
7373
}, error) {
74-
return retry.RetryWithData(BatchesState(w, opts, arg0), retry.RpcRetryConfig())
74+
return retry.RetryWithData(BatchesState(w, opts, arg0), retry.EthCallRetryConfig())
7575
}
7676

7777
func BatcherBalances(w *AvsWriter, opts *bind.CallOpts, senderAddress common.Address) func() (*big.Int, error) {
@@ -94,7 +94,7 @@ Get the balance of a batcher from the AVS contract.
9494
- Retry times (3 retries): 1 sec, 2 sec, 4 sec
9595
*/
9696
func (w *AvsWriter) BatcherBalancesRetryable(opts *bind.CallOpts, senderAddress common.Address) (*big.Int, error) {
97-
return retry.RetryWithData(BatcherBalances(w, opts, senderAddress), retry.RpcRetryConfig())
97+
return retry.RetryWithData(BatcherBalances(w, opts, senderAddress), retry.EthCallRetryConfig())
9898
}
9999

100100
func BalanceAt(w *AvsWriter, ctx context.Context, aggregatorAddress common.Address, blockNumber *big.Int) func() (*big.Int, error) {
@@ -119,7 +119,7 @@ TODO: it gets the balance from an Address, not necessarily an aggregator. The na
119119
- Retry times (3 retries): 1 sec, 2 sec, 4 sec.
120120
*/
121121
func (w *AvsWriter) BalanceAtRetryable(ctx context.Context, aggregatorAddress common.Address, blockNumber *big.Int) (*big.Int, error) {
122-
return retry.RetryWithData(BalanceAt(w, ctx, aggregatorAddress, blockNumber), retry.RpcRetryConfig())
122+
return retry.RetryWithData(BalanceAt(w, ctx, aggregatorAddress, blockNumber), retry.EthCallRetryConfig())
123123
}
124124

125125
// |---AVS_SUBSCRIBER---|
@@ -144,7 +144,7 @@ Get the latest block number from Ethereum
144144
- Retry times (3 retries): 1 sec, 2 sec, 4 sec.
145145
*/
146146
func (s *AvsSubscriber) BlockNumberRetryable(ctx context.Context) (uint64, error) {
147-
return retry.RetryWithData(BlockNumber(s, ctx), retry.RpcRetryConfig())
147+
return retry.RetryWithData(BlockNumber(s, ctx), retry.EthCallRetryConfig())
148148
}
149149

150150
func FilterBatchV2(s *AvsSubscriber, opts *bind.FilterOpts, batchMerkleRoot [][32]byte) func() (*servicemanager.ContractAlignedLayerServiceManagerNewBatchV2Iterator, error) {
@@ -165,7 +165,7 @@ Get NewBatchV2 logs from the AVS contract.
165165
- Retry times (3 retries): 1 sec, 2 sec, 4 sec.
166166
*/
167167
func (s *AvsSubscriber) FilterBatchV2Retryable(opts *bind.FilterOpts, batchMerkleRoot [][32]byte) (*servicemanager.ContractAlignedLayerServiceManagerNewBatchV2Iterator, error) {
168-
return retry.RetryWithData(FilterBatchV2(s, opts, batchMerkleRoot), retry.RpcRetryConfig())
168+
return retry.RetryWithData(FilterBatchV2(s, opts, batchMerkleRoot), retry.EthCallRetryConfig())
169169
}
170170

171171
func FilterBatchV3(s *AvsSubscriber, opts *bind.FilterOpts, batchMerkleRoot [][32]byte) func() (*servicemanager.ContractAlignedLayerServiceManagerNewBatchV3Iterator, error) {
@@ -186,7 +186,7 @@ Get NewBatchV3 logs from the AVS contract.
186186
- Retry times (3 retries): 1 sec, 2 sec, 4 sec.
187187
*/
188188
func (s *AvsSubscriber) FilterBatchV3Retryable(opts *bind.FilterOpts, batchMerkleRoot [][32]byte) (*servicemanager.ContractAlignedLayerServiceManagerNewBatchV3Iterator, error) {
189-
return retry.RetryWithData(FilterBatchV3(s, opts, batchMerkleRoot), retry.RpcRetryConfig())
189+
return retry.RetryWithData(FilterBatchV3(s, opts, batchMerkleRoot), retry.EthCallRetryConfig())
190190
}
191191

192192
func BatchState(s *AvsSubscriber, opts *bind.CallOpts, arg0 [32]byte) func() (struct {
@@ -220,7 +220,7 @@ func (s *AvsSubscriber) BatchesStateRetryable(opts *bind.CallOpts, arg0 [32]byte
220220
RespondToTaskFeeLimit *big.Int
221221
}, error) {
222222

223-
return retry.RetryWithData(BatchState(s, opts, arg0), retry.RpcRetryConfig())
223+
return retry.RetryWithData(BatchState(s, opts, arg0), retry.EthCallRetryConfig())
224224
}
225225

226226
func SubscribeNewHead(s *AvsSubscriber, ctx context.Context, c chan<- *types.Header) func() (ethereum.Subscription, error) {
@@ -243,7 +243,7 @@ Subscribe to new heads from the Ethereum node.
243243
- Retry times (3 retries): 1 sec, 2 sec, 4 sec.
244244
*/
245245
func (s *AvsSubscriber) SubscribeNewHeadRetryable(ctx context.Context, c chan<- *types.Header) (ethereum.Subscription, error) {
246-
return retry.RetryWithData(SubscribeNewHead(s, ctx, c), retry.RpcRetryConfig())
246+
return retry.RetryWithData(SubscribeNewHead(s, ctx, c), retry.EthCallRetryConfig())
247247
}
248248

249249
func SubscribeToNewTasksV2(
@@ -270,7 +270,7 @@ func SubscribeToNewTasksV2Retryable(
270270
newTaskCreatedChan chan *servicemanager.ContractAlignedLayerServiceManagerNewBatchV2,
271271
batchMerkleRoot [][32]byte,
272272
) (event.Subscription, error) {
273-
return retry.RetryWithData(SubscribeToNewTasksV2(opts, serviceManager, newTaskCreatedChan, batchMerkleRoot), retry.RpcRetryConfig())
273+
return retry.RetryWithData(SubscribeToNewTasksV2(opts, serviceManager, newTaskCreatedChan, batchMerkleRoot), retry.EthCallRetryConfig())
274274
}
275275

276276
func SubscribeToNewTasksV3(
@@ -297,5 +297,5 @@ func SubscribeToNewTasksV3Retryable(
297297
newTaskCreatedChan chan *servicemanager.ContractAlignedLayerServiceManagerNewBatchV3,
298298
batchMerkleRoot [][32]byte,
299299
) (event.Subscription, error) {
300-
return retry.RetryWithData(SubscribeToNewTasksV3(opts, serviceManager, newTaskCreatedChan, batchMerkleRoot), retry.RpcRetryConfig())
300+
return retry.RetryWithData(SubscribeToNewTasksV3(opts, serviceManager, newTaskCreatedChan, batchMerkleRoot), retry.EthCallRetryConfig())
301301
}

core/retry.go

Lines changed: 19 additions & 19 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-
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.
28+
EthCallInitialInterval = 1 * time.Second // Initial delay for retry interval.
29+
EthCallMaxInterval = 60 * time.Second // Maximum interval an individual retry may have.
30+
EthCallMaxElapsedTime = 0 * time.Second // Maximum time all retries may take. `0` corresponds to no limit on the time of the retries.
31+
EthCallRandomizationFactor 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+
EthCallMultiplier float64 = 2 // Multiplier factor computed exponential retry interval is scaled by.
33+
EthCallNumRetries 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 {
@@ -44,25 +44,25 @@ type RetryConfig struct {
4444
NumRetries uint64
4545
}
4646

47-
func RpcRetryConfig() *RetryConfig {
47+
func EthCallRetryConfig() *RetryConfig {
4848
return &RetryConfig{
49-
InitialInterval: RpcInitialInterval,
50-
MaxInterval: RpcMaxInterval,
51-
MaxElapsedTime: RpcMaxElapsedTime,
52-
RandomizationFactor: RpcRandomizationFactor,
53-
Multiplier: RpcMultiplier,
54-
NumRetries: RpcNumRetries,
49+
InitialInterval: EthCallInitialInterval,
50+
MaxInterval: EthCallMaxInterval,
51+
MaxElapsedTime: EthCallMaxElapsedTime,
52+
RandomizationFactor: EthCallRandomizationFactor,
53+
Multiplier: EthCallMultiplier,
54+
NumRetries: EthCallNumRetries,
5555
}
5656
}
5757

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

core/retry_test.go

Lines changed: 7 additions & 7 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.RpcMultiplier,
52-
NumRetries: retry.RpcNumRetries,
51+
Multiplier: retry.EthCallMultiplier,
52+
NumRetries: retry.EthCallNumRetries,
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.RpcMultiplier,
71-
NumRetries: retry.RpcNumRetries,
70+
Multiplier: retry.EthCallMultiplier,
71+
NumRetries: retry.EthCallNumRetries,
7272
}
7373
err := retry.Retry(function, config)
7474
if err != nil {
@@ -170,7 +170,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
170170
}
171171

172172
// Assert Call succeeds when Anvil running
173-
receipt_function := utils.WaitForTransactionReceipt(*client, *client, hash, retry.RpcRetryConfig())
173+
receipt_function := utils.WaitForTransactionReceipt(*client, *client, hash, retry.EthCallRetryConfig())
174174
_, err = receipt_function()
175175
assert.NotNil(t, err, "Error Waiting for Transaction with Anvil Running: %s\n", err)
176176
if !strings.Contains(err.Error(), "not found") {
@@ -183,7 +183,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
183183
return
184184
}
185185

186-
receipt_function = utils.WaitForTransactionReceipt(*client, *client, hash, retry.RpcRetryConfig())
186+
receipt_function = utils.WaitForTransactionReceipt(*client, *client, hash, retry.EthCallRetryConfig())
187187
_, err = receipt_function()
188188
assert.NotNil(t, err)
189189
if _, ok := err.(retry.PermanentError); ok {
@@ -200,7 +200,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
200200
t.Errorf("Error setting up Anvil: %s\n", err)
201201
}
202202

203-
receipt_function = utils.WaitForTransactionReceipt(*client, *client, hash, retry.RpcRetryConfig())
203+
receipt_function = utils.WaitForTransactionReceipt(*client, *client, hash, retry.EthCallRetryConfig())
204204
_, err = receipt_function()
205205
assert.NotNil(t, err)
206206
if !strings.Contains(err.Error(), "not found") {

core/utils/eth_client_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@ func GetGasPriceRetryable(client eth.InstrumentedClient, fallbackClient eth.Inst
103103

104104
return gasPrice, nil
105105
}
106-
return retry.RetryWithData(respondToTaskV2_func, retry.RpcRetryConfig())
106+
return retry.RetryWithData(respondToTaskV2_func, retry.EthCallRetryConfig())
107107
}

0 commit comments

Comments
 (0)