Skip to content
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

Index xcm tasks #28

Open
wants to merge 17 commits into
base: staging
Choose a base branch
from
7 changes: 5 additions & 2 deletions mixer/src/etl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ export const populateTask = async() => {
inner join events on extrinsics.id = events.extrinsic_id
where events.data->>'taskId' is not null
and events.method = 'TaskScheduled'
and extrinsics.module = 'automationTime'
and extrinsics.method like 'schedule%'
and (
(extrinsics.module = 'automationTime' and extrinsics.method like 'schedule%')
-- this is XCM task
or (extrinsics.module = 'parachainSystem' and extrinsics.method = 'setValidationData')
)
order by events.block_height asc, idx asc
)

Expand Down
1 change: 1 addition & 0 deletions mixer/src/migrate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const migrate = async () => {
client.query('alter table turing.tasks add column if not exists scheduled_start_at timestamp'),
client.query('alter table turing.tasks add column if not exists scheduled_end_at timestamp'),
client.query('alter table turing.tasks add column if not exists executed_count integer default(0)'),
client.query('alter table turing.tasks alter column executed_count set default(0)'),
])

// column need to be create before commit
Expand Down
1 change: 1 addition & 0 deletions project-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ network:
genesisHash: '0x0f62b701fb12d02237a33b84818c11f621653d2b1614c777973babf4652b535d'
chaintypes:
file: ./dist/chaintypes.js
dictionary: "https://api.subquery.network/sq/subquery/kusama-dictionary"
dataSources:
- kind: substrate/Runtime
startBlock: 1
Expand Down
3 changes: 2 additions & 1 deletion project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ schema:
network:
endpoint: 'wss://rpc.turing-staging.oak.tech'
chainId: '0xd54f0988402deb4548538626ce37e4a318441ea0529ca369400ebec4e04dfe4b'
#dictionary: "https://api.subquery.network/sq/subquery/kusama-dictionary"

dictionary: "https://api.subquery.network/sq/subquery/kusama-dictionary"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using subql 2.0 but the project has been update and the default discover url is no longer valid subquery/templates@e28f826 so we explicitly set it here.

chaintypes:
file: ./dist/chaintypes.js

Expand Down
12 changes: 10 additions & 2 deletions src/mappings/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,23 @@ export async function findOrCreateEvent(substrateEvent: SubstrateEvent): Promise
const blockHeight = block.block.header.number;

let callId = null;

if (typeof extrinsic !== 'undefined') {
const { section: extrinsicModule, method: extrinsicMethod } = extrinsic.extrinsic.method;

// Skip indexing events for mandatory system extrinsics
if ((extrinsicModule === 'parachainSystem' && extrinsicMethod === 'setValidationData') ||
(extrinsicModule === 'timestamp' && extrinsicMethod === 'set')) {
if (extrinsicModule === 'timestamp' && extrinsicMethod === 'set') {
return;
}

if (extrinsicModule === 'parachainSystem' && extrinsicMethod === 'setValidationData') {
if ((event.section !== 'automationTime') && (event.section !== 'xcmpQueue')) {
// we want to track anything related to our time/price automation,
// adn xcmp so we can cross check the schedule from other chain
return;
}
}

callId = canonicalExtrinsicID(extrinsic);
}

Expand Down
Loading