Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Rootul P <[email protected]>
  • Loading branch information
evan-forbes and rootulp authored Jul 25, 2023
1 parent b67a52f commit dcaaa58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions tools/gasmonitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ When creating a `testnode`, set the gas consumption trace decorator as an
`appOption` with the specific key.

```go
cfg := testnode.DefaultConfig()
cfg := testnode.DefaultConfig()
dec := gasmonitor.NewDecorator()
// store the gas monitor to read from after execution
// store the gas monitor to read from after execution
s.gasMonitor = dec
cfg.AppOptions.Set(gasmonitor.AppOptionsKey, dec)
```

### Saving Traces

Expand Down
6 changes: 3 additions & 3 deletions tools/gasmonitor/gas_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (d *Decorator) SaveJSON() error {
return json.NewEncoder(file).Encode(d.Traces)
}

// NewMonitoredGasMeter wraps the provided context's gas meter with a monitored
// NewGasConsumptionTrace wraps the provided context's gas meter with a monitored
// version.
func NewGasConsumptionTrace(ctx sdk.Context, tx sdk.Tx) (*GasConsumptionTrace, sdk.Context) {
meter := ctx.GasMeter()
Expand Down Expand Up @@ -106,8 +106,8 @@ func (gm *GasConsumptionTrace) RefundGas(amount sdk.Gas, descriptor string) {
gm.GasMeter.RefundGas(amount, descriptor)
}

// AnteHandle replaces the gas meter with the provided context with one that
// monitors the amount of gas consumed it fulfills the ante.Decorator interface.
// AnteHandle replaces the gas meter in the provided context with one that
// monitors the amount of gas consumed. It fulfills the ante.Decorator interface.
func (d *Decorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
if ctx.IsCheckTx() || ctx.IsReCheckTx() {
return next(ctx, tx, simulate)
Expand Down

0 comments on commit dcaaa58

Please sign in to comment.