Skip to content

Commit cef1926

Browse files
committed
feat: use GeometricTxnManager
1 parent a681973 commit cef1926

7 files changed

Lines changed: 113 additions & 205 deletions

File tree

aggregator/pkg/aggregator.go

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"encoding/hex"
66
"fmt"
7-
"math/big"
7+
"github.com/Layr-Labs/eigensdk-go/chainio/txmgr/geometric"
88
"sync"
99
"time"
1010

@@ -119,7 +119,23 @@ func NewAggregator(aggregatorConfig config.AggregatorConfig) (*Aggregator, error
119119
return nil, err
120120
}
121121

122-
avsWriter, err := chainio.NewAvsWriterFromConfig(aggregatorConfig.BaseConfig, aggregatorConfig.EcdsaConfig, aggregatorMetrics)
122+
geometricTransactionManagerParams := geometric.GeometricTxnManagerParams{
123+
ConfirmationBlocks: aggregatorConfig.Aggregator.ConfirmationBlocks,
124+
TxnBroadcastTimeout: aggregatorConfig.Aggregator.TxnBroadcastTimeout,
125+
TxnConfirmationTimeout: aggregatorConfig.Aggregator.TxnConfirmationTimeout,
126+
MaxSendTransactionRetry: aggregatorConfig.Aggregator.MaxSendTransactionRetry,
127+
GetTxReceiptTickerDuration: aggregatorConfig.Aggregator.GetTxReceiptTickerDuration,
128+
FallbackGasTipCap: aggregatorConfig.Aggregator.FallbackGasTipCap,
129+
GasMultiplier: aggregatorConfig.Aggregator.GasMultiplier,
130+
GasTipMultiplier: aggregatorConfig.Aggregator.GasTipMultiplier,
131+
}
132+
133+
avsWriter, err := chainio.NewAvsWriterFromConfig(
134+
aggregatorConfig.BaseConfig,
135+
aggregatorConfig.EcdsaConfig,
136+
aggregatorMetrics,
137+
geometricTransactionManagerParams,
138+
)
123139
if err != nil {
124140
return nil, err
125141
}
@@ -327,23 +343,12 @@ func (agg *Aggregator) sendAggregatedResponse(batchIdentifierHash [32]byte, batc
327343
"senderAddress", hex.EncodeToString(senderAddress[:]),
328344
"batchIdentifierHash", hex.EncodeToString(batchIdentifierHash[:]))
329345

330-
// This function is a callback that is called when the gas price is bumped on the avsWriter.SendAggregatedResponse
331-
onSetGasPrice := func(gasPrice *big.Int) {
332-
agg.telemetry.TaskSetGasPrice(batchMerkleRoot, gasPrice.String())
333-
}
334-
335346
startTime := time.Now()
336347
receipt, err := agg.avsWriter.SendAggregatedResponse(
337348
batchIdentifierHash,
338349
batchMerkleRoot,
339350
senderAddress,
340351
nonSignerStakesAndSignature,
341-
agg.AggregatorConfig.Aggregator.GasBaseBumpPercentage,
342-
agg.AggregatorConfig.Aggregator.GasBumpIncrementalPercentage,
343-
agg.AggregatorConfig.Aggregator.GasBumpPercentageLimit,
344-
agg.AggregatorConfig.Aggregator.TimeToWaitBeforeBump,
345-
agg.metrics,
346-
onSetGasPrice,
347352
)
348353
if err != nil {
349354
agg.walletMutex.Unlock()

config-files/config-aggregator-docker.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ aggregator:
3131
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)
3232
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
3333
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
34-
gas_base_bump_percentage: 25 # Percentage to overestimate gas price when sending a task
35-
gas_bump_incremental_percentage: 20 # An extra percentage to overestimate in each bump of respond to task. This is additive between tries
36-
# Gas used formula = est_gas_by_node * (gas_base_bump_percentage + gas_bum_incremental_percentage * i) / 100, where i is the iteration number.
37-
gas_bump_percentage_limit: 150 # The max percentage to bump the gas price.
38-
# The Gas formula is percentage (gas_base_bump_percentage + gas_bump_incremental_percentage * i) / 100) is checked against this value
39-
# If it is higher, it will default to `gas_bump_percentage_limit`
40-
time_to_wait_before_bump: 72s # The time to wait for the receipt when responding to task. Suggested value 72 seconds (6 blocks)
34+
confirmation_blocks: 0 # number of blocks to wait for a transaction to be confirmed. default: 0
35+
txn_broadcast_timeout: 2m # time to wait for a transaction to be broadcasted to the network. default: 2 minutes
36+
txn_confirmation_timeout: 60s # time to wait for a transaction to be confirmed (mined + confirmationBlocks blocks). default: 5 * 12 seconds
37+
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
38+
get_tx_receipt_ticker_duration: 3s # time to wait between checking for each transaction receipt while monitoring transactions to get mined. default: 3 seconds
39+
fallback_gas_tip_cap: 5_000_000_000 # default gas tip cap to use when eth_maxPriorityFeePerGas is not available. default: 5 gwei
40+
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
41+
gas_tip_multiplier: 1.25 # multiplier for gas tip. Should be >= 1.0. default: 1.25

