Skip to content

Commit f273494

Browse files
committed
feat: register operator to different quorum numbers
1 parent 2820ad5 commit f273494

3 files changed

Lines changed: 33 additions & 11 deletions

File tree

Makefile

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,11 @@ operator_set_eigen_sdk_go_version_error:
267267
@echo "Error setting Eigen SDK version, missing ENVIRONMENT. Possible values for ENVIRONMENT=<devnet|testnet|mainnet>"
268268
exit 1
269269

270-
operator_full_registration: operator_get_eth operator_register_with_eigen_layer operator_mint_mock_tokens operator_deposit_into_mock_strategy operator_whitelist_devnet operator_register_with_aligned_layer
270+
operator_full_registration_base: operator_get_eth operator_register_with_eigen_layer operator_whitelist_devnet
271+
operator_full_registration_weth: operator_full_registration_base operator_mint_mock_tokens operator_deposit_into_mock_strategy operator_register_with_aligned_layer_weth
272+
operator_full_registration_ali: operator_full_registration_base operator_mint_mock_tokens operator_deposit_into_mock_strategy operator_register_with_aligned_layer_ali
273+
274+
operator_full_registration: operator_full_registration_base operator_mint_mock_tokens operator_deposit_into_mock_strategy operator_register_with_aligned_layer_weth
271275

272276
operator_register_and_start: $(GET_SDK_VERSION) operator_full_registration operator_start
273277

@@ -358,7 +362,7 @@ operator_remove_from_whitelist:
358362

359363
operator_deposit_into_mock_strategy:
360364
@echo "Depositing into mock strategy"
361-
$(eval STRATEGY_ADDRESS = $(shell jq -r '.addresses.strategies.WETH' contracts/script/output/devnet/eigenlayer_deployment_output.json))
365+
$(eval STRATEGY_ADDRESS = $(shell jq -r '.addresses.strategies.ALI' contracts/script/output/devnet/eigenlayer_deployment_output.json))
362366
@go run operator/cmd/main.go deposit-into-strategy \
363367
--config $(CONFIG_FILE) \
364368
--strategy-address $(STRATEGY_ADDRESS) \
@@ -374,12 +378,21 @@ operator_deposit_into_strategy:
374378
--strategy-address $(STRATEGY_ADDRESS) \
375379
--amount $(AMOUNT)
376380

377-
operator_register_with_aligned_layer:
381+
operator_register_with_aligned_layer_weth:
378382
@echo "Registering operator with AlignedLayer"
379383
@go run operator/cmd/main.go register \
380-
--config $(CONFIG_FILE)
384+
--config $(CONFIG_FILE) \
385+
--quorum-number 0
386+
387+
operator_register_with_aligned_layer_ali:
388+
@echo "Registering operator with AlignedLayer"
389+
@go run operator/cmd/main.go register \
390+
--config $(CONFIG_FILE) \
391+
--quorum-number 1
392+
393+
operator_deposit_and_register_weth: operator_deposit_into_strategy operator_register_with_aligned_layer_weth
381394

382-
operator_deposit_and_register: operator_deposit_into_strategy operator_register_with_aligned_layer
395+
operator_deposit_and_register_ali: operator_deposit_into_strategy operator_register_with_aligned_layer_ali
383396

384397

385398
# The verifier ID to enable or disable corresponds to the index of the verifier in the `ProvingSystemID` enum.

operator/cmd/actions/register.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,25 @@ package actions
22

33
import (
44
"context"
5-
operator "github.com/yetanotherco/aligned_layer/operator/pkg"
65
"time"
76

7+
"github.com/Layr-Labs/eigensdk-go/types"
8+
operator "github.com/yetanotherco/aligned_layer/operator/pkg"
9+
810
"github.com/ethereum/go-ethereum/crypto"
911
"github.com/urfave/cli/v2"
1012
"github.com/yetanotherco/aligned_layer/core/config"
1113
)
1214

15+
var QuorumNumberFlag = &cli.UintFlag{
16+
Name: "quorum-number",
17+
Required: true,
18+
Usage: "Specifies the quorum to register with. Possible values: 0 - register with the `eth` quorum, 1 - register with the `ali` quorum.",
19+
}
20+
1321
var registerFlags = []cli.Flag{
1422
config.ConfigFileFlag,
23+
QuorumNumberFlag,
1524
}
1625

1726
var RegisterCommand = &cli.Command{
@@ -26,15 +35,16 @@ func registerOperatorMain(ctx *cli.Context) error {
2635
operatorConfig := config.NewOperatorConfig(ctx.String(config.ConfigFileFlag.Name))
2736
ecdsaConfig := config.NewEcdsaConfig(ctx.String(config.ConfigFileFlag.Name), operatorConfig.BaseConfig.ChainId)
2837

29-
quorumNumbers := []byte{0}
38+
quorumNumbersBytes := []byte{byte(QuorumNumberFlag.Value)}
39+
quorumNumbers := types.QuorumNums{types.QuorumNum(QuorumNumberFlag.Value)}
3040

3141
// Generate salt and expiry
3242
privateKeyBytes := []byte(operatorConfig.BlsConfig.KeyPair.PrivKey.String())
3343
salt := [32]byte{}
3444

35-
copy(salt[:], crypto.Keccak256([]byte("churn"), []byte(time.Now().String()), quorumNumbers, privateKeyBytes))
45+
copy(salt[:], crypto.Keccak256([]byte("churn"), []byte(time.Now().String()), quorumNumbersBytes, privateKeyBytes))
3646

37-
err := operator.RegisterOperator(context.Background(), operatorConfig, ecdsaConfig, salt)
47+
err := operator.RegisterOperator(context.Background(), operatorConfig, ecdsaConfig, quorumNumbers, salt)
3848
if err != nil {
3949
operatorConfig.BaseConfig.Logger.Error("Failed to register operator", "err", err)
4050
return err

operator/pkg/register.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func RegisterOperator(
1616
ctx context.Context,
1717
configuration *config.OperatorConfig,
1818
ecdsaConfig *config.EcdsaConfig,
19+
quorumNumbers types.QuorumNums,
1920
operatorToAvsRegistrationSigSalt [32]byte,
2021
) error {
2122
writer, err := chainio.NewAvsWriterFromConfig(configuration.BaseConfig, ecdsaConfig, nil)
@@ -26,8 +27,6 @@ func RegisterOperator(
2627

2728
socket := "Not Needed"
2829

29-
quorumNumbers := types.QuorumNums{0}
30-
3130
_, err = writer.RegisterOperator(ctx, ecdsaConfig.PrivateKey,
3231
configuration.BlsConfig.KeyPair,
3332
quorumNumbers, socket, true)

0 commit comments

Comments
 (0)