-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reduced origin min gas balance when quoting a route w/ origin gas token #3487
base: feat/relayer-arb-call
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -772,7 +772,17 @@ func (m *Manager) getOriginAmount(parentCtx context.Context, input QuoteInput) ( | |
// First, check if we have enough gas to complete the a bridge for this route | ||
// If not, set the quote amount to zero to make sure a stale quote won't be used | ||
// TODO: handle in-flight gas; for now we can set a high min_gas_token | ||
sufficentGasOrigin, err := m.inventoryManager.HasSufficientGas(ctx, input.OriginChainID, nil) | ||
|
||
// if the origin token is native gas, require less minimum gas on the origin chain. | ||
// as origin gas gets critically low, this will discourage the relayer from quoting most routes *except* those that will replenish the deficit gas. | ||
var sufficentGasOrigin bool | ||
if input.OriginTokenAddr.Hex() == "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can use |
||
multiplier := 0.65 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say this should probably be configurable, and we can default to 0.65 or some other sensible value |
||
sufficentGasOrigin, err = m.inventoryManager.HasSufficientGasWithMult(ctx, input.OriginChainID, nil, &multiplier) | ||
} else { | ||
sufficentGasOrigin, err = m.inventoryManager.HasSufficientGas(ctx, input.OriginChainID, nil) | ||
} | ||
|
||
if err != nil { | ||
return nil, fmt.Errorf("error checking sufficient gas: %w", err) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion here would be to add the
thresholdMultiplier
param toHasSufficientGas
and removeHasSufficientGasWithMult
- since you already havethresholdMultiplier
as a pointer, it serves as optional param. This way we can keep the interface simple