config-files/config-aggregator-ethereum-package.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ aggregator:
3131
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)
3232
garbage_collector_tasks_interval: 300 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
3333
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
34-
gas_base_bump_percentage: 10 # How much to bump gas price when responding to task. Suggested value 10%
35-
gas_bump_incremental_percentage: 2 # An extra percentage to bump every retry i*2 when responding to task. Suggested value 2%
36-
time_to_wait_before_bump: 36s # The time to wait for the receipt when responding to task. Suggested value 36 seconds (3 blocks)
34+
confirmation_blocks: 0 # number of blocks to wait for a transaction to be confirmed. default: 0
35+
txn_broadcast_timeout: 2m # time to wait for a transaction to be broadcasted to the network. default: 2 minutes
36+
txn_confirmation_timeout: 60s # time to wait for a transaction to be confirmed (mined + confirmationBlocks blocks). default: 5 * 12 seconds
37+
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
38+
get_tx_receipt_ticker_duration: 3s # time to wait between checking for each transaction receipt while monitoring transactions to get mined. default: 3 seconds
39+
fallback_gas_tip_cap: 5_000_000_000 # default gas tip cap to use when eth_maxPriorityFeePerGas is not available. default: 5 gwei
40+
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
41+
gas_tip_multiplier: 1.25 # multiplier for gas tip. Should be >= 1.0. default: 1.25

config-files/config-aggregator.yaml

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@ bls:
1919
private_key_store_path: "config-files/anvil.aggregator.bls.key.json"
2020
private_key_store_password: ""
2121

22-
# ## Batcher configurations # batcher:
23-
# block_interval: 3
24-
# batch_size_interval: 10
25-
# max_proof_size: 67108864 # 64 MiB
26-
# max_batch_size: 268435456 # 256 MiB
27-
# pre_verification_is_enabled: true
28-
2922
## Aggregator Configurations
3023
aggregator:
3124
server_ip_port_address: localhost:8090
@@ -34,32 +27,15 @@ aggregator:
3427
enable_metrics: true
3528
metrics_ip_port_address: localhost:9091
3629
telemetry_ip_port_address: localhost:4001
37-
garbage_collector_period: 2m #The period of the GC process. Suggested value for Prod: '168h' (7 days)
30+
garbage_collector_period: 168h #The period of the GC process. Suggested value for Prod: '168h' (7 days)
3831
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)
3932
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
4033
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
41-
gas_base_bump_percentage: 25 # Percentage to overestimate gas price when sending a task
42-
gas_bump_incremental_percentage: 20 # An extra percentage to overestimate in each bump of respond to task. This is additive between tries
43-
# Gas used formula = est_gas_by_node * (gas_base_bump_percentage + gas_bum_incremental_percentage * i) / 100, where i is the iteration number.
44-
gas_bump_percentage_limit: 150 # The max percentage to bump the gas price.
45-
# The Gas formula is percentage (gas_base_bump_percentage + gas_bump_incremental_percentage * i) / 100) is checked against this value
46-
# If it is higher, it will default to `gas_bump_percentage_limit`
47-
time_to_wait_before_bump: 72s # The time to wait for the receipt when responding to task. Suggested value 72 seconds (6 blocks)
48-
49-
## Operator Configurations
50-
# operator:
51-
# aggregator_rpc_server_ip_port_address: localhost:8090
52-
# address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
53-
# earnings_receiver_address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
54-
# delegation_approver_address: "0x0000000000000000000000000000000000000000"
55-
# staker_opt_out_window_blocks: 0
56-
# metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json"
57-
# enable_metrics: true
58-
# metrics_ip_port_address: localhost:9092
59-
# max_batch_size: 268435456 # 256 MiB
60-
# # Operators variables needed for register it in EigenLayer
61-
# el_delegation_manager_address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
62-
# private_key_store_path: config-files/anvil.ecdsa.key.json
63-
# bls_private_key_store_path: config-files/anvil.bls.key.json
64-
# signer_type: local_keystore
65-
# chain_id: 31337
34+
confirmation_blocks: 0 # number of blocks to wait for a transaction to be confirmed. default: 0
35+
txn_broadcast_timeout: 2m # time to wait for a transaction to be broadcasted to the network. default: 2 minutes
36+
txn_confirmation_timeout: 60s # time to wait for a transaction to be confirmed (mined + confirmationBlocks blocks). default: 5 * 12 seconds
37+
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
38+
get_tx_receipt_ticker_duration: 3s # time to wait between checking for each transaction receipt while monitoring transactions to get mined. default: 3 seconds
39+
fallback_gas_tip_cap: 5_000_000_000 # default gas tip cap to use when eth_maxPriorityFeePerGas is not available. default: 5 gwei
40+
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
41+
gas_tip_multiplier: 1.25 # multiplier for gas tip. Should be >= 1.0. default: 1.25

0 commit comments

Comments
 (0)