diff --git a/api/api.go b/api/api.go index a8c96cc9..33232fac 100644 --- a/api/api.go +++ b/api/api.go @@ -109,7 +109,7 @@ func SupportedAPIs( pullAPI *PullAPI, debugAPI *DebugAPI, walletAPI *WalletAPI, - config *config.Config, + config config.Config, ) []rpc.API { apis := []rpc.API{{ Namespace: "eth", @@ -151,7 +151,7 @@ func SupportedAPIs( type BlockChainAPI struct { logger zerolog.Logger - config *config.Config + config config.Config evm requester.Requester blocks storage.BlockIndexer transactions storage.TransactionIndexer @@ -163,7 +163,7 @@ type BlockChainAPI struct { func NewBlockChainAPI( logger zerolog.Logger, - config *config.Config, + config config.Config, evm requester.Requester, blocks storage.BlockIndexer, transactions storage.TransactionIndexer, diff --git a/api/debug.go b/api/debug.go index 4501a1e7..962804d4 100644 --- a/api/debug.go +++ b/api/debug.go @@ -49,7 +49,7 @@ type DebugAPI struct { transactions storage.TransactionIndexer receipts storage.ReceiptIndexer client *requester.CrossSporkClient - config *config.Config + config config.Config collector metrics.Collector } @@ -60,7 +60,7 @@ func NewDebugAPI( transactions storage.TransactionIndexer, receipts storage.ReceiptIndexer, client *requester.CrossSporkClient, - config *config.Config, + config config.Config, logger zerolog.Logger, collector metrics.Collector, ) *DebugAPI { diff --git a/api/net.go b/api/net.go index 7f5023a1..a72a02ce 100644 --- a/api/net.go +++ b/api/net.go @@ -9,10 +9,10 @@ import ( // NetAPI offers network related RPC methods type NetAPI struct { - config *config.Config + config config.Config } -func NewNetAPI(config *config.Config) *NetAPI { +func NewNetAPI(config config.Config) *NetAPI { return &NetAPI{ config: config, } diff --git a/api/pull.go b/api/pull.go index bd493ee5..8158b526 100644 --- a/api/pull.go +++ b/api/pull.go @@ -129,7 +129,7 @@ func newLogsFilter( type PullAPI struct { logger zerolog.Logger - config *config.Config + config config.Config blocks storage.BlockIndexer transactions storage.TransactionIndexer receipts storage.ReceiptIndexer @@ -140,7 +140,7 @@ type PullAPI struct { func NewPullAPI( logger zerolog.Logger, - config *config.Config, + config config.Config, blocks storage.BlockIndexer, transactions storage.TransactionIndexer, receipts storage.ReceiptIndexer, diff --git a/api/pull_test.go b/api/pull_test.go index a7c1c164..ef72aea5 100644 --- a/api/pull_test.go +++ b/api/pull_test.go @@ -60,7 +60,7 @@ func TestFilterExpiryChecker(t *testing.T) { t.Run(tc.name, func(t *testing.T) { api := &PullAPI{ filters: make(map[rpc.ID]filter), - config: &config.Config{FilterExpiry: time.Millisecond * 5}, + config: config.Config{FilterExpiry: time.Millisecond * 5}, } tc.setup(api) diff --git a/api/server.go b/api/server.go index 2bfb9aa3..e1a9dc5e 100644 --- a/api/server.go +++ b/api/server.go @@ -53,7 +53,7 @@ type Server struct { host string port int - config *config.Config + config config.Config collector metrics.Collector } @@ -66,7 +66,7 @@ const ( func NewServer( logger zerolog.Logger, collector metrics.Collector, - cfg *config.Config, + cfg config.Config, ) *Server { logger = logger.With().Str("component", "API").Logger() diff --git a/api/stream.go b/api/stream.go index bfc3b0fe..98a8f4fb 100644 --- a/api/stream.go +++ b/api/stream.go @@ -21,7 +21,7 @@ import ( type StreamAPI struct { logger zerolog.Logger - config *config.Config + config config.Config blocks storage.BlockIndexer transactions storage.TransactionIndexer receipts storage.ReceiptIndexer @@ -32,7 +32,7 @@ type StreamAPI struct { func NewStreamAPI( logger zerolog.Logger, - config *config.Config, + config config.Config, blocks storage.BlockIndexer, transactions storage.TransactionIndexer, receipts storage.ReceiptIndexer, diff --git a/api/wallet.go b/api/wallet.go index 3629af11..8bb9901e 100644 --- a/api/wallet.go +++ b/api/wallet.go @@ -19,10 +19,10 @@ import ( type WalletAPI struct { net *BlockChainAPI - config *config.Config + config config.Config } -func NewWalletAPI(config *config.Config, net *BlockChainAPI) *WalletAPI { +func NewWalletAPI(config config.Config, net *BlockChainAPI) *WalletAPI { return &WalletAPI{ net: net, config: config, diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index ce468ef9..67c5e828 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -51,7 +51,7 @@ type Publishers struct { type Bootstrap struct { logger zerolog.Logger - config *config.Config + config config.Config client *requester.CrossSporkClient storages *Storages publishers *Publishers @@ -63,7 +63,7 @@ type Bootstrap struct { db *pebbleDB.DB } -func New(config *config.Config) (*Bootstrap, error) { +func New(config config.Config) (*Bootstrap, error) { logger := zerolog.New(config.LogWriter). With().Timestamp().Str("version", api.Version). Logger().Level(config.LogLevel) @@ -432,7 +432,7 @@ func StartEngine( } // setupCrossSporkClient sets up a cross-spork AN client. -func setupCrossSporkClient(config *config.Config, logger zerolog.Logger) (*requester.CrossSporkClient, error) { +func setupCrossSporkClient(config config.Config, logger zerolog.Logger) (*requester.CrossSporkClient, error) { // create access client with cross-spork capabilities currentSporkClient, err := grpc.NewClient( config.AccessNodeHost, @@ -474,7 +474,7 @@ func setupCrossSporkClient(config *config.Config, logger zerolog.Logger) (*reque // setupStorage creates storage and initializes it with configured starting cadence height // in case such a height doesn't already exist in the database. func setupStorage( - config *config.Config, + config config.Config, client *requester.CrossSporkClient, logger zerolog.Logger, ) (*pebbleDB.DB, *Storages, error) { @@ -571,7 +571,7 @@ func setupStorage( // Run will run complete bootstrap of the EVM gateway with all the engines. // Run is a blocking call, but it does signal readiness of the service // through a channel provided as an argument. -func Run(ctx context.Context, cfg *config.Config, ready component.ReadyFunc) error { +func Run(ctx context.Context, cfg config.Config, ready component.ReadyFunc) error { boot, err := New(cfg) if err != nil { return err diff --git a/cmd/run/cmd.go b/cmd/run/cmd.go index f0dca36c..9cb42ec0 100644 --- a/cmd/run/cmd.go +++ b/cmd/run/cmd.go @@ -244,7 +244,7 @@ func parseConfigFromFlags() error { return nil } -var cfg = &config.Config{} +var cfg = config.Config{} var ( coinbase, gas, diff --git a/services/requester/requester.go b/services/requester/requester.go index 413daf27..a473e7ca 100644 --- a/services/requester/requester.go +++ b/services/requester/requester.go @@ -98,7 +98,7 @@ type EVM struct { registerStore *pebble.RegisterStorage blocksProvider *replayer.BlocksProvider client *CrossSporkClient - config *config.Config + config config.Config signer crypto.Signer txPool *TxPool logger zerolog.Logger @@ -116,7 +116,7 @@ func NewEVM( registerStore *pebble.RegisterStorage, blocksProvider *replayer.BlocksProvider, client *CrossSporkClient, - config *config.Config, + config config.Config, signer crypto.Signer, logger zerolog.Logger, blocks storage.BlockIndexer, diff --git a/tests/helpers.go b/tests/helpers.go index 6378f5c0..f8993b93 100644 --- a/tests/helpers.go +++ b/tests/helpers.go @@ -137,7 +137,7 @@ func servicesSetup(t *testing.T) (emulator.Emulator, func()) { service := emu.ServiceKey() // default config - cfg := &config.Config{ + cfg := config.Config{ DatabaseDir: t.TempDir(), AccessNodeHost: "localhost:3569", // emulator RPCPort: 8545, diff --git a/tests/integration_test.go b/tests/integration_test.go index af834bf1..b510476f 100644 --- a/tests/integration_test.go +++ b/tests/integration_test.go @@ -59,7 +59,7 @@ func Test_ConcurrentTransactionSubmission(t *testing.T) { ) require.NoError(t, err) - cfg := &config.Config{ + cfg := config.Config{ DatabaseDir: t.TempDir(), AccessNodeHost: grpcHost, RPCPort: 8545, @@ -165,7 +165,7 @@ func Test_EthClientTest(t *testing.T) { ) require.NoError(t, err) - cfg := &config.Config{ + cfg := config.Config{ DatabaseDir: t.TempDir(), AccessNodeHost: grpcHost, RPCPort: 8545, @@ -268,7 +268,7 @@ func Test_CloudKMSConcurrentTransactionSubmission(t *testing.T) { ) require.NoError(t, err) - cfg := &config.Config{ + cfg := config.Config{ DatabaseDir: t.TempDir(), AccessNodeHost: grpcHost, RPCPort: 8545,