Skip to content

Commit

Permalink
Merge pull request #1826 from ten-protocol/tudor/perf_fix_0.23
Browse files Browse the repository at this point in the history
performance fix
  • Loading branch information
tudor-malene authored Mar 2, 2024
2 parents 1110858 + 1953886 commit 9e9ac5f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go/enclave/enclave.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func NewEnclave(
registry,
config.GasLocalExecutionCapFlag,
)
rpcEncryptionManager := rpc.NewEncryptionManager(ecies.ImportECDSA(obscuroKey), storage, registry, crossChainProcessors, service, config, gasOracle, storage, chain, logger)
rpcEncryptionManager := rpc.NewEncryptionManager(ecies.ImportECDSA(obscuroKey), storage, registry, crossChainProcessors, service, config, gasOracle, storage, blockProcessor, chain, logger)
subscriptionManager := events.NewSubscriptionManager(storage, config.ObscuroChainID, logger)

// ensure cached chain state data is up-to-date using the persisted batch data
Expand Down
5 changes: 3 additions & 2 deletions go/enclave/rpc/EstimateGas.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func EstimateGasExecute(builder *CallBuilder[CallParamsWithBlock, hexutil.Uint64

txArgs := builder.Param.callParams
blockNumber := builder.Param.block
block, err := rpc.blockResolver.FetchHeadBlock()
block, err := rpc.l1BlockProcessor.GetHead()
if err != nil {
return err
}
Expand All @@ -72,7 +72,8 @@ func EstimateGasExecute(builder *CallBuilder[CallParamsWithBlock, hexutil.Uint64
return err
}

batch, err := rpc.storage.FetchHeadBatch()
headBatchSeq := rpc.registry.HeadBatchSeq()
batch, err := rpc.storage.FetchBatchBySeqNo(headBatchSeq.Uint64())
if err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion go/enclave/rpc/rpc_encryption_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ type EncryptionManager struct {
service nodetype.NodeType
gasOracle gas.Oracle
blockResolver storage.BlockResolver
l1BlockProcessor components.L1BlockProcessor
config *config.EnclaveConfig
logger gethlog.Logger
}

func NewEncryptionManager(enclavePrivateKeyECIES *ecies.PrivateKey, storage storage.Storage, registry components.BatchRegistry, processors *crosschain.Processors, service nodetype.NodeType, config *config.EnclaveConfig, oracle gas.Oracle, blockResolver storage.BlockResolver, chain l2chain.ObscuroChain, logger gethlog.Logger) *EncryptionManager {
func NewEncryptionManager(enclavePrivateKeyECIES *ecies.PrivateKey, storage storage.Storage, registry components.BatchRegistry, processors *crosschain.Processors, service nodetype.NodeType, config *config.EnclaveConfig, oracle gas.Oracle, blockResolver storage.BlockResolver, l1BlockProcessor components.L1BlockProcessor, chain l2chain.ObscuroChain, logger gethlog.Logger) *EncryptionManager {
return &EncryptionManager{
storage: storage,
registry: registry,
Expand All @@ -39,6 +40,7 @@ func NewEncryptionManager(enclavePrivateKeyECIES *ecies.PrivateKey, storage stor
chain: chain,
config: config,
blockResolver: blockResolver,
l1BlockProcessor: l1BlockProcessor,
gasOracle: oracle,
logger: logger,
enclavePrivateKeyECIES: enclavePrivateKeyECIES,
Expand Down

0 comments on commit 9e9ac5f

Please sign in to comment.