Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export OPERATOR_ADDRESS ?= $(shell yq -r '.operator.address' $(CONFIG_FILE))
AGG_CONFIG_FILE?=config-files/config-aggregator.yaml

OPERATOR_VERSION=v0.15.2
EIGEN_SDK_GO_VERSION_DEVNET=v0.2.0-beta.1
EIGEN_SDK_GO_VERSION_TESTNET=v0.2.0-beta.1
EIGEN_SDK_GO_VERSION_MAINNET=v0.2.0-beta.1
EIGEN_SDK_GO_VERSION_DEVNET=v0.3.0
EIGEN_SDK_GO_VERSION_TESTNET=v0.3.0
EIGEN_SDK_GO_VERSION_MAINNET=v0.3.0

ifeq ($(OS),Linux)
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
Expand Down
40 changes: 26 additions & 14 deletions aggregator/pkg/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/hex"
"fmt"
"math/big"
"github.com/Layr-Labs/eigensdk-go/chainio/txmgr/geometric"
"sync"
"time"

Expand Down Expand Up @@ -119,7 +119,23 @@ func NewAggregator(aggregatorConfig config.AggregatorConfig) (*Aggregator, error
return nil, err
}

avsWriter, err := chainio.NewAvsWriterFromConfig(aggregatorConfig.BaseConfig, aggregatorConfig.EcdsaConfig, aggregatorMetrics)
geometricTransactionManagerParams := geometric.GeometricTxnManagerParams{
ConfirmationBlocks: aggregatorConfig.Aggregator.ConfirmationBlocks,
TxnBroadcastTimeout: aggregatorConfig.Aggregator.TxnBroadcastTimeout,
TxnConfirmationTimeout: aggregatorConfig.Aggregator.TxnConfirmationTimeout,
MaxSendTransactionRetry: aggregatorConfig.Aggregator.MaxSendTransactionRetry,
GetTxReceiptTickerDuration: aggregatorConfig.Aggregator.GetTxReceiptTickerDuration,
FallbackGasTipCap: aggregatorConfig.Aggregator.FallbackGasTipCap,
GasMultiplier: aggregatorConfig.Aggregator.GasMultiplier,
GasTipMultiplier: aggregatorConfig.Aggregator.GasTipMultiplier,
}

avsWriter, err := chainio.NewAvsWriterFromConfig(
aggregatorConfig.BaseConfig,
aggregatorConfig.EcdsaConfig,
aggregatorMetrics,
geometricTransactionManagerParams,
)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -327,23 +343,12 @@ func (agg *Aggregator) sendAggregatedResponse(batchIdentifierHash [32]byte, batc
"senderAddress", hex.EncodeToString(senderAddress[:]),
"batchIdentifierHash", hex.EncodeToString(batchIdentifierHash[:]))

// This function is a callback that is called when the gas price is bumped on the avsWriter.SendAggregatedResponse
onSetGasPrice := func(gasPrice *big.Int) {
agg.telemetry.TaskSetGasPrice(batchMerkleRoot, gasPrice.String())
}

