Skip to content

chore(grpc): use EffectiveGasTip method to get the tip of a tx while streaming bids#48

Merged
bharath-123 merged 6 commits intomainfrom
bharath/use-effective-tip-method
Mar 5, 2025
Merged

chore(grpc): use EffectiveGasTip method to get the tip of a tx while streaming bids#48
bharath-123 merged 6 commits intomainfrom
bharath/use-effective-tip-method

Conversation

@bharath-123
Copy link
Copy Markdown
Contributor

@bharath-123 bharath-123 commented Mar 4, 2025

It is better to use the in-build EffectiveGasTip method to calculate the tip of a given tx. If the gas fee tip is too low, then we don't stream the bid to the auctioneer.

This has been tested by deploying auctioneer setup locally and sending txs against it.

@bharath-123 bharath-123 marked this pull request as ready for review March 4, 2025 08:13
Comment thread grpc/optimistic/server.go Outdated
effectiveTip := cmath.BigMin(pendingTx.GasTipCap(), new(big.Int).Sub(pendingTx.GasFeeCap(), optimisticBlock.BaseFee))
effectiveTip, err := pendingTx.EffectiveGasTip(optimisticBlock.BaseFee)
if err != nil {
log.Warn("effective tip is too low", "effectiveTip", effectiveTip.String())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might make sense as a debug or a metric counter + debug log. If people send low tips that's on them, but useful to know if it's happening a lot potentially.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good point, i ll add a metric. but ideally they shouldn't even arrive at this stage cause we are filtering txs which sends too low gas fee during tx submission.

Comment thread grpc/optimistic/server.go Outdated
Comment on lines +78 to +81
if err != nil {
txsTipTooLow.Inc(1)
log.Debug("effective tip is too low", "effectiveTip", effectiveTip.String())
// don't throw an error but we should avoid streaming this bid
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: put the comment above the check block

Suggested change
if err != nil {
txsTipTooLow.Inc(1)
log.Debug("effective tip is too low", "effectiveTip", effectiveTip.String())
// don't throw an error but we should avoid streaming this bid
// don't stream the bid if the tip is below minimum fee
if err != nil {
txsTipTooLow.Inc(1)
log.Debug("effective tip is too low", "effectiveTip", effectiveTip.String())

@bharath-123 bharath-123 merged commit 5ba0a3f into main Mar 5, 2025
@bharath-123 bharath-123 deleted the bharath/use-effective-tip-method branch March 5, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants