Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance fix #1826

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading