-
Notifications
You must be signed in to change notification settings - Fork 216
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
Subgraph Composition : Fix graph init for composed subgraphs #1920
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 3a75a7f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
55c1f2b
to
111a264
Compare
Deploying graph-tooling with Cloudflare Pages
|
@incrypto32 could you fix the linter error? |
I think there are some issues with running github actions in your branch after #1919 Rebasing on top of the latest main should help. |
8e5191c
to
2a7cf51
Compare
2a7cf51
to
7efc3f2
Compare
@YaroShkvorets i just rebase on top of main and the issue persists. I cant figure out what the lint issue is, also im not able to run the lint locally. Getting these error
|
7efc3f2
to
3a75a7f
Compare
Looks like it's passing. Good for review now? |
@YaroShkvorets yes, ready for review |
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.
- Remove
hidden: true
from--ipfs
flag on line 117 - There doesn't seem to be a way to scaffold a subgraph-based subgraph in non-interactive way from command line. Is it possible?
- this command does nothing and exits with code 0 without any error:
graph init test test --from-contract=0x0 --protocol=subgraph --network=mainnet
initial: ipfsUrl, | ||
skip: () => !isComposedSubgraph, | ||
result: value => { | ||
ipfsNode = value; |
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.
Let's check that this is at least a valid URL
if (isComposedSubgraph) { | ||
return value.startsWith('Qm') ? true : 'Subgraph deployment ID must start with Qm'; | ||
if (!ipfsNode) { |
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.
We shouldn't allow empty ipfsNode
. Return corresponding error message.
Also, if we validate ipfsNode
above this would be unnecessary.
// Get network from first data source | ||
const sourceNetwork = allSources[0].network; | ||
if (!sourceNetwork) { | ||
return { valid: true }; // Network not specified in source, skip validation |
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.
Is it possible?
And if possible, why is it valid?
} | ||
|
||
const normalizedSourceNetwork = sourceNetwork.toLowerCase(); | ||
const normalizedTargetNetwork = targetNetwork.toLowerCase(); |
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 don't think we need to normalize here. If somehow our targetNetwork
is Mainnet
it shouldn't let us continue. Because in graph-node network ID is case-sensitive.
@@ -822,6 +834,22 @@ async function processInitForm( | |||
|
|||
await promptManager.executeInteractive(); | |||
|
|||
// Validate network matches if loading from IPFS | |||
if (ipfsNode && source?.startsWith('Qm')) { |
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.
Why not check for isComposedSubgraph
instead?
I think we can move this validation into initSubgraphFromContract()
. We are already creating ipfsClient
anyway and doing some additional validations there. This method is to process init form.
This PR enables
graph init
for composed subgraphs. It creates a new ipfs client to validate the source subgraph manifest