Skip to content

Commit

Permalink
reproduce [goreleaser]
Browse files Browse the repository at this point in the history
  • Loading branch information
parodime committed Jan 28, 2025
1 parent f6bfa43 commit c79a81b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 37 deletions.
48 changes: 11 additions & 37 deletions ethergo/submitter/submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func (t *txSubmitterImpl) SubmitTransaction(parentCtx context.Context, chainID *
}

//tmpdebug

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

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

commentFormatting: put a space between `//` and comment text (gocritic)
fmt.Printf("test ver 6\n")
fmt.Printf("test ver 7\n")

// if dynamic gas estimation is not enabled, use cfg var gas_estimate as a gas limit default and do not run a pre-flight simulation
// since we do not need it to determine proper gas units
Expand All @@ -435,29 +435,22 @@ func (t *txSubmitterImpl) SubmitTransaction(parentCtx context.Context, chainID *
transactor.GasLimit = t.config.GetGasEstimate(int(chainID.Uint64()))

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

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

G115: integer overflow conversion uint64 -> int (gosec)
} else {

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

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

unnecessary leading newline (whitespace)

// //tmpdebug
// fmt.Printf("SubmitTransaction>forGasEst call \n")

// transactor_forGasEstimate := copyTransactOpts(transactor)

// transactor_forGasEstimate.Nonce.Add(transactor_forGasEstimate.Nonce, big.NewInt(1))
//tmpdebug
fmt.Printf("SubmitTransaction>forGasEst call \n")

// tx_forGasEstimate, err := call(transactor_forGasEstimate)
transactor_forGasEstimate := copyTransactOpts(transactor)

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

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

var-naming: don't use underscores in Go names; var transactor_forGasEstimate should be transactorForGasEstimate (revive)

// fmt.Printf("tx_forGasEstimate: %v\n", tx_forGasEstimate.Gas())
transactor_forGasEstimate.Nonce.Add(transactor_forGasEstimate.Nonce, big.NewInt(1))

// if err != nil {
// return 0, fmt.Errorf("err contract call for gas est: %w", err)
// }
tx_forGasEstimate, err := call(transactor_forGasEstimate)

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

View workflow job for this annotation

GitHub Actions / Lint (ethergo)

var-naming: don't use underscores in Go names; var tx_forGasEstimate should be txForGasEstimate (revive)

// // gasEstimate, err := t.getGasEstimate(ctx, chainClient, int(chainID.Uint64()), tx_forGasEstimate)
// // if err != nil {
// // return 0, fmt.Errorf("err getGasEstimate: %w", err)
// // }
fmt.Printf("tx_forGasEstimate: %v\n", tx_forGasEstimate.Gas())

// transactor.GasLimit = tx_forGasEstimate.Gas() + 555
if err != nil {
return 0, fmt.Errorf("err contract call for gas est: %w", err)
}

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

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L437-L451

Added lines #L437 - L451 were not covered by tests

transactor.GasLimit = 21555 // intentionally set too low
transactor.GasLimit = tx_forGasEstimate.Gas() + 555

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

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L453

Added line #L453 was not covered by tests

}

Expand All @@ -469,24 +462,6 @@ func (t *txSubmitterImpl) SubmitTransaction(parentCtx context.Context, chainID *
return 0, fmt.Errorf("err contract call for tx: %w", err)

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

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L462

Added line #L462 was not covered by tests
}

// if t.config.GetDynamicGasEstimate(int(chainID.Uint64())) {

// //tmpdebug
// fmt.Printf("tx.Gas (pre): %d\n", tx.Gas())
// transactor.GasLimit = tx.Gas() + 555

// //tmpdebug
// fmt.Printf("transactor.GasLimit2: %d\n", transactor.GasLimit)

// tx, err = call(transactor)
// if err != nil {
// return 0, fmt.Errorf("err contract call 2 for tx: %w", err)
// }

// //tmpdebug
// fmt.Printf("tx.Gas (post): %d\n", tx.Gas())
// }

//tmpdebug
fmt.Printf("tx.Gas: %d\n", tx.Gas())

Expand Down Expand Up @@ -789,7 +764,6 @@ func (t *txSubmitterImpl) getGasEstimate(ctx context.Context, chainClient client

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

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

View check run for this annotation

Codecov / codecov/patch

ethergo/submitter/submitter.go#L762-L765

Added lines #L762 - L765 were not covered by tests

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

Expand Down
2 changes: 2 additions & 0 deletions services/rfq/relayer/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ func (c Chain) SubmitRelay(ctx context.Context, request reldb.QuoteRequest) (uin
nonce, err := c.SubmitTransaction(ctx, func(transactor *bind.TransactOpts) (tx *types.Transaction, err error) {
transactor.Value = core.CopyBigInt(gasAmount)

//tmpdebug

Check failure on line 98 in services/rfq/relayer/chain/chain.go

View workflow job for this annotation

GitHub Actions / Lint (services/rfq)

commentFormatting: put a space between `//` and comment text (gocritic)
callType := "exec"
if transactor.GasLimit == 0 {
callType = "sim"
}

//tmpdebug
fmt.Println(callType, "SubmitTransaction>RelayV2: ", request.OriginTxHash)

Expand Down

0 comments on commit c79a81b

Please sign in to comment.