Skip to content

Commit d814f2b

Browse files
fix: operator downtime (#1073)
Co-authored-by: Urix <[email protected]>
1 parent 7d04367 commit d814f2b

File tree

10 files changed

+345
-192
lines changed

10 files changed

+345
-192
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ batcher/aligned/batch_inclusion_responses/*
1111
**/aligned_verification_data
1212
**/broadcast
1313
volume
14+
config-files/*.last_processed_batch.json
1415

1516
nonce_*.bin

config-files/config-operator-1.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
# Common variables for all the services
22
# 'production' only prints info and above. 'development' also prints debug
3-
environment: "development"
4-
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
5-
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
6-
eth_rpc_url: "http://localhost:8545"
7-
eth_rpc_url_fallback: "http://localhost:8545"
8-
eth_ws_url: "ws://localhost:8545"
9-
eth_ws_url_fallback: "ws://localhost:8545"
10-
eigen_metrics_ip_port_address: "localhost:9090"
3+
environment: 'development'
4+
aligned_layer_deployment_config_file_path: './contracts/script/output/devnet/alignedlayer_deployment_output.json'
5+
eigen_layer_deployment_config_file_path: './contracts/script/output/devnet/eigenlayer_deployment_output.json'
6+
eth_rpc_url: 'http://localhost:8545'
7+
eth_rpc_url_fallback: 'http://localhost:8545'
8+
eth_ws_url: 'ws://localhost:8545'
9+
eth_ws_url_fallback: 'ws://localhost:8545'
10+
eigen_metrics_ip_port_address: 'localhost:9090'
1111

1212
## ECDSA Configurations
1313
ecdsa:
14-
private_key_store_path: "config-files/devnet/keys/operator-1.ecdsa.key.json"
15-
private_key_store_password: ""
14+
private_key_store_path: 'config-files/devnet/keys/operator-1.ecdsa.key.json'
15+
private_key_store_password: ''
1616

1717
## BLS Configurations
1818
bls:
19-
private_key_store_path: "config-files/devnet/keys/operator-1.bls.key.json"
20-
private_key_store_password: ""
19+
private_key_store_path: 'config-files/devnet/keys/operator-1.bls.key.json'
20+
private_key_store_password: ''
2121

2222
## Operator Configurations
2323
operator:
2424
aggregator_rpc_server_ip_port_address: localhost:8090
2525
operator_tracker_ip_port_address: http://localhost:3030
2626
address: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
2727
earnings_receiver_address: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
28-
delegation_approver_address: "0x0000000000000000000000000000000000000000"
28+
delegation_approver_address: '0x0000000000000000000000000000000000000000'
2929
staker_opt_out_window_blocks: 0
30-
metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json"
30+
metadata_url: 'https://yetanotherco.github.io/operator_metadata/metadata.json'
3131
enable_metrics: true
3232
metrics_ip_port_address: localhost:9092
3333
max_batch_size: 268435456 # 256 MiB
34+
last_processed_batch_filepath: 'config-files/operator-1.last_processed_batch.json'
3435

3536
# Operators variables needed for register it in EigenLayer
36-
el_delegation_manager_address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
37+
el_delegation_manager_address: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9'
3738
private_key_store_path: config-files/devnet/keys/operator-1.ecdsa.key.json
3839
bls_private_key_store_path: config-files/devnet/keys/operator-1.bls.key.json
3940
signer_type: local_keystore

config-files/config-operator-2.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
# Common variables for all the services
22
# 'production' only prints info and above. 'development' also prints debug
3-
environment: "development"
4-
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
5-
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
6-
eth_rpc_url: "http://localhost:8545"
7-
eth_rpc_url_fallback: "http://localhost:8545"
8-
eth_ws_url: "ws://localhost:8545"
9-
eth_ws_url_fallback: "ws://localhost:8545"
10-
eigen_metrics_ip_port_address: "localhost:9090"
3+
environment: 'development'
4+
aligned_layer_deployment_config_file_path: './contracts/script/output/devnet/alignedlayer_deployment_output.json'
5+
eigen_layer_deployment_config_file_path: './contracts/script/output/devnet/eigenlayer_deployment_output.json'
6+
eth_rpc_url: 'http://localhost:8545'
7+
eth_rpc_url_fallback: 'http://localhost:8545'
8+
eth_ws_url: 'ws://localhost:8545'
9+
eth_ws_url_fallback: 'ws://localhost:8545'
10+
eigen_metrics_ip_port_address: 'localhost:9090'
1111

1212
## ECDSA Configurations
1313
ecdsa:
14-
private_key_store_path: "config-files/devnet/keys/operator-2.ecdsa.key.json"
15-
private_key_store_password: ""
14+
private_key_store_path: 'config-files/devnet/keys/operator-2.ecdsa.key.json'
15+
private_key_store_password: ''
1616

1717
## BLS Configurations
1818
bls:
19-
private_key_store_path: "config-files/devnet/keys/operator-2.bls.key.json"
20-
private_key_store_password: ""
19+
private_key_store_path: 'config-files/devnet/keys/operator-2.bls.key.json'
20+
private_key_store_password: ''
2121

2222
## Operator Configurations
2323
operator:
2424
aggregator_rpc_server_ip_port_address: localhost:8090
2525
operator_tracker_ip_port_address: http://localhost:3030
2626
address: 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
2727
earnings_receiver_address: 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
28-
delegation_approver_address: "0x0000000000000000000000000000000000000000"
28+
delegation_approver_address: '0x0000000000000000000000000000000000000000'
2929
staker_opt_out_window_blocks: 0
30-
metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json"
30+
metadata_url: 'https://yetanotherco.github.io/operator_metadata/metadata.json'
3131
max_batch_size: 268435456 # 256 MiB
32+
last_processed_batch_filepath: 'config-files/operator-2.last_processed_batch.json'
3233

3334
# Operators variables needed for register it in EigenLayer
34-
el_delegation_manager_address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
35+
el_delegation_manager_address: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9'
3536
private_key_store_path: config-files/devnet/keys/operator-2.ecdsa.key.json
3637
bls_private_key_store_path: config-files/devnet/keys/operator-2.bls.key.json
3738
signer_type: local_keystore

config-files/config-operator-3.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
# Common variables for all the services
22
# 'production' only prints info and above. 'development' also prints debug
3-
environment: "development"
4-
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
5-
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
6-
eth_rpc_url: "http://localhost:8545"
7-
eth_rpc_url_fallback: "http://localhost:8545"
8-
eth_ws_url: "ws://localhost:8545"
9-
eth_ws_url_fallback: "ws://localhost:8545"
10-
eigen_metrics_ip_port_address: "localhost:9090"
3+
environment: 'development'
4+
aligned_layer_deployment_config_file_path: './contracts/script/output/devnet/alignedlayer_deployment_output.json'
5+
eigen_layer_deployment_config_file_path: './contracts/script/output/devnet/eigenlayer_deployment_output.json'
6+
eth_rpc_url: 'http://localhost:8545'
7+
eth_rpc_url_fallback: 'http://localhost:8545'
8+
eth_ws_url: 'ws://localhost:8545'
9+
eth_ws_url_fallback: 'ws://localhost:8545'
10+
eigen_metrics_ip_port_address: 'localhost:9090'
1111

1212
## ECDSA Configurations
1313
ecdsa:
14-
private_key_store_path: "config-files/devnet/keys/operator-3.ecdsa.key.json"
15-
private_key_store_password: ""
14+
private_key_store_path: 'config-files/devnet/keys/operator-3.ecdsa.key.json'
15+
private_key_store_password: ''
1616

1717
## BLS Configurations
1818
bls:
19-
private_key_store_path: "config-files/devnet/keys/operator-3.bls.key.json"
20-
private_key_store_password: ""
19+
private_key_store_path: 'config-files/devnet/keys/operator-3.bls.key.json'
20+
private_key_store_password: ''
2121

2222
## Operator Configurations
2323
operator:
2424
aggregator_rpc_server_ip_port_address: localhost:8090
2525
operator_tracker_ip_port_address: http://localhost:3030
2626
address: 0x90F79bf6EB2c4f870365E785982E1f101E93b906
2727
earnings_receiver_address: 0x90F79bf6EB2c4f870365E785982E1f101E93b906
28-
delegation_approver_address: "0x0000000000000000000000000000000000000000"
28+
delegation_approver_address: '0x0000000000000000000000000000000000000000'
2929
staker_opt_out_window_blocks: 0
30-
metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json"
30+
metadata_url: 'https://yetanotherco.github.io/operator_metadata/metadata.json'
3131
max_batch_size: 268435456 # 256 MiB
32+
last_processed_batch_filepath: 'config-files/operator-3.last_processed_batch.json'
3233

3334
# Operators variables needed for register it in EigenLayer
34-
el_delegation_manager_address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
35+
el_delegation_manager_address: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9'
3536
private_key_store_path: config-files/devnet/keys/operator-3.ecdsa.key.json
3637
bls_private_key_store_path: config-files/devnet/keys/operator-3.bls.key.json
3738
signer_type: local_keystore

config-files/config-operator.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
# Common variables for all the services
22
# 'production' only prints info and above. 'development' also prints debug
3-
environment: "production"
4-
aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json"
5-
eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json"
6-
eth_rpc_url: "https://ethereum-holesky-rpc.publicnode.com"
7-
eth_rpc_url_fallback: "https://ethereum-holesky-rpc.publicnode.com"
8-
eth_ws_url: "wss://ethereum-holesky-rpc.publicnode.com"
9-
eth_ws_url_fallback: "wss://ethereum-holesky-rpc.publicnode.com"
10-
eigen_metrics_ip_port_address: "localhost:9090"
3+
environment: 'production'
4+
aligned_layer_deployment_config_file_path: './contracts/script/output/holesky/alignedlayer_deployment_output.json'
5+
eigen_layer_deployment_config_file_path: './contracts/script/output/holesky/eigenlayer_deployment_output.json'
6+
eth_rpc_url: 'https://ethereum-holesky-rpc.publicnode.com'
7+
eth_rpc_url_fallback: 'https://ethereum-holesky-rpc.publicnode.com'
8+
eth_ws_url: 'wss://ethereum-holesky-rpc.publicnode.com'
9+
eth_ws_url_fallback: 'wss://ethereum-holesky-rpc.publicnode.com'
10+
eigen_metrics_ip_port_address: 'localhost:9090'
1111

1212
## ECDSA Configurations
1313
ecdsa:
14-
private_key_store_path: "<ecdsa_key_store_location_path>"
15-
private_key_store_password: "<ecdsa_key_store_password>"
14+
private_key_store_path: '<ecdsa_key_store_location_path>'
15+
private_key_store_password: '<ecdsa_key_store_password>'
1616

1717
## BLS Configurations
1818
bls:
19-
private_key_store_path: "<bls_key_store_location_path>"
20-
private_key_store_password: "<bls_key_store_password>"
19+
private_key_store_path: '<bls_key_store_location_path>'
20+
private_key_store_password: '<bls_key_store_password>'
2121

2222
## Operator Configurations
2323
operator:
2424
aggregator_rpc_server_ip_port_address: aggregator.alignedlayer.com:8090
2525
operator_tracker_ip_port_address: https://holesky.tracker.alignedlayer.com
26-
address: "<operator_address>"
27-
earnings_receiver_address: "<earnings_receiver_address>" #Can be the same as the operator.
28-
delegation_approver_address: "0x0000000000000000000000000000000000000000"
26+
address: '<operator_address>'
27+
earnings_receiver_address: '<earnings_receiver_address>' #Can be the same as the operator.
28+
delegation_approver_address: '0x0000000000000000000000000000000000000000'
2929
staker_opt_out_window_blocks: 0
30-
metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json"
30+
metadata_url: 'https://yetanotherco.github.io/operator_metadata/metadata.json'
3131
enable_metrics: true
3232
metrics_ip_port_address: localhost:9092
3333
max_batch_size: 268435456 # 256 MiB
34+
last_processed_batch_filepath: 'config-files/operator.last_processed_batch.json'

config-files/config.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# Common variables for all the services
22
# 'production' only prints info and above. 'development' also prints debug
3-
environment: "production"
4-
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
5-
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
6-
eth_rpc_url: "http://localhost:8545"
7-
eth_rpc_url_fallback: "http://localhost:8545"
8-
eth_ws_url: "ws://localhost:8545"
9-
eth_ws_url_fallback: "ws://localhost:8545"
10-
eigen_metrics_ip_port_address: "localhost:9090"
3+
environment: 'production'
4+
aligned_layer_deployment_config_file_path: './contracts/script/output/devnet/alignedlayer_deployment_output.json'
5+
eigen_layer_deployment_config_file_path: './contracts/script/output/devnet/eigenlayer_deployment_output.json'
6+
eth_rpc_url: 'http://localhost:8545'
7+
eth_rpc_url_fallback: 'http://localhost:8545'
8+
eth_ws_url: 'ws://localhost:8545'
9+
eth_ws_url_fallback: 'ws://localhost:8545'
10+
eigen_metrics_ip_port_address: 'localhost:9090'
1111

1212
## ECDSA Configurations
1313
ecdsa:
14-
private_key_store_path: "config-files/anvil.ecdsa.key.json"
15-
private_key_store_password: ""
14+
private_key_store_path: 'config-files/anvil.ecdsa.key.json'
15+
private_key_store_password: ''
1616

1717
## BLS Configurations
1818
bls:
19-
private_key_store_path: "config-files/anvil.bls.key.json"
20-
private_key_store_password: ""
19+
private_key_store_path: 'config-files/anvil.bls.key.json'
20+
private_key_store_password: ''
2121

2222
## Batcher configurations
2323
batcher:
@@ -42,14 +42,15 @@ operator:
4242
operator_tracker_ip_port_address: http://localhost:3030
4343
address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
4444
earnings_receiver_address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
45-
delegation_approver_address: "0x0000000000000000000000000000000000000000"
45+
delegation_approver_address: '0x0000000000000000000000000000000000000000'
4646
staker_opt_out_window_blocks: 0
47-
metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json"
47+
metadata_url: 'https://yetanotherco.github.io/operator_metadata/metadata.json'
4848
enable_metrics: true
4949
metrics_ip_port_address: localhost:9092
5050
max_batch_size: 268435456 # 256 MiB
51+
last_processed_batch_filepath: config-files/operator.last_processed_batch.json
5152
# Operators variables needed for register it in EigenLayer
52-
el_delegation_manager_address: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
53+
el_delegation_manager_address: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9'
5354
private_key_store_path: config-files/anvil.ecdsa.key.json
5455
bls_private_key_store_path: config-files/anvil.bls.key.json
5556
signer_type: local_keystore

core/chainio/avs_reader.go

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package chainio
22

33
import (
4+
"context"
5+
46
"github.com/ethereum/go-ethereum/accounts/abi/bind"
5-
gethcommon "github.com/ethereum/go-ethereum/common"
7+
ethcommon "github.com/ethereum/go-ethereum/common"
8+
"github.com/ethereum/go-ethereum/crypto"
9+
servicemanager "github.com/yetanotherco/aligned_layer/contracts/bindings/AlignedLayerServiceManager"
610
contractERC20Mock "github.com/yetanotherco/aligned_layer/contracts/bindings/ERC20Mock"
711
"github.com/yetanotherco/aligned_layer/core/config"
812

@@ -13,8 +17,9 @@ import (
1317

1418
type AvsReader struct {
1519
*sdkavsregistry.ChainReader
16-
AvsContractBindings *AvsServiceBindings
17-
logger logging.Logger
20+
AvsContractBindings *AvsServiceBindings
21+
AlignedLayerServiceManagerAddr ethcommon.Address
22+
logger logging.Logger
1823
}
1924

2025
func NewAvsReaderFromConfig(baseConfig *config.BaseConfig, ecdsaConfig *config.EcdsaConfig) (*AvsReader, error) {
@@ -41,13 +46,14 @@ func NewAvsReaderFromConfig(baseConfig *config.BaseConfig, ecdsaConfig *config.E
4146
}
4247

4348
return &AvsReader{
44-
ChainReader: chainReader,
45-
AvsContractBindings: avsServiceBindings,
46-
logger: baseConfig.Logger,
49+
ChainReader: chainReader,
50+
AvsContractBindings: avsServiceBindings,
51+
AlignedLayerServiceManagerAddr: baseConfig.AlignedLayerDeploymentConfig.AlignedLayerServiceManagerAddr,
52+
logger: baseConfig.Logger,
4753
}, nil
4854
}
4955

50-
func (r *AvsReader) GetErc20Mock(tokenAddr gethcommon.Address) (*contractERC20Mock.ContractERC20Mock, error) {
56+
func (r *AvsReader) GetErc20Mock(tokenAddr ethcommon.Address) (*contractERC20Mock.ContractERC20Mock, error) {
5157
erc20Mock, err := contractERC20Mock.NewContractERC20Mock(tokenAddr, &r.AvsContractBindings.ethClient)
5258
if err != nil {
5359
// Retry with fallback client
@@ -59,6 +65,40 @@ func (r *AvsReader) GetErc20Mock(tokenAddr gethcommon.Address) (*contractERC20Mo
5965
return erc20Mock, nil
6066
}
6167

62-
func (r *AvsReader) IsOperatorRegistered(address gethcommon.Address) (bool, error) {
68+
func (r *AvsReader) IsOperatorRegistered(address ethcommon.Address) (bool, error) {
6369
return r.ChainReader.IsOperatorRegistered(&bind.CallOpts{}, address)
6470
}
71+
72+
// Returns all the "NewBatchV3" logs that have not been responded starting from the given block number
73+
func (r *AvsReader) GetNotRespondedTasksFrom(fromBlock uint64) ([]servicemanager.ContractAlignedLayerServiceManagerNewBatchV3, error) {
74+
logs, err := r.AvsContractBindings.ServiceManager.FilterNewBatchV3(&bind.FilterOpts{Start: fromBlock, End: nil, Context: context.Background()}, nil)
75+
76+
if err != nil {
77+
return nil, err
78+
}
79+
80+
var tasks []servicemanager.ContractAlignedLayerServiceManagerNewBatchV3
81+
82+
for logs.Next() {
83+
task, err := r.AvsContractBindings.ServiceManager.ParseNewBatchV3(logs.Event.Raw)
84+
if err != nil {
85+
return nil, err
86+
}
87+
88+
// now check if its finalized or not before appending
89+
batchIdentifier := append(task.BatchMerkleRoot[:], task.SenderAddress[:]...)
90+
batchIdentifierHash := *(*[32]byte)(crypto.Keccak256(batchIdentifier))
91+
state, err := r.AvsContractBindings.ServiceManager.ContractAlignedLayerServiceManagerCaller.BatchesState(nil, batchIdentifierHash)
92+
93+
if err != nil {
94+
return nil, err
95+
}
96+
97+
// append the task if not responded yet
98+
if !state.Responded {
99+
tasks = append(tasks, *task)
100+
}
101+
}
102+
103+
return tasks, nil
104+
}

0 commit comments

Comments
 (0)