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

fix: remove validate studio network checks #1521

Merged
merged 3 commits into from Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/three-fans-attend.md
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-cli': patch
---

remove studio network validation checks
99 changes: 0 additions & 99 deletions packages/cli/src/command-helpers/studio.test.ts

This file was deleted.

61 changes: 0 additions & 61 deletions packages/cli/src/command-helpers/studio.ts

This file was deleted.

21 changes: 0 additions & 21 deletions packages/cli/src/commands/deploy.ts
Expand Up @@ -10,7 +10,6 @@
import { createJsonRpcClient } from '../command-helpers/jsonrpc';
import { updateSubgraphNetwork } from '../command-helpers/network';
import { chooseNodeUrl, getHostedServiceSubgraphId } from '../command-helpers/node';
import { validateStudioNetwork } from '../command-helpers/studio';
import { assertGraphTsVersion, assertManifestApiVersion } from '../command-helpers/version';
import { GRAPH_CLI_SHARED_HEADERS } from '../constants';
import Protocol from '../protocols';
Expand Down Expand Up @@ -410,30 +409,10 @@

await ipfsClient.pin.add(ipfsHash);

try {
const dataSourcesAndTemplates = DataSourcesExtractor.fromManifestString(manifestFile);

for (const { network } of dataSourcesAndTemplates) {
validateStudioNetwork({ studio, product, network });
}
} catch (e) {
this.error(e, { exit: 1 });
}

await deploySubgraph(ipfsHash);
return;
}

try {
const dataSourcesAndTemplates = await DataSourcesExtractor.fromFilePath(manifest);

for (const { network } of dataSourcesAndTemplates) {
validateStudioNetwork({ studio, product, network });
}
} catch (e) {
this.error(e, { exit: 1 });
}

let protocol;
try {
// Checks to make sure deploy doesn't run against
Expand All @@ -453,7 +432,7 @@
}

if (network) {
const identifierName = protocol.getContract()!.identifierName();

Check warning on line 435 in packages/cli/src/commands/deploy.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion
await updateSubgraphNetwork(manifest, network, networkFile, identifierName);
}

Expand Down
18 changes: 0 additions & 18 deletions packages/cli/src/commands/init.ts
Expand Up @@ -13,7 +13,6 @@
import { chooseNodeUrl } from '../command-helpers/node';
import { generateScaffold, writeScaffold } from '../command-helpers/scaffold';
import { withSpinner } from '../command-helpers/spinner';
import { validateStudioNetwork } from '../command-helpers/studio';
import { getSubgraphBasename, validateSubgraphName } from '../command-helpers/subgraph';
import debugFactory from '../debug';
import Protocol, { ProtocolName } from '../protocols';
Expand Down Expand Up @@ -108,8 +107,8 @@
summary: 'Network the contract is deployed to.',
dependsOn: ['from-contract'],
options: [
...availableNetworks.get('ethereum')!,

Check warning on line 110 in packages/cli/src/commands/init.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion
...availableNetworks.get('near')!,

Check warning on line 111 in packages/cli/src/commands/init.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion
...availableNetworks.get('cosmos')!,
],
}),
Expand Down Expand Up @@ -245,8 +244,6 @@
subgraphName,
contractName,
node,
studio,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this already removing some arguments from init?

Copy link
Member Author

Choose a reason for hiding this comment

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

no we are not removing any args. This is simply removing the validation check since we only do that check during init fro studio. Should not change any args.

product,
startBlock,
spkgPath,
skipInstall,
Expand Down Expand Up @@ -322,8 +319,6 @@
indexEvents: answers.indexEvents,
contractName: answers.contractName,
node,
studio: answers.studio,
product: answers.product,
startBlock: answers.startBlock,
spkgPath: answers.spkgPath,
skipInstall,
Expand Down Expand Up @@ -1074,8 +1069,6 @@
indexEvents,
contractName,
node,
studio,
product,
startBlock,
spkgPath,
skipInstall,
Expand All @@ -1090,8 +1083,6 @@
indexEvents: boolean;
contractName?: string;
node?: string;
studio: boolean;
product?: string;
startBlock?: string;
spkgPath?: string;
skipInstall: boolean;
Expand Down Expand Up @@ -1132,15 +1123,6 @@
this.error(`ABI does not contain any events`, { exit: 1 });
}

// We can validate this before the scaffold because we receive
// the network from the form or via command line argument.
// We don't need to read the manifest in this case.
try {
validateStudioNetwork({ studio, product, network });
} catch (e) {
this.error(e, { exit: 1 });
}

// Scaffold subgraph
const scaffold = await withSpinner(
`Create subgraph scaffold`,
Expand Down