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

refactor(contract): rename RespondToTaskV2 to RespondToTask in AlignedLayerServiceManager.sol #1768

Open
wants to merge 5 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions contracts/bindings/AlignedLayerServiceManager/binding.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/src/core/AlignedLayerServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ contract AlignedLayerServiceManager is
);
}

function respondToTaskV2(
function respondToTask(
// (batchMerkleRoot,senderAddress) is signed as a way to verify the batch was right
bytes32 batchMerkleRoot,
address senderAddress,
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/core/IAlignedLayerServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ interface IAlignedLayerServiceManager {
uint256 respondToTaskFeeLimit
) external payable;

function respondToTaskV2(
function respondToTask(
bytes32 batchMerkleRoot,
address senderAddress,
IBLSSignatureChecker.NonSignerStakesAndSignature
Expand Down
8 changes: 4 additions & 4 deletions core/chainio/avs_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewAvsWriterFromConfig(baseConfig *config.BaseConfig, ecdsaConfig *config.E
func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMerkleRoot [32]byte, senderAddress [20]byte, nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature, gasBumpPercentage uint, gasBumpIncrementalPercentage uint, gasBumpPercentageLimit uint, timeToWaitBeforeBump time.Duration, metrics *metrics.Metrics, onSetGasPrice func(*big.Int)) (*types.Receipt, error) {
txOpts := *w.Signer.GetTxOpts()
txOpts.NoSend = true // simulate the transaction
simTx, err := w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature, retry.SendToChainRetryParams())
simTx, err := w.RespondToTaskRetryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature, retry.SendToChainRetryParams())
if err != nil {
return nil, err
}
Expand All @@ -108,7 +108,7 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe

batchMerkleRootHashString := hex.EncodeToString(batchMerkleRoot[:])

respondToTaskV2Func := func() (*types.Receipt, error) {
respondToTaskFunc := func() (*types.Receipt, error) {
gasPrice, err := utils.GetGasPriceRetryable(w.Client, w.ClientFallback, retry.NetworkRetryParams())
if err != nil {
return nil, err
Expand Down Expand Up @@ -175,7 +175,7 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
}

w.logger.Infof("Sending RespondToTask transaction with a gas price of %v", txOpts.GasPrice, "merkle root", batchMerkleRootHashString)
realTx, err := w.RespondToTaskV2Retryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature, retry.SendToChainRetryParams())
realTx, err := w.RespondToTaskRetryable(&txOpts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature, retry.SendToChainRetryParams())
if err != nil {
w.logger.Errorf("Respond to task transaction err, %v", err, "merkle root", batchMerkleRootHashString)
return nil, err
Expand Down Expand Up @@ -203,7 +203,7 @@ func (w *AvsWriter) SendAggregatedResponse(batchIdentifierHash [32]byte, batchMe
// This just retries the bump of a fee in case of a timeout
// The wait is done before on WaitForTransactionReceiptRetryable, and all the functions are retriable,
// so this retry doesn't need to wait more time
return retry.RetryWithData(respondToTaskV2Func, retry.RespondToTaskV2())
return retry.RetryWithData(respondToTaskFunc, retry.RespondToTask())
}

// Calculates the transaction cost from the receipt and updates the total amount paid by the aggregator metric
Expand Down
12 changes: 6 additions & 6 deletions core/chainio/retryable.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ import (
// |---AVS_WRITER---|

/*
RespondToTaskV2Retryable
RespondToTaskRetryable
Send a transaction to the AVS contract to respond to a task.
- All errors are considered Transient Errors
- Retry times (3 retries): 12 sec (1 Blocks), 24 sec (2 Blocks), 48 sec (4 Blocks)
- NOTE: Contract call reverts are not considered `PermanentError`'s as block reorg's may lead to contract call revert in which case the aggregator should retry.
*/
func (w *AvsWriter) RespondToTaskV2Retryable(opts *bind.TransactOpts, batchMerkleRoot [32]byte, senderAddress common.Address, nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature, config *retry.RetryParams) (*types.Transaction, error) {
respondToTaskV2_func := func() (*types.Transaction, error) {
func (w *AvsWriter) RespondToTaskRetryable(opts *bind.TransactOpts, batchMerkleRoot [32]byte, senderAddress common.Address, nonSignerStakesAndSignature servicemanager.IBLSSignatureCheckerNonSignerStakesAndSignature, config *retry.RetryParams) (*types.Transaction, error) {
respondToTask_func := func() (*types.Transaction, error) {
// Try with main connection
tx, err := w.AvsContractBindings.ServiceManager.RespondToTaskV2(opts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
tx, err := w.AvsContractBindings.ServiceManager.RespondToTask(opts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
if err != nil {
// If error try with fallback
tx, err = w.AvsContractBindings.ServiceManagerFallback.RespondToTaskV2(opts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
tx, err = w.AvsContractBindings.ServiceManagerFallback.RespondToTask(opts, batchMerkleRoot, senderAddress, nonSignerStakesAndSignature)
}

return tx, err
}
return retry.RetryWithData(respondToTaskV2_func, config)
return retry.RetryWithData(respondToTask_func, config)
}

/*
Expand Down
16 changes: 8 additions & 8 deletions core/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const (
WaitForTxMaxInterval = 2 * time.Second // Maximum interval for an individual retry.
WaitForTxNumRetries = 0 // Total number of retries attempted. If 0, retries indefinitely until maxElapsedTime is reached.

// Retry Parameters for RespondToTaskV2 in the Fee Bump
RespondToTaskV2MaxInterval = time.Millisecond * 500 // Maximum interval for an individual retry.
RespondToTaskV2MaxElapsedTime = 0 // Maximum time all retries may take. `0` corresponds to no limit on the time of the retries.
RespondToTaskV2NumRetries uint64 = 0 // Total number of retries attempted. If 0, retries indefinitely until maxElapsedTime is reached.
// Retry Parameters for RespondToTask in the Fee Bump
RespondToTaskMaxInterval = time.Millisecond * 500 // Maximum interval for an individual retry.
RespondToTaskMaxElapsedTime = 0 // Maximum time all retries may take. `0` corresponds to no limit on the time of the retries.
RespondToTaskNumRetries uint64 = 0 // Total number of retries attempted. If 0, retries indefinitely until maxElapsedTime is reached.
)

type RetryParams struct {
Expand Down Expand Up @@ -77,14 +77,14 @@ func SendToChainRetryParams() *RetryParams {
}
}

func RespondToTaskV2() *RetryParams {
func RespondToTask() *RetryParams {
return &RetryParams{
InitialInterval: ChainInitialInterval,
MaxInterval: RespondToTaskV2MaxInterval,
MaxElapsedTime: RespondToTaskV2MaxElapsedTime,
MaxInterval: RespondToTaskMaxInterval,
MaxElapsedTime: RespondToTaskMaxElapsedTime,
RandomizationFactor: NetworkRandomizationFactor,
Multiplier: NetworkMultiplier,
NumRetries: RespondToTaskV2NumRetries,
NumRetries: RespondToTaskNumRetries,
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/utils/eth_client_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Get the gas price from the client with retry logic.
- Retry times: 1 sec, 2 sec, 4 sec
*/
func GetGasPriceRetryable(client eth.InstrumentedClient, fallbackClient eth.InstrumentedClient, config *retry.RetryParams) (*big.Int, error) {
respondToTaskV2_func := func() (*big.Int, error) {
suggestGasPrice_func := func() (*big.Int, error) {
gasPrice, err := client.SuggestGasPrice(context.Background())
if err != nil {
gasPrice, err = fallbackClient.SuggestGasPrice(context.Background())
Expand All @@ -104,5 +104,5 @@ func GetGasPriceRetryable(client eth.InstrumentedClient, fallbackClient eth.Inst

return gasPrice, nil
}
return retry.RetryWithData(respondToTaskV2_func, config)
return retry.RetryWithData(suggestGasPrice_func, config)
}
2 changes: 1 addition & 1 deletion docs/0_internal/4_a_pause_contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Note: when executing a Pause, you can only ADD functions to the paused list, and
Note: the list of pausable functions and their numbers can be seen in the `AlignedLayerServiceManager.sol` contract. But the list is the following:

0. createNewTask
1. respondToTaskV2
1. respondToTask
2. verifyBatchInclusion
3. withdraw
4. depositToBatcher
Expand Down
2 changes: 1 addition & 1 deletion docs/0_internal/pausable.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Note: when executing a Pause, you can only ADD functions to the paused list, and
Note: the list of pausable functions and their numbers can be seen in the `AlignedLayerServiceManager.sol` contract. But the list is the following:

0. createNewTask
1. respondToTaskV2
1. respondToTask
2. verifyBatchInclusion
3. withdraw
4. depositToBatcher
Expand Down
Loading