-
Notifications
You must be signed in to change notification settings - Fork 45
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
improve(API): Pass gasPrice into relayerFeeDetails call + add OP_STACK_L1_DATA_FEE_MARKUP #1366
Merged
+101
−67
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5cdec88
improve(API): Pass gasPrice into relayerFeeDetails call
nicholaspai 3db3ac1
Add cache prefix
nicholaspai b9e4640
Add op stack multiplier env var
nicholaspai 866ddda
Defer gas price computation for Linea which depends on the unsignedTx
nicholaspai 5c78f58
import 3.4.8, smplify gas-prices, and don't pass in Linea chain ID in…
nicholaspai 380ea4e
Use correct linea price in gas-prices and pass markups correctly in g…
nicholaspai dc6becb
Update _utils.ts
nicholaspai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
improve(API): Pass gasPrice into relayerFeeDetails call
We should pass the pre-computed gas price into this call so that we don't query the gas price twice. Additionally, we can use the scaled up gas price value to derive the gas fee totals, which currently are not using the scaled up values
commit 5cdec8800539f04985f31d009e6477b6333f926e
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,39 +164,30 @@ const handler = async ( | |
message, | ||
}; | ||
|
||
const [tokenPriceNative, _tokenPriceUsd, latestBlock, gasCosts, gasPrice] = | ||
const [tokenPriceNative, _tokenPriceUsd, latestBlock, gasPrice] = | ||
await Promise.all([ | ||
getCachedTokenPrice( | ||
l1Token.address, | ||
sdk.utils.getNativeTokenSymbol(destinationChainId).toLowerCase() | ||
), | ||
getCachedTokenPrice(l1Token.address, "usd"), | ||
getCachedLatestBlock(HUB_POOL_CHAIN_ID), | ||
// Only use cached gas units if message is not defined, i.e. standard for standard bridges | ||
isMessageDefined | ||
? undefined | ||
: getCachedFillGasUsage(depositArgs, { | ||
relayerAddress: relayer, | ||
}), | ||
latestGasPriceCache(destinationChainId).get(), | ||
]); | ||
const tokenPriceUsd = ethers.utils.parseUnits(_tokenPriceUsd.toString()); | ||
|
||
const [ | ||
relayerFeeDetails, | ||
gasCosts, | ||
multicallOutput, | ||
fullRelayerBalances, | ||
transferRestrictedBalances, | ||
fullRelayerMainnetBalances, | ||
] = await Promise.all([ | ||
getRelayerFeeDetails( | ||
depositArgs, | ||
tokenPriceNative, | ||
relayer, | ||
gasPrice, | ||
gasCosts?.nativeGasCost, | ||
gasCosts?.tokenGasCost | ||
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. Currently, we are using this tokenGasCost that wasn't dependent on the |
||
), | ||
isMessageDefined | ||
? undefined // Only use cached gas units if message is not defined, i.e. standard for standard bridges | ||
: getCachedFillGasUsage(depositArgs, gasPrice, { | ||
relayerAddress: relayer, | ||
}), | ||
callViaMulticall3(provider, multiCalls, { | ||
blockTag: latestBlock.number, | ||
}), | ||
|
@@ -226,6 +217,16 @@ const handler = async ( | |
) | ||
), | ||
]); | ||
// This call should not make any additional RPC queries if gasCosts is defined--for any deposit | ||
// with an empty message. | ||
const relayerFeeDetails = await getRelayerFeeDetails( | ||
depositArgs, | ||
tokenPriceNative, | ||
relayer, | ||
gasPrice, | ||
gasCosts?.nativeGasCost, | ||
gasCosts?.tokenGasCost | ||
); | ||
logger.debug({ | ||
at: "Limits", | ||
message: "Relayer fee details from SDK", | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Passing this in avoids a redundant SDK.GasPriceOracle.getGasPriceEstimate call
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.
Also, if we don't pass in this gas price, then this function will return gasCosts that we use in the relayerFeeCalculator but it recomputes the gas price without any multipliers. So, the resultant tokenGasCost is likely too low