From dd7d9c510530324b8226532550a2ac004cce76e9 Mon Sep 17 00:00:00 2001 From: Robert Raynor <35671663+mooselumph@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:43:57 +0000 Subject: [PATCH] Update usage --- disperser/apiserver/server.go | 4 ++-- disperser/apiserver/server_test.go | 6 +++--- disperser/batcher/batcher.go | 4 ++-- disperser/batcher/batcher_test.go | 4 ++-- disperser/cmd/apiserver/main.go | 2 +- disperser/cmd/batcher/main.go | 2 +- disperser/cmd/dataapi/main.go | 2 +- disperser/dataapi/server.go | 4 ++-- disperser/dataapi/server_test.go | 2 +- inabox/tests/integration_suite_test.go | 2 +- node/grpc/server_test.go | 2 +- node/grpc/server_v2_test.go | 2 +- node/metrics.go | 4 ++-- node/node.go | 4 ++-- node/node_test.go | 4 ++-- node/operator.go | 8 ++++---- node/operator_test.go | 6 +++--- node/plugin/cmd/main.go | 2 +- node/plugin/tests/plugin_test.go | 6 +++--- node/store_test.go | 2 +- operators/churner/churner.go | 4 ++-- operators/churner/churner_test.go | 2 +- operators/churner/cmd/main.go | 2 +- operators/churner/server_test.go | 6 +++--- operators/churner/tests/churner_test.go | 6 +++--- operators/ejector/ejector.go | 4 ++-- retriever/cmd/main.go | 2 +- test/integration_test.go | 8 ++++---- tools/semverscan/cmd/main.go | 2 +- tools/traffic/generator_v2.go | 13 +++++++------ 30 files changed, 61 insertions(+), 60 deletions(-) diff --git a/disperser/apiserver/server.go b/disperser/apiserver/server.go index 18cd71ac1d..34355d45bc 100644 --- a/disperser/apiserver/server.go +++ b/disperser/apiserver/server.go @@ -40,7 +40,7 @@ type DispersalServer struct { rateConfig RateConfig blobStore disperser.BlobStore - tx core.Transactor + tx core.Reader quorumConfig QuorumConfig ratelimiter common.RateLimiter @@ -65,7 +65,7 @@ type QuorumConfig struct { func NewDispersalServer( serverConfig disperser.ServerConfig, store disperser.BlobStore, - tx core.Transactor, + tx core.Reader, _logger logging.Logger, metrics *disperser.Metrics, ratelimiter common.RateLimiter, diff --git a/disperser/apiserver/server_test.go b/disperser/apiserver/server_test.go index 1a7d5f7e76..39637a82e1 100644 --- a/disperser/apiserver/server_test.go +++ b/disperser/apiserver/server_test.go @@ -128,7 +128,7 @@ func TestDisperseBlobAuthTimeout(t *testing.T) { func TestDisperseBlobWithRequiredQuorums(t *testing.T) { - transactor := &mock.MockTransactor{} + transactor := &mock.MockWriter{} transactor.On("GetCurrentBlockNumber").Return(uint32(100), nil) transactor.On("GetQuorumCount").Return(uint8(2), nil) quorumParams := []core.SecurityParam{ @@ -595,7 +595,7 @@ func setup() { panic("failed to deploy AWS resources") } - transactor := &mock.MockTransactor{} + transactor := &mock.MockWriter{} transactor.On("GetCurrentBlockNumber").Return(uint32(100), nil) transactor.On("GetQuorumCount").Return(uint8(2), nil) quorumParams := []core.SecurityParam{ @@ -618,7 +618,7 @@ func teardown() { } } -func newTestServer(transactor core.Transactor) *apiserver.DispersalServer { +func newTestServer(transactor core.Writer) *apiserver.DispersalServer { logger := logging.NewNoopLogger() bucketName := "test-eigenda-blobstore" diff --git a/disperser/batcher/batcher.go b/disperser/batcher/batcher.go index 825a09b34b..f5fef3d38f 100644 --- a/disperser/batcher/batcher.go +++ b/disperser/batcher/batcher.go @@ -78,7 +78,7 @@ type Batcher struct { AssignmentCoordinator core.AssignmentCoordinator Aggregator core.SignatureAggregator EncodingStreamer *EncodingStreamer - Transactor core.Transactor + Transactor core.Writer TransactionManager TxnManager Metrics *Metrics HeartbeatChan chan time.Time @@ -99,7 +99,7 @@ func NewBatcher( aggregator core.SignatureAggregator, ethClient common.EthClient, finalizer Finalizer, - transactor core.Transactor, + transactor core.Writer, txnManager TxnManager, logger logging.Logger, metrics *Metrics, diff --git a/disperser/batcher/batcher_test.go b/disperser/batcher/batcher_test.go index 03c3252a3f..20fa0e7ae3 100644 --- a/disperser/batcher/batcher_test.go +++ b/disperser/batcher/batcher_test.go @@ -38,7 +38,7 @@ var ( ) type batcherComponents struct { - transactor *coremock.MockTransactor + transactor *coremock.MockWriter txnManager *batchermock.MockTxnManager blobStore *inmem.BlobStore encoderClient *disperser.LocalEncoderClient @@ -90,7 +90,7 @@ func makeBatcher(t *testing.T) (*batcherComponents, *bat.Batcher, func() []time. assert.NoError(t, err) cst.On("GetCurrentBlockNumber").Return(uint(10)+finalizationBlockDelay, nil) asgn := &core.StdAssignmentCoordinator{} - transactor := &coremock.MockTransactor{} + transactor := &coremock.MockWriter{} transactor.On("OperatorIDToAddress").Return(gethcommon.Address{}, nil) agg, err := core.NewStdSignatureAggregator(logger, transactor) assert.NoError(t, err) diff --git a/disperser/cmd/apiserver/main.go b/disperser/cmd/apiserver/main.go index d205e44fc2..932b63eeaa 100644 --- a/disperser/cmd/apiserver/main.go +++ b/disperser/cmd/apiserver/main.go @@ -71,7 +71,7 @@ func RunDisperserServer(ctx *cli.Context) error { return err } - transactor, err := eth.NewTransactor(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) + transactor, err := eth.NewReader(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) if err != nil { return err } diff --git a/disperser/cmd/batcher/main.go b/disperser/cmd/batcher/main.go index 8ce537770b..6c60358a78 100644 --- a/disperser/cmd/batcher/main.go +++ b/disperser/cmd/batcher/main.go @@ -176,7 +176,7 @@ func RunBatcher(ctx *cli.Context) error { if err != nil { return err } - tx, err := coreeth.NewTransactor(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) + tx, err := coreeth.NewWriter(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) if err != nil { return err } diff --git a/disperser/cmd/dataapi/main.go b/disperser/cmd/dataapi/main.go index a1331b3246..d9663ae1f0 100644 --- a/disperser/cmd/dataapi/main.go +++ b/disperser/cmd/dataapi/main.go @@ -83,7 +83,7 @@ func RunDataApi(ctx *cli.Context) error { return err } - tx, err := coreeth.NewTransactor(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) + tx, err := coreeth.NewReader(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) if err != nil { return err } diff --git a/disperser/dataapi/server.go b/disperser/dataapi/server.go index 6472e69718..a4113d44c9 100644 --- a/disperser/dataapi/server.go +++ b/disperser/dataapi/server.go @@ -194,7 +194,7 @@ type ( blobstore disperser.BlobStore promClient PrometheusClient subgraphClient SubgraphClient - transactor core.Transactor + transactor core.Reader chainState core.ChainState indexedChainState core.IndexedChainState @@ -212,7 +212,7 @@ func NewServer( blobstore disperser.BlobStore, promClient PrometheusClient, subgraphClient SubgraphClient, - transactor core.Transactor, + transactor core.Reader, chainState core.ChainState, indexedChainState core.IndexedChainState, logger logging.Logger, diff --git a/disperser/dataapi/server_test.go b/disperser/dataapi/server_test.go index c69d4a3f64..d0ffe58397 100644 --- a/disperser/dataapi/server_test.go +++ b/disperser/dataapi/server_test.go @@ -53,7 +53,7 @@ var ( config = dataapi.Config{ServerMode: "test", SocketAddr: ":8080", AllowOrigins: []string{"*"}, DisperserHostname: "localhost:32007", ChurnerHostname: "localhost:32009"} - mockTx = &coremock.MockTransactor{} + mockTx = &coremock.MockWriter{} metrics = dataapi.NewMetrics(nil, "9001", mockLogger) opId0, _ = core.OperatorIDFromHex("e22dae12a0074f20b8fc96a0489376db34075e545ef60c4845d264a732568311") opId1, _ = core.OperatorIDFromHex("e23cae12a0074f20b8fc96a0489376db34075e545ef60c4845d264b732568312") diff --git a/inabox/tests/integration_suite_test.go b/inabox/tests/integration_suite_test.go index 692d582c32..9cd9c7d03d 100644 --- a/inabox/tests/integration_suite_test.go +++ b/inabox/tests/integration_suite_test.go @@ -150,7 +150,7 @@ func setupRetrievalClient(testConfig *deploy.Config) error { if err != nil { log.Fatalln("could not start tcp listener", err) } - tx, err := eth.NewTransactor(logger, client, testConfig.Retriever.RETRIEVER_BLS_OPERATOR_STATE_RETRIVER, testConfig.Retriever.RETRIEVER_EIGENDA_SERVICE_MANAGER) + tx, err := eth.NewWriter(logger, client, testConfig.Retriever.RETRIEVER_BLS_OPERATOR_STATE_RETRIVER, testConfig.Retriever.RETRIEVER_EIGENDA_SERVICE_MANAGER) if err != nil { return err } diff --git a/node/grpc/server_test.go b/node/grpc/server_test.go index 629c3ea9bc..852a19c2e9 100644 --- a/node/grpc/server_test.go +++ b/node/grpc/server_test.go @@ -110,7 +110,7 @@ func newTestServerWithConfig(t *testing.T, mockValidator bool, config *node.Conf } noopMetrics := metrics.NewNoopMetrics() reg := prometheus.NewRegistry() - tx := &coremock.MockTransactor{} + tx := &coremock.MockWriter{} ratelimiter := &commonmock.NoopRatelimiter{} diff --git a/node/grpc/server_v2_test.go b/node/grpc/server_v2_test.go index d08dea6640..ecae922ade 100644 --- a/node/grpc/server_v2_test.go +++ b/node/grpc/server_v2_test.go @@ -44,7 +44,7 @@ func newTestServerV2WithConfig(t *testing.T, mockValidator bool, config *node.Co } noopMetrics := metrics.NewNoopMetrics() reg := prometheus.NewRegistry() - tx := &coremock.MockTransactor{} + tx := &coremock.MockWriter{} ratelimiter := &commonmock.NoopRatelimiter{} diff --git a/node/metrics.go b/node/metrics.go index 35b7274759..a153bf47ec 100644 --- a/node/metrics.go +++ b/node/metrics.go @@ -55,12 +55,12 @@ type Metrics struct { socketAddr string operatorId core.OperatorID onchainMetricsInterval int64 - tx core.Transactor + tx core.Reader chainState core.ChainState allQuorumCache map[core.QuorumID]bool } -func NewMetrics(eigenMetrics eigenmetrics.Metrics, reg *prometheus.Registry, logger logging.Logger, socketAddr string, operatorId core.OperatorID, onchainMetricsInterval int64, tx core.Transactor, chainState core.ChainState) *Metrics { +func NewMetrics(eigenMetrics eigenmetrics.Metrics, reg *prometheus.Registry, logger logging.Logger, socketAddr string, operatorId core.OperatorID, onchainMetricsInterval int64, tx core.Reader, chainState core.ChainState) *Metrics { // Add Go module collectors reg.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{})) diff --git a/node/node.go b/node/node.go index 865a78e74d..8da4030e51 100644 --- a/node/node.go +++ b/node/node.go @@ -61,7 +61,7 @@ type Node struct { Store *Store ChainState core.ChainState Validator core.ShardValidator - Transactor core.Transactor + Transactor core.Writer PubIPProvider pubip.Provider OperatorSocketsFilterer indexer.OperatorSocketsFilterer ChainID *big.Int @@ -106,7 +106,7 @@ func NewNode(reg *prometheus.Registry, config *Config, pubIPProvider pubip.Provi } // Create Transactor - tx, err := eth.NewTransactor(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) + tx, err := eth.NewWriter(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) if err != nil { return nil, err } diff --git a/node/node_test.go b/node/node_test.go index 2c6772c87b..46ed967158 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -22,7 +22,7 @@ var opID = [32]byte{} type components struct { node *node.Node - tx *coremock.MockTransactor + tx *coremock.MockWriter } func newComponents(t *testing.T) *components { @@ -53,7 +53,7 @@ func newComponents(t *testing.T) *components { if err != nil { panic("failed to create a directory for db") } - tx := &coremock.MockTransactor{} + tx := &coremock.MockWriter{} mockVal := coremock.NewMockShardValidator() mockVal.On("ValidateBatch", mock.Anything, mock.Anything, mock.Anything).Return(nil) diff --git a/node/operator.go b/node/operator.go index a4a0b52f59..10d2cf88ff 100644 --- a/node/operator.go +++ b/node/operator.go @@ -26,7 +26,7 @@ type Operator struct { } // RegisterOperator operator registers the operator with the given public key for the given quorum IDs. -func RegisterOperator(ctx context.Context, operator *Operator, transactor core.Transactor, churnerClient ChurnerClient, logger logging.Logger) error { +func RegisterOperator(ctx context.Context, operator *Operator, transactor core.Writer, churnerClient ChurnerClient, logger logging.Logger) error { if len(operator.QuorumIDs) > 1+core.MaxQuorumID { return fmt.Errorf("cannot provide more than %d quorums", 1+core.MaxQuorumID) } @@ -94,7 +94,7 @@ func RegisterOperator(ctx context.Context, operator *Operator, transactor core.T // 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.Transactor) error { +func DeregisterOperator(ctx context.Context, operator *Operator, KeyPair *core.KeyPair, transactor core.Writer) error { if len(operator.QuorumIDs) > 1+core.MaxQuorumID { return fmt.Errorf("cannot provide more than %d quorums", 1+core.MaxQuorumID) } @@ -106,12 +106,12 @@ func DeregisterOperator(ctx context.Context, operator *Operator, KeyPair *core.K } // UpdateOperatorSocket updates the socket for the given operator -func UpdateOperatorSocket(ctx context.Context, transactor core.Transactor, socket string) error { +func UpdateOperatorSocket(ctx context.Context, transactor core.Writer, socket string) error { return transactor.UpdateOperatorSocket(ctx, socket) } // getQuorumIdsToRegister returns the quorum ids that the operator is not registered in. -func (c *Operator) getQuorumIdsToRegister(ctx context.Context, transactor core.Transactor) ([]core.QuorumID, error) { +func (c *Operator) getQuorumIdsToRegister(ctx context.Context, transactor core.Writer) ([]core.QuorumID, error) { if len(c.QuorumIDs) == 0 { return nil, fmt.Errorf("an operator should be in at least one quorum to be useful") } diff --git a/node/operator_test.go b/node/operator_test.go index 257004d6ec..f88342054f 100644 --- a/node/operator_test.go +++ b/node/operator_test.go @@ -32,8 +32,8 @@ func TestRegisterOperator(t *testing.T) { QuorumIDs: []core.QuorumID{0, 1}, RegisterNodeAtStart: false, } - createMockTx := func(quorumIDs []uint8) *coremock.MockTransactor { - tx := &coremock.MockTransactor{} + createMockTx := func(quorumIDs []uint8) *coremock.MockWriter { + tx := &coremock.MockWriter{} tx.On("GetRegisteredQuorumIdsForOperator").Return(quorumIDs, nil) tx.On("GetOperatorSetParams", mock.Anything, mock.Anything).Return(&core.OperatorSetParam{ MaxOperatorCount: 1, @@ -72,7 +72,7 @@ func TestRegisterOperatorWithChurn(t *testing.T) { OperatorId: operatorID, QuorumIDs: []core.QuorumID{1}, } - tx := &coremock.MockTransactor{} + tx := &coremock.MockWriter{} tx.On("GetRegisteredQuorumIdsForOperator").Return([]uint8{2}, nil) tx.On("GetOperatorSetParams", mock.Anything, mock.Anything).Return(&core.OperatorSetParam{ MaxOperatorCount: 1, diff --git a/node/plugin/cmd/main.go b/node/plugin/cmd/main.go index 90780ea209..6fa489c203 100644 --- a/node/plugin/cmd/main.go +++ b/node/plugin/cmd/main.go @@ -96,7 +96,7 @@ func pluginOps(ctx *cli.Context) { } log.Printf("Info: ethclient created for url: %s", config.ChainRpcUrl) - tx, err := eth.NewTransactor(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) + tx, err := eth.NewWriter(logger, client, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) if err != nil { log.Printf("Error: failed to create EigenDA transactor: %v", err) return diff --git a/node/plugin/tests/plugin_test.go b/node/plugin/tests/plugin_test.go index 72dc752501..b01daf2df5 100644 --- a/node/plugin/tests/plugin_test.go +++ b/node/plugin/tests/plugin_test.go @@ -195,7 +195,7 @@ func getOperatorId(t *testing.T, operator deploy.OperatorVars) [32]byte { assert.NoError(t, err) assert.NotNil(t, client) - transactor, err := eth.NewTransactor(logger, client, operator.NODE_BLS_OPERATOR_STATE_RETRIVER, operator.NODE_EIGENDA_SERVICE_MANAGER) + transactor, err := eth.NewWriter(logger, client, operator.NODE_BLS_OPERATOR_STATE_RETRIVER, operator.NODE_EIGENDA_SERVICE_MANAGER) assert.NoError(t, err) assert.NotNil(t, transactor) @@ -214,7 +214,7 @@ func getOperatorId(t *testing.T, operator deploy.OperatorVars) [32]byte { return keyPair.GetPubKeyG1().GetOperatorID() } -func getTransactor(t *testing.T, operator deploy.OperatorVars) *eth.Transactor { +func getTransactor(t *testing.T, operator deploy.OperatorVars) *eth.Writer { hexPk := strings.TrimPrefix(testConfig.Pks.EcdsaMap[testConfig.Deployers[0].Name].PrivateKey, "0x") loggerConfig := common.DefaultLoggerConfig() logger, err := common.NewLogger(loggerConfig) @@ -230,7 +230,7 @@ func getTransactor(t *testing.T, operator deploy.OperatorVars) *eth.Transactor { assert.NoError(t, err) assert.NotNil(t, client) - transactor, err := eth.NewTransactor(logger, client, operator.NODE_BLS_OPERATOR_STATE_RETRIVER, operator.NODE_EIGENDA_SERVICE_MANAGER) + transactor, err := eth.NewWriter(logger, client, operator.NODE_BLS_OPERATOR_STATE_RETRIVER, operator.NODE_EIGENDA_SERVICE_MANAGER) assert.NoError(t, err) assert.NotNil(t, transactor) diff --git a/node/store_test.go b/node/store_test.go index ebd01afddf..29c92ae5df 100644 --- a/node/store_test.go +++ b/node/store_test.go @@ -215,7 +215,7 @@ func createStore(t *testing.T) *node.Store { reg := prometheus.NewRegistry() logger := logging.NewNoopLogger() operatorId := [32]byte(hexutil.MustDecode("0x3fbfefcdc76462d2cdb7d0cea75f27223829481b8b4aa6881c94cb2126a316ad")) - tx := &coremock.MockTransactor{} + tx := &coremock.MockWriter{} dat, _ := mock.MakeChainDataMock(map[uint8]int{ 0: 6, 1: 3, diff --git a/operators/churner/churner.go b/operators/churner/churner.go index dd857fbba1..5e3a0f3768 100644 --- a/operators/churner/churner.go +++ b/operators/churner/churner.go @@ -46,7 +46,7 @@ type ChurnResponse struct { type churner struct { mu sync.Mutex Indexer thegraph.IndexedChainState - Transactor core.Transactor + Transactor core.Writer QuorumCount uint8 privateKey *ecdsa.PrivateKey @@ -58,7 +58,7 @@ type churner struct { func NewChurner( config *Config, indexer thegraph.IndexedChainState, - transactor core.Transactor, + transactor core.Writer, logger logging.Logger, metrics *Metrics, ) (*churner, error) { diff --git a/operators/churner/churner_test.go b/operators/churner/churner_test.go index e86e4eec6a..0854de7496 100644 --- a/operators/churner/churner_test.go +++ b/operators/churner/churner_test.go @@ -18,7 +18,7 @@ import ( ) func TestProcessChurnRequest(t *testing.T) { - setupMockTransactor() + setupMockWriter() mockIndexer := &indexermock.MockIndexedChainState{} config := &churner.Config{ LoggerConfig: common.DefaultLoggerConfig(), diff --git a/operators/churner/cmd/main.go b/operators/churner/cmd/main.go index 8f4aaaf74d..a9ecd76e87 100644 --- a/operators/churner/cmd/main.go +++ b/operators/churner/cmd/main.go @@ -74,7 +74,7 @@ func run(ctx *cli.Context) error { log.Fatalln("could not start tcp listener", err) } - tx, err := eth.NewTransactor(logger, gethClient, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) + tx, err := eth.NewWriter(logger, gethClient, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) if err != nil { log.Fatalln("could not create new transactor", err) } diff --git a/operators/churner/server_test.go b/operators/churner/server_test.go index a6261b576f..5c7c471b7f 100644 --- a/operators/churner/server_test.go +++ b/operators/churner/server_test.go @@ -28,7 +28,7 @@ var ( keyPair *dacore.KeyPair quorumIds = []uint32{0, 1} logger = logging.NewNoopLogger() - transactorMock = &coremock.MockTransactor{} + transactorMock = &coremock.MockWriter{} mockIndexer = &indexermock.MockIndexedChainState{} operatorAddr = gethcommon.HexToAddress("0x0000000000000000000000000000000000000001") operatorToChurnInPrivateKeyHex = "0000000000000000000000000000000000000000000000000000000000000020" @@ -129,7 +129,7 @@ func TestChurnWithInvalidQuorum(t *testing.T) { assert.Equal(t, err.Error(), "rpc error: code = InvalidArgument desc = invalid request: invalid request: the quorum_id must be in range [0, 1], but found 2") } -func setupMockTransactor() { +func setupMockWriter() { transactorMock.On("StakeRegistry").Return(gethcommon.HexToAddress("0x0000000000000000000000000000000000000001"), nil).Once() transactorMock.On("OperatorIDToAddress").Return(operatorAddr, nil) transactorMock.On("GetCurrentQuorumBitmapByOperatorId").Return(big.NewInt(0), nil) @@ -179,7 +179,7 @@ func newTestServer(t *testing.T) *churner.Server { t.Fatalf("Generating random BLS keys Error: %s", err.Error()) } - setupMockTransactor() + setupMockWriter() metrics := churner.NewMetrics("9001", logger) cn, err := churner.NewChurner(config, mockIndexer, transactorMock, logger, metrics) diff --git a/operators/churner/tests/churner_test.go b/operators/churner/tests/churner_test.go index af013fe62a..ba9f11c522 100644 --- a/operators/churner/tests/churner_test.go +++ b/operators/churner/tests/churner_test.go @@ -100,7 +100,7 @@ func TestChurner(t *testing.T) { } var lowestStakeOperatorAddr gethcommon.Address var lowestStakeOperatorPubKey *core.G1Point - var tx *eth.Transactor + var tx *eth.Writer var operatorPrivateKey *ecdsa.PrivateKey var keyPair *dacore.KeyPair for i, op := range testConfig.Operators { @@ -187,7 +187,7 @@ func TestChurner(t *testing.T) { assert.NoError(t, err) } -func createTransactorFromScratch(privateKey, operatorStateRetriever, serviceManager string, logger logging.Logger) (*eth.Transactor, error) { +func createTransactorFromScratch(privateKey, operatorStateRetriever, serviceManager string, logger logging.Logger) (*eth.Writer, error) { ethClientCfg := geth.EthClientConfig{ RPCURLs: []string{rpcURL}, PrivateKeyString: privateKey, @@ -200,7 +200,7 @@ func createTransactorFromScratch(privateKey, operatorStateRetriever, serviceMana log.Fatalln("could not start tcp listener", err) } - return eth.NewTransactor(logger, gethClient, operatorStateRetriever, serviceManager) + return eth.NewWriter(logger, gethClient, operatorStateRetriever, serviceManager) } func newTestServer(t *testing.T) *churner.Server { diff --git a/operators/ejector/ejector.go b/operators/ejector/ejector.go index 1559405b75..23a3988566 100644 --- a/operators/ejector/ejector.go +++ b/operators/ejector/ejector.go @@ -78,7 +78,7 @@ type Ejector struct { wallet walletsdk.Wallet ethClient common.EthClient logger logging.Logger - transactor core.Transactor + transactor core.Writer metrics *Metrics txnTimeout time.Duration nonsigningRateThreshold int @@ -87,7 +87,7 @@ type Ejector struct { mu sync.Mutex } -func NewEjector(wallet walletsdk.Wallet, ethClient common.EthClient, logger logging.Logger, tx core.Transactor, metrics *Metrics, txnTimeout time.Duration, nonsigningRateThreshold int) *Ejector { +func NewEjector(wallet walletsdk.Wallet, ethClient common.EthClient, logger logging.Logger, tx core.Writer, metrics *Metrics, txnTimeout time.Duration, nonsigningRateThreshold int) *Ejector { return &Ejector{ wallet: wallet, ethClient: ethClient, diff --git a/retriever/cmd/main.go b/retriever/cmd/main.go index ab03ec6eff..fd1704c315 100644 --- a/retriever/cmd/main.go +++ b/retriever/cmd/main.go @@ -93,7 +93,7 @@ func RetrieverMain(ctx *cli.Context) error { // return err // } - tx, err := eth.NewTransactor(logger, gethClient, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) + tx, err := eth.NewReader(logger, gethClient, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) if err != nil { log.Fatalln("could not start tcp listener", err) } diff --git a/test/integration_test.go b/test/integration_test.go index 693f75e499..aa787a0002 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -126,7 +126,7 @@ type TestDisperser struct { batcher *batcher.Batcher server *apiserver.DispersalServer encoderServer *encoder.Server - transactor *coremock.MockTransactor + transactor *coremock.MockWriter txnManager *batchermock.MockTxnManager } @@ -137,7 +137,7 @@ func mustMakeDisperser(t *testing.T, cst core.IndexedChainState, store disperser batcherMetrics := batcher.NewMetrics("9100", logger) dispatcher := dispatcher.NewDispatcher(dispatcherConfig, logger, batcherMetrics.DispatcherMetrics) - transactor := &coremock.MockTransactor{} + transactor := &coremock.MockWriter{} transactor.On("OperatorIDToAddress").Return(gethcommon.Address{}, nil) agg, err := core.NewStdSignatureAggregator(logger, transactor) assert.NoError(t, err) @@ -192,7 +192,7 @@ func mustMakeDisperser(t *testing.T, cst core.IndexedChainState, store disperser serverConfig := disperser.ServerConfig{ GrpcPort: fmt.Sprint(disperserGrpcPort), } - tx := &coremock.MockTransactor{} + tx := &coremock.MockWriter{} tx.On("GetCurrentBlockNumber").Return(uint64(100), nil) tx.On("GetQuorumCount").Return(1, nil) server := apiserver.NewDispersalServer(serverConfig, store, tx, logger, disperserMetrics, ratelimiter, rateConfig, testMaxBlobSize) @@ -270,7 +270,7 @@ func mustMakeOperators(t *testing.T, cst *coremock.ChainDataMock, logger logging _, v0 := mustMakeTestComponents() val := core.NewShardValidator(v0, asn, cst, id) - tx := &coremock.MockTransactor{} + tx := &coremock.MockWriter{} tx.On("RegisterBLSPublicKey").Return(nil) tx.On("RegisterOperator").Return(nil) tx.On("GetRegisteredQuorumIdsForOperator").Return(registeredQuorums, nil) diff --git a/tools/semverscan/cmd/main.go b/tools/semverscan/cmd/main.go index a727f5aa96..89e0457a01 100644 --- a/tools/semverscan/cmd/main.go +++ b/tools/semverscan/cmd/main.go @@ -55,7 +55,7 @@ func RunScan(ctx *cli.Context) error { return err } - tx, err := eth.NewTransactor(logger, gethClient, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) + tx, err := eth.NewReader(logger, gethClient, config.BLSOperatorStateRetrieverAddr, config.EigenDAServiceManagerAddr) if err != nil { log.Fatalln("could not start tcp listener", err) } diff --git a/tools/traffic/generator_v2.go b/tools/traffic/generator_v2.go index d5ce70ae67..7b2a92159f 100644 --- a/tools/traffic/generator_v2.go +++ b/tools/traffic/generator_v2.go @@ -3,6 +3,12 @@ package traffic import ( "context" "fmt" + "os" + "os/signal" + "sync" + "syscall" + "time" + "github.com/Layr-Labs/eigenda/common/geth" "github.com/Layr-Labs/eigenda/core/auth" "github.com/Layr-Labs/eigenda/core/eth" @@ -16,11 +22,6 @@ import ( "github.com/Layr-Labs/eigensdk-go/logging" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" - "os" - "os/signal" - "sync" - "syscall" - "time" "github.com/Layr-Labs/eigenda/api/clients" "github.com/Layr-Labs/eigenda/common" @@ -156,7 +157,7 @@ func buildRetriever(config *config.Config) (clients.RetrievalClient, retrivereth panic(fmt.Sprintf("Unable to instantiate geth client: %s", err)) } - tx, err := eth.NewTransactor( + tx, err := eth.NewReader( logger, gethClient, config.RetrievalClientConfig.BLSOperatorStateRetrieverAddr,