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 d2227106fc..df6066b00f 100644 --- a/core/eth/reader.go +++ b/core/eth/reader.go @@ -4,6 +4,7 @@ import ( "context" "crypto/ecdsa" "fmt" + "encoding/hex" "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, @@ -302,20 +306,50 @@ func (t *Reader) getRegistrationParams( return nil, nil, err } + 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) + signature, err := sig.Deserialize(sigBytes) + if err != nil { + return nil, nil, err + } 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) + _, 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) + _, err = g2point.Deserialize(g2KeyBytes) + if err != nil { + return nil, nil, err + } + g2Point_ := pubKeyG2ToBN254G2Point(g2point) g2Point := regcoordinator.BN254G2Point{ X: g2Point_.X, Y: g2Point_.Y, diff --git a/core/eth/writer.go b/core/eth/writer.go index d088b6871f..3d71092a37 100644 --- a/core/eth/writer.go +++ b/core/eth/writer.go @@ -14,6 +14,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" @@ -59,6 +60,7 @@ func NewWriter( func (t *Writer) RegisterOperator( ctx context.Context, keypair *core.KeyPair, + signer sdkSigner.Signer, socket string, quorumIds []core.QuorumID, operatorEcdsaPrivateKey *ecdsa.PrivateKey, @@ -66,7 +68,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 @@ -99,6 +101,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, @@ -107,7 +110,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..44970cbfd0 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.Local, + }) + 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 129da59644..92e3a47db0 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" @@ -283,7 +283,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 13d923dd01..8a94ed52cb 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..795ebbfb37 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.20250108183217-59122e8557bc + github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250108183217-59122e8557bc 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..f567bc2588 100644 --- a/go.sum +++ b/go.sum @@ -8,10 +8,14 @@ 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.20250108021201-9313acc6a60a h1:79C0Rti47GLaViqq6oS6cZKsyq/ccwVsyK0WIWZNSIM= +github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250108021201-9313acc6a60a/go.mod h1:G4yqiK+5NfUuEMVGGncOEm7QskuGRPmKA7bKxpPzPT4= +github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250108183217-59122e8557bc h1:NMM+LULjQu8vSbDtWSxWFDCEb16hCNILp+ZD1JLpc6U= +github.com/Layr-Labs/eigensdk-go v0.2.0-beta.1.0.20250108183217-59122e8557bc/go.mod h1:G4yqiK+5NfUuEMVGGncOEm7QskuGRPmKA7bKxpPzPT4= +github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250108183217-59122e8557bc h1:dKLTQUvD4Bd+A7Yoj06Al+eWVSxlWk7x8/f/ZTKqYsQ= +github.com/Layr-Labs/eigensdk-go/signer v0.0.0-20250108183217-59122e8557bc/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 +162,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..abcb8dfbe0 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,21 @@ 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) + var messageHashBytes []byte + copy(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 +129,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/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..2116ad96b5 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 { @@ -583,35 +555,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/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..f786d35468 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" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + sdkSigner "github.com/Layr-Labs/eigensdk-go/signer/bls" + sdkSignerTypes "github.com/Layr-Labs/eigensdk-go/signer/bls/types" ) 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.Local, + }) + 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, @@ -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) diff --git a/node/plugin/cmd/main.go b/node/plugin/cmd/main.go index 6fa489c203..adb1a25e7f 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.BLSSignerCertFile, + 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,