startTime := time.Now()
receipt, err := agg.avsWriter.SendAggregatedResponse(
batchIdentifierHash,
batchMerkleRoot,
senderAddress,
nonSignerStakesAndSignature,
agg.AggregatorConfig.Aggregator.GasBaseBumpPercentage,
agg.AggregatorConfig.Aggregator.GasBumpIncrementalPercentage,
agg.AggregatorConfig.Aggregator.GasBumpPercentageLimit,
agg.AggregatorConfig.Aggregator.TimeToWaitBeforeBump,
agg.metrics,
onSetGasPrice,
)
if err != nil {
agg.walletMutex.Unlock()
Expand Down Expand Up @@ -410,7 +415,14 @@ func (agg *Aggregator) AddNewTask(batchMerkleRoot [32]byte, senderAddress [20]by
quorumNums := eigentypes.QuorumNums{eigentypes.QuorumNum(QUORUM_NUMBER)}
quorumThresholdPercentages := eigentypes.QuorumThresholdPercentages{eigentypes.QuorumThresholdPercentage(QUORUM_THRESHOLD)}

err := agg.blsAggregationService.InitializeNewTaskWithWindow(batchIndex, taskCreatedBlock, quorumNums, quorumThresholdPercentages, agg.AggregatorConfig.Aggregator.BlsServiceTaskTimeout, 15*time.Second)
taskMetadata := blsagg.NewTaskMetadata(
batchIndex,
taskCreatedBlock,
quorumNums,
quorumThresholdPercentages,
agg.AggregatorConfig.Aggregator.BlsServiceTaskTimeout,
).WithWindowDuration(15 * time.Second)
err := agg.blsAggregationService.InitializeNewTask(taskMetadata)
if err != nil {
agg.logger.Fatalf("BLS aggregation service error when initializing new task: %s", err)
}
Expand Down
15 changes: 11 additions & 4 deletions aggregator/pkg/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/hex"
"errors"
"fmt"
blsagg "github.com/Layr-Labs/eigensdk-go/services/bls_aggregation"
"net/http"
"net/rpc"
"time"
Expand Down Expand Up @@ -85,18 +86,24 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t

agg.logger.Info("Starting bls signature process")
go func() {
taskSignature := blsagg.NewTaskSignature(
taskIndex,
signedTaskResponse.BatchIdentifierHash,
&signedTaskResponse.BlsSignature,
signedTaskResponse.OperatorId,
)
err := agg.blsAggregationService.ProcessNewSignature(
context.Background(), taskIndex, signedTaskResponse.BatchIdentifierHash,
&signedTaskResponse.BlsSignature, signedTaskResponse.OperatorId,
context.Background(),
taskSignature,
)

if err != nil {
agg.logger.Warnf("BLS aggregation service error: %s", err)
done<- 1
done <- 1
// todo shouldn't we here close the channel with a reply = 1?
} else {
agg.logger.Info("BLS process succeeded")
done<- 0
done <- 0
}

close(done)
Expand Down
15 changes: 8 additions & 7 deletions config-files/config-aggregator-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ aggregator:
garbage_collector_tasks_age: 20 #The age of tasks that will be removed by the GC, in blocks. Suggested value for prod: '216000' (30 days)
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
gas_base_bump_percentage: 25 # Percentage to overestimate gas price when sending a task
gas_bump_incremental_percentage: 20 # An extra percentage to overestimate in each bump of respond to task. This is additive between tries
# Gas used formula = est_gas_by_node * (gas_base_bump_percentage + gas_bum_incremental_percentage * i) / 100, where i is the iteration number.
gas_bump_percentage_limit: 150 # The max percentage to bump the gas price.
# The Gas formula is percentage (gas_base_bump_percentage + gas_bump_incremental_percentage * i) / 100) is checked against this value
# If it is higher, it will default to `gas_bump_percentage_limit`
time_to_wait_before_bump: 72s # The time to wait for the receipt when responding to task. Suggested value 72 seconds (6 blocks)
confirmation_blocks: 0 # number of blocks to wait for a transaction to be confirmed. default: 0
txn_broadcast_timeout: 2m # time to wait for a transaction to be broadcasted to the network. default: 2 minutes
txn_confirmation_timeout: 60s # time to wait for a transaction to be confirmed (mined + confirmationBlocks blocks). default: 5 * 12 seconds
max_send_transaction_retry: 3 # max number of times to retry sending a transaction before failing. this applies to every transaction attempt when a nonce is bumped. default: 3
get_tx_receipt_ticker_duration: 3s # time to wait between checking for each transaction receipt while monitoring transactions to get mined. default: 3 seconds
fallback_gas_tip_cap: 5_000_000_000 # default gas tip cap to use when eth_maxPriorityFeePerGas is not available. default: 5 gwei
gas_multiplier: 1.2 # multiplier for gas limit to add a buffer and increase chance of tx getting included. Should be >= 1.0. default: 1.2
gas_tip_multiplier: 1.25 # multiplier for gas tip. Should be >= 1.0. default: 1.25
11 changes: 8 additions & 3 deletions config-files/config-aggregator-ethereum-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ aggregator:
garbage_collector_tasks_age: 300 #The age of tasks that will be removed by the GC, in blocks. Suggested value for prod: '216000' (30 days)
garbage_collector_tasks_interval: 300 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
gas_base_bump_percentage: 10 # How much to bump gas price when responding to task. Suggested value 10%
gas_bump_incremental_percentage: 2 # An extra percentage to bump every retry i*2 when responding to task. Suggested value 2%
time_to_wait_before_bump: 36s # The time to wait for the receipt when responding to task. Suggested value 36 seconds (3 blocks)
confirmation_blocks: 0 # number of blocks to wait for a transaction to be confirmed. default: 0
txn_broadcast_timeout: 2m # time to wait for a transaction to be broadcasted to the network. default: 2 minutes
txn_confirmation_timeout: 60s # time to wait for a transaction to be confirmed (mined + confirmationBlocks blocks). default: 5 * 12 seconds
max_send_transaction_retry: 3 # max number of times to retry sending a transaction before failing. this applies to every transaction attempt when a nonce is bumped. default: 3
get_tx_receipt_ticker_duration: 3s # time to wait between checking for each transaction receipt while monitoring transactions to get mined. default: 3 seconds
fallback_gas_tip_cap: 5_000_000_000 # default gas tip cap to use when eth_maxPriorityFeePerGas is not available. default: 5 gwei
gas_multiplier: 1.2 # multiplier for gas limit to add a buffer and increase chance of tx getting included. Should be >= 1.0. default: 1.2
gas_tip_multiplier: 1.25 # multiplier for gas tip. Should be >= 1.0. default: 1.25
42 changes: 9 additions & 33 deletions config-files/config-aggregator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ bls:
private_key_store_path: "config-files/anvil.aggregator.bls.key.json"
private_key_store_password: ""

# ## Batcher configurations # batcher:
# block_interval: 3
# batch_size_interval: 10
# max_proof_size: 67108864 # 64 MiB
# max_batch_size: 268435456 # 256 MiB
# pre_verification_is_enabled: true

## Aggregator Configurations
aggregator:
server_ip_port_address: localhost:8090
Expand All @@ -34,32 +27,15 @@ aggregator:
enable_metrics: true
metrics_ip_port_address: localhost:9091
telemetry_ip_port_address: localhost:4001
garbage_collector_period: 2m #The period of the GC process. Suggested value for Prod: '168h' (7 days)
garbage_collector_period: 168h #The period of the GC process. Suggested value for Prod: '168h' (7 days)
garbage_collector_tasks_age: 20 #The age of tasks that will be removed by the GC, in blocks. Suggested value for prod: '216000' (30 days)
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
gas_base_bump_percentage: 25 # Percentage to overestimate gas price when sending a task
gas_bump_incremental_percentage: 20 # An extra percentage to overestimate in each bump of respond to task. This is additive between tries
# Gas used formula = est_gas_by_node * (gas_base_bump_percentage + gas_bum_incremental_percentage * i) / 100, where i is the iteration number.
gas_bump_percentage_limit: 150 # The max percentage to bump the gas price.
# The Gas formula is percentage (gas_base_bump_percentage + gas_bump_incremental_percentage * i) / 100) is checked against this value
# If it is higher, it will default to `gas_bump_percentage_limit`
time_to_wait_before_bump: 72s # The time to wait for the receipt when responding to task. Suggested value 72 seconds (6 blocks)

## Operator Configurations
# operator:
# aggregator_rpc_server_ip_port_address: localhost:8090
# address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
# earnings_receiver_address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
# delegation_approver_address: "0x0000000000000000000000000000000000000000"
# staker_opt_out_window_blocks: 0
# metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json"
# enable_metrics: true
# metrics_ip_port_address: localhost:9092
# max_batch_size: 268435456 # 256 MiB
# # Operators variables needed for register it in EigenLayer
# el_delegation_manager_address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
# private_key_store_path: config-files/anvil.ecdsa.key.json
# bls_private_key_store_path: config-files/anvil.bls.key.json
# signer_type: local_keystore
# chain_id: 31337
confirmation_blocks: 0 # number of blocks to wait for a transaction to be confirmed. default: 0
txn_broadcast_timeout: 2m # time to wait for a transaction to be broadcasted to the network. default: 2 minutes
txn_confirmation_timeout: 60s # time to wait for a transaction to be confirmed (mined + confirmationBlocks blocks). default: 5 * 12 seconds
max_send_transaction_retry: 3 # max number of times to retry sending a transaction before failing. this applies to every transaction attempt when a nonce is bumped. default: 3
get_tx_receipt_ticker_duration: 3s # time to wait between checking for each transaction receipt while monitoring transactions to get mined. default: 3 seconds
fallback_gas_tip_cap: 5_000_000_000 # default gas tip cap to use when eth_maxPriorityFeePerGas is not available. default: 5 gwei
gas_multiplier: 1.2 # multiplier for gas limit to add a buffer and increase chance of tx getting included. Should be >= 1.0. default: 1.2
gas_tip_multiplier: 1.25 # multiplier for gas tip. Should be >= 1.0. default: 1.25
Loading
Loading