diff --git a/core/chainio.go b/core/chainio.go index 5cdb165be9..da29101fca 100644 --- a/core/chainio.go +++ b/core/chainio.go @@ -146,7 +146,6 @@ type Writer interface { // will be returned. RegisterOperator( ctx context.Context, - keypair *KeyPair, signer blssigner.Signer, socket string, quorumIds []QuorumID, @@ -159,7 +158,6 @@ type Writer interface { // with the provided signature from the churner RegisterOperatorWithChurn( ctx context.Context, - keypair *KeyPair, signer blssigner.Signer, socket string, quorumIds []QuorumID, diff --git a/core/eth/writer.go b/core/eth/writer.go index 2009a995e5..17f0a26ec7 100644 --- a/core/eth/writer.go +++ b/core/eth/writer.go @@ -63,7 +63,6 @@ func NewWriter( // will be returned. func (t *Writer) RegisterOperator( ctx context.Context, - keypair *core.KeyPair, signer blssigner.Signer, socket string, quorumIds []core.QuorumID, @@ -104,7 +103,6 @@ func (t *Writer) RegisterOperator( // with the provided signature from the churner func (t *Writer) RegisterOperatorWithChurn( ctx context.Context, - keypair *core.KeyPair, signer blssigner.Signer, socket string, quorumIds []core.QuorumID, diff --git a/core/indexer/state_test.go b/core/indexer/state_test.go index 7a44e9e6d1..3c0d6cfc49 100644 --- a/core/indexer/state_test.go +++ b/core/indexer/state_test.go @@ -59,9 +59,6 @@ func mustRegisterOperators(env *deploy.Config, logger logging.Logger) { }) Expect(err).To(BeNil()) - keyPair, err := core.MakeKeyPairFromString(op.NODE_TEST_PRIVATE_BLS) - Expect(err).To(BeNil()) - socket := fmt.Sprintf("%v:%v", op.NODE_HOSTNAME, op.NODE_DISPERSAL_PORT) salt := [32]byte{} @@ -72,7 +69,7 @@ func mustRegisterOperators(env *deploy.Config, logger logging.Logger) { privKey, err := crypto.HexToECDSA(op.NODE_PRIVATE_KEY) Expect(err).To(BeNil()) - err = tx.RegisterOperator(context.Background(), keyPair, signer, socket, quorums, privKey, salt, expiry) + err = tx.RegisterOperator(context.Background(), signer, socket, quorums, privKey, salt, expiry) Expect(err).To(BeNil()) } } diff --git a/core/mock/writer.go b/core/mock/writer.go index 0f7a5e0e38..2c38d69c88 100644 --- a/core/mock/writer.go +++ b/core/mock/writer.go @@ -39,7 +39,6 @@ func (t *MockWriter) GetRegisteredQuorumIdsForOperator(ctx context.Context, oper func (t *MockWriter) RegisterOperator( ctx context.Context, - keypair *core.KeyPair, signer blssigner.Signer, socket string, quorumIds []core.QuorumID, @@ -47,13 +46,12 @@ func (t *MockWriter) RegisterOperator( operatorToAvsRegistrationSigSalt [32]byte, operatorToAvsRegistrationSigExpiry *big.Int, ) error { - args := t.Called(ctx, keypair, signer, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) + args := t.Called(ctx, signer, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) return args.Error(0) } func (t *MockWriter) RegisterOperatorWithChurn( ctx context.Context, - keypair *core.KeyPair, signer blssigner.Signer, socket string, quorumIds []core.QuorumID, @@ -61,7 +59,7 @@ func (t *MockWriter) RegisterOperatorWithChurn( operatorToAvsRegistrationSigSalt [32]byte, operatorToAvsRegistrationSigExpiry *big.Int, churnReply *churner.ChurnReply) error { - args := t.Called(ctx, keypair, signer, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry, churnReply) + args := t.Called(ctx, signer, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry, churnReply) return args.Error(0) } diff --git a/node/node.go b/node/node.go index f00b956af9..308dda6974 100644 --- a/node/node.go +++ b/node/node.go @@ -301,7 +301,6 @@ func (n *Node) Start(ctx context.Context) error { Socket: socket, Timeout: 10 * time.Second, PrivKey: privateKey, - KeyPair: n.KeyPair, Signer: n.BLSSigner, OperatorId: n.Config.ID, QuorumIDs: n.Config.QuorumIDList, diff --git a/node/operator.go b/node/operator.go index 3f26333a64..4572dfe52f 100644 --- a/node/operator.go +++ b/node/operator.go @@ -21,7 +21,6 @@ type Operator struct { Socket string Timeout time.Duration PrivKey *ecdsa.PrivateKey - KeyPair *core.KeyPair Signer blssigner.Signer OperatorId core.OperatorID QuorumIDs []core.QuorumID @@ -91,10 +90,10 @@ func RegisterOperator(ctx context.Context, operator *Operator, transactor core.W return fmt.Errorf("failed to request churn approval: %w", err) } - return transactor.RegisterOperatorWithChurn(ctx, operator.KeyPair, operator.Signer, operator.Socket, quorumsToRegister, operator.PrivKey, salt, expiry, churnReply) + return transactor.RegisterOperatorWithChurn(ctx, operator.Signer, operator.Socket, quorumsToRegister, operator.PrivKey, salt, expiry, churnReply) } else { // other wise just register normally - return transactor.RegisterOperator(ctx, operator.KeyPair, operator.Signer, operator.Socket, quorumsToRegister, operator.PrivKey, salt, expiry) + return transactor.RegisterOperator(ctx, operator.Signer, operator.Socket, quorumsToRegister, operator.PrivKey, salt, expiry) } } diff --git a/node/operator_test.go b/node/operator_test.go index aefdffe60a..f5a6ba8f1e 100644 --- a/node/operator_test.go +++ b/node/operator_test.go @@ -34,7 +34,6 @@ func TestRegisterOperator(t *testing.T) { Socket: "localhost:50051", Timeout: 10 * time.Second, PrivKey: nil, - KeyPair: keyPair, Signer: signer, OperatorId: operatorID, QuorumIDs: []core.QuorumID{0, 1}, @@ -49,7 +48,7 @@ func TestRegisterOperator(t *testing.T) { ChurnBIPsOfTotalStake: 20000, }, nil) tx.On("GetNumberOfRegisteredOperatorForQuorum").Return(uint32(0), nil) - tx.On("RegisterOperator", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + tx.On("RegisterOperator", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) return tx } @@ -70,13 +69,18 @@ func TestRegisterOperatorWithChurn(t *testing.T) { operatorID := [32]byte(hexutil.MustDecode("0x3fbfefcdc76462d2cdb7d0cea75f27223829481b8b4aa6881c94cb2126a316ad")) keyPair, err := core.GenRandomBlsKeys() assert.NoError(t, err) + signer, err := blssigner.NewSigner(blssignerTypes.SignerConfig{ + PrivateKey: keyPair.PrivKey.String(), + SignerType: blssignerTypes.PrivateKey, + }) + assert.NoError(t, err) // Create a new operator operator := &node.Operator{ Address: "0xB7Ad27737D88B07De48CDc2f379917109E993Be4", Socket: "localhost:50051", Timeout: 10 * time.Second, + Signer: signer, PrivKey: nil, - KeyPair: keyPair, OperatorId: operatorID, QuorumIDs: []core.QuorumID{1}, } @@ -88,10 +92,10 @@ func TestRegisterOperatorWithChurn(t *testing.T) { ChurnBIPsOfTotalStake: 20000, }, nil) tx.On("GetNumberOfRegisteredOperatorForQuorum").Return(uint32(1), nil) - tx.On("RegisterOperatorWithChurn", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + tx.On("RegisterOperatorWithChurn", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) churnerClient := &nodemock.ChurnerClient{} churnerClient.On("Churn").Return(nil, nil) err = node.RegisterOperator(context.Background(), operator, tx, churnerClient, logger) assert.NoError(t, err) - tx.AssertCalled(t, "RegisterOperatorWithChurn", mock.Anything, mock.Anything, mock.Anything, mock.Anything, []core.QuorumID{1}, mock.Anything, mock.Anything, mock.Anything, mock.Anything) + tx.AssertCalled(t, "RegisterOperatorWithChurn", mock.Anything, mock.Anything, mock.Anything, []core.QuorumID{1}, mock.Anything, mock.Anything, mock.Anything, mock.Anything) } diff --git a/operators/churner/tests/churner_test.go b/operators/churner/tests/churner_test.go index 9418436130..593cf0cf16 100644 --- a/operators/churner/tests/churner_test.go +++ b/operators/churner/tests/churner_test.go @@ -120,10 +120,6 @@ func TestChurner(t *testing.T) { g1point := &core.G1Point{ G1Affine: kp.PubKey.G1Affine, } - opKeyPair := &core.KeyPair{ - PrivKey: kp.PrivKey, - PubKey: g1point, - } sk, privateKey, err := plugin.GetECDSAPrivateKey(op.NODE_ECDSA_KEY_FILE, op.NODE_ECDSA_KEY_PASSWORD) assert.NoError(t, err) if i == 0 { @@ -139,12 +135,11 @@ func TestChurner(t *testing.T) { if i >= testConfig.Services.Counts.NumMaxOperatorCount { // This operator will churn others operatorAddr = sk.Address.Hex() - keyPair = opKeyPair signer = opSigner operatorPrivateKey = sk.PrivateKey break } - err = tx.RegisterOperator(ctx, opKeyPair, opSigner, socket, quorumIDsUint8, sk.PrivateKey, salt, expiry) + err = tx.RegisterOperator(ctx, opSigner, socket, quorumIDsUint8, sk.PrivateKey, salt, expiry) assert.NoError(t, err) } assert.Greater(t, len(lowestStakeOperatorAddr), 0) @@ -194,7 +189,7 @@ func TestChurner(t *testing.T) { salt32 := [32]byte{} copy(salt32[:], salt) expiry := big.NewInt((time.Now().Add(10 * time.Minute)).Unix()) - err = tx.RegisterOperatorWithChurn(ctx, keyPair, signer, "localhost:8080", quorumIDsUint8, operatorPrivateKey, salt32, expiry, reply) + err = tx.RegisterOperatorWithChurn(ctx, signer, "localhost:8080", quorumIDsUint8, operatorPrivateKey, salt32, expiry, reply) assert.NoError(t, err) }