Skip to content

Commit

Permalink
Fix gas estimation (#1582)
Browse files Browse the repository at this point in the history
* Added stopwatches in important functions.

* Using defer.

---------

Co-authored-by: StefanIliev545 <[email protected]>
  • Loading branch information
StefanIliev545 and StefanIliev545 authored Oct 5, 2023
1 parent 1e7e94c commit dc900b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go/enclave/enclave.go
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ func (e *enclaveImpl) GetPublicTransactionData(pagination *common.QueryPaginatio
// Create a helper to check if a gas allowance results in an executable transaction
// isGasEnough returns whether the gaslimit should be raised, lowered, or if it was impossible to execute the message
func (e *enclaveImpl) isGasEnough(args *gethapi.TransactionArgs, gas uint64, blkNumber *gethrpc.BlockNumber) (bool, *gethcore.ExecutionResult, error) {
core.LogMethodDuration(e.logger, measure.NewStopwatch(), "enclave.go:IsGasEnough")
defer core.LogMethodDuration(e.logger, measure.NewStopwatch(), "enclave.go:IsGasEnough")
args.Gas = (*hexutil.Uint64)(&gas)
result, err := e.chain.ObsCallAtBlock(args, blkNumber)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go/enclave/evm/evm_facade.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func ExecuteObsCall(
noBaseFee = false
}

core.LogMethodDuration(logger, measure.NewStopwatch(), "evm_facade.go:ObsCall()")
defer core.LogMethodDuration(logger, measure.NewStopwatch(), "evm_facade.go:ObsCall()")

chain, vmCfg, gp := initParams(storage, noBaseFee, nil)
ethHeader, err := gethencoding.CreateEthHeaderForBatch(header, secret(storage))
Expand Down

0 comments on commit dc900b6

Please sign in to comment.