Skip to content

Commit

Permalink
getGasEst bump approach [goreleaser]
Browse files Browse the repository at this point in the history
  • Loading branch information
parodime committed Jan 28, 2025
1 parent ee9eb85 commit f6bfa43
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ethergo/submitter/submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,9 @@ func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client

gasUnitAddPercentage := t.config.GetDynamicGasUnitAddPercentage(chainID)

//tmpdebug
fmt.Println("getGasEstimate>gasUnitAddPercentage", gasUnitAddPercentage)

Check warning on line 764 in ethergo/submitter/submitter.go

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L758-L764

Added lines #L758 - L764 were not covered by tests
ctx, span := t.metrics.Tracer().Start(ctx, "submitter.getGasEstimate", trace.WithAttributes(
attribute.Int(metrics.ChainID, chainID),

Check warning on line 767 in ethergo/submitter/submitter.go

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L767

Added line #L767 was not covered by tests
Expand All @@ -780,15 +783,25 @@ func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client

gasEstimate, err = chainClient.EstimateGas(ctx, *call)
if err != nil {

//tmpdebug
fmt.Printf("getGasEstimate> Error estimating gas: %v\n", err)

span.AddEvent("could not estimate gas", trace.WithAttributes(attribute.String("error", err.Error())))

Check warning on line 790 in ethergo/submitter/submitter.go

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L787-L790

Added lines #L787 - L790 were not covered by tests

// fallback to default
return t.config.GetGasEstimate(chainID), nil
}

//tmpdebug
fmt.Println("getGasEstimate>gasEstimate pre", gasEstimate)

// Modify the gasEstimate by the configured percentage
gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)

Check failure on line 800 in ethergo/submitter/submitter.go

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

assignOp: replace `gasEstimate = gasEstimate + (gasEstimate * uint64(gasUnitAddPercentage) / 100)` with `gasEstimate += (gasEstimate * uint64(gasUnitAddPercentage) / 100)` (gocritic)

//tmpdebug
fmt.Println("getGasEstimate>gasEstimate post", gasEstimate)

Check warning on line 804 in ethergo/submitter/submitter.go

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L797-L804

Added lines #L797 - L804 were not covered by tests
return gasEstimate, nil
}

Expand Down

0 comments on commit f6bfa43

Please sign in to comment.