-
Notifications
You must be signed in to change notification settings - Fork 424
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
"Failed to get gas constants data from the optimism gas oracle" when quoting swaps on Base and Optimism #518
Comments
Let me know if we can provide any more information that can be useful in the investigation here! |
I'm getting the same symptom. Using version @uniswap/smart-order-router@3.17.4 in a browser. (tried to upgrade to latest but couldn't get it to work in the browser, but that's a different issue) The point of failure for me is in
The
|
I'm seeing this same thing, is there a way around this? |
Confirmed for us as well! |
also confirming seeing this too |
I solved this by using the v2 version of swap router: 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 |
i believe the error is related to the deprecation of L1 calldata fees and transition to blob fees. the data returned by the errors decoded are revert messages: "GasPriceOracle: scalar() is deprecated" and "GasPriceOracle: overhead() is deprecated" i'm not sure what the equivalent of overhead is in blobspace, but the patch below fixes the issue. it replaces the L1 fee variables with blob equivalents where available (everything except overhead) and updates the gas oracle ABI with the one from the latest deployment https://optimistic.etherscan.io/address/0xb528d11cc114e026f138fe568744c6d45ce6da7a#code diff --git a/node_modules/@uniswap/smart-order-router/build/module/providers/v3/gas-data-provider.js b/node_modules/@uniswap/smart-order-router/build/module/providers/v3/gas-data-provider.js
index 700e514..939c775 100644
--- a/node_modules/@uniswap/smart-order-router/build/module/providers/v3/gas-data-provider.js
+++ b/node_modules/@uniswap/smart-order-router/build/module/providers/v3/gas-data-provider.js
@@ -2,6 +2,7 @@ import { ChainId } from '@uniswap/sdk-core';
import { GasDataArbitrum__factory } from '../../types/other/factories/GasDataArbitrum__factory';
import { GasPriceOracle__factory } from '../../types/other/factories/GasPriceOracle__factory';
import { ARB_GASINFO_ADDRESS, log, OVM_GASPRICE_ADDRESS } from '../../util';
+import { BigNumber } from 'ethers';
export class OptimismGasDataProvider {
constructor(chainId, multicall2Provider, gasPriceAddress) {
this.chainId = chainId;
@@ -18,23 +19,25 @@ export class OptimismGasDataProvider {
*/
async getGasData() {
var _a, _b, _c, _d;
- const funcNames = ['l1BaseFee', 'scalar', 'decimals', 'overhead'];
+ const funcNames = ['blobBaseFee', 'blobBaseFeeScalar', 'decimals', 'overhead'];
const tx = await this.multicall2Provider.callMultipleFunctionsOnSameContract({
address: this.gasOracleAddress,
contractInterface: GasPriceOracle__factory.createInterface(),
functionNames: funcNames,
});
+
if (!((_a = tx.results[0]) === null || _a === void 0 ? void 0 : _a.success) ||
!((_b = tx.results[1]) === null || _b === void 0 ? void 0 : _b.success) ||
- !((_c = tx.results[2]) === null || _c === void 0 ? void 0 : _c.success) ||
- !((_d = tx.results[3]) === null || _d === void 0 ? void 0 : _d.success)) {
+ !((_c = tx.results[2]) === null || _c === void 0 ? void 0 : _c.success)
+ // || !((_d = tx.results[3]) === null || _d === void 0 ? void 0 : _d.success)
+ ) {
log.info({ results: tx.results }, 'Failed to get gas constants data from the optimism gas oracle');
throw new Error('Failed to get gas constants data from the optimism gas oracle');
}
const { result: l1BaseFee } = tx.results[0];
const { result: scalar } = tx.results[1];
const { result: decimals } = tx.results[2];
- const { result: overhead } = tx.results[3];
+ const { result: overhead } = tx.results[3].success ? tx.results[3] : {result: [BigNumber.from(0)]};
return {
l1BaseFee: l1BaseFee[0],
scalar: scalar[0],
diff --git a/node_modules/@uniswap/smart-order-router/build/module/types/other/factories/GasPriceOracle__factory.js b/node_modules/@uniswap/smart-order-router/build/module/types/other/factories/GasPriceOracle__factory.js
index a893e46..c41f77e 100644
--- a/node_modules/@uniswap/smart-order-router/build/module/types/other/factories/GasPriceOracle__factory.js
+++ b/node_modules/@uniswap/smart-order-router/build/module/types/other/factories/GasPriceOracle__factory.js
@@ -4,302 +4,207 @@
import { Contract, utils } from "ethers";
const _abi = [
{
- inputs: [
- {
- internalType: "address",
- name: "_owner",
- type: "address",
- },
- ],
- stateMutability: "nonpayable",
- type: "constructor",
- },
- {
- anonymous: false,
- inputs: [
- {
- indexed: false,
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- name: "DecimalsUpdated",
- type: "event",
- },
- {
- anonymous: false,
- inputs: [
- {
- indexed: false,
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- name: "GasPriceUpdated",
- type: "event",
- },
- {
- anonymous: false,
- inputs: [
- {
- indexed: false,
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- name: "L1BaseFeeUpdated",
- type: "event",
- },
- {
- anonymous: false,
- inputs: [
- {
- indexed: false,
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- name: "OverheadUpdated",
- type: "event",
- },
- {
- anonymous: false,
- inputs: [
- {
- indexed: true,
- internalType: "address",
- name: "previousOwner",
- type: "address",
- },
- {
- indexed: true,
- internalType: "address",
- name: "newOwner",
- type: "address",
- },
- ],
- name: "OwnershipTransferred",
- type: "event",
- },
- {
- anonymous: false,
- inputs: [
- {
- indexed: false,
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- name: "ScalarUpdated",
- type: "event",
- },
- {
- inputs: [],
- name: "decimals",
- outputs: [
- {
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- stateMutability: "view",
- type: "function",
- },
- {
- inputs: [],
- name: "gasPrice",
- outputs: [
- {
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- stateMutability: "view",
- type: "function",
- },
- {
- inputs: [
- {
- internalType: "bytes",
- name: "_data",
- type: "bytes",
- },
- ],
- name: "getL1Fee",
- outputs: [
- {
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- stateMutability: "view",
- type: "function",
- },
- {
- inputs: [
- {
- internalType: "bytes",
- name: "_data",
- type: "bytes",
- },
- ],
- name: "getL1GasUsed",
- outputs: [
- {
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- stateMutability: "view",
- type: "function",
- },
- {
- inputs: [],
- name: "l1BaseFee",
- outputs: [
- {
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- stateMutability: "view",
- type: "function",
- },
- {
- inputs: [],
- name: "overhead",
- outputs: [
- {
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- stateMutability: "view",
- type: "function",
- },
- {
- inputs: [],
- name: "owner",
- outputs: [
- {
- internalType: "address",
- name: "",
- type: "address",
- },
- ],
- stateMutability: "view",
- type: "function",
- },
- {
- inputs: [],
- name: "renounceOwnership",
- outputs: [],
- stateMutability: "nonpayable",
- type: "function",
- },
- {
- inputs: [],
- name: "scalar",
- outputs: [
- {
- internalType: "uint256",
- name: "",
- type: "uint256",
- },
- ],
- stateMutability: "view",
- type: "function",
- },
- {
- inputs: [
- {
- internalType: "uint256",
- name: "_decimals",
- type: "uint256",
- },
- ],
- name: "setDecimals",
- outputs: [],
- stateMutability: "nonpayable",
- type: "function",
- },
- {
- inputs: [
- {
- internalType: "uint256",
- name: "_gasPrice",
- type: "uint256",
- },
- ],
- name: "setGasPrice",
- outputs: [],
- stateMutability: "nonpayable",
- type: "function",
- },
- {
- inputs: [
- {
- internalType: "uint256",
- name: "_baseFee",
- type: "uint256",
- },
- ],
- name: "setL1BaseFee",
- outputs: [],
- stateMutability: "nonpayable",
- type: "function",
- },
- {
- inputs: [
- {
- internalType: "uint256",
- name: "_overhead",
- type: "uint256",
- },
- ],
- name: "setOverhead",
- outputs: [],
- stateMutability: "nonpayable",
- type: "function",
- },
- {
- inputs: [
- {
- internalType: "uint256",
- name: "_scalar",
- type: "uint256",
- },
- ],
- name: "setScalar",
- outputs: [],
- stateMutability: "nonpayable",
- type: "function",
- },
- {
- inputs: [
- {
- internalType: "address",
- name: "newOwner",
- type: "address",
- },
- ],
- name: "transferOwnership",
- outputs: [],
- stateMutability: "nonpayable",
- type: "function",
- },
-];
+ "inputs": [],
+ "name": "DECIMALS",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "baseFee",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "baseFeeScalar",
+ "outputs": [
+ {
+ "internalType": "uint32",
+ "name": "",
+ "type": "uint32"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "blobBaseFee",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "blobBaseFeeScalar",
+ "outputs": [
+ {
+ "internalType": "uint32",
+ "name": "",
+ "type": "uint32"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "gasPrice",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "bytes",
+ "name": "_data",
+ "type": "bytes"
+ }
+ ],
+ "name": "getL1Fee",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "bytes",
+ "name": "_data",
+ "type": "bytes"
+ }
+ ],
+ "name": "getL1GasUsed",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "isEcotone",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "l1BaseFee",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "overhead",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "scalar",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "setEcotone",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "version",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ }
+ ];
export class GasPriceOracle__factory {
static createInterface() {
return new utils.Interface(_abi);
|
Same here. Can anyone please help me? |
we were able to get rid of the error of
which caused after which we ran into - It seems to have worked for me. I was able to get a quote for ETH/ other tokens .. on Optimism chain using Alpha router & do a successful swap. So I would request uniswap team @jsy1218 to update the imports perhaps? not sure why there are two different imports when they use the same |
Sorry for the trouble. The original issue happened after OP Ecotone upgrade, same day as Dencun. Proper fix was in since 3.26.0. For the minor import issue in #518 (comment), will find a time to fix. |
@jsy1218 It seems the import fix to #518 (comment) was never merged upstream |
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
Hi there! I work for Endaoment and we are currently unable to process donations on L2's due to an error we are getting with the AutoRouter.
Every time we try to compute swaps on
Optimism
orBase
on their respective Mainnets, the AutoRouter throws the following error:"Error: Failed to get gas constants data from the optimism gas oracle"
The problem seems to have started alongside the Dencun Update, so may be related?
Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
Stack trace:
Arguments for failed
WETH/USDbC
Swap Quote onBase
Arguments for failed
WETH/USDC
Swap Quote onOptimism
The text was updated successfully, but these errors were encountered: