Skip to content

Commit f9931f2

Browse files
committed
use latest subql node v3
1 parent 182af49 commit f9931f2

File tree

3 files changed

+33
-36
lines changed

3 files changed

+33
-36
lines changed

packages/evm-subql/docker-compose.yml

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,23 @@
11
version: '3.9'
22

33
services:
4-
mandala-node:
5-
image: ghcr.io/acalanetwork/mandala-node:sha-89ef1e5
6-
ports:
7-
- 9944:9944
8-
healthcheck:
9-
test: "curl --fail -X POST -H \"Content-Type: application/json\" http://localhost:9944 -d \"{\"jsonrpc\": \"2.0\" }\" || exit 1"
10-
interval: 10s
11-
retries: 10
12-
start_period: 30s
13-
command:
14-
- --dev
15-
- -lruntime=debug
16-
- -levm=debug
17-
- --rpc-external
18-
- --rpc-cors=all
19-
- --rpc-methods=unsafe
20-
- --pruning=archive
21-
- --instant-sealing
22-
- --tmp
23-
244
postgres:
255
image: postgres:12-alpine
6+
container_name: postgres
267
ports:
278
- 5432:5432
28-
volumes:
29-
- postgres:/var/lib/postgresql/data
309
environment:
3110
POSTGRES_PASSWORD: postgres
11+
healthcheck:
12+
test: ["CMD-SHELL", "pg_isready -U postgres"]
13+
interval: 5s
14+
timeout: 5s
15+
retries: 5
3216

3317
subquery-node:
34-
image: onfinality/subql-node:v1.21.2
18+
image: subquerynetwork/subql-node-substrate:v3.10.1
3519
depends_on:
3620
postgres:
37-
condition: service_started
38-
mandala-node:
3921
condition: service_healthy
4022
ports:
4123
- 3000:3000
@@ -49,20 +31,28 @@ services:
4931
volumes:
5032
- ./:/app
5133
command:
52-
- -f=/app
53-
- --network-endpoint=ws://mandala-node:9944
34+
- -f=/app/project-acala.yaml
35+
- --network-endpoint=wss://acala-rpc.aca-api.network
5436
- --db-schema=acala_evm
5537
- --log-level=debug
5638
- --unsafe
5739
- --disable-historical
40+
- --batch-size=1
41+
healthcheck:
42+
test: ["CMD", "curl", "-f", "http://subquery-node:3000/ready"]
43+
interval: 3s
44+
timeout: 5s
45+
retries: 10
5846

5947
graphql-engine:
60-
image: onfinality/subql-query:v1.4.0
48+
image: subquerynetwork/subql-query:v2.10.0
6149
ports:
6250
- 3001:3001
6351
depends_on:
64-
- postgres
65-
- subquery-node
52+
postgres:
53+
condition: service_healthy
54+
subquery-node:
55+
condition: service_healthy
6656
restart: always
6757
environment:
6858
DB_USER: postgres

packages/evm-subql/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
//Exports all handler functions
1+
// https://github.com/subquery/subql/issues/1277#issuecomment-1404181415
2+
import { atob } from 'abab';
3+
global.atob = atob as any;
4+
25
export * from './mappings/mappingHandlers';

packages/evm-subql/src/mappings/mappingHandlers.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
import '@subql/types/dist/global';
22
import { SubstrateBlock } from '@subql/types';
3-
import { parseReceiptsFromBlockData } from '@acala-network/eth-providers/utils';
3+
import { parseReceiptsFromBlockData } from '@acala-network/eth-providers';
44

55
export const handleBlock = async (substrateBlock: SubstrateBlock): Promise<void> => {
6+
if (!unsafeApi) {
7+
logger.error('Unsafe API is not available');
8+
}
9+
610
const receipts = await parseReceiptsFromBlockData(
7-
unsafeApi,
11+
unsafeApi!,
812
substrateBlock,
913
substrateBlock.events,
1014
);
1115

1216
const blockNumber = substrateBlock.block.header.number.toBigInt();
1317
const timestamp = substrateBlock.timestamp;
14-
const receiptEntities = [];
15-
const logEntities = [];
18+
const receiptEntities: any[] = [];
19+
const logEntities: any[] = [];
1620

1721
receipts.forEach((receipt, idx) => {
1822
const receiptId = `${receipt.blockNumber.toString()}-${idx}`;
@@ -25,7 +29,7 @@ export const handleBlock = async (substrateBlock: SubstrateBlock): Promise<void>
2529
cumulativeGasUsed: receipt.cumulativeGasUsed.toBigInt(),
2630
effectiveGasPrice: receipt.effectiveGasPrice.toBigInt(),
2731
type: BigInt(receipt.type),
28-
status: BigInt(receipt.status),
32+
status: BigInt(receipt.status!),
2933
transactionIndex,
3034
blockNumber,
3135
timestamp,

0 commit comments

Comments
 (0)