Skip to content

Commit c6de054

Browse files
committed
fix: allocation delay config and update tests (#257)
1 parent 7f6d647 commit c6de054

File tree

6 files changed

+34
-34
lines changed

6 files changed

+34
-34
lines changed

pkg/operator/config/create.go

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -119,36 +119,31 @@ func promptOperatorInfo(config *types.OperatorConfig, p utils.Prompter) (types.O
119119
}
120120
config.Operator.Address = operatorAddress
121121

122-
// TODO(madhur): Disabling this for now as the feature doesn't work but
123-
// we need to keep the code around for future
124122
// Prompt to gate stakers approval
125-
//gateApproval, err := p.Confirm("Do you want to gate stakers approval?")
126-
//if err != nil {
127-
// return types.OperatorConfig{}, err
128-
//}
123+
gateApproval, err := p.Confirm("Do you want to gate stakers approval?")
124+
if err != nil {
125+
return types.OperatorConfig{}, err
126+
}
129127
// Prompt for address if operator wants to gate approvals
130-
//if gateApproval {
131-
// delegationApprover, err := p.InputString("Enter your staker approver address:", "", "",
132-
// func(s string) error {
133-
// isValidAddress := eigenSdkUtils.IsValidEthereumAddress(s)
134-
//
135-
// if !isValidAddress {
136-
// return errors.New("address is invalid")
137-
// }
138-
//
139-
// return nil
140-
// },
141-
// )
142-
// if err != nil {
143-
// return types.OperatorConfig{}, err
144-
// }
145-
// config.Operator.DelegationApproverAddress = delegationApprover
146-
//} else {
147-
// config.Operator.DelegationApproverAddress = eigensdkTypes.ZeroAddress
148-
//}
149-
150-
// TODO(madhur): Remove this once we have the feature working and want to prompt users for this address
151-
config.Operator.DelegationApproverAddress = eigensdkTypes.ZeroAddress
128+
if gateApproval {
129+
delegationApprover, err := p.InputString("Enter your staker approver address:", "", "",
130+
func(s string) error {
131+
isValidAddress := eigenSdkUtils.IsValidEthereumAddress(s)
132+
133+
if !isValidAddress {
134+
return errors.New("address is invalid")
135+
}
136+
137+
return nil
138+
},
139+
)
140+
if err != nil {
141+
return types.OperatorConfig{}, err
142+
}
143+
config.Operator.DelegationApproverAddress = delegationApprover
144+
} else {
145+
config.Operator.DelegationApproverAddress = eigensdkTypes.ZeroAddress
146+
}
152147

153148
// Prompt for eth node
154149
rpcUrl, err := p.InputString("Enter your ETH rpc url:", "http://localhost:8545", "",
@@ -161,8 +156,8 @@ func promptOperatorInfo(config *types.OperatorConfig, p utils.Prompter) (types.O
161156

162157
// Prompt for allocation delay
163158
allocationDelay, err := p.InputInteger(
164-
"Enter your allocation delay (in seconds, default is 17.5 days):",
165-
"1512000",
159+
"Enter your allocation delay (in blocks, default is 1200):",
160+
"1200",
166161
"",
167162
func(i int64) error {
168163
if i < 0 {
@@ -180,7 +175,7 @@ func promptOperatorInfo(config *types.OperatorConfig, p utils.Prompter) (types.O
180175
"Are you sure you want to set the allocation delay to " + strconv.FormatInt(
181176
allocationDelay,
182177
10,
183-
) + " seconds? This cannot be changed once set.",
178+
) + " blocks?",
184179
)
185180
if err != nil {
186181
return types.OperatorConfig{}, err

pkg/user/admin/types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package admin
22

33
import (
4+
"math/big"
5+
46
"github.com/Layr-Labs/eigenlayer-cli/pkg/types"
57
gethcommon "github.com/ethereum/go-ethereum/common"
6-
"math/big"
78
)
89

910
type listPendingAdminsConfig struct {

pkg/user/appointee/remove_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package appointee
33
import (
44
"context"
55
"errors"
6-
gethtypes "github.com/ethereum/go-ethereum/core/types"
76
"testing"
87

8+
gethtypes "github.com/ethereum/go-ethereum/core/types"
9+
910
"github.com/Layr-Labs/eigensdk-go/chainio/clients/elcontracts"
1011
"github.com/Layr-Labs/eigensdk-go/logging"
1112
"github.com/stretchr/testify/assert"

pkg/user/appointee/set_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package appointee
33
import (
44
"context"
55
"errors"
6-
gethtypes "github.com/ethereum/go-ethereum/core/types"
76
"testing"
87

8+
gethtypes "github.com/ethereum/go-ethereum/core/types"
9+
910
"github.com/Layr-Labs/eigensdk-go/chainio/clients/elcontracts"
1011
"github.com/Layr-Labs/eigensdk-go/logging"
1112
"github.com/stretchr/testify/assert"

tests/keystore/operator-ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ operator:
33
delegation_approver_address: 0xcaB1b44dd1f1C265405878Ac1179cd94D0dBA634
44
staker_opt_out_window_blocks: 0
55
metadata_url: https://madhur-test-public.s3.us-east-2.amazonaws.com/metadata.json
6+
allocation_delay: 1200
67
el_delegation_manager_address: 0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9
78
eth_rpc_url: http://localhost:8545
89
private_key_store_path: /home/runner/.eigenlayer/operator_keys/opr0.ecdsa.key.json

tests/web3signer/operator-ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ operator:
33
delegation_approver_address: 0xcaB1b44dd1f1C265405878Ac1179cd94D0dBA634
44
staker_opt_out_window_blocks: 0
55
metadata_url: https://madhur-test-public.s3.us-east-2.amazonaws.com/metadata.json
6+
allocation_delay: 1200
67
el_delegation_manager_address: 0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9
78
eth_rpc_url: http://localhost:8545
89
private_key_store_path:

0 commit comments

Comments
 (0)