Skip to content

Commit

Permalink
swap context [goreleaser]
Browse files Browse the repository at this point in the history
  • Loading branch information
parodime committed Jan 29, 2025
1 parent 965802d commit 7b62df2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ main

# golang-ci-lint binary
contrib/golang-ci-lint/golang-ci-lint

*signer*.txt
config-stage.yaml
7 changes: 6 additions & 1 deletion ethergo/submitter/submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,11 @@ func (t *txSubmitterImpl) SubmitTransaction(parentCtx context.Context, chainID *
//tmpdebug
fmt.Printf("transactor.GasLimit: %d\n", transactor.GasLimit)

var cancel context.CancelFunc
transactor.Context, cancel = context.WithTimeout(ctx, time.Second*5)
defer func() {
cancel()
}()
tx, err := call(transactor)
if err != nil {
return 0, fmt.Errorf("err contract call for tx: %w", err)

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

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L472

Added line #L472 was not covered by tests
Expand Down Expand Up @@ -777,7 +782,7 @@ func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client
gasLimit_fromEstimate = max(t.config.GetGasEstimate(chainID), gasLimit_fromEstimate)

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

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L779-L782

Added lines #L779 - L782 were not covered by tests
}

// use whichever is higher, gas from the prior attempt, or gas from our latest simulation estimate
// start with whichever value is higher gas from the prior attempt, or gas from our latest simulation estimate
gasLimit_new = max(gasLimit_fromPrior, gasLimit_fromEstimate)

// whichever source is used as the base, multiply it by the configured gas unit add percentage
Expand Down

0 comments on commit 7b62df2

Please sign in to comment.