Skip to content

Commit e8219bb

Browse files
authored
Cherrypick RPC cpu optimization changes (#2452)
## Describe your changes and provide context - cache receipts in memory - only load nonce for applicable txs to reduce reads ## Testing performed to validate your change tested on archive node
1 parent 6ec74a2 commit e8219bb

12 files changed

Lines changed: 213 additions & 91 deletions

File tree

evmrpc/block.go

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@ type BlockAPI struct {
4343
namespace string
4444
includeShellReceipts bool
4545
includeBankTransfers bool
46+
globalBlockCache BlockCache
47+
cacheCreationMutex *sync.Mutex
4648
}
4749

4850
type SeiBlockAPI struct {
4951
*BlockAPI
5052
isPanicTx func(ctx context.Context, hash common.Hash) (bool, error)
5153
}
5254

53-
func NewBlockAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txConfigProvider func(int64) client.TxConfig, connectionType ConnectionType) *BlockAPI {
55+
func NewBlockAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, txConfigProvider func(int64) client.TxConfig, connectionType ConnectionType, globalBlockCache BlockCache, cacheCreationMutex *sync.Mutex) *BlockAPI {
5456
return &BlockAPI{
5557
tmClient: tmClient,
5658
keeper: k,
@@ -60,6 +62,8 @@ func NewBlockAPI(tmClient rpcclient.Client, k *keeper.Keeper, ctxProvider func(i
6062
includeShellReceipts: false,
6163
includeBankTransfers: false,
6264
namespace: EthNamespace,
65+
globalBlockCache: globalBlockCache,
66+
cacheCreationMutex: cacheCreationMutex,
6367
}
6468
}
6569

@@ -70,6 +74,8 @@ func NewSeiBlockAPI(
7074
txConfigProvider func(int64) client.TxConfig,
7175
connectionType ConnectionType,
7276
isPanicTx func(ctx context.Context, hash common.Hash) (bool, error),
77+
globalBlockCache BlockCache,
78+
cacheCreationMutex *sync.Mutex,
7379
) *SeiBlockAPI {
7480
blockAPI := &BlockAPI{
7581
tmClient: tmClient,
@@ -80,6 +86,8 @@ func NewSeiBlockAPI(
8086
includeShellReceipts: true,
8187
includeBankTransfers: false,
8288
namespace: SeiNamespace,
89+
globalBlockCache: globalBlockCache,
90+
cacheCreationMutex: cacheCreationMutex,
8391
}
8492
return &SeiBlockAPI{
8593
BlockAPI: blockAPI,
@@ -94,8 +102,10 @@ func NewSei2BlockAPI(
94102
txConfigProvider func(int64) client.TxConfig,
95103
connectionType ConnectionType,
96104
isPanicTx func(ctx context.Context, hash common.Hash) (bool, error),
105+
globalBlockCache BlockCache,
106+
cacheCreationMutex *sync.Mutex,
97107
) *SeiBlockAPI {
98-
blockAPI := NewSeiBlockAPI(tmClient, k, ctxProvider, txConfigProvider, connectionType, isPanicTx)
108+
blockAPI := NewSeiBlockAPI(tmClient, k, ctxProvider, txConfigProvider, connectionType, isPanicTx, globalBlockCache, cacheCreationMutex)
99109
blockAPI.namespace = Sei2Namespace
100110
blockAPI.includeBankTransfers = true
101111
return blockAPI
@@ -158,7 +168,7 @@ func (a *BlockAPI) getBlockByHash(ctx context.Context, blockHash common.Hash, fu
158168
if err != nil {
159169
return nil, err
160170
}
161-
return EncodeTmBlock(a.ctxProvider, a.txConfigProvider, block, blockRes, a.keeper, fullTx, a.includeBankTransfers, includeSyntheticTxs, isPanicTx)
171+
return EncodeTmBlock(a.ctxProvider, a.txConfigProvider, block, blockRes, a.keeper, fullTx, a.includeBankTransfers, includeSyntheticTxs, isPanicTx, a.globalBlockCache, a.cacheCreationMutex)
162172
}
163173

164174
func (a *BlockAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (result map[string]interface{}, returnErr error) {
@@ -220,7 +230,7 @@ func (a *BlockAPI) getBlockByNumber(
220230
if err != nil {
221231
return nil, err
222232
}
223-
return EncodeTmBlock(a.ctxProvider, a.txConfigProvider, block, blockRes, a.keeper, fullTx, a.includeBankTransfers, includeSyntheticTxs, isPanicTx)
233+
return EncodeTmBlock(a.ctxProvider, a.txConfigProvider, block, blockRes, a.keeper, fullTx, a.includeBankTransfers, includeSyntheticTxs, isPanicTx, a.globalBlockCache, a.cacheCreationMutex)
224234
}
225235

226236
func (a *BlockAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (result []map[string]interface{}, returnErr error) {
@@ -239,7 +249,9 @@ func (a *BlockAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.Block
239249

240250
// Get all tx hashes for the block
241251
height := block.Block.Height
242-
txHashes := getTxHashesFromBlock(a.ctxProvider, a.txConfigProvider, a.keeper, block, shouldIncludeSynthetic(a.namespace))
252+
253+
txHashes := getTxHashesFromBlock(a.ctxProvider, a.txConfigProvider, a.keeper, block, shouldIncludeSynthetic(a.namespace), a.cacheCreationMutex, a.globalBlockCache)
254+
243255
// Get tx receipts for all hashes in parallel
244256
wg := sync.WaitGroup{}
245257
mtx := sync.Mutex{}
@@ -258,7 +270,7 @@ func (a *BlockAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.Block
258270
mtx.Unlock()
259271
}
260272
} else {
261-
encodedReceipt, err := encodeReceipt(a.ctxProvider, a.txConfigProvider, receipt, a.keeper, block, a.includeShellReceipts)
273+
encodedReceipt, err := encodeReceipt(a.ctxProvider, a.txConfigProvider, receipt, a.keeper, block, a.includeShellReceipts, a.globalBlockCache, a.cacheCreationMutex)
262274
if err != nil {
263275
mtx.Lock()
264276
returnErr = err
@@ -294,6 +306,8 @@ func EncodeTmBlock(
294306
includeBankTransfers bool,
295307
includeSyntheticTxs bool,
296308
isPanicOrSynthetic func(ctx context.Context, hash common.Hash) (bool, error),
309+
globalBlockCache BlockCache,
310+
cacheCreationMutex *sync.Mutex,
297311
) (map[string]interface{}, error) {
298312
number := big.NewInt(block.Block.Height)
299313
blockhash := common.HexToHash(block.BlockID.Hash.String())
@@ -315,7 +329,7 @@ func EncodeTmBlock(
315329
transactions := []interface{}{}
316330
latestCtx := ctxProvider(LatestCtxHeight)
317331

318-
msgs := filterTransactions(k, ctxProvider, txConfigProvider, block, includeSyntheticTxs, includeBankTransfers)
332+
msgs := filterTransactions(k, ctxProvider, txConfigProvider, block, includeSyntheticTxs, includeBankTransfers, cacheCreationMutex, globalBlockCache)
319333

320334
blockBloom := make([]byte, ethtypes.BloomByteLength)
321335
for _, msg := range msgs {

evmrpc/block_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package evmrpc_test
33
import (
44
"crypto/sha256"
55
"math/big"
6+
"sync"
67
"testing"
78
"time"
89

@@ -49,7 +50,7 @@ func TestEncodeTmBlock_EmptyTransactions(t *testing.T) {
4950
}
5051

5152
// Call EncodeTmBlock with empty transactions
52-
result, err := evmrpc.EncodeTmBlock(func(i int64) sdk.Context { return ctx }, func(i int64) client.TxConfig { return TxConfig }, block, blockRes, k, true, false, false, nil)
53+
result, err := evmrpc.EncodeTmBlock(func(i int64) sdk.Context { return ctx }, func(i int64) client.TxConfig { return TxConfig }, block, blockRes, k, true, false, false, nil, evmrpc.NewBlockCache(3000), &sync.Mutex{})
5354
require.Nil(t, err)
5455

5556
// Assert txHash is equal to ethtypes.EmptyTxsHash
@@ -95,7 +96,7 @@ func TestEncodeBankMsg(t *testing.T) {
9596
},
9697
},
9798
}
98-
res, err := evmrpc.EncodeTmBlock(func(i int64) sdk.Context { return ctx }, func(i int64) client.TxConfig { return TxConfig }, &resBlock, &resBlockRes, k, true, false, false, nil)
99+
res, err := evmrpc.EncodeTmBlock(func(i int64) sdk.Context { return ctx }, func(i int64) client.TxConfig { return TxConfig }, &resBlock, &resBlockRes, k, true, false, false, nil, evmrpc.NewBlockCache(3000), &sync.Mutex{})
99100
require.Nil(t, err)
100101
txs := res["transactions"].([]interface{})
101102
require.Equal(t, 0, len(txs))
@@ -143,7 +144,7 @@ func TestEncodeWasmExecuteMsg(t *testing.T) {
143144
},
144145
},
145146
}
146-
res, err := evmrpc.EncodeTmBlock(func(i int64) sdk.Context { return ctx }, func(i int64) client.TxConfig { return TxConfig }, &resBlock, &resBlockRes, k, true, false, true, nil)
147+
res, err := evmrpc.EncodeTmBlock(func(i int64) sdk.Context { return ctx }, func(i int64) client.TxConfig { return TxConfig }, &resBlock, &resBlockRes, k, true, false, true, nil, evmrpc.NewBlockCache(3000), &sync.Mutex{})
147148
require.Nil(t, err)
148149
txs := res["transactions"].([]interface{})
149150
require.Equal(t, 1, len(txs))
@@ -204,7 +205,7 @@ func TestEncodeBankTransferMsg(t *testing.T) {
204205
},
205206
},
206207
}
207-
res, err := evmrpc.EncodeTmBlock(func(i int64) sdk.Context { return ctx }, func(i int64) client.TxConfig { return TxConfig }, &resBlock, &resBlockRes, k, true, true, false, nil)
208+
res, err := evmrpc.EncodeTmBlock(func(i int64) sdk.Context { return ctx }, func(i int64) client.TxConfig { return TxConfig }, &resBlock, &resBlockRes, k, true, true, false, nil, evmrpc.NewBlockCache(3000), &sync.Mutex{})
208209
require.Nil(t, err)
209210
txs := res["transactions"].([]interface{})
210211
require.Equal(t, 1, len(txs))

evmrpc/filter.go

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ func getCachedReceipt(globalBlockCache BlockCache, blockHeight int64, txHash com
6868
return nil, false
6969
}
7070

71+
func getOrSetCachedReceipt(cacheCreationMutex *sync.Mutex, globalBlockCache BlockCache, ctx sdk.Context, k *keeper.Keeper, block *coretypes.ResultBlock, txHash common.Hash) (*evmtypes.Receipt, bool) {
72+
blockHeight := block.Block.Height
73+
receipt, found := getCachedReceipt(globalBlockCache, blockHeight, txHash)
74+
if found {
75+
return receipt, true
76+
}
77+
receipt, err := k.GetReceipt(ctx, txHash)
78+
if err != nil {
79+
return nil, false
80+
}
81+
setCachedReceipt(cacheCreationMutex, globalBlockCache, blockHeight, block, txHash, receipt)
82+
return receipt, true
83+
}
84+
7185
// LoadOrStore ensures atomic cache entry creation (like sync.Map.LoadOrStore)
7286
func loadOrStoreCacheEntry(cacheCreationMutex *sync.Mutex, globalBlockCache BlockCache, blockHeight int64, block *coretypes.ResultBlock) *BlockCacheEntry {
7387
// Fast path: try to get existing entry
@@ -261,6 +275,7 @@ func NewFilterAPI(
261275
namespace string,
262276
dbReadSemaphore chan struct{},
263277
globalBlockCache BlockCache,
278+
cacheCreationMutex *sync.Mutex,
264279
globalLogSlicePool *LogSlicePool,
265280
) *FilterAPI {
266281
if filterConfig.maxBlock <= 0 {
@@ -280,6 +295,7 @@ func NewFilterAPI(
280295
includeSyntheticReceipts: shouldIncludeSynthetic(namespace),
281296
dbReadSemaphore: dbReadSemaphore,
282297
globalBlockCache: globalBlockCache,
298+
cacheCreationMutex: cacheCreationMutex,
283299
globalLogSlicePool: globalLogSlicePool,
284300
}
285301
filters := make(map[ethrpc.ID]filter)
@@ -641,7 +657,7 @@ type LogFetcher struct {
641657
includeSyntheticReceipts bool
642658
dbReadSemaphore chan struct{}
643659
globalBlockCache BlockCache
644-
cacheCreationMutex sync.Mutex
660+
cacheCreationMutex *sync.Mutex
645661
globalLogSlicePool *LogSlicePool
646662
}
647663

@@ -828,15 +844,11 @@ func (f *LogFetcher) collectLogs(block *coretypes.ResultBlock, crit filters.Filt
828844
totalLogs := uint(0)
829845
evmTxIndex := 0
830846

831-
for _, hash := range getTxHashesFromBlock(f.ctxProvider, f.txConfigProvider, f.k, block, f.includeSyntheticReceipts) {
832-
receipt, found := getCachedReceipt(f.globalBlockCache, block.Block.Height, hash.hash)
847+
for _, hash := range getTxHashesFromBlock(f.ctxProvider, f.txConfigProvider, f.k, block, f.includeSyntheticReceipts, f.cacheCreationMutex, f.globalBlockCache) {
848+
receipt, found := getOrSetCachedReceipt(f.cacheCreationMutex, f.globalBlockCache, ctx, f.k, block, hash.hash)
833849
if !found {
834-
var err error
835-
receipt, err = f.k.GetReceipt(ctx, hash.hash)
836-
if err != nil {
837-
continue
838-
}
839-
setCachedReceipt(&f.cacheCreationMutex, f.globalBlockCache, block.Block.Height, block, hash.hash, receipt)
850+
ctx.Logger().Error(fmt.Sprintf("collectLogs: unable to find receipt for hash %s", hash.hash.Hex()))
851+
continue
840852
}
841853

842854
txLogs := keeper.GetLogsForTx(receipt, totalLogs)
@@ -1031,7 +1043,7 @@ func (f *LogFetcher) processBatch(ctx context.Context, start, end int64, crit fi
10311043
}
10321044

10331045
// Use LoadOrStore to create/get cache entry atomically
1034-
entry := loadOrStoreCacheEntry(&f.cacheCreationMutex, f.globalBlockCache, height, block)
1046+
entry := loadOrStoreCacheEntry(f.cacheCreationMutex, f.globalBlockCache, height, block)
10351047
// Fill bloom if we have it and it's missing
10361048
if blockBloom != (ethtypes.Bloom{}) {
10371049
fillMissingFields(entry, block, blockBloom)

evmrpc/send.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"sync"
78
"time"
89

910
"github.com/cosmos/cosmos-sdk/baseapp"
@@ -38,16 +39,28 @@ type SendConfig struct {
3839
slow bool
3940
}
4041

41-
func NewSendAPI(tmClient rpcclient.Client, txConfigProvider func(int64) client.TxConfig, sendConfig *SendConfig, k *keeper.Keeper, ctxProvider func(int64) sdk.Context, homeDir string, simulateConfig *SimulateConfig, app *baseapp.BaseApp,
42-
antehandler sdk.AnteHandler, connectionType ConnectionType) *SendAPI {
42+
func NewSendAPI(
43+
tmClient rpcclient.Client,
44+
txConfigProvider func(int64) client.TxConfig,
45+
sendConfig *SendConfig,
46+
k *keeper.Keeper,
47+
ctxProvider func(int64) sdk.Context,
48+
homeDir string,
49+
simulateConfig *SimulateConfig,
50+
app *baseapp.BaseApp,
51+
antehandler sdk.AnteHandler,
52+
connectionType ConnectionType,
53+
globalBlockCache BlockCache,
54+
cacheCreationMutex *sync.Mutex,
55+
) *SendAPI {
4356
return &SendAPI{
4457
tmClient: tmClient,
4558
txConfigProvider: txConfigProvider,
4659
sendConfig: sendConfig,
4760
keeper: k,
4861
ctxProvider: ctxProvider,
4962
homeDir: homeDir,
50-
backend: NewBackend(ctxProvider, k, txConfigProvider, tmClient, simulateConfig, app, antehandler),
63+
backend: NewBackend(ctxProvider, k, txConfigProvider, tmClient, simulateConfig, app, antehandler, globalBlockCache, cacheCreationMutex),
5164
connectionType: connectionType,
5265
}
5366
}

evmrpc/server.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package evmrpc
33
import (
44
"context"
55
"strings"
6+
"sync"
67

78
"github.com/cosmos/cosmos-sdk/baseapp"
89
"github.com/cosmos/cosmos-sdk/client"
@@ -60,22 +61,23 @@ func NewEVMHTTPServer(
6061
EVMTimeout: config.SimulationEVMTimeout,
6162
MaxConcurrentSimulationCalls: config.MaxConcurrentSimulationCalls,
6263
}
63-
sendAPI := NewSendAPI(tmClient, txConfigProvider, &SendConfig{slow: config.Slow}, k, ctxProvider, homeDir, simulateConfig, app, antehandler, ConnectionTypeHTTP)
64+
globalBlockCache := NewBlockCache(3000)
65+
cacheCreationMutex := &sync.Mutex{}
66+
sendAPI := NewSendAPI(tmClient, txConfigProvider, &SendConfig{slow: config.Slow}, k, ctxProvider, homeDir, simulateConfig, app, antehandler, ConnectionTypeHTTP, globalBlockCache, cacheCreationMutex)
6467

6568
ctx := ctxProvider(LatestCtxHeight)
6669

67-
txAPI := NewTransactionAPI(tmClient, k, ctxProvider, txConfigProvider, homeDir, ConnectionTypeHTTP)
68-
debugAPI := NewDebugAPI(tmClient, k, ctxProvider, txConfigProvider, simulateConfig, app, antehandler, ConnectionTypeHTTP, config)
70+
txAPI := NewTransactionAPI(tmClient, k, ctxProvider, txConfigProvider, homeDir, ConnectionTypeHTTP, globalBlockCache, cacheCreationMutex)
71+
debugAPI := NewDebugAPI(tmClient, k, ctxProvider, txConfigProvider, simulateConfig, app, antehandler, ConnectionTypeHTTP, config, globalBlockCache, cacheCreationMutex)
6972
if isPanicOrSyntheticTxFunc == nil {
7073
isPanicOrSyntheticTxFunc = func(ctx context.Context, hash common.Hash) (bool, error) {
7174
return debugAPI.isPanicOrSyntheticTx(ctx, hash)
7275
}
7376
}
74-
seiTxAPI := NewSeiTransactionAPI(tmClient, k, ctxProvider, txConfigProvider, homeDir, ConnectionTypeHTTP, isPanicOrSyntheticTxFunc)
75-
seiDebugAPI := NewSeiDebugAPI(tmClient, k, ctxProvider, txConfigProvider, simulateConfig, app, antehandler, ConnectionTypeHTTP, config)
77+
seiTxAPI := NewSeiTransactionAPI(tmClient, k, ctxProvider, txConfigProvider, homeDir, ConnectionTypeHTTP, isPanicOrSyntheticTxFunc, globalBlockCache, cacheCreationMutex)
78+
seiDebugAPI := NewSeiDebugAPI(tmClient, k, ctxProvider, txConfigProvider, simulateConfig, app, antehandler, ConnectionTypeHTTP, config, globalBlockCache, cacheCreationMutex)
7679

7780
dbReadSemaphore := make(chan struct{}, MaxDBReadConcurrency)
78-
globalBlockCache := NewBlockCache(3000)
7981
globalLogSlicePool := NewLogSlicePool()
8082
apis := []rpc.API{
8183
{
@@ -84,15 +86,15 @@ func NewEVMHTTPServer(
8486
},
8587
{
8688
Namespace: "eth",
87-
Service: NewBlockAPI(tmClient, k, ctxProvider, txConfigProvider, ConnectionTypeHTTP),
89+
Service: NewBlockAPI(tmClient, k, ctxProvider, txConfigProvider, ConnectionTypeHTTP, globalBlockCache, cacheCreationMutex),
8890
},
8991
{
9092
Namespace: "sei",
91-
Service: NewSeiBlockAPI(tmClient, k, ctxProvider, txConfigProvider, ConnectionTypeHTTP, isPanicOrSyntheticTxFunc),
93+
Service: NewSeiBlockAPI(tmClient, k, ctxProvider, txConfigProvider, ConnectionTypeHTTP, isPanicOrSyntheticTxFunc, globalBlockCache, cacheCreationMutex),
9294
},
9395
{
9496
Namespace: "sei2",
95-
Service: NewSei2BlockAPI(tmClient, k, ctxProvider, txConfigProvider, ConnectionTypeHTTP, isPanicOrSyntheticTxFunc),
97+
Service: NewSei2BlockAPI(tmClient, k, ctxProvider, txConfigProvider, ConnectionTypeHTTP, isPanicOrSyntheticTxFunc, globalBlockCache, cacheCreationMutex),
9698
},
9799
{
98100
Namespace: "eth",
@@ -116,7 +118,7 @@ func NewEVMHTTPServer(
116118
},
117119
{
118120
Namespace: "eth",
119-
Service: NewSimulationAPI(ctxProvider, k, txConfigProvider, tmClient, simulateConfig, app, antehandler, ConnectionTypeHTTP),
121+
Service: NewSimulationAPI(ctxProvider, k, txConfigProvider, tmClient, simulateConfig, app, antehandler, ConnectionTypeHTTP, globalBlockCache, cacheCreationMutex),
120122
},
121123
{
122124
Namespace: "net",
@@ -134,6 +136,7 @@ func NewEVMHTTPServer(
134136
"eth",
135137
dbReadSemaphore,
136138
globalBlockCache,
139+
cacheCreationMutex,
137140
globalLogSlicePool,
138141
),
139142
},
@@ -149,6 +152,7 @@ func NewEVMHTTPServer(
149152
"sei",
150153
dbReadSemaphore,
151154
globalBlockCache,
155+
cacheCreationMutex,
152156
globalLogSlicePool,
153157
),
154158
},
@@ -227,6 +231,7 @@ func NewEVMWebSocketServer(
227231
}
228232
dbReadSemaphore := make(chan struct{}, MaxDBReadConcurrency)
229233
globalBlockCache := NewBlockCache(3000)
234+
cacheCreationMutex := &sync.Mutex{}
230235
globalLogSlicePool := NewLogSlicePool()
231236
apis := []rpc.API{
232237
{
@@ -235,11 +240,11 @@ func NewEVMWebSocketServer(
235240
},
236241
{
237242
Namespace: "eth",
238-
Service: NewBlockAPI(tmClient, k, ctxProvider, txConfigProvider, ConnectionTypeWS),
243+
Service: NewBlockAPI(tmClient, k, ctxProvider, txConfigProvider, ConnectionTypeWS, globalBlockCache, cacheCreationMutex),
239244
},
240245
{
241246
Namespace: "eth",
242-
Service: NewTransactionAPI(tmClient, k, ctxProvider, txConfigProvider, homeDir, ConnectionTypeWS),
247+
Service: NewTransactionAPI(tmClient, k, ctxProvider, txConfigProvider, homeDir, ConnectionTypeWS, globalBlockCache, cacheCreationMutex),
243248
},
244249
{
245250
Namespace: "eth",
@@ -251,11 +256,11 @@ func NewEVMWebSocketServer(
251256
},
252257
{
253258
Namespace: "eth",
254-
Service: NewSendAPI(tmClient, txConfigProvider, &SendConfig{slow: config.Slow}, k, ctxProvider, homeDir, simulateConfig, app, antehandler, ConnectionTypeWS),
259+
Service: NewSendAPI(tmClient, txConfigProvider, &SendConfig{slow: config.Slow}, k, ctxProvider, homeDir, simulateConfig, app, antehandler, ConnectionTypeWS, globalBlockCache, cacheCreationMutex),
255260
},
256261
{
257262
Namespace: "eth",
258-
Service: NewSimulationAPI(ctxProvider, k, txConfigProvider, tmClient, simulateConfig, app, antehandler, ConnectionTypeWS),
263+
Service: NewSimulationAPI(ctxProvider, k, txConfigProvider, tmClient, simulateConfig, app, antehandler, ConnectionTypeWS, globalBlockCache, cacheCreationMutex),
259264
},
260265
{
261266
Namespace: "net",
@@ -270,6 +275,7 @@ func NewEVMWebSocketServer(
270275
txConfigProvider: txConfigProvider,
271276
dbReadSemaphore: dbReadSemaphore,
272277
globalBlockCache: globalBlockCache,
278+
cacheCreationMutex: cacheCreationMutex,
273279
globalLogSlicePool: globalLogSlicePool,
274280
}, &SubscriptionConfig{subscriptionCapacity: 100, newHeadLimit: config.MaxSubscriptionsNewHead}, &FilterConfig{timeout: config.FilterTimeout, maxLog: config.MaxLogNoBlock, maxBlock: config.MaxBlocksForLog}, ConnectionTypeWS),
275281
},

0 commit comments

Comments
 (0)