Skip to content

Commit a2386c1

Browse files
Use instance of config instead of reference
1 parent 528bd94 commit a2386c1

File tree

13 files changed

+28
-28
lines changed

13 files changed

+28
-28
lines changed

api/api.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func SupportedAPIs(
109109
pullAPI *PullAPI,
110110
debugAPI *DebugAPI,
111111
walletAPI *WalletAPI,
112-
config *config.Config,
112+
config config.Config,
113113
) []rpc.API {
114114
apis := []rpc.API{{
115115
Namespace: "eth",
@@ -151,7 +151,7 @@ func SupportedAPIs(
151151

152152
type BlockChainAPI struct {
153153
logger zerolog.Logger
154-
config *config.Config
154+
config config.Config
155155
evm requester.Requester
156156
blocks storage.BlockIndexer
157157
transactions storage.TransactionIndexer
@@ -163,7 +163,7 @@ type BlockChainAPI struct {
163163

164164
func NewBlockChainAPI(
165165
logger zerolog.Logger,
166-
config *config.Config,
166+
config config.Config,
167167
evm requester.Requester,
168168
blocks storage.BlockIndexer,
169169
transactions storage.TransactionIndexer,

api/debug.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type DebugAPI struct {
4949
transactions storage.TransactionIndexer
5050
receipts storage.ReceiptIndexer
5151
client *requester.CrossSporkClient
52-
config *config.Config
52+
config config.Config
5353
collector metrics.Collector
5454
}
5555

@@ -60,7 +60,7 @@ func NewDebugAPI(
6060
transactions storage.TransactionIndexer,
6161
receipts storage.ReceiptIndexer,
6262
client *requester.CrossSporkClient,
63-
config *config.Config,
63+
config config.Config,
6464
logger zerolog.Logger,
6565
collector metrics.Collector,
6666
) *DebugAPI {

api/net.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99

1010
// NetAPI offers network related RPC methods
1111
type NetAPI struct {
12-
config *config.Config
12+
config config.Config
1313
}
1414

15-
func NewNetAPI(config *config.Config) *NetAPI {
15+
func NewNetAPI(config config.Config) *NetAPI {
1616
return &NetAPI{
1717
config: config,
1818
}

api/pull.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func newLogsFilter(
129129

130130
type PullAPI struct {
131131
logger zerolog.Logger
132-
config *config.Config
132+
config config.Config
133133
blocks storage.BlockIndexer
134134
transactions storage.TransactionIndexer
135135
receipts storage.ReceiptIndexer
@@ -140,7 +140,7 @@ type PullAPI struct {
140140

141141
func NewPullAPI(
142142
logger zerolog.Logger,
143-
config *config.Config,
143+
config config.Config,
144144
blocks storage.BlockIndexer,
145145
transactions storage.TransactionIndexer,
146146
receipts storage.ReceiptIndexer,

api/pull_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestFilterExpiryChecker(t *testing.T) {
6060
t.Run(tc.name, func(t *testing.T) {
6161
api := &PullAPI{
6262
filters: make(map[rpc.ID]filter),
63-
config: &config.Config{FilterExpiry: time.Millisecond * 5},
63+
config: config.Config{FilterExpiry: time.Millisecond * 5},
6464
}
6565

6666
tc.setup(api)

api/server.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type Server struct {
5353
host string
5454
port int
5555

56-
config *config.Config
56+
config config.Config
5757
collector metrics.Collector
5858
}
5959

@@ -66,7 +66,7 @@ const (
6666
func NewServer(
6767
logger zerolog.Logger,
6868
collector metrics.Collector,
69-
cfg *config.Config,
69+
cfg config.Config,
7070
) *Server {
7171
logger = logger.With().Str("component", "API").Logger()
7272

api/stream.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
type StreamAPI struct {
2323
logger zerolog.Logger
24-
config *config.Config
24+
config config.Config
2525
blocks storage.BlockIndexer
2626
transactions storage.TransactionIndexer
2727
receipts storage.ReceiptIndexer
@@ -32,7 +32,7 @@ type StreamAPI struct {
3232

3333
func NewStreamAPI(
3434
logger zerolog.Logger,
35-
config *config.Config,
35+
config config.Config,
3636
blocks storage.BlockIndexer,
3737
transactions storage.TransactionIndexer,
3838
receipts storage.ReceiptIndexer,

api/wallet.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import (
1919

2020
type WalletAPI struct {
2121
net *BlockChainAPI
22-
config *config.Config
22+
config config.Config
2323
}
2424

25-
func NewWalletAPI(config *config.Config, net *BlockChainAPI) *WalletAPI {
25+
func NewWalletAPI(config config.Config, net *BlockChainAPI) *WalletAPI {
2626
return &WalletAPI{
2727
net: net,
2828
config: config,

bootstrap/bootstrap.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type Publishers struct {
5151

5252
type Bootstrap struct {
5353
logger zerolog.Logger
54-
config *config.Config
54+
config config.Config
5555
client *requester.CrossSporkClient
5656
storages *Storages
5757
publishers *Publishers
@@ -63,7 +63,7 @@ type Bootstrap struct {
6363
db *pebbleDB.DB
6464
}
6565

66-
func New(config *config.Config) (*Bootstrap, error) {
66+
func New(config config.Config) (*Bootstrap, error) {
6767
logger := zerolog.New(config.LogWriter).
6868
With().Timestamp().Str("version", api.Version).
6969
Logger().Level(config.LogLevel)
@@ -432,7 +432,7 @@ func StartEngine(
432432
}
433433

434434
// setupCrossSporkClient sets up a cross-spork AN client.
435-
func setupCrossSporkClient(config *config.Config, logger zerolog.Logger) (*requester.CrossSporkClient, error) {
435+
func setupCrossSporkClient(config config.Config, logger zerolog.Logger) (*requester.CrossSporkClient, error) {
436436
// create access client with cross-spork capabilities
437437
currentSporkClient, err := grpc.NewClient(
438438
config.AccessNodeHost,
@@ -474,7 +474,7 @@ func setupCrossSporkClient(config *config.Config, logger zerolog.Logger) (*reque
474474
// setupStorage creates storage and initializes it with configured starting cadence height
475475
// in case such a height doesn't already exist in the database.
476476
func setupStorage(
477-
config *config.Config,
477+
config config.Config,
478478
client *requester.CrossSporkClient,
479479
logger zerolog.Logger,
480480
) (*pebbleDB.DB, *Storages, error) {
@@ -571,7 +571,7 @@ func setupStorage(
571571
// Run will run complete bootstrap of the EVM gateway with all the engines.
572572
// Run is a blocking call, but it does signal readiness of the service
573573
// through a channel provided as an argument.
574-
func Run(ctx context.Context, cfg *config.Config, ready component.ReadyFunc) error {
574+
func Run(ctx context.Context, cfg config.Config, ready component.ReadyFunc) error {
575575
boot, err := New(cfg)
576576
if err != nil {
577577
return err

cmd/run/cmd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func parseConfigFromFlags() error {
244244
return nil
245245
}
246246

247-
var cfg = &config.Config{}
247+
var cfg = config.Config{}
248248
var (
249249
coinbase,
250250
gas,

services/requester/requester.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ type EVM struct {
9898
registerStore *pebble.RegisterStorage
9999
blocksProvider *replayer.BlocksProvider
100100
client *CrossSporkClient
101-
config *config.Config
101+
config config.Config
102102
signer crypto.Signer
103103
txPool *TxPool
104104
logger zerolog.Logger
@@ -116,7 +116,7 @@ func NewEVM(
116116
registerStore *pebble.RegisterStorage,
117117
blocksProvider *replayer.BlocksProvider,
118118
client *CrossSporkClient,
119-
config *config.Config,
119+
config config.Config,
120120
signer crypto.Signer,
121121
logger zerolog.Logger,
122122
blocks storage.BlockIndexer,

tests/helpers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func servicesSetup(t *testing.T) (emulator.Emulator, func()) {
137137
service := emu.ServiceKey()
138138

139139
// default config
140-
cfg := &config.Config{
140+
cfg := config.Config{
141141
DatabaseDir: t.TempDir(),
142142
AccessNodeHost: "localhost:3569", // emulator
143143
RPCPort: 8545,

tests/integration_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func Test_ConcurrentTransactionSubmission(t *testing.T) {
5959
)
6060
require.NoError(t, err)
6161

62-
cfg := &config.Config{
62+
cfg := config.Config{
6363
DatabaseDir: t.TempDir(),
6464
AccessNodeHost: grpcHost,
6565
RPCPort: 8545,
@@ -165,7 +165,7 @@ func Test_EthClientTest(t *testing.T) {
165165
)
166166
require.NoError(t, err)
167167

168-
cfg := &config.Config{
168+
cfg := config.Config{
169169
DatabaseDir: t.TempDir(),
170170
AccessNodeHost: grpcHost,
171171
RPCPort: 8545,
@@ -268,7 +268,7 @@ func Test_CloudKMSConcurrentTransactionSubmission(t *testing.T) {
268268
)
269269
require.NoError(t, err)
270270

271-
cfg := &config.Config{
271+
cfg := config.Config{
272272
DatabaseDir: t.TempDir(),
273273
AccessNodeHost: grpcHost,
274274
RPCPort: 8545,

0 commit comments

Comments
 (0)