Skip to content

Commit f2674f0

Browse files
authored
Merge pull request #5172 from connext/handle_hub_domain_events
feat: handle hub domain events
2 parents d355257 + 7e7a92b commit f2674f0

File tree

8 files changed

+116201
-114955
lines changed

8 files changed

+116201
-114955
lines changed

packages/adapters/subgraph/.graphclient/index.ts

+62,832-62,744
Large diffs are not rendered by default.

packages/adapters/subgraph/.graphclient/schema.graphql

+52,282-52,197
Large diffs are not rendered by default.

packages/adapters/subgraph/.graphclient/sources/Hub_Staging_Goerli/introspectionSchema.ts

+892-14
Large diffs are not rendered by default.

packages/adapters/subgraph/.graphclient/sources/Hub_Staging_Goerli/schema.graphql

+85
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,39 @@ enum staginggoerli_GnosisConnectorMeta_orderBy {
393393
mirrorConnector
394394
}
395395

396+
type staginggoerli_HubDomain {
397+
id: ID!
398+
domain: BigInt
399+
}
400+
401+
input staginggoerli_HubDomain_filter {
402+
id: ID
403+
id_not: ID
404+
id_gt: ID
405+
id_lt: ID
406+
id_gte: ID
407+
id_lte: ID
408+
id_in: [ID!]
409+
id_not_in: [ID!]
410+
domain: BigInt
411+
domain_not: BigInt
412+
domain_gt: BigInt
413+
domain_lt: BigInt
414+
domain_gte: BigInt
415+
domain_lte: BigInt
416+
domain_in: [BigInt!]
417+
domain_not_in: [BigInt!]
418+
"""Filter for the block changed event."""
419+
_change_block: staginggoerli_BlockChangedFilter
420+
and: [staginggoerli_HubDomain_filter]
421+
or: [staginggoerli_HubDomain_filter]
422+
}
423+
424+
enum staginggoerli_HubDomain_orderBy {
425+
id
426+
domain
427+
}
428+
396429
type staginggoerli_HubOptimisticRootFinalized {
397430
id: ID!
398431
aggregateRoot: staginggoerli_Bytes!
@@ -1195,6 +1228,32 @@ type Query {
11951228
"""
11961229
subgraphError: _SubgraphErrorPolicy_! = deny
11971230
): [staginggoerli_AggregateRootSavedSlow!]!
1231+
staginggoerli_hubDomain(
1232+
id: ID!
1233+
"""
1234+
The block at which the query should be executed. Can either be a `{ hash: Bytes }` value containing a block hash, a `{ number: Int }` containing the block number, or a `{ number_gte: Int }` containing the minimum block number. In the case of `number_gte`, the query will be executed on the latest block only if the subgraph has progressed to or past the minimum block number. Defaults to the latest block when omitted.
1235+
"""
1236+
block: staginggoerli_Block_height
1237+
"""
1238+
Set to `allow` to receive data even if the subgraph has skipped over errors while syncing.
1239+
"""
1240+
subgraphError: _SubgraphErrorPolicy_! = deny
1241+
): staginggoerli_HubDomain
1242+
staginggoerli_hubDomains(
1243+
skip: Int = 0
1244+
first: Int = 100
1245+
orderBy: staginggoerli_HubDomain_orderBy
1246+
orderDirection: staginggoerli_OrderDirection
1247+
where: staginggoerli_HubDomain_filter
1248+
"""
1249+
The block at which the query should be executed. Can either be a `{ hash: Bytes }` value containing a block hash, a `{ number: Int }` containing the block number, or a `{ number_gte: Int }` containing the minimum block number. In the case of `number_gte`, the query will be executed on the latest block only if the subgraph has progressed to or past the minimum block number. Defaults to the latest block when omitted.
1250+
"""
1251+
block: staginggoerli_Block_height
1252+
"""
1253+
Set to `allow` to receive data even if the subgraph has skipped over errors while syncing.
1254+
"""
1255+
subgraphError: _SubgraphErrorPolicy_! = deny
1256+
): [staginggoerli_HubDomain!]!
11981257
"""Access to subgraph metadata"""
11991258
staginggoerli__meta(block: staginggoerli_Block_height): staginggoerli__Meta_
12001259
}
@@ -1941,6 +2000,32 @@ type Subscription {
19412000
"""
19422001
subgraphError: _SubgraphErrorPolicy_! = deny
19432002
): [staginggoerli_AggregateRootSavedSlow!]!
2003+
staginggoerli_hubDomain(
2004+
id: ID!
2005+
"""
2006+
The block at which the query should be executed. Can either be a `{ hash: Bytes }` value containing a block hash, a `{ number: Int }` containing the block number, or a `{ number_gte: Int }` containing the minimum block number. In the case of `number_gte`, the query will be executed on the latest block only if the subgraph has progressed to or past the minimum block number. Defaults to the latest block when omitted.
2007+
"""
2008+
block: staginggoerli_Block_height
2009+
"""
2010+
Set to `allow` to receive data even if the subgraph has skipped over errors while syncing.
2011+
"""
2012+
subgraphError: _SubgraphErrorPolicy_! = deny
2013+
): staginggoerli_HubDomain
2014+
staginggoerli_hubDomains(
2015+
skip: Int = 0
2016+
first: Int = 100
2017+
orderBy: staginggoerli_HubDomain_orderBy
2018+
orderDirection: staginggoerli_OrderDirection
2019+
where: staginggoerli_HubDomain_filter
2020+
"""
2021+
The block at which the query should be executed. Can either be a `{ hash: Bytes }` value containing a block hash, a `{ number: Int }` containing the block number, or a `{ number_gte: Int }` containing the minimum block number. In the case of `number_gte`, the query will be executed on the latest block only if the subgraph has progressed to or past the minimum block number. Defaults to the latest block when omitted.
2022+
"""
2023+
block: staginggoerli_Block_height
2024+
"""
2025+
Set to `allow` to receive data even if the subgraph has skipped over errors while syncing.
2026+
"""
2027+
subgraphError: _SubgraphErrorPolicy_! = deny
2028+
): [staginggoerli_HubDomain!]!
19442029
"""Access to subgraph metadata"""
19452030
staginggoerli__meta(block: staginggoerli_Block_height): staginggoerli__Meta_
19462031
}

