From 5c78f581dab3a0e18006a0360e3e6ce9969d0cbf Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Thu, 9 Jan 2025 18:58:11 -0500 Subject: [PATCH] import 3.4.8, smplify gas-prices, and don't pass in Linea chain ID into gas-prices --- api/_utils.ts | 7 +++++-- api/gas-prices.ts | 33 ++++++--------------------------- package.json | 2 +- yarn.lock | 8 ++++---- 4 files changed, 16 insertions(+), 34 deletions(-) diff --git a/api/_utils.ts b/api/_utils.ts index 18c1c1dc1..ecfdf61e8 100644 --- a/api/_utils.ts +++ b/api/_utils.ts @@ -2000,8 +2000,11 @@ export function getCachedFillGasUsage( overrides?.relayerAddress, { gasPrice, - opStackL1GasCostMultiplier: getGasMarkup(deposit.destinationChainId) - .opStackL1DataFeeMarkup, + opStackL1GasCostMultiplier: sdk.utils.chainIsOPStack( + deposit.destinationChainId + ) + ? getGasMarkup(deposit.destinationChainId).opStackL1DataFeeMarkup + : undefined, } ); return { diff --git a/api/gas-prices.ts b/api/gas-prices.ts index 4430252cf..2fb63a32b 100644 --- a/api/gas-prices.ts +++ b/api/gas-prices.ts @@ -15,6 +15,7 @@ import { L2Provider } from "@eth-optimism/sdk/dist/interfaces/l2-provider"; import mainnetChains from "../src/data/chains_1.json"; import { + CHAIN_IDs, DEFAULT_SIMULATED_RECIPIENT_ADDRESS, TOKEN_SYMBOLS_MAP, } from "./_constants"; @@ -73,7 +74,7 @@ const handler = async ( const opStackL1GasCostMultiplier = getGasMarkup( Number(chainId) ).opStackL1DataFeeMarkup; - const { nativeGasCost, tokenGasCost } = + const { nativeGasCost, tokenGasCost, opStackL1GasCost } = await relayerFeeCalculatorQueries.getGasCosts( deposit, relayerFeeCalculatorQueries.simulatedRelayerAddress, @@ -81,35 +82,13 @@ const handler = async ( // Pass in the already-computed gasPrice into this query so that the tokenGasCost includes // the scaled gas price, // e.g. tokenGasCost = nativeGasCost * (baseFee * baseFeeMultiplier + priorityFee). - gasPrice: gasPrices[i].maxFeePerGas, + gasPrice: + Number(chainId) === CHAIN_IDs.LINEA + ? undefined + : gasPrices[i].maxFeePerGas, opStackL1GasCostMultiplier, } ); - // OPStack chains factor in the L1 gas cost of including the L2 transaction in an L1 rollup batch - // into the total gas cost of the L2 transaction. - let opStackL1GasCost: ethers.BigNumber | undefined = undefined; - if (sdk.utils.chainIsOPStack(Number(chainId))) { - const provider = relayerFeeCalculatorQueries.provider; - const _unsignedTx = await sdk.utils.populateV3Relay( - relayerFeeCalculatorQueries.spokePool, - deposit, - relayerFeeCalculatorQueries.simulatedRelayerAddress - ); - const voidSigner = new VoidSigner( - relayerFeeCalculatorQueries.simulatedRelayerAddress, - relayerFeeCalculatorQueries.provider - ); - const unsignedTx = await voidSigner.populateTransaction({ - ..._unsignedTx, - gasLimit: nativeGasCost, // prevents additional gas estimation call - }); - opStackL1GasCost = await ( - provider as L2Provider - ).estimateL1GasCost(unsignedTx); - opStackL1GasCost = opStackL1GasCostMultiplier - .mul(opStackL1GasCost) - .div(sdk.utils.fixedPointAdjustment); - } return { nativeGasCost, tokenGasCost, diff --git a/package.json b/package.json index 6ec93dc78..4ff85caf5 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "@across-protocol/constants": "^3.1.24", "@across-protocol/contracts": "^3.0.19", "@across-protocol/contracts-v3.0.6": "npm:@across-protocol/contracts@3.0.6", - "@across-protocol/sdk": "^3.4.7", + "@across-protocol/sdk": "^3.4.8", "@amplitude/analytics-browser": "^2.3.5", "@balancer-labs/sdk": "1.1.6-beta.16", "@emotion/react": "^11.13.0", diff --git a/yarn.lock b/yarn.lock index 9b06bf5bf..fd3648c77 100644 --- a/yarn.lock +++ b/yarn.lock @@ -83,10 +83,10 @@ yargs "^17.7.2" zksync-web3 "^0.14.3" -"@across-protocol/sdk@^3.4.7": - version "3.4.7" - resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.4.7.tgz#6ddf9698f918d7b7e0216327d60b54b37fe14f22" - integrity sha512-GeyzDG8EzlN8oddmjXASqND+usZPkWDLpzbdWfAfBfHT3pjIMatntZqZghfCfjy+ICf+rlYrAb8I24H4jlct8Q== +"@across-protocol/sdk@^3.4.8": + version "3.4.8" + resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.4.8.tgz#070abb97b687cfe22d89349d776f68008af5f6a7" + integrity sha512-m4JnT3Sh+zmTZ/Oi7QrTv3IuNB+myBcbnPnEEssZroyBost/yEPyxXks+EHeU67KrT84t/otGyNb5YpTOvOK0A== dependencies: "@across-protocol/across-token" "^1.0.0" "@across-protocol/constants" "^3.1.25"