Skip to content

Commit 8a40615

Browse files
authored
fix ancient8 oracle (#185)
1 parent 93c2580 commit 8a40615

File tree

16 files changed

+81
-66
lines changed

16 files changed

+81
-66
lines changed

.github/workflows/bundler-spec-tests.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ jobs:
4444
4545
- name: Install Geth
4646
run: |
47-
sudo add-apt-repository -y ppa:ethereum/ethereum && \
48-
sudo apt-get update && \
49-
sudo apt-get install ethereum
47+
wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.13.15-c5ba367e.tar.gz
48+
tar -xvf geth-linux-amd64-1.13.15-c5ba367e.tar.gz
5049
5150
- name: Run Geth
5251
run: |
53-
geth \
52+
cd geth-linux-amd64-1.13.15-c5ba367e &&
53+
./geth \
5454
--verbosity 1 \
5555
--http.vhosts '*,localhost,host.docker.internal' \
5656
--http \
@@ -76,7 +76,8 @@ jobs:
7676
7777
- name: Fund bundler
7878
run: |
79-
geth \
79+
cd geth-linux-amd64-1.13.15-c5ba367e &&
80+
./geth \
8081
--exec "eth.sendTransaction({from: eth.accounts[0], to: \"0x55082761664aEb8062B3427ba5E0455bFb7b68CB\", value: web3.toWei(4337, \"ether\")})" \
8182
attach http://localhost:8545/
8283

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,4 @@ packages/contracts/out-via-ir/
138138
packages/contracts/.env
139139
packages/contracts/broadcast/*/*/*
140140
packages/contracts/out/
141+
packages/cli/.git-data.json

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"packages/*"
44
],
55
"npmClient": "yarn",
6-
"version": "1.5.7",
6+
"version": "1.5.8",
77
"stream": "true",
88
"command": {
99
"version": {

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
22
"name": "root",
3-
"private": false,
4-
"publishConfig": {
5-
"access": "public"
6-
},
7-
"version": "1.5.7",
3+
"private": true,
4+
"version": "1.5.8",
85
"engines": {
96
"node": ">=18.0.0"
107
},

packages/api/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "The API module of Etherspot bundler client",
99
"author": "Etherspot",
1010
"homepage": "https://https://github.com/etherspot/skandha#readme",
@@ -34,10 +34,10 @@
3434
"dependencies": {
3535
"@fastify/cors": "9.0.1",
3636
"@fastify/websocket": "10.0.1",
37-
"@skandha/executor": "^1.5.7",
38-
"@skandha/monitoring": "^1.5.7",
39-
"@skandha/types": "^1.5.7",
40-
"@skandha/utils": "^1.5.7",
37+
"@skandha/executor": "^1.5.8",
38+
"@skandha/monitoring": "^1.5.8",
39+
"@skandha/types": "^1.5.8",
40+
"@skandha/utils": "^1.5.8",
4141
"class-transformer": "0.5.1",
4242
"class-validator": "0.14.1",
4343
"ethers": "5.7.2",

packages/cli/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "> TODO: description",
99
"author": "zincoshine <[email protected]>",
1010
"homepage": "https://https://github.com/etherspot/skandha#readme",
@@ -40,12 +40,12 @@
4040
"@libp2p/peer-id-factory": "2.0.1",
4141
"@libp2p/prometheus-metrics": "1.1.3",
4242
"@multiformats/multiaddr": "12.1.3",
43-
"@skandha/api": "^1.5.7",
44-
"@skandha/db": "^1.5.7",
45-
"@skandha/executor": "^1.5.7",
46-
"@skandha/monitoring": "^1.5.7",
47-
"@skandha/node": "^1.5.7",
48-
"@skandha/types": "^1.5.7",
43+
"@skandha/api": "^1.5.8",
44+
"@skandha/db": "^1.5.8",
45+
"@skandha/executor": "^1.5.8",
46+
"@skandha/monitoring": "^1.5.8",
47+
"@skandha/node": "^1.5.8",
48+
"@skandha/types": "^1.5.8",
4949
"find-up": "5.0.0",
5050
"got": "12.5.3",
5151
"js-yaml": "4.1.0",

packages/contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "Smart contracts of Etherspot bundler client",
99
"author": "Etherspot",
1010
"homepage": "https://https://github.com/etherspot/skandha#readme",

packages/db/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "The DB module of Etherspot bundler client",
99
"author": "Etherspot",
1010
"homepage": "https://github.com/etherspot/etherspot-bundler#readme",
@@ -34,7 +34,7 @@
3434
"dependencies": {
3535
"@chainsafe/ssz": "0.10.1",
3636
"@farcaster/rocksdb": "5.5.0",
37-
"@skandha/types": "^1.5.7"
37+
"@skandha/types": "^1.5.8"
3838
},
3939
"devDependencies": {
4040
"@types/rocksdb": "3.0.1",

packages/executor/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "The Relayer module of Etherspot bundler client",
99
"author": "Etherspot",
1010
"homepage": "https://https://github.com/etherspot/skandha#readme",
@@ -35,10 +35,10 @@
3535
},
3636
"dependencies": {
3737
"@flashbots/ethers-provider-bundle": "0.6.2",
38-
"@skandha/monitoring": "^1.5.7",
39-
"@skandha/params": "^1.5.7",
40-
"@skandha/types": "^1.5.7",
41-
"@skandha/utils": "^1.5.7",
38+
"@skandha/monitoring": "^1.5.8",
39+
"@skandha/params": "^1.5.8",
40+
"@skandha/types": "^1.5.8",
41+
"@skandha/utils": "^1.5.8",
4242
"async-mutex": "0.4.0",
4343
"ethers": "5.7.2",
4444
"strict-event-emitter-types": "2.0.0",

packages/monitoring/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "The Monitoring module of Etherspot bundler client",
99
"author": "Etherspot",
1010
"homepage": "https://github.com/etherspot/etherspot-bundler#readme",
@@ -32,7 +32,7 @@
3232
"check-readme": "typescript-docs-verifier"
3333
},
3434
"dependencies": {
35-
"@skandha/types": "^1.5.7",
35+
"@skandha/types": "^1.5.8",
3636
"prom-client": "^14.2.0"
3737
}
3838
}

packages/node/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "The bundler node module of Etherspot bundler client",
99
"author": "Etherspot",
1010
"homepage": "https://https://github.com/etherspot/skandha#readme",
@@ -56,13 +56,13 @@
5656
"@libp2p/prometheus-metrics": "1.1.3",
5757
"@libp2p/tcp": "6.1.0",
5858
"@multiformats/multiaddr": "11.4.0",
59-
"@skandha/api": "^1.5.7",
60-
"@skandha/db": "^1.5.7",
61-
"@skandha/executor": "^1.5.7",
62-
"@skandha/monitoring": "^1.5.7",
63-
"@skandha/params": "^1.5.7",
64-
"@skandha/types": "^1.5.7",
65-
"@skandha/utils": "^1.5.7",
59+
"@skandha/api": "^1.5.8",
60+
"@skandha/db": "^1.5.8",
61+
"@skandha/executor": "^1.5.8",
62+
"@skandha/monitoring": "^1.5.8",
63+
"@skandha/params": "^1.5.8",
64+
"@skandha/types": "^1.5.8",
65+
"@skandha/utils": "^1.5.8",
6666
"@types/varint": "6.0.1",
6767
"abstract-leveldown": "7.2.0",
6868
"datastore-core": "8.0.1",

packages/params/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "Various bundler parameters",
99
"author": "Etherspot",
1010
"homepage": "https://github.com/etherspot/skandha#readme",
@@ -29,8 +29,8 @@
2929
"@chainsafe/ssz": "0.10.1",
3030
"@eth-optimism/sdk": "3.2.3",
3131
"@mantleio/sdk": "0.2.1",
32-
"@skandha/types": "^1.5.7",
33-
"@skandha/utils": "^1.5.7",
32+
"@skandha/types": "^1.5.8",
33+
"@skandha/utils": "^1.5.8",
3434
"ethers": "5.7.2"
3535
},
3636
"scripts": {

packages/params/src/gas-price-oracles/getGasFee.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export const getGasFee = async (
1919
try {
2020
const feeData = await provider.getFeeData();
2121
return {
22-
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas ?? feeData.gasPrice ?? 0,
22+
maxPriorityFeePerGas:
23+
feeData.maxPriorityFeePerGas ?? feeData.gasPrice ?? 0,
2324
maxFeePerGas: feeData.maxFeePerGas ?? feeData.gasPrice ?? 0,
2425
gasPrice: feeData.gasPrice ?? 0,
2526
};

packages/params/src/gas-price-oracles/oracles/ancient8.ts

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
11
import { fetchJson, hexValue } from "ethers/lib/utils";
2-
import { BigNumber } from "ethers";
2+
import { BigNumber, providers } from "ethers";
33
import { parseGwei } from "./utils";
44
import { IGetGasFeeResult, IOracle } from "./interfaces";
55

6-
export const getAncient8GasFee: IOracle =
7-
async (): Promise<IGetGasFeeResult> => {
8-
const { gas_prices }: Ancient8Response = await fetchJson({
9-
url: "https://scan.ancient8.gg/api/v2/stats",
10-
headers: {
11-
"updated-gas-oracle": "true",
12-
},
13-
});
14-
const maxPriorityFeePerGas = hexValue(
15-
BigNumber.from(gas_prices.fast.priority_fee_wei)
16-
);
17-
const maxFeePerGas = parseGwei(gas_prices.fast.priority_fee);
18-
return {
19-
maxPriorityFeePerGas: maxPriorityFeePerGas,
20-
gasPrice: maxFeePerGas,
21-
maxFeePerGas: maxFeePerGas,
22-
};
6+
export const getAncient8GasFee: IOracle = async (
7+
apiKey: string,
8+
provider?: providers.JsonRpcProvider
9+
): Promise<IGetGasFeeResult> => {
10+
try {
11+
if (provider) {
12+
const gasPrice = await provider.getGasPrice();
13+
return {
14+
maxPriorityFeePerGas: gasPrice,
15+
gasPrice: gasPrice,
16+
maxFeePerGas: gasPrice,
17+
};
18+
}
19+
} catch (err) {
20+
/* empty */
21+
}
22+
23+
const { gas_prices }: Ancient8Response = await fetchJson({
24+
url: "https://scan.ancient8.gg/api/v2/stats",
25+
headers: {
26+
"updated-gas-oracle": "true",
27+
},
28+
});
29+
const maxPriorityFeePerGas = hexValue(
30+
BigNumber.from(gas_prices.average.priority_fee_wei)
31+
);
32+
const maxFeePerGas = parseGwei(gas_prices.average.priority_fee);
33+
return {
34+
maxPriorityFeePerGas: maxPriorityFeePerGas,
35+
gasPrice: maxFeePerGas,
36+
maxFeePerGas: maxFeePerGas,
2337
};
38+
};
2439

2540
type Ancient8Response = {
2641
gas_prices: {

packages/types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "The types of Etherspot bundler client",
99
"author": "Etherspot",
1010
"homepage": "https://https://github.com/etherspot/skandha#readme",

packages/utils/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7-
"version": "1.5.7",
7+
"version": "1.5.8",
88
"description": "utils of Etherspot bundler client",
99
"author": "Etherspot",
1010
"homepage": "https://https://github.com/etherspot/skandha#readme",
@@ -33,7 +33,7 @@
3333
},
3434
"dependencies": {
3535
"@chainsafe/as-sha256": "0.3.1",
36-
"@skandha/types": "^1.5.7",
36+
"@skandha/types": "^1.5.8",
3737
"any-signal": "3.0.1",
3838
"bigint-buffer": "1.1.5",
3939
"case": "^1.6.3",

0 commit comments

Comments
 (0)