packages/adapters/subgraph/.graphclient/sources/Hub_Staging_Goerli/types.ts

+80
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,38 @@ export type staginggoerli_GnosisConnectorMeta_orderBy =
392392
| 'rootManager'
393393
| 'mirrorConnector';
394394

395+
export type staginggoerli_HubDomain = {
396+
id: Scalars['ID'];
397+
domain?: Maybe<Scalars['BigInt']>;
398+
};
399+
400+
export type staginggoerli_HubDomain_filter = {
401+
id?: InputMaybe<Scalars['ID']>;
402+
id_not?: InputMaybe<Scalars['ID']>;
403+
id_gt?: InputMaybe<Scalars['ID']>;
404+
id_lt?: InputMaybe<Scalars['ID']>;
405+
id_gte?: InputMaybe<Scalars['ID']>;
406+
id_lte?: InputMaybe<Scalars['ID']>;
407+
id_in?: InputMaybe<Array<Scalars['ID']>>;
408+
id_not_in?: InputMaybe<Array<Scalars['ID']>>;
409+
domain?: InputMaybe<Scalars['BigInt']>;
410+
domain_not?: InputMaybe<Scalars['BigInt']>;
411+
domain_gt?: InputMaybe<Scalars['BigInt']>;
412+
domain_lt?: InputMaybe<Scalars['BigInt']>;
413+
domain_gte?: InputMaybe<Scalars['BigInt']>;
414+
domain_lte?: InputMaybe<Scalars['BigInt']>;
415+
domain_in?: InputMaybe<Array<Scalars['BigInt']>>;
416+
domain_not_in?: InputMaybe<Array<Scalars['BigInt']>>;
417+
/** Filter for the block changed event. */
418+
_change_block?: InputMaybe<staginggoerli_BlockChangedFilter>;
419+
and?: InputMaybe<Array<InputMaybe<staginggoerli_HubDomain_filter>>>;
420+
or?: InputMaybe<Array<InputMaybe<staginggoerli_HubDomain_filter>>>;
421+
};
422+
423+
export type staginggoerli_HubDomain_orderBy =
424+
| 'id'
425+
| 'domain';
426+
395427
export type staginggoerli_HubOptimisticRootFinalized = {
396428
id: Scalars['ID'];
397429
aggregateRoot: Scalars['staginggoerli_Bytes'];
@@ -798,6 +830,8 @@ export type Query = {
798830
staginggoerli_rootMessageProcesseds: Array<staginggoerli_RootMessageProcessed>;
799831
staginggoerli_aggregateRootSavedSlow?: Maybe<staginggoerli_AggregateRootSavedSlow>;
800832
staginggoerli_aggregateRootSavedSlows: Array<staginggoerli_AggregateRootSavedSlow>;
833+
staginggoerli_hubDomain?: Maybe<staginggoerli_HubDomain>;
834+
staginggoerli_hubDomains: Array<staginggoerli_HubDomain>;
801835
/** Access to subgraph metadata */
802836
staginggoerli__meta?: Maybe<staginggoerli__Meta_>;
803837
};
@@ -1091,6 +1125,24 @@ export type Querystaginggoerli_aggregateRootSavedSlowsArgs = {
10911125
};
10921126

10931127

1128+
export type Querystaginggoerli_hubDomainArgs = {
1129+
id: Scalars['ID'];
1130+
block?: InputMaybe<staginggoerli_Block_height>;
1131+
subgraphError?: _SubgraphErrorPolicy_;
1132+
};
1133+
1134+
1135+
export type Querystaginggoerli_hubDomainsArgs = {
1136+
skip?: InputMaybe<Scalars['Int']>;
1137+
first?: InputMaybe<Scalars['Int']>;
1138+
orderBy?: InputMaybe<staginggoerli_HubDomain_orderBy>;
1139+
orderDirection?: InputMaybe<staginggoerli_OrderDirection>;
1140+
where?: InputMaybe<staginggoerli_HubDomain_filter>;
1141+
block?: InputMaybe<staginggoerli_Block_height>;
1142+
subgraphError?: _SubgraphErrorPolicy_;
1143+
};
1144+
1145+
10941146
export type Querystaginggoerli__metaArgs = {
10951147
block?: InputMaybe<staginggoerli_Block_height>;
10961148
};
@@ -1448,6 +1500,8 @@ export type Subscription = {
14481500
staginggoerli_rootMessageProcesseds: Array<staginggoerli_RootMessageProcessed>;
14491501
staginggoerli_aggregateRootSavedSlow?: Maybe<staginggoerli_AggregateRootSavedSlow>;
14501502
staginggoerli_aggregateRootSavedSlows: Array<staginggoerli_AggregateRootSavedSlow>;
1503+
staginggoerli_hubDomain?: Maybe<staginggoerli_HubDomain>;
1504+
staginggoerli_hubDomains: Array<staginggoerli_HubDomain>;
14511505
/** Access to subgraph metadata */
14521506
staginggoerli__meta?: Maybe<staginggoerli__Meta_>;
14531507
};
@@ -1741,6 +1795,24 @@ export type Subscriptionstaginggoerli_aggregateRootSavedSlowsArgs = {
17411795
};
17421796

17431797

1798+
export type Subscriptionstaginggoerli_hubDomainArgs = {
1799+
id: Scalars['ID'];
1800+
block?: InputMaybe<staginggoerli_Block_height>;
1801+
subgraphError?: _SubgraphErrorPolicy_;
1802+
};
1803+
1804+
1805+
export type Subscriptionstaginggoerli_hubDomainsArgs = {
1806+
skip?: InputMaybe<Scalars['Int']>;
1807+
first?: InputMaybe<Scalars['Int']>;
1808+
orderBy?: InputMaybe<staginggoerli_HubDomain_orderBy>;
1809+
orderDirection?: InputMaybe<staginggoerli_OrderDirection>;
1810+
where?: InputMaybe<staginggoerli_HubDomain_filter>;
1811+
block?: InputMaybe<staginggoerli_Block_height>;
1812+
subgraphError?: _SubgraphErrorPolicy_;
1813+
};
1814+
1815+
17441816
export type Subscriptionstaginggoerli__metaArgs = {
17451817
block?: InputMaybe<staginggoerli_Block_height>;
17461818
};
@@ -1919,6 +1991,10 @@ export type _SubgraphErrorPolicy_ =
19191991
staginggoerli_aggregateRootSavedSlow: InContextSdkMethod<Query['staginggoerli_aggregateRootSavedSlow'], Querystaginggoerli_aggregateRootSavedSlowArgs, MeshContext>,
19201992
/** null **/
19211993
staginggoerli_aggregateRootSavedSlows: InContextSdkMethod<Query['staginggoerli_aggregateRootSavedSlows'], Querystaginggoerli_aggregateRootSavedSlowsArgs, MeshContext>,
1994+
/** null **/
1995+
staginggoerli_hubDomain: InContextSdkMethod<Query['staginggoerli_hubDomain'], Querystaginggoerli_hubDomainArgs, MeshContext>,
1996+
/** null **/
1997+
staginggoerli_hubDomains: InContextSdkMethod<Query['staginggoerli_hubDomains'], Querystaginggoerli_hubDomainsArgs, MeshContext>,
19221998
/** Access to subgraph metadata **/
19231999
staginggoerli__meta: InContextSdkMethod<Query['staginggoerli__meta'], Querystaginggoerli__metaArgs, MeshContext>
19242000
};
@@ -1992,6 +2068,10 @@ export type _SubgraphErrorPolicy_ =
19922068
staginggoerli_aggregateRootSavedSlow: InContextSdkMethod<Subscription['staginggoerli_aggregateRootSavedSlow'], Subscriptionstaginggoerli_aggregateRootSavedSlowArgs, MeshContext>,
19932069
/** null **/
19942070
staginggoerli_aggregateRootSavedSlows: InContextSdkMethod<Subscription['staginggoerli_aggregateRootSavedSlows'], Subscriptionstaginggoerli_aggregateRootSavedSlowsArgs, MeshContext>,
2071+
/** null **/
2072+
staginggoerli_hubDomain: InContextSdkMethod<Subscription['staginggoerli_hubDomain'], Subscriptionstaginggoerli_hubDomainArgs, MeshContext>,
2073+
/** null **/
2074+
staginggoerli_hubDomains: InContextSdkMethod<Subscription['staginggoerli_hubDomains'], Subscriptionstaginggoerli_hubDomainsArgs, MeshContext>,
19952075
/** Access to subgraph metadata **/
19962076
staginggoerli__meta: InContextSdkMethod<Subscription['staginggoerli__meta'], Subscriptionstaginggoerli__metaArgs, MeshContext>
19972077
};

packages/deployments/subgraph/src/amarok-hub-staging/mapping/rootManager.ts

+21
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
OptimisticModeActivated as OptimisticModeActivatedEvent,
1212
AggregateRootSavedOptimistic as AggregateRootSavedOptimisticEvent,
1313
AggregateRootSavedSlow as AggregateRootSavedSlowEvent,
14+
HubDomainSet,
15+
HubDomainCleared,
1416
} from "../../../generated/RootManager/RootManager";
1517

1618
import {
@@ -21,12 +23,15 @@ import {
2123
OptimisticRootProposed,
2224
HubOptimisticRootFinalized,
2325
AggregateRootSavedSlow,
26+
HubDomain,
2427
} from "../../../generated/schema";
2528

2629
const ROOT_MANAGER_META_ID = "ROOT_MANAGER_META_ID";
2730
const ROOT_MANAGER_MODE_ID = "ROOT_MANAGER_MODE_ID";
31+
const HUB_DOMAIN_ID = "HUB_DOMAIN_ID";
2832
const OPTIMISTIC_MODE = "OPTIMISTIC_MODE";
2933
const SLOW_MODE = "SLOW_MODE";
34+
const DEFUALT_HUB_DOMAIN = 0;
3035

3136
/// MARK - ROOT MANAGER
3237
// TODO: Needed?
@@ -146,3 +151,19 @@ export function handleOptimisticModeActivated(event: OptimisticModeActivatedEven
146151

147152
instance.save();
148153
}
154+
155+
export function handleHubDomainSet(event: HubDomainSet): void {
156+
let instance = HubDomain.load(HUB_DOMAIN_ID);
157+
if (instance == null) {
158+
instance = new HubDomain(HUB_DOMAIN_ID);
159+
}
160+
161+
instance.domain = event.params.domain;
162+
163+
instance.save();
164+
}
165+
166+
export function handleHubDomainCleared(event: HubDomainCleared): void {
167+
const instance = new HubDomain(HUB_DOMAIN_ID);
168+
instance.save();
169+
}

packages/deployments/subgraph/src/amarok-hub-staging/schema.graphql

+5
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,8 @@ type AggregateRootSavedSlow @entity {
149149
aggregatedRoots: [Bytes!]
150150
rootTimestamp: BigInt!
151151
}
152+
153+
type HubDomain @entity {
154+
id: ID! # "HUB_DOMAIN_ID"
155+
domain: BigInt
156+
}

packages/deployments/subgraph/src/amarok-hub-staging/subgraph.template.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ dataSources:
4343
handler: handleAggregateRootSavedOptimistic
4444
- event: AggregateRootSavedSlow(indexed bytes32,uint256,bytes32[],uint256)
4545
handler: handleAggregateRootSavedSlow
46+
- event: HubDomainSet(uint32)
47+
handler: handleHubDomainSet
48+
- event: HubDomainCleared()
49+
handler: handleHubDomainCleared
4650
file: ./src/amarok-hub-staging/mapping/rootManager.ts
4751
# MERKLE TREE MANAGER events
4852
- kind: ethereum/contract

0 commit comments

Comments
 (0)