From 7c7c900bad69efc0cb5c223871e6efc81cc69016 Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Wed, 11 Dec 2024 13:38:12 -0800 Subject: [PATCH 1/8] add bls signer abstraction from eigensdk update eigensdk to that commit upgrade logger to remove noop fix testmode fix nil pointers rebase and fix rebase update to new eigensdk add bls signer to plugin fix unit tests fix g2 point deser fix file signer fix copying remove unused code --- api/clients/retrieval_client_test.go | 5 +- common/geth/multihoming_client_test.go | 5 +- common/ratelimit/ratelimit_test.go | 4 +- common/store/dynamo_store_test.go | 5 +- common/testutils/test_utils.go | 6 + core/aggregation_test.go | 4 +- core/chainio.go | 3 + core/eth/reader.go | 43 +++++++- core/eth/writer.go | 7 +- core/indexer/state_test.go | 13 ++- core/meterer/meterer_test.go | 5 +- core/mock/state.go | 9 ++ core/mock/writer.go | 7 +- core/thegraph/state_integration_test.go | 5 +- core/thegraph/state_test.go | 10 +- core/v2/core_test.go | 6 +- disperser/apiserver/server_test.go | 5 +- disperser/apiserver/server_v2_test.go | 4 +- disperser/batcher/batcher_test.go | 6 +- disperser/batcher/encoding_streamer_test.go | 8 +- disperser/batcher/finalizer_test.go | 8 +- disperser/batcher/txn_manager_test.go | 16 +-- disperser/common/blobstore/blobstore_test.go | 4 +- .../common/v2/blobstore/blobstore_test.go | 4 +- disperser/controller/controller_test.go | 4 +- disperser/controller/dispatcher_test.go | 2 +- disperser/controller/encoding_manager_test.go | 4 +- disperser/dataapi/server_test.go | 4 +- disperser/dataapi/subgraph_client_test.go | 14 +-- disperser/dataapi/v2/server_v2_test.go | 6 +- disperser/encoder/server_test.go | 4 +- disperser/encoder/setup_test.go | 4 +- go.mod | 11 +- go.sum | 14 ++- indexer/eth/header_service_test.go | 5 +- indexer/test/indexer_test.go | 5 +- node/churner_client.go | 57 +++++++++- node/config.go | 72 ++++++------ node/grpc/server_test.go | 10 ++ node/mock/churner_client.go | 3 +- node/node.go | 103 ++++++------------ node/node_test.go | 4 +- node/operator.go | 12 +- node/operator_test.go | 21 +++- node/plugin/cmd/main.go | 59 +++++++--- node/plugin/config.go | 26 +++++ node/store_test.go | 4 +- node/store_v2_test.go | 4 +- operators/churner/server_test.go | 4 +- operators/churner/tests/churner_test.go | 17 ++- relay/chunkstore/chunk_store_test.go | 4 +- retriever/eth/chain_client_test.go | 5 +- retriever/server_test.go | 4 +- retriever/v2/server_test.go | 4 +- test/integration_test.go | 5 +- tools/traffic/generator_test.go | 7 +- 56 files changed, 438 insertions(+), 256 deletions(-) diff --git a/api/clients/retrieval_client_test.go b/api/clients/retrieval_client_test.go index 0c61531b42..2b19629d58 100644 --- a/api/clients/retrieval_client_test.go +++ b/api/clients/retrieval_client_test.go @@ -3,11 +3,13 @@ package clients_test import ( "bytes" "context" + "runtime" "testing" "github.com/Layr-Labs/eigenda/api/clients" clientsmock "github.com/Layr-Labs/eigenda/api/clients/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" coreindexer "github.com/Layr-Labs/eigenda/core/indexer" coremock "github.com/Layr-Labs/eigenda/core/mock" @@ -17,7 +19,6 @@ import ( "github.com/Layr-Labs/eigenda/encoding/kzg/verifier" "github.com/Layr-Labs/eigenda/encoding/utils/codec" indexermock "github.com/Layr-Labs/eigenda/indexer/mock" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/consensys/gnark-crypto/ecc/bn254" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -96,7 +97,7 @@ func setup(t *testing.T) { if err != nil { t.Fatal(err) } - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() indexer = &indexermock.MockIndexer{} indexer.On("Index").Return(nil).Once() diff --git a/common/geth/multihoming_client_test.go b/common/geth/multihoming_client_test.go index 91b4802a32..6ba42d3dd9 100644 --- a/common/geth/multihoming_client_test.go +++ b/common/geth/multihoming_client_test.go @@ -3,12 +3,13 @@ package geth_test import ( "context" "fmt" + "math/big" "testing" "github.com/Layr-Labs/eigenda/common/geth" damock "github.com/Layr-Labs/eigenda/common/mock" - "github.com/Layr-Labs/eigensdk-go/logging" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/ethereum/go-ethereum/rpc" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -25,7 +26,7 @@ func (j *JsonError) Error() string { return "json error" } func (j *JsonError) ErrorCode() int { return -32000 } func makeTestMultihomingClient(numRetries int, designatedError error) (*geth.MultiHomingClient, error) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() ethClientCfg := geth.EthClientConfig{ RPCURLs: rpcURLs, diff --git a/common/ratelimit/ratelimit_test.go b/common/ratelimit/ratelimit_test.go index 969d698dbf..aadec8d128 100644 --- a/common/ratelimit/ratelimit_test.go +++ b/common/ratelimit/ratelimit_test.go @@ -8,7 +8,7 @@ import ( "github.com/Layr-Labs/eigenda/common" "github.com/Layr-Labs/eigenda/common/ratelimit" "github.com/Layr-Labs/eigenda/common/store" - "github.com/Layr-Labs/eigensdk-go/logging" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" ) @@ -26,7 +26,7 @@ func makeTestRatelimiter() (common.RateLimiter, error) { return nil, err } - ratelimiter := ratelimit.NewRateLimiter(prometheus.NewRegistry(), globalParams, bucketStore, logging.NewNoopLogger()) + ratelimiter := ratelimit.NewRateLimiter(prometheus.NewRegistry(), globalParams, bucketStore, testutils.GetLogger()) return ratelimiter, nil diff --git a/common/store/dynamo_store_test.go b/common/store/dynamo_store_test.go index 8ddeebeee8..4e0d6fef35 100644 --- a/common/store/dynamo_store_test.go +++ b/common/store/dynamo_store_test.go @@ -3,6 +3,7 @@ package store_test import ( "context" "fmt" + "os" "testing" "time" @@ -12,14 +13,14 @@ import ( "github.com/Layr-Labs/eigenda/common/aws/dynamodb" test_utils "github.com/Layr-Labs/eigenda/common/aws/dynamodb/utils" "github.com/Layr-Labs/eigenda/common/store" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/inabox/deploy" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/ory/dockertest/v3" "github.com/stretchr/testify/assert" ) var ( - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() dockertestPool *dockertest.Pool dockertestResource *dockertest.Resource diff --git a/common/testutils/test_utils.go b/common/testutils/test_utils.go index 38daa774b2..8a425b2652 100644 --- a/common/testutils/test_utils.go +++ b/common/testutils/test_utils.go @@ -3,8 +3,10 @@ package testutils import ( "context" "fmt" + "github.com/Layr-Labs/eigensdk-go/logging" "github.com/stretchr/testify/assert" "golang.org/x/exp/rand" + "os" "testing" "time" ) @@ -112,3 +114,7 @@ func RandomString(length int) string { } return string(b) } + +func GetLogger() logging.Logger { + return logging.NewTextSLogger(os.Stdout, &logging.SLoggerOptions{}) +} diff --git a/core/aggregation_test.go b/core/aggregation_test.go index b9b20a008b..a6595f83b4 100644 --- a/core/aggregation_test.go +++ b/core/aggregation_test.go @@ -7,9 +7,9 @@ import ( "os" "testing" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/core/mock" - "github.com/Layr-Labs/eigensdk-go/logging" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" ) @@ -30,7 +30,7 @@ func TestMain(m *testing.M) { if err != nil { panic(err) } - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() transactor := &mock.MockWriter{} transactor.On("OperatorIDToAddress").Return(gethcommon.Address{}, nil) agg, err = core.NewStdSignatureAggregator(logger, transactor) diff --git a/core/chainio.go b/core/chainio.go index c95e11380a..7e9078895d 100644 --- a/core/chainio.go +++ b/core/chainio.go @@ -6,6 +6,7 @@ import ( "math/big" "github.com/Layr-Labs/eigenda/api/grpc/churner" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -146,6 +147,7 @@ type Writer interface { RegisterOperator( ctx context.Context, keypair *KeyPair, + signer sdkSigner.Signer, socket string, quorumIds []QuorumID, operatorEcdsaPrivateKey *ecdsa.PrivateKey, @@ -158,6 +160,7 @@ type Writer interface { RegisterOperatorWithChurn( ctx context.Context, keypair *KeyPair, + signer sdkSigner.Signer, socket string, quorumIds []QuorumID, operatorEcdsaPrivateKey *ecdsa.PrivateKey, diff --git a/core/eth/reader.go b/core/eth/reader.go index c523124128..c23a6ee0ac 100644 --- a/core/eth/reader.go +++ b/core/eth/reader.go @@ -3,6 +3,7 @@ package eth import ( "context" "crypto/ecdsa" + "encoding/hex" "fmt" "math/big" "strings" @@ -29,6 +30,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/pingcap/errors" + + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" ) type ContractBindings struct { @@ -288,6 +291,7 @@ func (t *Reader) GetRegisteredQuorumIdsForOperator(ctx context.Context, operator func (t *Reader) getRegistrationParams( ctx context.Context, keypair *core.KeyPair, + sdkSigner sdkSigner.Signer, operatorEcdsaPrivateKey *ecdsa.PrivateKey, operatorToAvsRegistrationSigSalt [32]byte, operatorToAvsRegistrationSigExpiry *big.Int, @@ -303,24 +307,55 @@ func (t *Reader) getRegistrationParams( } msgToSignG1 := core.NewG1Point(msgToSignG1_.X, msgToSignG1_.Y) - signature := keypair.SignHashedToCurveMessage(msgToSignG1) + sigBytes, err := sdkSigner.SignG1(ctx, msgToSignG1.Serialize()) + if err != nil { + return nil, nil, err + } + sig := new(core.Signature) + g, err := sig.Deserialize(sigBytes) + if err != nil { + return nil, nil, err + } + signature := &core.Signature{ + G1Point: g, + } signedMessageHashParam := regcoordinator.BN254G1Point{ X: signature.X.BigInt(big.NewInt(0)), Y: signature.Y.BigInt(big.NewInt(0)), } - g1Point_ := pubKeyG1ToBN254G1Point(keypair.GetPubKeyG1()) + g1KeyHex := sdkSigner.GetPublicKeyG1() + g1KeyBytes, err := hex.DecodeString(g1KeyHex) + if err != nil { + return nil, nil, err + } + g1point := new(core.G1Point) + g1point, err = g1point.Deserialize(g1KeyBytes) + if err != nil { + return nil, nil, err + } + g1Point_ := pubKeyG1ToBN254G1Point(g1point) g1Point := regcoordinator.BN254G1Point{ X: g1Point_.X, Y: g1Point_.Y, } - g2Point_ := pubKeyG2ToBN254G2Point(keypair.GetPubKeyG2()) + + g2KeyHex := sdkSigner.GetPublicKeyG2() + g2KeyBytes, err := hex.DecodeString(g2KeyHex) + if err != nil { + return nil, nil, err + } + g2point := new(core.G2Point) + g2point, err = g2point.Deserialize(g2KeyBytes) + if err != nil { + return nil, nil, err + } + g2Point_ := pubKeyG2ToBN254G2Point(g2point) g2Point := regcoordinator.BN254G2Point{ X: g2Point_.X, Y: g2Point_.Y, } - params := regcoordinator.IBLSApkRegistryPubkeyRegistrationParams{ PubkeyRegistrationSignature: signedMessageHashParam, PubkeyG1: g1Point, diff --git a/core/eth/writer.go b/core/eth/writer.go index 5e8770f5d8..74010e0c1d 100644 --- a/core/eth/writer.go +++ b/core/eth/writer.go @@ -17,6 +17,7 @@ import ( regcoordinator "github.com/Layr-Labs/eigenda/contracts/bindings/RegistryCoordinator" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigensdk-go/logging" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" "github.com/ethereum/go-ethereum/accounts/abi/bind" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -62,6 +63,7 @@ func NewWriter( func (t *Writer) RegisterOperator( ctx context.Context, keypair *core.KeyPair, + signer sdkSigner.Signer, socket string, quorumIds []core.QuorumID, operatorEcdsaPrivateKey *ecdsa.PrivateKey, @@ -69,7 +71,7 @@ func (t *Writer) RegisterOperator( operatorToAvsRegistrationSigExpiry *big.Int, ) error { - params, operatorSignature, err := t.getRegistrationParams(ctx, keypair, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) + params, operatorSignature, err := t.getRegistrationParams(ctx, keypair, signer, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) if err != nil { t.logger.Error("Failed to get registration params", "err", err) return err @@ -102,6 +104,7 @@ func (t *Writer) RegisterOperator( func (t *Writer) RegisterOperatorWithChurn( ctx context.Context, keypair *core.KeyPair, + signer sdkSigner.Signer, socket string, quorumIds []core.QuorumID, operatorEcdsaPrivateKey *ecdsa.PrivateKey, @@ -110,7 +113,7 @@ func (t *Writer) RegisterOperatorWithChurn( churnReply *churner.ChurnReply, ) error { - params, operatorSignature, err := t.getRegistrationParams(ctx, keypair, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) + params, operatorSignature, err := t.getRegistrationParams(ctx, keypair, signer, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) if err != nil { t.logger.Error("Failed to get registration params", "err", err) return err diff --git a/core/indexer/state_test.go b/core/indexer/state_test.go index 96e463638a..d1f4714c5d 100644 --- a/core/indexer/state_test.go +++ b/core/indexer/state_test.go @@ -18,6 +18,7 @@ import ( "github.com/Layr-Labs/eigenda/common" "github.com/Layr-Labs/eigenda/common/geth" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/core/eth" indexedstate "github.com/Layr-Labs/eigenda/core/indexer" @@ -26,6 +27,8 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" + sdkSignerTypes "github.com/Layr-Labs/eigensdk-go/signer/bls/types" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rpc" @@ -50,6 +53,12 @@ func mustRegisterOperators(env *deploy.Config, logger logging.Logger) { for _, op := range env.Operators { tx := mustMakeOperatorTransactor(env, op, logger) + signer, err := sdkSigner.NewSigner(sdkSignerTypes.SignerConfig{ + PrivateKey: op.NODE_TEST_PRIVATE_BLS, + SignerType: sdkSignerTypes.PrivateKey, + }) + Expect(err).To(BeNil()) + keyPair, err := core.MakeKeyPairFromString(op.NODE_TEST_PRIVATE_BLS) Expect(err).To(BeNil()) @@ -63,7 +72,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, socket, quorums, privKey, salt, expiry) + err = tx.RegisterOperator(context.Background(), keyPair, signer, socket, quorums, privKey, salt, expiry) Expect(err).To(BeNil()) } } @@ -154,7 +163,7 @@ var _ = Describe("Indexer", func() { Skip("No test path provided") } - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() ctx, cancel := context.WithCancel(context.Background()) _ = cancel diff --git a/core/meterer/meterer_test.go b/core/meterer/meterer_test.go index 0f9c16569c..fafae5e4f3 100644 --- a/core/meterer/meterer_test.go +++ b/core/meterer/meterer_test.go @@ -12,6 +12,7 @@ import ( "github.com/Layr-Labs/eigenda/common" commonaws "github.com/Layr-Labs/eigenda/common/aws" commondynamodb "github.com/Layr-Labs/eigenda/common/aws/dynamodb" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/core/meterer" "github.com/Layr-Labs/eigenda/core/mock" @@ -22,8 +23,6 @@ import ( "github.com/ory/dockertest/v3" "github.com/stretchr/testify/assert" testifymock "github.com/stretchr/testify/mock" - - "github.com/Layr-Labs/eigensdk-go/logging" ) var ( @@ -108,7 +107,7 @@ func setup(_ *testing.M) { panic("failed to generate private key") } - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() config := meterer.Config{ ChainReadTimeout: 3 * time.Second, UpdateInterval: 1 * time.Second, diff --git a/core/mock/state.go b/core/mock/state.go index 2c2934357c..bf2292cb4f 100644 --- a/core/mock/state.go +++ b/core/mock/state.go @@ -8,6 +8,8 @@ import ( "sort" "github.com/Layr-Labs/eigenda/core" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" + sdkSignerTypes "github.com/Layr-Labs/eigensdk-go/signer/bls/types" "github.com/stretchr/testify/mock" ) @@ -25,6 +27,7 @@ var _ core.IndexedChainState = (*ChainDataMock)(nil) type PrivateOperatorInfo struct { *core.IndexedOperatorInfo KeyPair *core.KeyPair + Signer sdkSigner.Signer Host string DispersalPort string RetrievalPort string @@ -143,9 +146,15 @@ func (d *ChainDataMock) GetTotalOperatorStateWithQuorums(ctx context.Context, bl PubkeyG2: d.KeyPairs[id].GetPubKeyG2(), } + signer, _ := sdkSigner.NewSigner(sdkSignerTypes.SignerConfig{ + PrivateKey: d.KeyPairs[id].PrivKey.String(), + SignerType: sdkSignerTypes.PrivateKey, + }) + private := &PrivateOperatorInfo{ IndexedOperatorInfo: indexed, KeyPair: d.KeyPairs[id], + Signer: signer, Host: host, DispersalPort: dispersalPort, RetrievalPort: retrievalPort, diff --git a/core/mock/writer.go b/core/mock/writer.go index f5bb433b91..711580e4d2 100644 --- a/core/mock/writer.go +++ b/core/mock/writer.go @@ -7,6 +7,7 @@ import ( "github.com/Layr-Labs/eigenda/api/grpc/churner" "github.com/Layr-Labs/eigenda/core" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/mock" @@ -39,26 +40,28 @@ func (t *MockWriter) GetRegisteredQuorumIdsForOperator(ctx context.Context, oper func (t *MockWriter) RegisterOperator( ctx context.Context, keypair *core.KeyPair, + signer sdkSigner.Signer, socket string, quorumIds []core.QuorumID, operatorEcdsaPrivateKey *ecdsa.PrivateKey, operatorToAvsRegistrationSigSalt [32]byte, operatorToAvsRegistrationSigExpiry *big.Int, ) error { - args := t.Called(ctx, keypair, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) + args := t.Called(ctx, keypair, signer, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) return args.Error(0) } func (t *MockWriter) RegisterOperatorWithChurn( ctx context.Context, keypair *core.KeyPair, + signer sdkSigner.Signer, socket string, quorumIds []core.QuorumID, operatorEcdsaPrivateKey *ecdsa.PrivateKey, operatorToAvsRegistrationSigSalt [32]byte, operatorToAvsRegistrationSigExpiry *big.Int, churnReply *churner.ChurnReply) error { - args := t.Called(ctx, keypair, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry, churnReply) + args := t.Called(ctx, keypair, signer, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry, churnReply) return args.Error(0) } diff --git a/core/thegraph/state_integration_test.go b/core/thegraph/state_integration_test.go index f7326d22be..7e3fb13124 100644 --- a/core/thegraph/state_integration_test.go +++ b/core/thegraph/state_integration_test.go @@ -10,6 +10,7 @@ import ( "github.com/Layr-Labs/eigenda/common" "github.com/Layr-Labs/eigenda/common/geth" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core/eth" "github.com/Layr-Labs/eigenda/core/thegraph" "github.com/Layr-Labs/eigenda/inabox/deploy" @@ -67,7 +68,7 @@ func setup() { PrivateKeyString: pk, NumConfirmations: 0, NumRetries: 1, - }, gethcommon.Address{}, logging.NewNoopLogger()) + }, gethcommon.Address{}, testutils.GetLogger()) if err != nil { panic(err) } @@ -95,7 +96,7 @@ func TestIndexerIntegration(t *testing.T) { setup() defer teardown() - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() client := mustMakeTestClient(t, testConfig, testConfig.Batcher[0].BATCHER_PRIVATE_KEY, logger) tx, err := eth.NewWriter(logger, client, testConfig.EigenDA.OperatorStateRetreiver, testConfig.EigenDA.ServiceManager) assert.NoError(t, err) diff --git a/core/thegraph/state_test.go b/core/thegraph/state_test.go index f9fcf4f0af..47dd97db6c 100644 --- a/core/thegraph/state_test.go +++ b/core/thegraph/state_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/core/mock" "github.com/Layr-Labs/eigenda/core/thegraph" - "github.com/Layr-Labs/eigensdk-go/logging" ethcomm "github.com/ethereum/go-ethereum/common" "github.com/shurcooL/graphql" "github.com/stretchr/testify/assert" @@ -26,7 +26,7 @@ func (m mockGraphQLQuerier) Query(ctx context.Context, q any, variables map[stri } func TestIndexedChainState_GetIndexedOperatorState(t *testing.T) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() chainState, _ := mock.MakeChainDataMock(map[uint8]int{ 0: 1, @@ -93,7 +93,7 @@ func TestIndexedChainState_GetIndexedOperatorState(t *testing.T) { } func TestIndexedChainState_GetIndexedOperatorStateMissingOperator(t *testing.T) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() chainState, _ := mock.MakeChainDataMock(map[uint8]int{ 0: 2, @@ -160,7 +160,7 @@ func TestIndexedChainState_GetIndexedOperatorStateMissingOperator(t *testing.T) } func TestIndexedChainState_GetIndexedOperatorStateExtraOperator(t *testing.T) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() chainState, _ := mock.MakeChainDataMock(map[uint8]int{ 0: 1, @@ -243,7 +243,7 @@ func TestIndexedChainState_GetIndexedOperatorStateExtraOperator(t *testing.T) { } func TestIndexedChainState_GetIndexedOperatorInfoByOperatorId(t *testing.T) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() chainState, _ := mock.MakeChainDataMock(map[uint8]int{ 0: 1, diff --git a/core/v2/core_test.go b/core/v2/core_test.go index e4ecd520b3..80c49c11ff 100644 --- a/core/v2/core_test.go +++ b/core/v2/core_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/Layr-Labs/eigenda/common" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/core/mock" corev2 "github.com/Layr-Labs/eigenda/core/v2" @@ -18,7 +19,6 @@ import ( "github.com/Layr-Labs/eigenda/encoding/kzg/prover" "github.com/Layr-Labs/eigenda/encoding/kzg/verifier" "github.com/Layr-Labs/eigenda/encoding/utils/codec" - "github.com/Layr-Labs/eigensdk-go/logging" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/gammazero/workerpool" "github.com/hashicorp/go-multierror" @@ -53,7 +53,7 @@ func TestMain(m *testing.M) { if err != nil { panic(err) } - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() reader := &mock.MockWriter{} reader.On("OperatorIDToAddress").Return(gethcommon.Address{}, nil) agg, err = core.NewStdSignatureAggregator(logger, reader) @@ -227,7 +227,7 @@ func checkBatchByUniversalVerifier( for id := range state.IndexedOperators { - val := corev2.NewShardValidator(v, id, logging.NewNoopLogger()) + val := corev2.NewShardValidator(v, id, testutils.GetLogger()) blobs := packagedBlobs[id] diff --git a/disperser/apiserver/server_test.go b/disperser/apiserver/server_test.go index a696c46863..9b8b72687c 100644 --- a/disperser/apiserver/server_test.go +++ b/disperser/apiserver/server_test.go @@ -5,6 +5,7 @@ import ( "crypto/rand" "flag" "fmt" + "math" "math/big" "net" @@ -22,7 +23,6 @@ import ( "github.com/Layr-Labs/eigenda/encoding/kzg" p "github.com/Layr-Labs/eigenda/encoding/kzg/prover" "github.com/Layr-Labs/eigenda/encoding/utils/codec" - "github.com/Layr-Labs/eigensdk-go/logging" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/google/uuid" @@ -37,6 +37,7 @@ import ( "github.com/Layr-Labs/eigenda/common/aws/s3" "github.com/Layr-Labs/eigenda/common/ratelimit" "github.com/Layr-Labs/eigenda/common/store" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/disperser" "github.com/Layr-Labs/eigenda/inabox/deploy" @@ -718,7 +719,7 @@ func teardown() { } func newTestServer(transactor core.Writer, testName string) *apiserver.DispersalServer { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() awsConfig := aws.ClientConfig{ Region: "us-east-1", diff --git a/disperser/apiserver/server_v2_test.go b/disperser/apiserver/server_v2_test.go index 44a6924545..da9f2f468e 100644 --- a/disperser/apiserver/server_v2_test.go +++ b/disperser/apiserver/server_v2_test.go @@ -14,6 +14,7 @@ import ( "github.com/Layr-Labs/eigenda/common/aws" "github.com/Layr-Labs/eigenda/common/aws/dynamodb" "github.com/Layr-Labs/eigenda/common/aws/s3" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" auth "github.com/Layr-Labs/eigenda/core/auth/v2" "github.com/Layr-Labs/eigenda/core/meterer" @@ -25,7 +26,6 @@ import ( "github.com/Layr-Labs/eigenda/disperser/common/v2/blobstore" "github.com/Layr-Labs/eigenda/encoding" "github.com/Layr-Labs/eigenda/encoding/utils/codec" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/consensys/gnark-crypto/ecc/bn254" "google.golang.org/grpc/peer" @@ -423,7 +423,7 @@ func TestV2GetBlobCommitment(t *testing.T) { } func newTestServerV2(t *testing.T) *testComponents { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() // logger, err := common.NewLogger(common.DefaultLoggerConfig()) // if err != nil { // panic("failed to create logger") diff --git a/disperser/batcher/batcher_test.go b/disperser/batcher/batcher_test.go index 53c7950eff..e042654190 100644 --- a/disperser/batcher/batcher_test.go +++ b/disperser/batcher/batcher_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/hex" "errors" + "math/big" "runtime" "sync" @@ -11,9 +12,8 @@ import ( "time" "github.com/Layr-Labs/eigenda/common" - "github.com/Layr-Labs/eigensdk-go/logging" - cmock "github.com/Layr-Labs/eigenda/common/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" "github.com/Layr-Labs/eigenda/disperser" @@ -78,7 +78,7 @@ func makeBatcher(t *testing.T) (*batcherComponents, *bat.Batcher, func() []time. // Common Components // logger, err := common.NewLogger(common.DefaultLoggerConfig()) // assert.NoError(t, err) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() finalizationBlockDelay := uint(75) diff --git a/disperser/batcher/encoding_streamer_test.go b/disperser/batcher/encoding_streamer_test.go index fc05b8254c..8a583e8d39 100644 --- a/disperser/batcher/encoding_streamer_test.go +++ b/disperser/batcher/encoding_streamer_test.go @@ -8,13 +8,13 @@ import ( "time" cmock "github.com/Layr-Labs/eigenda/common/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" "github.com/Layr-Labs/eigenda/disperser" "github.com/Layr-Labs/eigenda/disperser/batcher" "github.com/Layr-Labs/eigenda/disperser/common/inmem" "github.com/Layr-Labs/eigenda/disperser/mock" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/gammazero/workerpool" "github.com/stretchr/testify/assert" tmock "github.com/stretchr/testify/mock" @@ -39,7 +39,7 @@ type components struct { } func createEncodingStreamer(t *testing.T, initialBlockNumber uint, batchThreshold uint64, streamerConfig batcher.StreamerConfig) (*batcher.EncodingStreamer, *components) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() blobStore := inmem.NewBlobStore() cst, err := coremock.MakeChainDataMock(map[uint8]int{ 0: numOperators, @@ -66,7 +66,7 @@ func createEncodingStreamer(t *testing.T, initialBlockNumber uint, batchThreshol } func TestEncodingQueueLimit(t *testing.T) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() blobStore := inmem.NewBlobStore() cst, err := coremock.MakeChainDataMock(map[uint8]int{ 0: numOperators, @@ -296,7 +296,7 @@ func TestStreamingEncoding(t *testing.T) { } func TestEncodingFailure(t *testing.T) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() blobStore := inmem.NewBlobStore() cst, err := coremock.MakeChainDataMock(map[uint8]int{ 0: numOperators, diff --git a/disperser/batcher/finalizer_test.go b/disperser/batcher/finalizer_test.go index 2bc18d295c..68a1b69817 100644 --- a/disperser/batcher/finalizer_test.go +++ b/disperser/batcher/finalizer_test.go @@ -7,12 +7,12 @@ import ( "time" "github.com/Layr-Labs/eigenda/common/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/disperser" "github.com/Layr-Labs/eigenda/disperser/batcher" "github.com/Layr-Labs/eigenda/disperser/common/inmem" "github.com/Layr-Labs/eigenda/encoding" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -26,7 +26,7 @@ const loopInterval = 6 * time.Minute func TestFinalizedBlob(t *testing.T) { queue := inmem.NewBlobStore() - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() ethClient := &mock.MockEthClient{} rpcClient := &mock.MockRPCEthClient{} @@ -125,7 +125,7 @@ func TestFinalizedBlob(t *testing.T) { func TestUnfinalizedBlob(t *testing.T) { ctx := context.Background() queue := inmem.NewBlobStore() - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() ethClient := &mock.MockEthClient{} rpcClient := &mock.MockRPCEthClient{} @@ -198,7 +198,7 @@ func TestUnfinalizedBlob(t *testing.T) { func TestNoReceipt(t *testing.T) { ctx := context.Background() queue := inmem.NewBlobStore() - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() ethClient := &mock.MockEthClient{} rpcClient := &mock.MockRPCEthClient{} diff --git a/disperser/batcher/txn_manager_test.go b/disperser/batcher/txn_manager_test.go index c3886898e4..628d8de305 100644 --- a/disperser/batcher/txn_manager_test.go +++ b/disperser/batcher/txn_manager_test.go @@ -8,10 +8,10 @@ import ( "time" "github.com/Layr-Labs/eigenda/common/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/disperser/batcher" sdkmock "github.com/Layr-Labs/eigensdk-go/chainio/clients/mocks" walletsdk "github.com/Layr-Labs/eigensdk-go/chainio/clients/wallet" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/assert" @@ -22,7 +22,7 @@ func TestProcessTransaction(t *testing.T) { ethClient := &mock.MockEthClient{} ctrl := gomock.NewController(t) w := sdkmock.NewMockWallet(ctrl) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() metrics := batcher.NewMetrics("9100", logger) txnManager := batcher.NewTxnManager(ethClient, w, 0, 5, 100*time.Millisecond, 100*time.Millisecond, logger, metrics.TxnManagerMetrics) ctx, cancel := context.WithTimeout(context.Background(), time.Second*1) @@ -72,7 +72,7 @@ func TestReplaceGasFee(t *testing.T) { ethClient := &mock.MockEthClient{} ctrl := gomock.NewController(t) w := sdkmock.NewMockWallet(ctrl) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() metrics := batcher.NewMetrics("9100", logger) txnManager := batcher.NewTxnManager(ethClient, w, 0, 5, 100*time.Millisecond, 100*time.Millisecond, logger, metrics.TxnManagerMetrics) ctx, cancel := context.WithTimeout(context.Background(), time.Second*1) @@ -108,7 +108,7 @@ func TestTransactionReplacementFailure(t *testing.T) { ethClient := &mock.MockEthClient{} ctrl := gomock.NewController(t) w := sdkmock.NewMockWallet(ctrl) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() metrics := batcher.NewMetrics("9100", logger) txnManager := batcher.NewTxnManager(ethClient, w, 0, 5, time.Second, 48*time.Second, logger, metrics.TxnManagerMetrics) ctx, cancel := context.WithTimeout(context.Background(), time.Second*1) @@ -141,7 +141,7 @@ func TestSendTransactionReceiptRetry(t *testing.T) { ethClient := &mock.MockEthClient{} ctrl := gomock.NewController(t) w := sdkmock.NewMockWallet(ctrl) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() metrics := batcher.NewMetrics("9100", logger) txnManager := batcher.NewTxnManager(ethClient, w, 0, 5, time.Second, 48*time.Second, logger, metrics.TxnManagerMetrics) ctx, cancel := context.WithTimeout(context.Background(), time.Second*1) @@ -179,7 +179,7 @@ func TestSendTransactionRetrySuccess(t *testing.T) { ethClient := &mock.MockEthClient{} ctrl := gomock.NewController(t) w := sdkmock.NewMockWallet(ctrl) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() metrics := batcher.NewMetrics("9100", logger) txnManager := batcher.NewTxnManager(ethClient, w, 0, 5, time.Second, 48*time.Second, logger, metrics.TxnManagerMetrics) ctx, cancel := context.WithTimeout(context.Background(), time.Second*1) @@ -221,7 +221,7 @@ func TestSendTransactionRetryFailure(t *testing.T) { ethClient := &mock.MockEthClient{} ctrl := gomock.NewController(t) w := sdkmock.NewMockWallet(ctrl) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() metrics := batcher.NewMetrics("9100", logger) txnManager := batcher.NewTxnManager(ethClient, w, 0, 5, time.Second, 48*time.Second, logger, metrics.TxnManagerMetrics) ctx, cancel := context.WithTimeout(context.Background(), time.Second*1) @@ -259,7 +259,7 @@ func TestTransactionNotBroadcasted(t *testing.T) { ethClient := &mock.MockEthClient{} ctrl := gomock.NewController(t) w := sdkmock.NewMockWallet(ctrl) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() metrics := batcher.NewMetrics("9100", logger) txnManager := batcher.NewTxnManager(ethClient, w, 0, 5, 100*time.Millisecond, 48*time.Second, logger, metrics.TxnManagerMetrics) ctx, cancel := context.WithTimeout(context.Background(), time.Second*1) diff --git a/disperser/common/blobstore/blobstore_test.go b/disperser/common/blobstore/blobstore_test.go index 23aa2bafe0..5d2dbcb3ef 100644 --- a/disperser/common/blobstore/blobstore_test.go +++ b/disperser/common/blobstore/blobstore_test.go @@ -10,10 +10,10 @@ import ( "github.com/Layr-Labs/eigenda/common/aws" "github.com/Layr-Labs/eigenda/common/aws/dynamodb" test_utils "github.com/Layr-Labs/eigenda/common/aws/dynamodb/utils" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/google/uuid" awsmock "github.com/Layr-Labs/eigenda/common/aws/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/disperser/common/blobstore" "github.com/Layr-Labs/eigenda/inabox/deploy" @@ -21,7 +21,7 @@ import ( ) var ( - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() securityParams = []*core.SecurityParam{{ QuorumID: 1, AdversaryThreshold: 80, diff --git a/disperser/common/v2/blobstore/blobstore_test.go b/disperser/common/v2/blobstore/blobstore_test.go index a864e3b03f..56be90f73e 100644 --- a/disperser/common/v2/blobstore/blobstore_test.go +++ b/disperser/common/v2/blobstore/blobstore_test.go @@ -12,9 +12,9 @@ import ( test_utils "github.com/Layr-Labs/eigenda/common/aws/dynamodb/utils" "github.com/Layr-Labs/eigenda/common/aws/mock" "github.com/Layr-Labs/eigenda/common/aws/s3" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/encoding" "github.com/Layr-Labs/eigenda/inabox/deploy" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/consensys/gnark-crypto/ecc/bn254" "github.com/consensys/gnark-crypto/ecc/bn254/fp" "github.com/google/uuid" @@ -24,7 +24,7 @@ import ( ) var ( - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() dockertestPool *dockertest.Pool dockertestResource *dockertest.Resource diff --git a/disperser/controller/controller_test.go b/disperser/controller/controller_test.go index 50b4145ccd..8c78408374 100644 --- a/disperser/controller/controller_test.go +++ b/disperser/controller/controller_test.go @@ -13,12 +13,12 @@ import ( "github.com/Layr-Labs/eigenda/common/aws/dynamodb" test_utils "github.com/Layr-Labs/eigenda/common/aws/dynamodb/utils" "github.com/Layr-Labs/eigenda/common/aws/s3" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" corev2 "github.com/Layr-Labs/eigenda/core/v2" "github.com/Layr-Labs/eigenda/disperser/common/v2/blobstore" "github.com/Layr-Labs/eigenda/encoding" "github.com/Layr-Labs/eigenda/inabox/deploy" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/consensys/gnark-crypto/ecc/bn254" "github.com/consensys/gnark-crypto/ecc/bn254/fp" "github.com/google/uuid" @@ -27,7 +27,7 @@ import ( ) var ( - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() dockertestPool *dockertest.Pool dockertestResource *dockertest.Resource diff --git a/disperser/controller/dispatcher_test.go b/disperser/controller/dispatcher_test.go index 7b5c83c6d2..00c358cd95 100644 --- a/disperser/controller/dispatcher_test.go +++ b/disperser/controller/dispatcher_test.go @@ -461,7 +461,7 @@ func deleteBlobs(t *testing.T, blobMetadataStore *blobstore.BlobMetadataStore, k } func newDispatcherComponents(t *testing.T) *dispatcherComponents { - // logger := logging.NewNoopLogger() + // logger := testutils.GetLogger() logger, err := common.NewLogger(common.DefaultLoggerConfig()) require.NoError(t, err) pool := workerpool.New(5) diff --git a/disperser/controller/encoding_manager_test.go b/disperser/controller/encoding_manager_test.go index e6fde1107a..1b71cb0468 100644 --- a/disperser/controller/encoding_manager_test.go +++ b/disperser/controller/encoding_manager_test.go @@ -7,6 +7,7 @@ import ( "github.com/Layr-Labs/eigenda/common" commonmock "github.com/Layr-Labs/eigenda/common/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" corev2 "github.com/Layr-Labs/eigenda/core/v2" @@ -16,7 +17,6 @@ import ( "github.com/Layr-Labs/eigenda/disperser/controller" dispmock "github.com/Layr-Labs/eigenda/disperser/mock" "github.com/Layr-Labs/eigenda/encoding" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/gammazero/workerpool" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" @@ -295,7 +295,7 @@ func TestEncodingManagerHandleBatchRetryFailure(t *testing.T) { } func newTestComponents(t *testing.T, mockPool bool) *testComponents { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() // logger, err := common.NewLogger(common.DefaultLoggerConfig()) // require.NoError(t, err) var pool common.WorkerPool diff --git a/disperser/dataapi/server_test.go b/disperser/dataapi/server_test.go index 50c5723954..2672fb56f2 100644 --- a/disperser/dataapi/server_test.go +++ b/disperser/dataapi/server_test.go @@ -15,6 +15,7 @@ import ( "testing" "time" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" "github.com/Layr-Labs/eigenda/disperser" @@ -24,7 +25,6 @@ import ( "github.com/Layr-Labs/eigenda/disperser/dataapi/subgraph" subgraphmock "github.com/Layr-Labs/eigenda/disperser/dataapi/subgraph/mock" "github.com/Layr-Labs/eigenda/encoding" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/consensys/gnark-crypto/ecc/bn254/fp" "github.com/ethereum/go-ethereum/common" gethcommon "github.com/ethereum/go-ethereum/common" @@ -43,7 +43,7 @@ var ( mockPrometheusRespAvgThroughput string expectedBlobCommitment *encoding.BlobCommitments - mockLogger = logging.NewNoopLogger() + mockLogger = testutils.GetLogger() blobstore = inmem.NewBlobStore() mockPrometheusApi = &prommock.MockPrometheusApi{} prometheusClient = dataapi.NewPrometheusClient(mockPrometheusApi, "test-cluster") diff --git a/disperser/dataapi/subgraph_client_test.go b/disperser/dataapi/subgraph_client_test.go index 1d3768359c..5282ca45e9 100644 --- a/disperser/dataapi/subgraph_client_test.go +++ b/disperser/dataapi/subgraph_client_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/disperser/dataapi" "github.com/Layr-Labs/eigenda/disperser/dataapi/subgraph" subgraphmock "github.com/Layr-Labs/eigenda/disperser/dataapi/subgraph/mock" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/shurcooL/graphql" "github.com/stretchr/testify/assert" ) @@ -436,7 +436,7 @@ var ( func TestQueryBatchesWithLimit(t *testing.T) { mockSubgraphApi := &subgraphmock.MockSubgraphApi{} - subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, logging.NewNoopLogger()) + subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, testutils.GetLogger()) mockSubgraphApi.On("QueryBatches").Return(subgraphBatches, nil) batches, err := subgraphClient.QueryBatchesWithLimit(context.Background(), 2, 0) assert.NoError(t, err) @@ -463,7 +463,7 @@ func TestQueryBatchesWithLimit(t *testing.T) { func TestQueryOperators(t *testing.T) { mockSubgraphApi := &subgraphmock.MockSubgraphApi{} mockSubgraphApi.On("QueryOperators").Return(subgraphOperatorRegistereds, nil) - subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, logging.NewNoopLogger()) + subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, testutils.GetLogger()) operators, err := subgraphClient.QueryOperatorsWithLimit(context.Background(), 2) assert.NoError(t, err) @@ -490,7 +490,7 @@ func TestQueryIndexedDeregisteredOperatorsForTimeWindow(t *testing.T) { mockSubgraphApi := &subgraphmock.MockSubgraphApi{} mockSubgraphApi.On("QueryDeregisteredOperatorsGreaterThanBlockTimestamp").Return(subgraphOperatorDeregistered, nil) mockSubgraphApi.On("QueryOperatorInfoByOperatorIdAtBlockNumber").Return(subgraphIndexedOperatorInfo1, nil) - subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, logging.NewNoopLogger()) + subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, testutils.GetLogger()) indexedDeregisteredOperatorState, err := subgraphClient.QueryIndexedOperatorsWithStateForTimeWindow(context.Background(), 1, dataapi.Deregistered) assert.NoError(t, err) @@ -519,7 +519,7 @@ func TestQueryIndexedRegisteredOperatorsForTimeWindow(t *testing.T) { mockSubgraphApi := &subgraphmock.MockSubgraphApi{} mockSubgraphApi.On("QueryRegisteredOperatorsGreaterThanBlockTimestamp").Return(subgraphOperatorRegistered, nil) mockSubgraphApi.On("QueryOperatorInfoByOperatorIdAtBlockNumber").Return(subgraphIndexedOperatorInfo1, nil) - subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, logging.NewNoopLogger()) + subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, testutils.GetLogger()) indexedRegisteredOperatorState, err := subgraphClient.QueryIndexedOperatorsWithStateForTimeWindow(context.Background(), 1, dataapi.Registered) assert.NoError(t, err) @@ -547,7 +547,7 @@ func TestQueryIndexedRegisteredOperatorsForTimeWindow(t *testing.T) { func TestQueryBatchNonSigningInfoInInterval(t *testing.T) { mockSubgraphApi := &subgraphmock.MockSubgraphApi{} mockSubgraphApi.On("QueryBatchNonSigningInfo", int64(0), int64(1)).Return(batchNonSigningInfo, nil) - subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, logging.NewNoopLogger()) + subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, testutils.GetLogger()) result, err := subgraphClient.QueryBatchNonSigningInfoInInterval(context.Background(), 0, 1) assert.NoError(t, err) assert.Equal(t, 2, len(result)) @@ -582,7 +582,7 @@ func TestQueryOperatorQuorumEvent(t *testing.T) { mockSubgraphApi := &subgraphmock.MockSubgraphApi{} mockSubgraphApi.On("QueryOperatorAddedToQuorum").Return(operatorAddedToQuorum, nil) mockSubgraphApi.On("QueryOperatorRemovedFromQuorum").Return(operatorRemovedFromQuorum, nil) - subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, logging.NewNoopLogger()) + subgraphClient := dataapi.NewSubgraphClient(mockSubgraphApi, testutils.GetLogger()) result, err := subgraphClient.QueryOperatorQuorumEvent(context.Background(), uint32(78), uint32(88)) assert.NoError(t, err) diff --git a/disperser/dataapi/v2/server_v2_test.go b/disperser/dataapi/v2/server_v2_test.go index 1580c6c579..955ba512cb 100644 --- a/disperser/dataapi/v2/server_v2_test.go +++ b/disperser/dataapi/v2/server_v2_test.go @@ -18,6 +18,7 @@ import ( "github.com/Layr-Labs/eigenda/common/aws" "github.com/Layr-Labs/eigenda/common/aws/dynamodb" test_utils "github.com/Layr-Labs/eigenda/common/aws/dynamodb/utils" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" corev2 "github.com/Layr-Labs/eigenda/core/v2" @@ -31,7 +32,6 @@ import ( serverv2 "github.com/Layr-Labs/eigenda/disperser/dataapi/v2" "github.com/Layr-Labs/eigenda/encoding" "github.com/Layr-Labs/eigenda/inabox/deploy" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/consensys/gnark-crypto/ecc/bn254" "github.com/consensys/gnark-crypto/ecc/bn254/fp" gethcommon "github.com/ethereum/go-ethereum/common" @@ -57,7 +57,7 @@ var ( blobMetadataStore *blobstorev2.BlobMetadataStore testDataApiServerV2 *serverv2.ServerV2 - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() // Local stack localStackPort = "4566" @@ -65,7 +65,7 @@ var ( dockertestResource *dockertest.Resource deployLocalStack bool - mockLogger = logging.NewNoopLogger() + mockLogger = testutils.GetLogger() blobstore = inmem.NewBlobStore() mockPrometheusApi = &prommock.MockPrometheusApi{} prometheusClient = dataapi.NewPrometheusClient(mockPrometheusApi, "test-cluster") diff --git a/disperser/encoder/server_test.go b/disperser/encoder/server_test.go index b8c83e0503..a438cf8b5b 100644 --- a/disperser/encoder/server_test.go +++ b/disperser/encoder/server_test.go @@ -16,9 +16,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/encoding/kzg" encmock "github.com/Layr-Labs/eigenda/encoding/mock" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" @@ -32,7 +32,7 @@ var ( gettysburgAddressBytes = []byte("Fourscore and seven years ago our fathers brought forth, on this continent, a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived, and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting-place for those who here gave their lives, that that nation might live. It is altogether fitting and proper that we should do this. But, in a larger sense, we cannot dedicate, we cannot consecrate—we cannot hallow—this ground. The brave men, living and dead, who struggled here, have consecrated it far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they here gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom, and that government of the people, by the people, for the people, shall not perish from the earth.") ) -var logger = logging.NewNoopLogger() +var logger = testutils.GetLogger() func makeTestProver(numPoint uint64) (encoding.Prover, ServerConfig) { kzgConfig := &kzg.KzgConfig{ diff --git a/disperser/encoder/setup_test.go b/disperser/encoder/setup_test.go index cb6df6fd95..3982346a0b 100644 --- a/disperser/encoder/setup_test.go +++ b/disperser/encoder/setup_test.go @@ -5,15 +5,15 @@ import ( "os" "testing" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/encoding" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/consensys/gnark-crypto/ecc/bn254" "github.com/consensys/gnark-crypto/ecc/bn254/fp" "github.com/google/uuid" ) var ( - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() UUID = uuid.New() s3BucketName = "test-eigenda" mockCommitment = encoding.BlobCommitments{} diff --git a/go.mod b/go.mod index b5de6d4e7b..e618fd5b22 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,10 @@ module github.com/Layr-Labs/eigenda -go 1.21 - -toolchain go1.21.1 +go 1.21.13 require ( - github.com/Layr-Labs/cerberus-api v0.0.0-20241112163132-950ce31ba1ee - github.com/Layr-Labs/eigensdk-go v0.1.7-0.20240507215523-7e4891d5099a + github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250110011045-5649f15d5f37 + github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250110011045-5649f15d5f37 github.com/aws/aws-sdk-go-v2 v1.26.1 github.com/aws/aws-sdk-go-v2/credentials v1.17.11 github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.12 @@ -48,6 +46,7 @@ require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/DataDog/zstd v1.5.2 // indirect github.com/KyleBanks/depth v1.2.1 // indirect + github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect @@ -83,7 +82,7 @@ require ( github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/docker/cli v25.0.3+incompatible // indirect - github.com/docker/docker v25.0.5+incompatible // indirect + github.com/docker/docker v25.0.6+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect diff --git a/go.sum b/go.sum index 11c555d81c..c0797216d2 100644 --- a/go.sum +++ b/go.sum @@ -8,10 +8,12 @@ github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= -github.com/Layr-Labs/cerberus-api v0.0.0-20241112163132-950ce31ba1ee h1:aUOOI6lDb3mrAg0ClQPM+TUe0XkKcpP0Ddb9ZubciEA= -github.com/Layr-Labs/cerberus-api v0.0.0-20241112163132-950ce31ba1ee/go.mod h1:Lm4fhzy0S3P7GjerzuseGaBFVczsIKmEhIjcT52Hluo= -github.com/Layr-Labs/eigensdk-go v0.1.7-0.20240507215523-7e4891d5099a h1:L/UsJFw9M31FD/WgXTPFB0oxbq9Cu4Urea1xWPMQS7Y= -github.com/Layr-Labs/eigensdk-go v0.1.7-0.20240507215523-7e4891d5099a/go.mod h1:OF9lmS/57MKxS0xpSpX0qHZl0SKkDRpvJIvsGvMN1y8= +github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5 h1:s24M6HYObEuV9OSY36jUM09kp5fOhuz/g1ev2qWDPzU= +github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5/go.mod h1:Lm4fhzy0S3P7GjerzuseGaBFVczsIKmEhIjcT52Hluo= +github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250110011045-5649f15d5f37 h1:0MlNMABUHCl85FqrgIKc4/v0qEOuoYy8Piu5nudB/dE= +github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250110011045-5649f15d5f37/go.mod h1:G4yqiK+5NfUuEMVGGncOEm7QskuGRPmKA7bKxpPzPT4= +github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250110011045-5649f15d5f37 h1:cT2mS9rtYq5gb/nBTDhLxWN1AimukTOGEiN0Fyi+7ew= +github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250110011045-5649f15d5f37/go.mod h1:p/coyQpMG0aaF+JekxNoacPWP6FqSuWLI2YpiC+YVKs= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= @@ -158,8 +160,8 @@ github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/cli v25.0.3+incompatible h1:KLeNs7zws74oFuVhgZQ5ONGZiXUUdgsdy6/EsX/6284= github.com/docker/cli v25.0.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE= -github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v25.0.6+incompatible h1:5cPwbwriIcsua2REJe8HqQV+6WlWc1byg2QSXzBxBGg= +github.com/docker/docker v25.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= diff --git a/indexer/eth/header_service_test.go b/indexer/eth/header_service_test.go index bbef1a108f..a351b9fb99 100644 --- a/indexer/eth/header_service_test.go +++ b/indexer/eth/header_service_test.go @@ -7,10 +7,9 @@ import ( "testing" cm "github.com/Layr-Labs/eigenda/common/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/indexer" "github.com/Layr-Labs/eigenda/indexer/eth" - "github.com/Layr-Labs/eigensdk-go/logging" - "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc" @@ -20,7 +19,7 @@ import ( ) var ( - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() blockNumber int64 = 17320293 ) diff --git a/indexer/test/indexer_test.go b/indexer/test/indexer_test.go index 1c5d9eecbb..5a9c32a31e 100644 --- a/indexer/test/indexer_test.go +++ b/indexer/test/indexer_test.go @@ -2,21 +2,22 @@ package weth_test import ( "context" + "testing" "time" "github.com/Layr-Labs/eigenda/indexer" - "github.com/Layr-Labs/eigensdk-go/logging" ethereumcm "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/indexer/eth" "github.com/Layr-Labs/eigenda/indexer/test/mock" "github.com/Layr-Labs/eigenda/indexer/inmem" ) -var logger = logging.NewNoopLogger() +var logger = testutils.GetLogger() func newTestFilterer(sc *mock.ContractSimulator, isFastMode bool) *Filterer { return &Filterer{ diff --git a/node/churner_client.go b/node/churner_client.go index bdbb2aa03b..fb68a36619 100644 --- a/node/churner_client.go +++ b/node/churner_client.go @@ -4,6 +4,7 @@ import ( "context" "crypto/rand" "crypto/tls" + "encoding/hex" "errors" "time" @@ -11,6 +12,7 @@ import ( "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/operators/churner" "github.com/Layr-Labs/eigensdk-go/logging" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "google.golang.org/grpc" @@ -22,7 +24,7 @@ type ChurnerClient interface { // Churn sends a churn request to the churner service // The quorumIDs cannot be empty, but may contain quorums that the operator is already registered in. // If the operator is already registered in a quorum, the churner will ignore it and continue with the other quorums. - Churn(ctx context.Context, operatorAddress string, keyPair *core.KeyPair, quorumIDs []core.QuorumID) (*churnerpb.ChurnReply, error) + Churn(ctx context.Context, operatorAddress string, keyPair *core.KeyPair, sdkSigner sdkSigner.Signer, quorumIDs []core.QuorumID) (*churnerpb.ChurnReply, error) } type churnerClient struct { @@ -41,7 +43,13 @@ func NewChurnerClient(churnerURL string, useSecureGrpc bool, timeout time.Durati } } -func (c *churnerClient) Churn(ctx context.Context, operatorAddress string, keyPair *core.KeyPair, quorumIDs []core.QuorumID) (*churnerpb.ChurnReply, error) { +func (c *churnerClient) Churn( + ctx context.Context, + operatorAddress string, + keyPair *core.KeyPair, + sdkSigner sdkSigner.Signer, + quorumIDs []core.QuorumID, +) (*churnerpb.ChurnReply, error) { if len(quorumIDs) == 0 { return nil, errors.New("quorumIDs cannot be empty") } @@ -53,10 +61,14 @@ func (c *churnerClient) Churn(ctx context.Context, operatorAddress string, keyPa } salt := crypto.Keccak256([]byte("churn"), []byte(time.Now().String()), quorumIDs[:], bytes) + g1, g2, err := getG1G2FromSdkSigner(sdkSigner) + if err != nil { + return nil, err + } churnRequest := &churner.ChurnRequest{ OperatorAddress: gethcommon.HexToAddress(operatorAddress), - OperatorToRegisterPubkeyG1: keyPair.PubKey, - OperatorToRegisterPubkeyG2: keyPair.GetPubKeyG2(), + OperatorToRegisterPubkeyG1: g1, + OperatorToRegisterPubkeyG2: g2, OperatorRequestSignature: &core.Signature{}, QuorumIDs: quorumIDs, } @@ -64,7 +76,20 @@ func (c *churnerClient) Churn(ctx context.Context, operatorAddress string, keyPa copy(churnRequest.Salt[:], salt) // sign the request - churnRequest.OperatorRequestSignature = keyPair.SignMessage(churner.CalculateRequestHash(churnRequest)) + messageHash := churner.CalculateRequestHash(churnRequest) + messageHashBytes := messageHash[:] + signatureBytes, err := sdkSigner.Sign(ctx, messageHashBytes) + if err != nil { + return nil, err + } + signature := new(core.Signature) + g1Signature, err := signature.Deserialize(signatureBytes) + if err != nil { + return nil, err + } + churnRequest.OperatorRequestSignature = &core.Signature{ + G1Point: g1Signature, + } // convert to protobuf churnRequestPb := &churnerpb.ChurnRequest{ @@ -103,3 +128,25 @@ func (c *churnerClient) Churn(ctx context.Context, operatorAddress string, keyPa return gc.Churn(ctx, churnRequestPb, opt) } + +func getG1G2FromSdkSigner(sdkSigner sdkSigner.Signer) (*core.G1Point, *core.G2Point, error) { + g1 := new(core.G1Point) + g2 := new(core.G2Point) + g1KeyBytes, err := hex.DecodeString(sdkSigner.GetPublicKeyG1()) + if err != nil { + return nil, nil, err + } + g1, err = g1.Deserialize(g1KeyBytes) + if err != nil { + return nil, nil, err + } + g2KeyBytes, err := hex.DecodeString(sdkSigner.GetPublicKeyG2()) + if err != nil { + return nil, nil, err + } + g2, err = g2.Deserialize(g2KeyBytes) + if err != nil { + return nil, nil, err + } + return g1, g2, nil +} diff --git a/node/config.go b/node/config.go index 6b4bec16cb..c2581d0223 100644 --- a/node/config.go +++ b/node/config.go @@ -14,7 +14,7 @@ import ( "github.com/Layr-Labs/eigenda/encoding/kzg" "github.com/Layr-Labs/eigenda/node/flags" - "github.com/Layr-Labs/eigensdk-go/crypto/bls" + sdkSignerTypes "github.com/Layr-Labs/eigensdk-go/signer/bls/types" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/crypto" @@ -62,7 +62,6 @@ type Config struct { QuorumIDList []core.QuorumID DbPath string LogPath string - PrivateBls string ID core.OperatorID BLSOperatorStateRetrieverAddr string EigenDAServiceManagerAddr string @@ -78,11 +77,7 @@ type Config struct { ReachabilityPollIntervalSec uint64 DisableNodeInfoResources bool - BLSRemoteSignerEnabled bool - BLSRemoteSignerUrl string - BLSPublicKeyHex string - BLSKeyPassword string - BLSSignerTLSCertFilePath string + BlsSignerConfig sdkSignerTypes.SignerConfig EthClientConfig geth.EthClientConfig LoggerConfig common.LoggerConfig @@ -171,28 +166,46 @@ func NewConfig(ctx *cli.Context) (*Config, error) { ethClientConfig = geth.ReadEthClientConfig(ctx) } - // check if BLS remote signer configuration is provided - blsRemoteSignerEnabled := ctx.GlobalBool(flags.BLSRemoteSignerEnabledFlag.Name) - if blsRemoteSignerEnabled && (ctx.GlobalString(flags.BLSRemoteSignerUrlFlag.Name) == "" || ctx.GlobalString(flags.BLSPublicKeyHexFlag.Name) == "") { - return nil, fmt.Errorf("BLS remote signer URL and Public Key Hex is required if BLS remote signer is enabled") - } - if !blsRemoteSignerEnabled && (ctx.GlobalString(flags.BlsKeyFileFlag.Name) == "" || ctx.GlobalString(flags.BlsKeyPasswordFlag.Name) == "") { - return nil, fmt.Errorf("BLS key file and password is required if BLS remote signer is disabled") - } - - // Decrypt BLS key - var privateBls string + var blsSignerConfig sdkSignerTypes.SignerConfig if !testMode { - // If remote signer fields are empty then try to read the BLS key from the file - if !blsRemoteSignerEnabled { - kp, err := bls.ReadPrivateKeyFromFile(ctx.GlobalString(flags.BlsKeyFileFlag.Name), ctx.GlobalString(flags.BlsKeyPasswordFlag.Name)) - if err != nil { - return nil, fmt.Errorf("could not read or decrypt the BLS private key: %v", err) - } - privateBls = kp.PrivKey.String() + blsSignerCertFilePath := ctx.GlobalString(flags.BLSSignerCertFileFlag.Name) + enableTLS := len(blsSignerCertFilePath) > 0 + signerType := sdkSignerTypes.Local + + // check if BLS remote signer configuration is provided + blsRemoteSignerEnabled := ctx.GlobalBool(flags.BLSRemoteSignerEnabledFlag.Name) + blsRemoteSignerUrl := ctx.GlobalString(flags.BLSRemoteSignerUrlFlag.Name) + blsPublicKeyHex := ctx.GlobalString(flags.BLSPublicKeyHexFlag.Name) + blsKeyFilePath := ctx.GlobalString(flags.BlsKeyFileFlag.Name) + blsKeyPassword := ctx.GlobalString(flags.BlsKeyPasswordFlag.Name) + + if blsRemoteSignerEnabled && (blsRemoteSignerUrl == "" || blsPublicKeyHex == "") { + return nil, fmt.Errorf("BLS remote signer URL and Public Key Hex is required if BLS remote signer is enabled") + } + if !blsRemoteSignerEnabled && (blsKeyFilePath == "" || blsKeyPassword == "") { + return nil, fmt.Errorf("BLS key file and password is required if BLS remote signer is disabled") + } + + if blsRemoteSignerEnabled { + signerType = sdkSignerTypes.Cerberus + } + + blsSignerConfig = sdkSignerTypes.SignerConfig{ + SignerType: signerType, + Path: blsKeyFilePath, + Password: blsKeyPassword, + CerberusUrl: blsRemoteSignerUrl, + PublicKeyHex: blsPublicKeyHex, + CerberusPassword: blsKeyPassword, + EnableTLS: enableTLS, + TLSCertFilePath: ctx.GlobalString(flags.BLSSignerCertFileFlag.Name), } } else { - privateBls = ctx.GlobalString(flags.TestPrivateBlsFlag.Name) + privateBls := ctx.GlobalString(flags.TestPrivateBlsFlag.Name) + blsSignerConfig = sdkSignerTypes.SignerConfig{ + SignerType: sdkSignerTypes.PrivateKey, + PrivateKey: privateBls, + } } internalDispersalFlag := ctx.GlobalString(flags.InternalDispersalPortFlag.Name) @@ -229,7 +242,6 @@ func NewConfig(ctx *cli.Context) (*Config, error) { OverrideStoreDurationBlocks: ctx.GlobalInt64(flags.OverrideStoreDurationBlocksFlag.Name), QuorumIDList: ids, DbPath: ctx.GlobalString(flags.DbPathFlag.Name), - PrivateBls: privateBls, EthClientConfig: ethClientConfig, EncoderConfig: kzg.ReadCLIConfig(ctx), LoggerConfig: *loggerConfig, @@ -245,11 +257,7 @@ func NewConfig(ctx *cli.Context) (*Config, error) { ClientIPHeader: ctx.GlobalString(flags.ClientIPHeaderFlag.Name), UseSecureGrpc: ctx.GlobalBoolT(flags.ChurnerUseSecureGRPC.Name), DisableNodeInfoResources: ctx.GlobalBool(flags.DisableNodeInfoResourcesFlag.Name), - BLSRemoteSignerUrl: ctx.GlobalString(flags.BLSRemoteSignerUrlFlag.Name), - BLSPublicKeyHex: ctx.GlobalString(flags.BLSPublicKeyHexFlag.Name), - BLSKeyPassword: ctx.GlobalString(flags.BlsKeyPasswordFlag.Name), - BLSSignerTLSCertFilePath: ctx.GlobalString(flags.BLSSignerCertFileFlag.Name), - BLSRemoteSignerEnabled: blsRemoteSignerEnabled, + BlsSignerConfig: blsSignerConfig, EnableV2: ctx.GlobalBool(flags.EnableV2Flag.Name), OnchainStateRefreshInterval: ctx.GlobalDuration(flags.OnchainStateRefreshIntervalFlag.Name), ChunkDownloadTimeout: ctx.GlobalDuration(flags.ChunkDownloadTimeoutFlag.Name), diff --git a/node/grpc/server_test.go b/node/grpc/server_test.go index b608e91c2b..7a91075bd0 100644 --- a/node/grpc/server_test.go +++ b/node/grpc/server_test.go @@ -23,6 +23,8 @@ import ( "github.com/Layr-Labs/eigenda/node" "github.com/Layr-Labs/eigenda/node/grpc" "github.com/Layr-Labs/eigensdk-go/metrics" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" + sdkSignerTypes "github.com/Layr-Labs/eigensdk-go/signer/bls/types" "github.com/consensys/gnark-crypto/ecc/bn254/fp" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" @@ -99,6 +101,13 @@ func newTestServerWithConfig(t *testing.T, mockValidator bool, config *node.Conf if err != nil { panic("failed to create a BLS Key") } + signer, err := sdkSigner.NewSigner(sdkSignerTypes.SignerConfig{ + SignerType: sdkSignerTypes.PrivateKey, + PrivateKey: keyPair.PrivKey.String(), + }) + if err != nil { + panic("failed to create a BLS signer") + } opID = [32]byte{} copy(opID[:], []byte(fmt.Sprintf("%d", 3))) loggerConfig := common.DefaultLoggerConfig() @@ -155,6 +164,7 @@ func newTestServerWithConfig(t *testing.T, mockValidator bool, config *node.Conf Config: config, Logger: logger, KeyPair: keyPair, + BlsSigner: signer, Metrics: metrics, Store: store, ChainState: chainState, diff --git a/node/mock/churner_client.go b/node/mock/churner_client.go index a69d4f4eb7..382404c844 100644 --- a/node/mock/churner_client.go +++ b/node/mock/churner_client.go @@ -6,6 +6,7 @@ import ( churnerpb "github.com/Layr-Labs/eigenda/api/grpc/churner" "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/node" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" "github.com/stretchr/testify/mock" ) @@ -15,7 +16,7 @@ type ChurnerClient struct { var _ node.ChurnerClient = (*ChurnerClient)(nil) -func (c *ChurnerClient) Churn(ctx context.Context, operatorAddress string, keyPair *core.KeyPair, quorumIDs []core.QuorumID) (*churnerpb.ChurnReply, error) { +func (c *ChurnerClient) Churn(ctx context.Context, operatorAddress string, keyPair *core.KeyPair, signer sdkSigner.Signer, quorumIDs []core.QuorumID) (*churnerpb.ChurnReply, error) { args := c.Called() var reply *churnerpb.ChurnReply if args.Get(0) != nil { diff --git a/node/node.go b/node/node.go index b7bfaed516..630a11b1ca 100644 --- a/node/node.go +++ b/node/node.go @@ -28,10 +28,6 @@ import ( gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" - "github.com/Layr-Labs/eigenda/api/clients/v2" "github.com/Layr-Labs/eigenda/api/grpc/node" "github.com/Layr-Labs/eigenda/common/geth" @@ -40,12 +36,13 @@ import ( "github.com/Layr-Labs/eigenda/core/indexer" corev2 "github.com/Layr-Labs/eigenda/core/v2" v2 "github.com/Layr-Labs/eigenda/core/v2" + "github.com/Layr-Labs/eigensdk-go/logging" "github.com/Layr-Labs/eigensdk-go/metrics" "github.com/Layr-Labs/eigensdk-go/nodeapi" - "github.com/gammazero/workerpool" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" - blssignerV1 "github.com/Layr-Labs/cerberus-api/pkg/api/v1" + "github.com/gammazero/workerpool" ) const ( @@ -76,7 +73,9 @@ type Node struct { PubIPProvider pubip.Provider OperatorSocketsFilterer indexer.OperatorSocketsFilterer ChainID *big.Int - BLSSigner blssignerV1.SignerClient + BLSPublicKeyHex string + + BlsSigner sdkSigner.Signer RelayClient atomic.Value @@ -126,45 +125,18 @@ func NewNode( // Create ChainState Client cst := eth.NewChainState(tx, client) - var keyPair *core.KeyPair - var blsClient blssignerV1.SignerClient - if config.PrivateBls != "" { - nodeLogger.Info("using local keystore private key for BLS signing") - // Generate BLS keys - keyPair, err = core.MakeKeyPairFromString(config.PrivateBls) - if err != nil { - return nil, err - } - - config.ID = keyPair.GetPubKeyG1().GetOperatorID() - } else { - pkBytes, err := hex.DecodeString(config.BLSPublicKeyHex) - if err != nil { - return nil, fmt.Errorf("failed to decode BLS public key: %w", err) - } - pubkey := new(core.G1Point) - publicKey, err := pubkey.Deserialize(pkBytes) - if err != nil { - return nil, err - } - - config.ID = publicKey.GetOperatorID() - - nodeLogger.Info("creating signer client", "url", config.BLSRemoteSignerUrl) - creds := insecure.NewCredentials() - if config.BLSSignerTLSCertFilePath != "" { - creds, err = credentials.NewClientTLSFromFile(config.BLSSignerTLSCertFilePath, "") - if err != nil { - return nil, err - } - } - conn, err := grpc.NewClient( - config.BLSRemoteSignerUrl, grpc.WithTransportCredentials(creds), - ) - if err != nil { - return nil, fmt.Errorf("failed to create new BLS remote signer client: %w", err) - } - blsClient = blssignerV1.NewSignerClient(conn) + blsSigner, err := sdkSigner.NewSigner(config.BlsSignerConfig) + if err != nil { + return nil, fmt.Errorf("failed to create BLS signer: %w", err) + } + blsPublicKeyHex := blsSigner.GetPublicKeyG1() + operatorID, err := blsSigner.GetOperatorId() + if err != nil { + return nil, fmt.Errorf("failed to get operator ID: %w", err) + } + config.ID, err = core.OperatorIDFromHex(operatorID) + if err != nil { + return nil, fmt.Errorf("failed to convert operator ID: %w", err) } // Setup Node Api @@ -222,7 +194,6 @@ func NewNode( n := &Node{ Config: config, Logger: nodeLogger, - KeyPair: keyPair, Metrics: metrics, NodeApi: nodeApi, Store: store, @@ -233,7 +204,8 @@ func NewNode( PubIPProvider: pubIPProvider, OperatorSocketsFilterer: socketsFilterer, ChainID: chainID, - BLSSigner: blsClient, + BlsSigner: blsSigner, + BLSPublicKeyHex: blsPublicKeyHex, } if !config.EnableV2 { @@ -333,6 +305,7 @@ func (n *Node) Start(ctx context.Context) error { Timeout: 10 * time.Second, PrivKey: privateKey, KeyPair: n.KeyPair, + Signer: n.BlsSigner, OperatorId: n.Config.ID, QuorumIDs: n.Config.QuorumIDList, RegisterNodeAtStart: n.Config.RegisterNodeAtStart, @@ -583,35 +556,25 @@ func (n *Node) ProcessBatch(ctx context.Context, header *core.BatchHeader, blobs } n.Metrics.RecordStoreChunksStage("signed", batchSize, time.Since(stageTimer)) - log.Debug("Sign batch succeeded", "pubkey", n.Config.BLSPublicKeyHex, "duration", time.Since(stageTimer)) + log.Debug("Sign batch succeeded", "pubkey", n.BLSPublicKeyHex, "duration", time.Since(stageTimer)) log.Debug("Exiting process batch", "duration", time.Since(start)) return signature, nil } func (n *Node) SignMessage(ctx context.Context, data [32]byte) (*core.Signature, error) { - if n.Config.BLSRemoteSignerEnabled { - sigResp, err := n.BLSSigner.SignGeneric( - ctx, - &blssignerV1.SignGenericRequest{ - PublicKey: n.Config.BLSPublicKeyHex, - Password: n.Config.BLSKeyPassword, - Data: data[:], - }, - ) - if err != nil { - return nil, fmt.Errorf("failed to sign data: %w", err) - } - sig := new(core.Signature) - g, err := sig.Deserialize(sigResp.Signature) - if err != nil { - return nil, fmt.Errorf("failed to deserialize signature: %w", err) - } - return &core.Signature{ - G1Point: g, - }, nil + signature, err := n.BlsSigner.Sign(ctx, data[:]) + if err != nil { + return nil, fmt.Errorf("failed to sign message: %w", err) + } + sig := new(core.Signature) + g, err := sig.Deserialize(signature) + if err != nil { + return nil, fmt.Errorf("failed to deserialize signature: %w", err) } - return n.KeyPair.SignMessage(data), nil + return &core.Signature{ + G1Point: g, + }, nil } func (n *Node) ValidateBatch(ctx context.Context, header *core.BatchHeader, blobs []*core.BlobMessage) error { diff --git a/node/node_test.go b/node/node_test.go index 906183c812..63af0d9cc0 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -125,7 +125,7 @@ func TestNodeStartOperatorIDMatch(t *testing.T) { ChurnBIPsOfTotalStake: uint16(10), }, nil) c.tx.On("GetNumberOfRegisteredOperatorForQuorum", mock.Anything, mock.Anything).Return(uint32(0), nil) - c.tx.On("RegisterOperator", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + c.tx.On("RegisterOperator", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) c.tx.On("OperatorAddressToID", mock.Anything).Return(core.OperatorID(opID), nil) @@ -148,7 +148,7 @@ func TestNodeStartOperatorIDDoesNotMatch(t *testing.T) { ChurnBIPsOfTotalStake: uint16(10), }, nil) c.tx.On("GetNumberOfRegisteredOperatorForQuorum", mock.Anything, mock.Anything).Return(uint32(0), nil) - c.tx.On("RegisterOperator", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) + c.tx.On("RegisterOperator", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) c.tx.On("OperatorAddressToID", mock.Anything).Return(core.OperatorID{1}, nil) diff --git a/node/operator.go b/node/operator.go index 5a73ca72e0..9a1e3d99bc 100644 --- a/node/operator.go +++ b/node/operator.go @@ -12,6 +12,7 @@ import ( "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigensdk-go/logging" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" "github.com/ethereum/go-ethereum/crypto" ) @@ -21,6 +22,7 @@ type Operator struct { Timeout time.Duration PrivKey *ecdsa.PrivateKey KeyPair *core.KeyPair + Signer sdkSigner.Signer OperatorId core.OperatorID QuorumIDs []core.QuorumID RegisterNodeAtStart bool @@ -84,21 +86,21 @@ func RegisterOperator(ctx context.Context, operator *Operator, transactor core.W // if we should call the churner, call it if shouldCallChurner { - churnReply, err := churnerClient.Churn(ctx, operator.Address, operator.KeyPair, quorumsToRegister) + churnReply, err := churnerClient.Churn(ctx, operator.Address, operator.KeyPair, operator.Signer, quorumsToRegister) if err != nil { return fmt.Errorf("failed to request churn approval: %w", err) } - return transactor.RegisterOperatorWithChurn(ctx, operator.KeyPair, operator.Socket, quorumsToRegister, operator.PrivKey, salt, expiry, churnReply) + return transactor.RegisterOperatorWithChurn(ctx, operator.KeyPair, operator.Signer, operator.Socket, quorumsToRegister, operator.PrivKey, salt, expiry, churnReply) } else { // other wise just register normally - return transactor.RegisterOperator(ctx, operator.KeyPair, operator.Socket, quorumsToRegister, operator.PrivKey, salt, expiry) + return transactor.RegisterOperator(ctx, operator.KeyPair, operator.Signer, operator.Socket, quorumsToRegister, operator.PrivKey, salt, expiry) } } // DeregisterOperator deregisters the operator with the given public key from the specified quorums that it is registered with at the supplied block number. // If the operator isn't registered with any of the specified quorums, this function will return error, and no quorum will be deregistered. -func DeregisterOperator(ctx context.Context, operator *Operator, KeyPair *core.KeyPair, transactor core.Writer) error { +func DeregisterOperator(ctx context.Context, operator *Operator, pubKeyG1 *core.G1Point, transactor core.Writer) error { if len(operator.QuorumIDs) > 1+core.MaxQuorumID { return fmt.Errorf("cannot provide more than %d quorums", 1+core.MaxQuorumID) } @@ -106,7 +108,7 @@ func DeregisterOperator(ctx context.Context, operator *Operator, KeyPair *core.K if err != nil { return fmt.Errorf("failed to get current block number: %w", err) } - return transactor.DeregisterOperator(ctx, KeyPair.GetPubKeyG1(), blockNumber, operator.QuorumIDs) + return transactor.DeregisterOperator(ctx, pubKeyG1, blockNumber, operator.QuorumIDs) } // UpdateOperatorSocket updates the socket for the given operator diff --git a/node/operator_test.go b/node/operator_test.go index f88342054f..49c9a8f63f 100644 --- a/node/operator_test.go +++ b/node/operator_test.go @@ -2,25 +2,33 @@ package node_test import ( "context" + "strings" "testing" "time" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" "github.com/Layr-Labs/eigenda/node" nodemock "github.com/Layr-Labs/eigenda/node/mock" - "github.com/Layr-Labs/eigensdk-go/logging" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" + sdkSignerTypes "github.com/Layr-Labs/eigensdk-go/signer/bls/types" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) func TestRegisterOperator(t *testing.T) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() operatorID := [32]byte(hexutil.MustDecode("0x3fbfefcdc76462d2cdb7d0cea75f27223829481b8b4aa6881c94cb2126a316ad")) keyPair, err := core.GenRandomBlsKeys() assert.NoError(t, err) + signer, err := sdkSigner.NewSigner(sdkSignerTypes.SignerConfig{ + PrivateKey: keyPair.PrivKey.String(), + SignerType: sdkSignerTypes.PrivateKey, + }) + assert.NoError(t, err) // Create a new operator operator := &node.Operator{ Address: "0xB7Ad27737D88B07De48CDc2f379917109E993Be4", @@ -28,6 +36,7 @@ func TestRegisterOperator(t *testing.T) { Timeout: 10 * time.Second, PrivKey: nil, KeyPair: keyPair, + Signer: signer, OperatorId: operatorID, QuorumIDs: []core.QuorumID{0, 1}, RegisterNodeAtStart: false, @@ -41,7 +50,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).Return(nil) + tx.On("RegisterOperator", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) return tx } @@ -58,7 +67,7 @@ func TestRegisterOperator(t *testing.T) { } func TestRegisterOperatorWithChurn(t *testing.T) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() operatorID := [32]byte(hexutil.MustDecode("0x3fbfefcdc76462d2cdb7d0cea75f27223829481b8b4aa6881c94cb2126a316ad")) keyPair, err := core.GenRandomBlsKeys() assert.NoError(t, err) @@ -80,10 +89,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).Return(nil) + tx.On("RegisterOperatorWithChurn", mock.Anything, 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, []core.QuorumID{1}, mock.Anything, mock.Anything, mock.Anything, mock.Anything) + tx.AssertCalled(t, "RegisterOperatorWithChurn", mock.Anything, mock.Anything, mock.Anything, mock.Anything, []core.QuorumID{1}, mock.Anything, mock.Anything, mock.Anything, mock.Anything) } diff --git a/node/plugin/cmd/main.go b/node/plugin/cmd/main.go index 6fa489c203..20621e82d6 100644 --- a/node/plugin/cmd/main.go +++ b/node/plugin/cmd/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "encoding/hex" "log" "os" "strings" @@ -14,7 +15,8 @@ import ( "github.com/Layr-Labs/eigenda/core/eth" "github.com/Layr-Labs/eigenda/node" "github.com/Layr-Labs/eigenda/node/plugin" - "github.com/Layr-Labs/eigensdk-go/crypto/bls" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" + sdkSignerTypes "github.com/Layr-Labs/eigensdk-go/signer/bls/types" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/urfave/cli" ) @@ -35,6 +37,9 @@ func main() { plugin.ChurnerUrlFlag, plugin.NumConfirmationsFlag, plugin.PubIPProviderFlag, + plugin.BLSRemoteSignerUrlFlag, + plugin.BLSPublicKeyHexFlag, + plugin.BLSSignerCertFileFlag, } app.Name = "eigenda-node-plugin" app.Usage = "EigenDA Node Plugin" @@ -54,21 +59,47 @@ func pluginOps(ctx *cli.Context) { } log.Printf("Info: plugin configs and flags parsed") - kp, err := bls.ReadPrivateKeyFromFile(config.BlsKeyFile, config.BlsKeyPassword) + signerCfg := sdkSignerTypes.SignerConfig{ + PublicKeyHex: config.BLSPublicKeyHex, + CerberusUrl: config.BLSRemoteSignerUrl, + CerberusPassword: config.BlsKeyPassword, + TLSCertFilePath: config.BLSSignerCertFile, + Path: config.BlsKeyFile, + Password: config.BlsKeyPassword, + } + if config.BLSRemoteSignerUrl != "" { + signerCfg.SignerType = sdkSignerTypes.Cerberus + } else { + signerCfg.SignerType = sdkSignerTypes.Local + } + signer, err := sdkSigner.NewSigner(signerCfg) if err != nil { - log.Printf("Error: failed to read or decrypt the BLS private key: %v", err) + log.Printf("Error: failed to create BLS signer: %v", err) return } - g1point := &core.G1Point{ - G1Affine: kp.PubKey.G1Affine, + + opID, err := signer.GetOperatorId() + if err != nil { + log.Printf("Error: failed to get operator ID: %v", err) + return } - keyPair := &core.KeyPair{ - PrivKey: kp.PrivKey, - PubKey: g1point, + operatorID, err := core.OperatorIDFromHex(opID) + if err != nil { + log.Printf("Error: failed to convert operator ID: %v", err) + return + } + pubKeyG1Hex := signer.GetPublicKeyG1() + pubKeyG1, err := hex.DecodeString(pubKeyG1Hex) + if err != nil { + log.Printf("Error: failed to decode public key G1: %v", err) + return + } + pubKeyG1Point := new(core.G1Point) + pubKeyG1Point, err = pubKeyG1Point.Deserialize(pubKeyG1) + if err != nil { + log.Printf("Error: failed to deserialize public key G1: %v", err) + return } - log.Printf("Info: Bls key read and decrypted from %s", config.BlsKeyFile) - - operatorID := keyPair.GetPubKeyG1().GetOperatorID() sk, privateKey, err := plugin.GetECDSAPrivateKey(config.EcdsaKeyFile, config.EcdsaKeyPassword) if err != nil { @@ -123,8 +154,8 @@ func pluginOps(ctx *cli.Context) { Socket: socket, Timeout: 10 * time.Second, PrivKey: sk.PrivateKey, - KeyPair: keyPair, - OperatorId: keyPair.GetPubKeyG1().GetOperatorID(), + Signer: signer, + OperatorId: operatorID, QuorumIDs: config.QuorumIDList, RegisterNodeAtStart: false, } @@ -139,7 +170,7 @@ func pluginOps(ctx *cli.Context) { log.Printf("Info: successfully opt-in the EigenDA, for operator ID: %x, operator address: %x, socket: %s, and quorums: %v", operatorID, sk.Address, config.Socket, config.QuorumIDList) } else if config.Operation == plugin.OperationOptOut { log.Printf("Info: Operator with Operator Address: %x and OperatorID: %x is opting out of EigenDA", sk.Address, operatorID) - err = node.DeregisterOperator(context.Background(), operator, keyPair, tx) + err = node.DeregisterOperator(context.Background(), operator, pubKeyG1Point, tx) if err != nil { log.Printf("Error: failed to opt-out EigenDA Node Network for operator ID: %x, operator address: %x, quorums: %v, error: %v", operatorID, sk.Address, config.QuorumIDList, err) return diff --git a/node/plugin/config.go b/node/plugin/config.go index 6d7ee2af5a..e97cbdaeb2 100644 --- a/node/plugin/config.go +++ b/node/plugin/config.go @@ -63,6 +63,26 @@ var ( Usage: "Password to decrypt the bls key", EnvVar: common.PrefixEnvVar(flags.EnvVarPrefix, "BLS_KEY_PASSWORD"), } + BLSRemoteSignerUrlFlag = cli.StringFlag{ + Name: "bls-remote-signer-url", + Usage: "The URL of the BLS remote signer", + Required: false, + EnvVar: common.PrefixEnvVar(flags.EnvVarPrefix, "BLS_REMOTE_SIGNER_URL"), + } + + BLSPublicKeyHexFlag = cli.StringFlag{ + Name: "bls-public-key-hex", + Usage: "The hex-encoded public key of the BLS signer", + Required: false, + EnvVar: common.PrefixEnvVar(flags.EnvVarPrefix, "BLS_PUBLIC_KEY_HEX"), + } + + BLSSignerCertFileFlag = cli.StringFlag{ + Name: "bls-signer-cert-file", + Usage: "The path to the BLS signer certificate file", + Required: false, + EnvVar: common.PrefixEnvVar(flags.EnvVarPrefix, "BLS_SIGNER_CERT_FILE"), + } // The socket and the quorums to register. SocketFlag = cli.StringFlag{ @@ -119,6 +139,9 @@ type Config struct { BlsKeyFile string EcdsaKeyPassword string BlsKeyPassword string + BLSRemoteSignerUrl string + BLSPublicKeyHex string + BLSSignerCertFile string Socket string QuorumIDList []core.QuorumID ChainRpcUrl string @@ -157,6 +180,9 @@ func NewConfig(ctx *cli.Context) (*Config, error) { BlsKeyPassword: ctx.GlobalString(BlsKeyPasswordFlag.Name), EcdsaKeyFile: ctx.GlobalString(EcdsaKeyFileFlag.Name), BlsKeyFile: ctx.GlobalString(BlsKeyFileFlag.Name), + BLSRemoteSignerUrl: ctx.GlobalString(BLSRemoteSignerUrlFlag.Name), + BLSPublicKeyHex: ctx.GlobalString(BLSPublicKeyHexFlag.Name), + BLSSignerCertFile: ctx.GlobalString(BLSSignerCertFileFlag.Name), Socket: ctx.GlobalString(SocketFlag.Name), QuorumIDList: ids, ChainRpcUrl: ctx.GlobalString(ChainRpcUrlFlag.Name), diff --git a/node/store_test.go b/node/store_test.go index ef64a78e90..39789f8e59 100644 --- a/node/store_test.go +++ b/node/store_test.go @@ -15,8 +15,8 @@ import ( "github.com/Layr-Labs/eigenda/encoding" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/node" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/Layr-Labs/eigensdk-go/metrics" "github.com/consensys/gnark-crypto/ecc/bn254" "github.com/consensys/gnark-crypto/ecc/bn254/fp" @@ -213,7 +213,7 @@ func CreateBatchWith(t *testing.T, encodeBundle bool) (*core.BatchHeader, []*cor func createStore(t *testing.T) *node.Store { noopMetrics := metrics.NewNoopMetrics() reg := prometheus.NewRegistry() - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() operatorId := [32]byte(hexutil.MustDecode("0x3fbfefcdc76462d2cdb7d0cea75f27223829481b8b4aa6881c94cb2126a316ad")) tx := &coremock.MockWriter{} dat, _ := mock.MakeChainDataMock(map[uint8]int{ diff --git a/node/store_v2_test.go b/node/store_v2_test.go index 814c61c0de..43a27359ad 100644 --- a/node/store_v2_test.go +++ b/node/store_v2_test.go @@ -6,11 +6,11 @@ import ( "github.com/Layr-Labs/eigenda/common/kvstore" "github.com/Layr-Labs/eigenda/common/kvstore/tablestore" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" corev2 "github.com/Layr-Labs/eigenda/core/v2" "github.com/Layr-Labs/eigenda/node" nodemock "github.com/Layr-Labs/eigenda/node/mock" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -162,7 +162,7 @@ func TestGetChunks(t *testing.T) { } func createStoreV2(t *testing.T) (node.StoreV2, kvstore.TableStore) { - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() config := tablestore.DefaultLevelDBConfig(t.TempDir()) config.Schema = []string{node.BatchHeaderTableName, node.BlobCertificateTableName, node.BundleTableName} tStore, err := tablestore.Start(logger, config) diff --git a/operators/churner/server_test.go b/operators/churner/server_test.go index 5c7c471b7f..ec75f1c71f 100644 --- a/operators/churner/server_test.go +++ b/operators/churner/server_test.go @@ -10,12 +10,12 @@ import ( "github.com/Layr-Labs/eigenda/common" "github.com/Layr-Labs/eigenda/common/geth" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" dacore "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" indexermock "github.com/Layr-Labs/eigenda/core/mock" "github.com/Layr-Labs/eigenda/operators/churner" - "github.com/Layr-Labs/eigensdk-go/logging" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/assert" @@ -27,7 +27,7 @@ import ( var ( keyPair *dacore.KeyPair quorumIds = []uint32{0, 1} - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() transactorMock = &coremock.MockWriter{} mockIndexer = &indexermock.MockIndexedChainState{} operatorAddr = gethcommon.HexToAddress("0x0000000000000000000000000000000000000001") diff --git a/operators/churner/tests/churner_test.go b/operators/churner/tests/churner_test.go index ba9f11c522..d0a2ef500d 100644 --- a/operators/churner/tests/churner_test.go +++ b/operators/churner/tests/churner_test.go @@ -14,6 +14,7 @@ import ( pb "github.com/Layr-Labs/eigenda/api/grpc/churner" "github.com/Layr-Labs/eigenda/common" "github.com/Layr-Labs/eigenda/common/geth" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" dacore "github.com/Layr-Labs/eigenda/core" "github.com/Layr-Labs/eigenda/core/eth" @@ -23,6 +24,8 @@ import ( "github.com/Layr-Labs/eigenda/operators/churner" "github.com/Layr-Labs/eigensdk-go/crypto/bls" "github.com/Layr-Labs/eigensdk-go/logging" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" + sdkSignerTypes "github.com/Layr-Labs/eigensdk-go/signer/bls/types" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/assert" @@ -37,7 +40,7 @@ var ( testConfig *deploy.Config templateName string testName string - logger = logging.NewNoopLogger() + logger = testutils.GetLogger() mockIndexer = &indexermock.MockIndexedChainState{} rpcURL = "http://localhost:8545" quorumIds = []uint32{0, 1} @@ -103,8 +106,15 @@ func TestChurner(t *testing.T) { var tx *eth.Writer var operatorPrivateKey *ecdsa.PrivateKey var keyPair *dacore.KeyPair + var signer sdkSigner.Signer for i, op := range testConfig.Operators { socket := fmt.Sprintf("%s:%s:%s", op.NODE_HOSTNAME, op.NODE_DISPERSAL_PORT, op.NODE_RETRIEVAL_PORT) + opSigner, err := sdkSigner.NewSigner(sdkSignerTypes.SignerConfig{ + Path: op.NODE_BLS_KEY_FILE, + Password: op.NODE_BLS_KEY_PASSWORD, + SignerType: sdkSignerTypes.Local, + }) + assert.NoError(t, err) kp, err := bls.ReadPrivateKeyFromFile(op.NODE_BLS_KEY_FILE, op.NODE_BLS_KEY_PASSWORD) assert.NoError(t, err) g1point := &core.G1Point{ @@ -130,10 +140,11 @@ func TestChurner(t *testing.T) { // This operator will churn others operatorAddr = sk.Address.Hex() keyPair = opKeyPair + signer = opSigner operatorPrivateKey = sk.PrivateKey break } - err = tx.RegisterOperator(ctx, opKeyPair, socket, quorumIDsUint8, sk.PrivateKey, salt, expiry) + err = tx.RegisterOperator(ctx, opKeyPair, opSigner, socket, quorumIDsUint8, sk.PrivateKey, salt, expiry) assert.NoError(t, err) } assert.Greater(t, len(lowestStakeOperatorAddr), 0) @@ -183,7 +194,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, "localhost:8080", quorumIDsUint8, operatorPrivateKey, salt32, expiry, reply) + err = tx.RegisterOperatorWithChurn(ctx, keyPair, signer, "localhost:8080", quorumIDsUint8, operatorPrivateKey, salt32, expiry, reply) assert.NoError(t, err) } diff --git a/relay/chunkstore/chunk_store_test.go b/relay/chunkstore/chunk_store_test.go index 6d0c3e2d3e..8aedde11e4 100644 --- a/relay/chunkstore/chunk_store_test.go +++ b/relay/chunkstore/chunk_store_test.go @@ -10,13 +10,13 @@ import ( "github.com/Layr-Labs/eigenda/common/aws" "github.com/Layr-Labs/eigenda/common/aws/mock" "github.com/Layr-Labs/eigenda/common/aws/s3" + "github.com/Layr-Labs/eigenda/common/testutils" tu "github.com/Layr-Labs/eigenda/common/testutils" corev2 "github.com/Layr-Labs/eigenda/core/v2" "github.com/Layr-Labs/eigenda/encoding" "github.com/Layr-Labs/eigenda/encoding/rs" "github.com/Layr-Labs/eigenda/encoding/utils/codec" "github.com/Layr-Labs/eigenda/inabox/deploy" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/consensys/gnark-crypto/ecc/bn254/fp" "github.com/ory/dockertest/v3" "github.com/stretchr/testify/assert" @@ -262,7 +262,7 @@ func TestCheckProofCoefficientsExist(t *testing.T) { // logger, err := common.NewLogger(common.DefaultLoggerConfig()) // require.NoError(t, err) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() chunkSize := uint64(rand.Intn(1024) + 100) fragmentSize := int(chunkSize / 2) diff --git a/retriever/eth/chain_client_test.go b/retriever/eth/chain_client_test.go index fe66e1c6ca..80edd2f177 100644 --- a/retriever/eth/chain_client_test.go +++ b/retriever/eth/chain_client_test.go @@ -3,14 +3,15 @@ package eth_test import ( "context" "encoding/hex" + "math/big" "testing" "github.com/Layr-Labs/eigenda/common" damock "github.com/Layr-Labs/eigenda/common/mock" + "github.com/Layr-Labs/eigenda/common/testutils" binding "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDAServiceManager" "github.com/Layr-Labs/eigenda/retriever/eth" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/ethereum/go-ethereum" gcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -19,7 +20,7 @@ import ( func TestFetchBatchHeader(t *testing.T) { ethClient := &damock.MockEthClient{} - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() serviceManagerAddress := gcommon.HexToAddress("0x0000000000000000000000000000000000000000") batchHeaderHash := []byte("hashhash") chainClient := eth.NewChainClient(ethClient, logger) diff --git a/retriever/server_test.go b/retriever/server_test.go index 79e2b22a8e..2617ec2f5a 100644 --- a/retriever/server_test.go +++ b/retriever/server_test.go @@ -8,6 +8,7 @@ import ( clientsmock "github.com/Layr-Labs/eigenda/api/clients/mock" pb "github.com/Layr-Labs/eigenda/api/grpc/retriever" + "github.com/Layr-Labs/eigenda/common/testutils" binding "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDAServiceManager" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" @@ -18,7 +19,6 @@ import ( "github.com/Layr-Labs/eigenda/encoding/utils/codec" "github.com/Layr-Labs/eigenda/retriever" "github.com/Layr-Labs/eigenda/retriever/mock" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/stretchr/testify/assert" ) @@ -61,7 +61,7 @@ func newTestServer(t *testing.T) *retriever.Server { var err error config := &retriever.Config{} - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() indexedChainState, err = coremock.MakeChainDataMock(map[uint8]int{ 0: numOperators, diff --git a/retriever/v2/server_test.go b/retriever/v2/server_test.go index 5585c9d4f3..d74b27f236 100644 --- a/retriever/v2/server_test.go +++ b/retriever/v2/server_test.go @@ -10,6 +10,7 @@ import ( commonpb "github.com/Layr-Labs/eigenda/api/grpc/common" commonpbv2 "github.com/Layr-Labs/eigenda/api/grpc/common/v2" pb "github.com/Layr-Labs/eigenda/api/grpc/retriever/v2" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" "github.com/Layr-Labs/eigenda/encoding" @@ -19,7 +20,6 @@ import ( "github.com/Layr-Labs/eigenda/encoding/utils/codec" "github.com/Layr-Labs/eigenda/retriever/mock" retriever "github.com/Layr-Labs/eigenda/retriever/v2" - "github.com/Layr-Labs/eigensdk-go/logging" "github.com/consensys/gnark-crypto/ecc/bn254" "github.com/consensys/gnark-crypto/ecc/bn254/fp" "github.com/stretchr/testify/require" @@ -62,7 +62,7 @@ func newTestServer(t *testing.T) *retriever.Server { var err error config := &retriever.Config{} - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() indexedChainState, err = coremock.MakeChainDataMock(map[uint8]int{ 0: numOperators, diff --git a/test/integration_test.go b/test/integration_test.go index 6c93cd3821..6a6cc03578 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -30,6 +30,7 @@ import ( clientsmock "github.com/Layr-Labs/eigenda/api/clients/mock" commonaws "github.com/Layr-Labs/eigenda/common/aws" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/core/meterer" coremock "github.com/Layr-Labs/eigenda/core/mock" "github.com/Layr-Labs/eigenda/disperser/apiserver" @@ -361,7 +362,6 @@ func mustMakeOperators(t *testing.T, cst *coremock.ChainDataMock, logger logging ExpirationPollIntervalSec: 10, DbPath: dbPath, LogPath: logPath, - PrivateBls: string(op.KeyPair.GetPubKeyG1().Serialize()), ID: id, QuorumIDList: registeredQuorums, DispersalAuthenticationKeyCacheSize: 1024, @@ -410,6 +410,7 @@ func mustMakeOperators(t *testing.T, cst *coremock.ChainDataMock, logger logging Config: config, Logger: logger, KeyPair: op.KeyPair, + BlsSigner: op.Signer, Metrics: metrics, Store: store, ChainState: cst, @@ -491,7 +492,7 @@ func TestDispersalAndRetrieval(t *testing.T) { cst.On("GetCurrentBlockNumber").Return(uint(10), nil) - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() assert.NoError(t, err) store := inmem.NewBlobStore() dis := mustMakeDisperser(t, cst, store, logger) diff --git a/tools/traffic/generator_test.go b/tools/traffic/generator_test.go index b530ef5bd2..d0db0b9d2e 100644 --- a/tools/traffic/generator_test.go +++ b/tools/traffic/generator_test.go @@ -7,16 +7,15 @@ import ( "github.com/Layr-Labs/eigenda/api/clients" clientsmock "github.com/Layr-Labs/eigenda/api/clients/mock" + "github.com/Layr-Labs/eigenda/common/testutils" "github.com/Layr-Labs/eigenda/disperser" "github.com/Layr-Labs/eigenda/tools/traffic" - "github.com/Layr-Labs/eigensdk-go/logging" - "github.com/stretchr/testify/mock" ) func TestTrafficGenerator(t *testing.T) { disperserClient := clientsmock.NewMockDisperserClient() - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() trafficGenerator := &traffic.TrafficGenerator{ Logger: logger, Config: &traffic.Config{ @@ -43,7 +42,7 @@ func TestTrafficGenerator(t *testing.T) { func TestTrafficGeneratorAuthenticated(t *testing.T) { disperserClient := clientsmock.NewMockDisperserClient() - logger := logging.NewNoopLogger() + logger := testutils.GetLogger() trafficGenerator := &traffic.TrafficGenerator{ Logger: logger, From f82a13730c2e9c271114f598eaffbaf7dc4678e9 Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Sun, 12 Jan 2025 19:04:25 -0800 Subject: [PATCH 2/8] update server v2 --- node/grpc/server_v2.go | 17 ++++++++++------- node/grpc/server_v2_test.go | 12 +++++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/node/grpc/server_v2.go b/node/grpc/server_v2.go index acbc057f9e..fd877073af 100644 --- a/node/grpc/server_v2.go +++ b/node/grpc/server_v2.go @@ -5,6 +5,9 @@ import ( "encoding/hex" "errors" "fmt" + "runtime" + "time" + "github.com/Layr-Labs/eigenda/api" pb "github.com/Layr-Labs/eigenda/api/grpc/node/v2" "github.com/Layr-Labs/eigenda/common" @@ -17,8 +20,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/shirou/gopsutil/mem" "google.golang.org/grpc/peer" - "runtime" - "time" ) // ServerV2 implements the Node v2 proto APIs. @@ -114,9 +115,8 @@ func (s *ServerV2) StoreChunks(ctx context.Context, in *pb.StoreChunksRequest) ( return nil, api.NewErrorInternal("v2 store not initialized") } - // TODO(ian-shim): support remote signer - if s.node.KeyPair == nil { - return nil, api.NewErrorInternal("missing key pair") + if s.node.BlsSigner == nil { + return nil, api.NewErrorInternal("missing bls signer") } batch, err := s.validateStoreChunksRequest(in) @@ -179,12 +179,15 @@ func (s *ServerV2) StoreChunks(ctx context.Context, in *pb.StoreChunksRequest) ( return nil, api.NewErrorInternal(fmt.Sprintf("failed to store batch: %v", res.err)) } - sig := s.node.KeyPair.SignMessage(batchHeaderHash).Bytes() + sig, err := s.node.BlsSigner.Sign(ctx, batchHeaderHash[:]) + if err != nil { + return nil, api.NewErrorInternal(fmt.Sprintf("failed to sign batch: %v", err)) + } s.metrics.ReportStoreChunksLatency(time.Since(start)) return &pb.StoreChunksReply{ - Signature: sig[:], + Signature: sig, }, nil } diff --git a/node/grpc/server_v2_test.go b/node/grpc/server_v2_test.go index b1784a7a67..33a346be53 100644 --- a/node/grpc/server_v2_test.go +++ b/node/grpc/server_v2_test.go @@ -3,11 +3,12 @@ package grpc_test import ( "context" "errors" - coreeth "github.com/Layr-Labs/eigenda/core/eth" "os" "sync/atomic" "testing" + coreeth "github.com/Layr-Labs/eigenda/core/eth" + "github.com/Layr-Labs/eigenda/api/clients/v2" clientsmock "github.com/Layr-Labs/eigenda/api/clients/v2/mock" pbcommon "github.com/Layr-Labs/eigenda/api/grpc/common/v2" @@ -23,6 +24,8 @@ import ( "github.com/Layr-Labs/eigenda/node/grpc" nodemock "github.com/Layr-Labs/eigenda/node/mock" "github.com/Layr-Labs/eigensdk-go/metrics" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" + sdkSignerTypes "github.com/Layr-Labs/eigensdk-go/signer/bls/types" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -53,6 +56,12 @@ type testComponents struct { func newTestComponents(t *testing.T, config *node.Config) *testComponents { keyPair, err := core.GenRandomBlsKeys() require.NoError(t, err) + require.NoError(t, err) + signer, err := sdkSigner.NewSigner(sdkSignerTypes.SignerConfig{ + SignerType: sdkSignerTypes.PrivateKey, + PrivateKey: keyPair.PrivKey.String(), + }) + require.NoError(t, err) opID = [32]byte{0} loggerConfig := common.DefaultLoggerConfig() logger, err := common.NewLogger(loggerConfig) @@ -76,6 +85,7 @@ func newTestComponents(t *testing.T, config *node.Config) *testComponents { Config: config, Logger: logger, KeyPair: keyPair, + BlsSigner: signer, Metrics: metrics, StoreV2: s, ChainState: chainState, From aa6499bcd132805ce8d6486af5b37e4e8ea60688 Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Mon, 13 Jan 2025 12:54:40 -0800 Subject: [PATCH 3/8] update to new sdk with grpc fix --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index e618fd5b22..895b13cc00 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/Layr-Labs/eigenda go 1.21.13 require ( - github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250110011045-5649f15d5f37 - github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250110011045-5649f15d5f37 + github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250113205313-04f1688dbfdf + github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250113205313-04f1688dbfdf github.com/aws/aws-sdk-go-v2 v1.26.1 github.com/aws/aws-sdk-go-v2/credentials v1.17.11 github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.12 diff --git a/go.sum b/go.sum index c0797216d2..ceb06ea129 100644 --- a/go.sum +++ b/go.sum @@ -10,10 +10,10 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5 h1:s24M6HYObEuV9OSY36jUM09kp5fOhuz/g1ev2qWDPzU= github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5/go.mod h1:Lm4fhzy0S3P7GjerzuseGaBFVczsIKmEhIjcT52Hluo= -github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250110011045-5649f15d5f37 h1:0MlNMABUHCl85FqrgIKc4/v0qEOuoYy8Piu5nudB/dE= -github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250110011045-5649f15d5f37/go.mod h1:G4yqiK+5NfUuEMVGGncOEm7QskuGRPmKA7bKxpPzPT4= -github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250110011045-5649f15d5f37 h1:cT2mS9rtYq5gb/nBTDhLxWN1AimukTOGEiN0Fyi+7ew= -github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250110011045-5649f15d5f37/go.mod h1:p/coyQpMG0aaF+JekxNoacPWP6FqSuWLI2YpiC+YVKs= +github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250113205313-04f1688dbfdf h1:kLgBNQR5Whd2YxuOL1KHde1gc6HfOY6x8bAQw22pVQk= +github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250113205313-04f1688dbfdf/go.mod h1:G4yqiK+5NfUuEMVGGncOEm7QskuGRPmKA7bKxpPzPT4= +github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250113205313-04f1688dbfdf h1:U+tVyNlN0sCzPtzVVycLXQzLqr1GHh96U9NURqBSlkc= +github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250113205313-04f1688dbfdf/go.mod h1:p/coyQpMG0aaF+JekxNoacPWP6FqSuWLI2YpiC+YVKs= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= From 200244ae72a25198de0047295bc82975d2bf30c1 Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Mon, 13 Jan 2025 14:40:13 -0800 Subject: [PATCH 4/8] update to new sdk with operator id fix --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 895b13cc00..5b88427716 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/Layr-Labs/eigenda go 1.21.13 require ( - github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250113205313-04f1688dbfdf - github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250113205313-04f1688dbfdf + github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250113223831-1f7860a17f04 + github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250113223831-1f7860a17f04 github.com/aws/aws-sdk-go-v2 v1.26.1 github.com/aws/aws-sdk-go-v2/credentials v1.17.11 github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.13.12 diff --git a/go.sum b/go.sum index ceb06ea129..ea529f589d 100644 --- a/go.sum +++ b/go.sum @@ -10,10 +10,10 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5 h1:s24M6HYObEuV9OSY36jUM09kp5fOhuz/g1ev2qWDPzU= github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5/go.mod h1:Lm4fhzy0S3P7GjerzuseGaBFVczsIKmEhIjcT52Hluo= -github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250113205313-04f1688dbfdf h1:kLgBNQR5Whd2YxuOL1KHde1gc6HfOY6x8bAQw22pVQk= -github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250113205313-04f1688dbfdf/go.mod h1:G4yqiK+5NfUuEMVGGncOEm7QskuGRPmKA7bKxpPzPT4= -github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250113205313-04f1688dbfdf h1:U+tVyNlN0sCzPtzVVycLXQzLqr1GHh96U9NURqBSlkc= -github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250113205313-04f1688dbfdf/go.mod h1:p/coyQpMG0aaF+JekxNoacPWP6FqSuWLI2YpiC+YVKs= +github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250113223831-1f7860a17f04 h1:AQcSNdNYDGsjcT9cyzM+NWBvWkHsadG/wOOfj9eyfBE= +github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250113223831-1f7860a17f04/go.mod h1:G4yqiK+5NfUuEMVGGncOEm7QskuGRPmKA7bKxpPzPT4= +github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250113223831-1f7860a17f04 h1:9nLbACTtSOYGRG/O+f080FbyZsucOF4kBTExt1RW0Ms= +github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250113223831-1f7860a17f04/go.mod h1:A8KqCQnvx8BERH35etN9VlubNSpR92zrogV6LkV9hHo= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= From 4e97e8e80a9d8eb080a161bbde7e1313936f061e Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Mon, 13 Jan 2025 15:36:40 -0800 Subject: [PATCH 5/8] bump go patch version to 1.21.13 --- .github/workflows/codeql-scanning.yaml | 2 +- Dockerfile | 2 +- api/builder/Dockerfile | 2 +- disperser/cmd/encoder/icicle.Dockerfile | 4 ++-- lightnode/docker/Dockerfile | 4 ++-- synthetic-test-client.Dockerfile | 2 +- trafficgenerator.Dockerfile | 2 +- trafficgenerator2.Dockerfile | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/codeql-scanning.yaml b/.github/workflows/codeql-scanning.yaml index 46bca7add3..90a073ecc5 100644 --- a/.github/workflows/codeql-scanning.yaml +++ b/.github/workflows/codeql-scanning.yaml @@ -44,7 +44,7 @@ jobs: - name: Install golang uses: actions/setup-go@v3 with: - go-version: '1.21.1' + go-version: '1.21.13' - name: Custom build using make run: | diff --git a/Dockerfile b/Dockerfile index 64f146dd8f..b797220f81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ARG SEMVER="" ARG GITCOMMIT="" ARG GITDATE="" -FROM golang:1.21.1-alpine3.18 AS base-builder +FROM golang:1.21.13-alpine3.18 AS base-builder RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash # Common build stage diff --git a/api/builder/Dockerfile b/api/builder/Dockerfile index 612f8df3c7..6ec885eb49 100644 --- a/api/builder/Dockerfile +++ b/api/builder/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.12-bookworm +FROM golang:1.21.13-bookworm # The URL where the protoc binary can be downloaded. Is different depending on architecture. ARG PROTOC_URL diff --git a/disperser/cmd/encoder/icicle.Dockerfile b/disperser/cmd/encoder/icicle.Dockerfile index 28b8bd10d2..1c6e8788b8 100644 --- a/disperser/cmd/encoder/icicle.Dockerfile +++ b/disperser/cmd/encoder/icicle.Dockerfile @@ -1,8 +1,8 @@ FROM nvidia/cuda:12.2.2-devel-ubuntu22.04 AS builder # Install Go -ENV GOLANG_VERSION=1.21.1 -ENV GOLANG_SHA256=b3075ae1ce5dab85f89bc7905d1632de23ca196bd8336afd93fa97434cfa55ae +ENV GOLANG_VERSION=1.21.13 +ENV GOLANG_SHA256=502fc16d5910562461e6a6631fb6377de2322aad7304bf2bcd23500ba9dab4a7 ADD https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz /tmp/go.tar.gz RUN echo "${GOLANG_SHA256} /tmp/go.tar.gz" | sha256sum -c - && \ diff --git a/lightnode/docker/Dockerfile b/lightnode/docker/Dockerfile index 11f89b42e4..c107af8ce9 100644 --- a/lightnode/docker/Dockerfile +++ b/lightnode/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.12-bookworm AS base +FROM golang:1.21.13-bookworm AS base # Install core dependencies RUN apt update @@ -29,7 +29,7 @@ WORKDIR /home/lnode/eigenda/lightnode RUN make build # In order to equip this image with a shell for debugging, -# swap out the "FROM scratch" below with "FROM golang:1.21.12-bookworm" +# swap out the "FROM scratch" below with "FROM golang:1.21.13-bookworm" FROM scratch AS final # Copy over files needed for lnode user. diff --git a/synthetic-test-client.Dockerfile b/synthetic-test-client.Dockerfile index c1a28641e1..822abb292a 100644 --- a/synthetic-test-client.Dockerfile +++ b/synthetic-test-client.Dockerfile @@ -1,5 +1,5 @@ # Use the official Go image as the base image -FROM golang:1.21.1-alpine3.18 as builder +FROM golang:1.21.13-alpine3.18 as builder # Copy only the test file and necessary files to the container COPY ./disperser /app/disperser diff --git a/trafficgenerator.Dockerfile b/trafficgenerator.Dockerfile index 8d39eaf337..6833f83bdf 100644 --- a/trafficgenerator.Dockerfile +++ b/trafficgenerator.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.1-alpine3.18 as builder +FROM golang:1.21.13-alpine3.18 as builder RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash diff --git a/trafficgenerator2.Dockerfile b/trafficgenerator2.Dockerfile index 8f9dc149b7..017ce75a54 100644 --- a/trafficgenerator2.Dockerfile +++ b/trafficgenerator2.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.1-alpine3.18 as builder +FROM golang:1.21.13-alpine3.18 as builder RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash From 2802cd673154ccb26ccdadd5642c90eb1480478b Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Mon, 13 Jan 2025 16:28:10 -0800 Subject: [PATCH 6/8] correct alpine version --- Dockerfile | 2 +- synthetic-test-client.Dockerfile | 2 +- trafficgenerator.Dockerfile | 2 +- trafficgenerator2.Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b797220f81..3052d24ae0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ARG SEMVER="" ARG GITCOMMIT="" ARG GITDATE="" -FROM golang:1.21.13-alpine3.18 AS base-builder +FROM golang:1.21.13-alpine3.20 AS base-builder RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash # Common build stage diff --git a/synthetic-test-client.Dockerfile b/synthetic-test-client.Dockerfile index 822abb292a..ada43f6eff 100644 --- a/synthetic-test-client.Dockerfile +++ b/synthetic-test-client.Dockerfile @@ -1,5 +1,5 @@ # Use the official Go image as the base image -FROM golang:1.21.13-alpine3.18 as builder +FROM golang:1.21.13-alpine3.20 as builder # Copy only the test file and necessary files to the container COPY ./disperser /app/disperser diff --git a/trafficgenerator.Dockerfile b/trafficgenerator.Dockerfile index 6833f83bdf..a22ea382b3 100644 --- a/trafficgenerator.Dockerfile +++ b/trafficgenerator.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.13-alpine3.18 as builder +FROM golang:1.21.13-alpine3.20 as builder RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash diff --git a/trafficgenerator2.Dockerfile b/trafficgenerator2.Dockerfile index 017ce75a54..524faa91d1 100644 --- a/trafficgenerator2.Dockerfile +++ b/trafficgenerator2.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.13-alpine3.18 as builder +FROM golang:1.21.13-alpine3.20 as builder RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash From 2e43636e769b61079858a316134ecdb5e508b517 Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Mon, 13 Jan 2025 21:26:13 -0800 Subject: [PATCH 7/8] remove empty lines and keypair --- core/eth/reader.go | 1 - core/eth/writer.go | 9 +++++---- node/churner_client.go | 3 +-- node/mock/churner_client.go | 2 +- node/operator.go | 2 +- node/operator_test.go | 1 - retriever/eth/chain_client_test.go | 1 - 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/core/eth/reader.go b/core/eth/reader.go index c23a6ee0ac..e119f5af72 100644 --- a/core/eth/reader.go +++ b/core/eth/reader.go @@ -290,7 +290,6 @@ func (t *Reader) GetRegisteredQuorumIdsForOperator(ctx context.Context, operator func (t *Reader) getRegistrationParams( ctx context.Context, - keypair *core.KeyPair, sdkSigner sdkSigner.Signer, operatorEcdsaPrivateKey *ecdsa.PrivateKey, operatorToAvsRegistrationSigSalt [32]byte, diff --git a/core/eth/writer.go b/core/eth/writer.go index 74010e0c1d..1ad9a98e58 100644 --- a/core/eth/writer.go +++ b/core/eth/writer.go @@ -6,11 +6,12 @@ import ( "encoding/hex" "encoding/json" "fmt" - "github.com/Layr-Labs/eigenda/api" - dreg "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDADisperserRegistry" "log" "math/big" + "github.com/Layr-Labs/eigenda/api" + dreg "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDADisperserRegistry" + "github.com/Layr-Labs/eigenda/api/grpc/churner" "github.com/Layr-Labs/eigenda/common" eigendasrvmg "github.com/Layr-Labs/eigenda/contracts/bindings/EigenDAServiceManager" @@ -71,7 +72,7 @@ func (t *Writer) RegisterOperator( operatorToAvsRegistrationSigExpiry *big.Int, ) error { - params, operatorSignature, err := t.getRegistrationParams(ctx, keypair, signer, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) + params, operatorSignature, err := t.getRegistrationParams(ctx, signer, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) if err != nil { t.logger.Error("Failed to get registration params", "err", err) return err @@ -113,7 +114,7 @@ func (t *Writer) RegisterOperatorWithChurn( churnReply *churner.ChurnReply, ) error { - params, operatorSignature, err := t.getRegistrationParams(ctx, keypair, signer, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) + params, operatorSignature, err := t.getRegistrationParams(ctx, signer, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) if err != nil { t.logger.Error("Failed to get registration params", "err", err) return err diff --git a/node/churner_client.go b/node/churner_client.go index fb68a36619..87d51acdb1 100644 --- a/node/churner_client.go +++ b/node/churner_client.go @@ -24,7 +24,7 @@ type ChurnerClient interface { // Churn sends a churn request to the churner service // The quorumIDs cannot be empty, but may contain quorums that the operator is already registered in. // If the operator is already registered in a quorum, the churner will ignore it and continue with the other quorums. - Churn(ctx context.Context, operatorAddress string, keyPair *core.KeyPair, sdkSigner sdkSigner.Signer, quorumIDs []core.QuorumID) (*churnerpb.ChurnReply, error) + Churn(ctx context.Context, operatorAddress string, sdkSigner sdkSigner.Signer, quorumIDs []core.QuorumID) (*churnerpb.ChurnReply, error) } type churnerClient struct { @@ -46,7 +46,6 @@ func NewChurnerClient(churnerURL string, useSecureGrpc bool, timeout time.Durati func (c *churnerClient) Churn( ctx context.Context, operatorAddress string, - keyPair *core.KeyPair, sdkSigner sdkSigner.Signer, quorumIDs []core.QuorumID, ) (*churnerpb.ChurnReply, error) { diff --git a/node/mock/churner_client.go b/node/mock/churner_client.go index 382404c844..87d29f3372 100644 --- a/node/mock/churner_client.go +++ b/node/mock/churner_client.go @@ -16,7 +16,7 @@ type ChurnerClient struct { var _ node.ChurnerClient = (*ChurnerClient)(nil) -func (c *ChurnerClient) Churn(ctx context.Context, operatorAddress string, keyPair *core.KeyPair, signer sdkSigner.Signer, quorumIDs []core.QuorumID) (*churnerpb.ChurnReply, error) { +func (c *ChurnerClient) Churn(ctx context.Context, operatorAddress string, signer sdkSigner.Signer, quorumIDs []core.QuorumID) (*churnerpb.ChurnReply, error) { args := c.Called() var reply *churnerpb.ChurnReply if args.Get(0) != nil { diff --git a/node/operator.go b/node/operator.go index 9a1e3d99bc..28af3954f7 100644 --- a/node/operator.go +++ b/node/operator.go @@ -86,7 +86,7 @@ func RegisterOperator(ctx context.Context, operator *Operator, transactor core.W // if we should call the churner, call it if shouldCallChurner { - churnReply, err := churnerClient.Churn(ctx, operator.Address, operator.KeyPair, operator.Signer, quorumsToRegister) + churnReply, err := churnerClient.Churn(ctx, operator.Address, operator.Signer, quorumsToRegister) if err != nil { return fmt.Errorf("failed to request churn approval: %w", err) } diff --git a/node/operator_test.go b/node/operator_test.go index 49c9a8f63f..1fa97ef18c 100644 --- a/node/operator_test.go +++ b/node/operator_test.go @@ -2,7 +2,6 @@ package node_test import ( "context" - "strings" "testing" "time" diff --git a/retriever/eth/chain_client_test.go b/retriever/eth/chain_client_test.go index 80edd2f177..adf9c9c352 100644 --- a/retriever/eth/chain_client_test.go +++ b/retriever/eth/chain_client_test.go @@ -3,7 +3,6 @@ package eth_test import ( "context" "encoding/hex" - "math/big" "testing" From b3075cc9bca4dc049a214ffce17d751793a4637e Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Mon, 13 Jan 2025 21:33:35 -0800 Subject: [PATCH 8/8] remove empty lines --- api/clients/retrieval_client_test.go | 1 - common/geth/multihoming_client_test.go | 1 - common/store/dynamo_store_test.go | 1 - common/testutils/test_utils.go | 7 ++++--- disperser/apiserver/server_test.go | 1 - disperser/batcher/batcher_test.go | 1 - indexer/test/indexer_test.go | 1 - 7 files changed, 4 insertions(+), 9 deletions(-) diff --git a/api/clients/retrieval_client_test.go b/api/clients/retrieval_client_test.go index 2b19629d58..0fbd139660 100644 --- a/api/clients/retrieval_client_test.go +++ b/api/clients/retrieval_client_test.go @@ -3,7 +3,6 @@ package clients_test import ( "bytes" "context" - "runtime" "testing" diff --git a/common/geth/multihoming_client_test.go b/common/geth/multihoming_client_test.go index 6ba42d3dd9..c79da079b6 100644 --- a/common/geth/multihoming_client_test.go +++ b/common/geth/multihoming_client_test.go @@ -3,7 +3,6 @@ package geth_test import ( "context" "fmt" - "math/big" "testing" diff --git a/common/store/dynamo_store_test.go b/common/store/dynamo_store_test.go index 4e0d6fef35..eca873e722 100644 --- a/common/store/dynamo_store_test.go +++ b/common/store/dynamo_store_test.go @@ -3,7 +3,6 @@ package store_test import ( "context" "fmt" - "os" "testing" "time" diff --git a/common/testutils/test_utils.go b/common/testutils/test_utils.go index 8a425b2652..f5eac45e34 100644 --- a/common/testutils/test_utils.go +++ b/common/testutils/test_utils.go @@ -3,12 +3,13 @@ package testutils import ( "context" "fmt" - "github.com/Layr-Labs/eigensdk-go/logging" - "github.com/stretchr/testify/assert" - "golang.org/x/exp/rand" "os" "testing" "time" + + "github.com/Layr-Labs/eigensdk-go/logging" + "github.com/stretchr/testify/assert" + "golang.org/x/exp/rand" ) // InitializeRandom initializes the random number generator. If no arguments are provided, then the seed is randomly diff --git a/disperser/apiserver/server_test.go b/disperser/apiserver/server_test.go index 9b8b72687c..26d2b0b53a 100644 --- a/disperser/apiserver/server_test.go +++ b/disperser/apiserver/server_test.go @@ -5,7 +5,6 @@ import ( "crypto/rand" "flag" "fmt" - "math" "math/big" "net" diff --git a/disperser/batcher/batcher_test.go b/disperser/batcher/batcher_test.go index e042654190..0805cc6d3b 100644 --- a/disperser/batcher/batcher_test.go +++ b/disperser/batcher/batcher_test.go @@ -4,7 +4,6 @@ import ( "context" "encoding/hex" "errors" - "math/big" "runtime" "sync" diff --git a/indexer/test/indexer_test.go b/indexer/test/indexer_test.go index 5a9c32a31e..3849ed5653 100644 --- a/indexer/test/indexer_test.go +++ b/indexer/test/indexer_test.go @@ -2,7 +2,6 @@ package weth_test import ( "context" - "testing" "time"