-
Notifications
You must be signed in to change notification settings - Fork 127
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
Indexing rules by subgraph id #329
Conversation
const epochLength = | ||
await this.network.contracts.epochManager.epochLength() | ||
const blockPeriod = 15 | ||
const bufferPeriod = epochLength.toNumber() * blockPeriod * 100 // 100 epochs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably going to want to parameterize this, so indexers can set the period for which they continue to support the previous version.
c740f83
to
373fb09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍 Haven't tried it locally as the indexer-agent still crashes for me, so the comments are only from reading 🥸
packages/indexer-common/src/indexer-management/models/indexing-rule.ts
Outdated
Show resolved
Hide resolved
Env all set up :D I'm crashing on the error IE017 below. Migration was successful, and a default global indexing rule was created with params
|
7dcdaf8
to
4756681
Compare
I think this is probably because my schema isn't updating, so I'm not sure if we would need to revisit
|
1da7359
to
52d9229
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to understand the handling for convertSubgraphBasedRulesToDeploymentBased
. If there is an existing deployment based rule and subgraph based rule on the same deployment but with different parameters, should the subgraphBased rule trump the deployment rule?
52d9229
to
dcfd1b7
Compare
- Upgrade umzug dependency. - Setup umzug migrations CLI. - Move migrations to db directory.
d1859b8
to
51dbf46
Compare
@@ -40,6 +43,16 @@ const deploymentInList = ( | |||
): boolean => | |||
list.find(item => item.bytes32 === deployment.bytes32) !== undefined | |||
|
|||
const deploymentRuleInList = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hopeyen I've created this function to check if a deployment based rule already exists in the db. I use this below in convertSubgraphBasedRulesToDeploymentBased
to check for existing deployment rules before creating them. This way any user defined deployment
rules take precedent over subgraph
based rules. I'll make note of this order of precedent in the documentation.
51dbf46
to
b090391
Compare
- Update indexing-rule model: deployment --> identifier & identifierType - CLI interface unchanged but now supports providing subgraph ids where deployment ids were the only supported ids previously. - Rules by subgraph id are processed into deployment based rules, so the reconciliation logic doesn't need to change. - Update indexing-rules tests in indexer-common to use new rules model. - Update indexer rules CLI integration tests.
b090391
to
7c69ac5
Compare
This PR adds support for defining indexing rules by subgraph id (rather than deployment id). Defining rules at a subgraph level allows the indexer-agent to automatically manage versioning; keeping both the current and previous version synced and allocated towards.
Changes: