From f8f0b4aa81ec37b831cf9740f1498c0530898e57 Mon Sep 17 00:00:00 2001 From: Raman Shekhawat Date: Thu, 9 May 2024 22:10:14 +0530 Subject: [PATCH] fix: remove hardcoded archive url (#1054) * remvoe harcoded archive url * remove archive stuff from dockeer-compose * Add canary specs to fueltankCreated * add more rules * fix a tiny issue --- docker-compose.yml | 55 ------------------- src/config.ts | 3 +- .../fuelTanks/events/fuelTankCreated.ts | 12 ++++ .../fuelTanks/events/ruleSetInserted.ts | 36 ++++++++++++ src/mappings/xcm/events/attempted.ts | 2 +- src/processor.ts | 4 +- src/types/custom/processorConfig.ts | 3 +- 7 files changed, 53 insertions(+), 62 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3ef92545..ab40d1c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -74,62 +74,7 @@ services: - indexer_db - indexer_redis - archive_db: - container_name: archive_db - image: cockroachdb/cockroach:v22.2.2 - restart: unless-stopped - volumes: - - archive_db:/cockroach/cockroach-data - ports: - - "26257:26257" - command: [ - "start-single-node", - "--insecure" - ] - - archive_ingest: - container_name: archive_ingest - image: subsquid/substrate-ingest:firesquid - restart: unless-stopped - depends_on: - - archive_db - command: [ - "-e", "wss://archive.matrix.blockchain.enjin.io", - "-c", "40", - "--out", "postgres://root@archive_db:26257/defaultdb" - ] - - archive_gateway: - container_name: archive_gateway - image: subsquid/substrate-gateway:firesquid - restart: unless-stopped - depends_on: - - archive_db - environment: - DATABASE_MAX_CONNECTIONS: 10 - RUST_LOG: "actix_web=info,actix_server=info" - command: [ - "--database-url", "postgres://root@archive_db:26257/defaultdb", - "--scan-start-value", "100" - ] - ports: - - "8888:8000" - - archive_explorer: - container_name: archive_explorer - image: subsquid/substrate-explorer:latest - restart: unless-stopped - environment: - DB_TYPE: cockroach - DB_HOST: archive_db - DB_PORT: "26257" - DB_NAME: "defaultdb" - DB_USER: "root" - ports: - - "4444:3000" - volumes: indexer_db: - archive_db: redis_db: diff --git a/src/config.ts b/src/config.ts index 14dbbf31..015940b5 100644 --- a/src/config.ts +++ b/src/config.ts @@ -5,9 +5,8 @@ const config: ProcessorConfig = { prefix: process.env.CHAIN_PREFIX ? parseInt(process.env.CHAIN_PREFIX, 10) : 1110, lastBlockHeight: process.env.LAST_BLOCK_HEIGHT ? parseInt(process.env.LAST_BLOCK_HEIGHT, 10) : 0, genesisHash: process.env.GENESIS_HASH || '0x3af4ff48ec76d2efc8476730f423ac07e25ad48f5f4c9dc39c778b164d808615', - rpc: process.env.CHAIN_RPC || 'wss://rpc.matrix.blockchain.enjin.io', dataSource: { - archive: process.env.ARCHIVE_ENDPOINT || 'https://matrixchain.archive.subsquid.io/graphql', + archive: process.env.ARCHIVE_ENDPOINT || 'https://v2.archive.subsquid.io/network/enjin-matrix', chain: process.env.CHAIN_ENDPOINT || 'wss://archive.matrix.blockchain.enjin.io', }, redisHost: process.env.REDIS_HOST || 'indexer_redis', diff --git a/src/mappings/fuelTanks/events/fuelTankCreated.ts b/src/mappings/fuelTanks/events/fuelTankCreated.ts index 55171df0..3cb8f96d 100644 --- a/src/mappings/fuelTanks/events/fuelTankCreated.ts +++ b/src/mappings/fuelTanks/events/fuelTankCreated.ts @@ -115,6 +115,18 @@ function getCallData(ctx: CommonContext, call: CallItem) { return calls.fuelTanks.createFuelTank.v602.decode(call) } + if (calls.fuelTanks.createFuelTank.v601.is(call)) { + return calls.fuelTanks.createFuelTank.v601.decode(call) + } + + if (calls.fuelTanks.createFuelTank.v600.is(call)) { + return calls.fuelTanks.createFuelTank.v600.decode(call) + } + + if (calls.fuelTanks.createFuelTank.v500.is(call)) { + return calls.fuelTanks.createFuelTank.v500.decode(call) + } + throw new UnknownVersionError(calls.fuelTanks.createFuelTank.name) } diff --git a/src/mappings/fuelTanks/events/ruleSetInserted.ts b/src/mappings/fuelTanks/events/ruleSetInserted.ts index 3d7c3182..78f6bbc4 100644 --- a/src/mappings/fuelTanks/events/ruleSetInserted.ts +++ b/src/mappings/fuelTanks/events/ruleSetInserted.ts @@ -33,6 +33,42 @@ function getCallData(call: CallItem) { return calls.fuelTanks.insertRuleSet.matrixEnjinV603.decode(call) } + if (calls.fuelTanks.insertRuleSet.v1005.is(call)) { + return calls.fuelTanks.insertRuleSet.v1005.decode(call) + } + + if (calls.fuelTanks.insertRuleSet.v1004.is(call)) { + return calls.fuelTanks.insertRuleSet.v1004.decode(call) + } + + if (calls.fuelTanks.insertRuleSet.v1003.is(call)) { + return calls.fuelTanks.insertRuleSet.v1003.decode(call) + } + + if (calls.fuelTanks.insertRuleSet.v1000.is(call)) { + return calls.fuelTanks.insertRuleSet.v1000.decode(call) + } + + if (calls.fuelTanks.insertRuleSet.v604.is(call)) { + return calls.fuelTanks.insertRuleSet.v604.decode(call) + } + + if (calls.fuelTanks.insertRuleSet.v602.is(call)) { + return calls.fuelTanks.insertRuleSet.v602.decode(call) + } + + if (calls.fuelTanks.insertRuleSet.v601.is(call)) { + return calls.fuelTanks.insertRuleSet.v601.decode(call) + } + + if (calls.fuelTanks.insertRuleSet.v600.is(call)) { + return calls.fuelTanks.insertRuleSet.v600.decode(call) + } + + if (calls.fuelTanks.insertRuleSet.v500.is(call)) { + return calls.fuelTanks.insertRuleSet.v500.decode(call) + } + throw new UnknownVersionError(calls.fuelTanks.insertRuleSet.name) } diff --git a/src/mappings/xcm/events/attempted.ts b/src/mappings/xcm/events/attempted.ts index 0fd169f1..40764a40 100644 --- a/src/mappings/xcm/events/attempted.ts +++ b/src/mappings/xcm/events/attempted.ts @@ -65,7 +65,7 @@ async function getCallData(ctx: CommonContext, call: CallItem) { } if (data.v1003.is(call)) { - callData = data.v1000.decode(call) + callData = data.v1003.decode(call) } if (data.v1000.is(call)) { diff --git a/src/processor.ts b/src/processor.ts index 86b6dfc7..4e52a7fe 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -3,8 +3,8 @@ import config from './config' import { events, calls } from './types/generated' export const processor = new SubstrateBatchProcessor() - .setRpcEndpoint(config.rpc) - .setGateway('https://v2.archive.subsquid.io/network/enjin-matrix') + .setRpcEndpoint(config.dataSource.chain) + .setGateway(config.dataSource.archive) .setBlockRange({ from: 0 }) .addCall({ name: [calls.identity.setSubs.name, calls.identity.renameSub.name], diff --git a/src/types/custom/processorConfig.ts b/src/types/custom/processorConfig.ts index 0abe1c97..8cc9c6d0 100644 --- a/src/types/custom/processorConfig.ts +++ b/src/types/custom/processorConfig.ts @@ -1,4 +1,4 @@ -import { DataSource } from "@subsquid/archive-registry" +import { DataSource } from '@subsquid/archive-registry' type Parameters = T extends (...args: infer T) => any ? T : never @@ -13,7 +13,6 @@ export interface ProcessorConfig { prefix: number | string lastBlockHeight: number genesisHash: string - rpc: string batchSize?: number redisHost: string redisDb: number