forked from subquery/subql
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Sync with main SDK for project upgrades support #148
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
759053b
Update deps to support project upgrades feature
stwiname ff00cc4
Tidy up
stwiname 6db9f10
Update changelog
stwiname dafe419
fix celo tests
guplersaxanoid 0d06c40
Add POI changes
stwiname b356e9e
Apply latest changes from deps
stwiname 07e96ad
update node-core and fix testing framework
guplersaxanoid 381eab2
fix tests
guplersaxanoid e9be79d
Sync with latest changes, update deps and fix build issues
stwiname 548fcc9
Implement skipTransaction feature (#170)
stwiname 7cda050
Update node-core, apply recent changes
stwiname c8e0a6b
Address comments
stwiname 3b28814
update dependencies (#171)
jiqiang90 b80366c
Remove resolution for types core
stwiname de6a7da
Revert jest config change
stwiname 7e97699
Update yarn.lock
stwiname File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,10 @@ | ||
// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
import fs from 'fs'; | ||
import path from 'path'; | ||
import {loadFromJsonOrYaml} from '@subql/common'; | ||
import {EthereumProjectManifestVersioned, VersionedProjectManifest} from './versioned'; | ||
|
||
export function parseEthereumProjectManifest(raw: unknown): EthereumProjectManifestVersioned { | ||
const projectManifest = new EthereumProjectManifestVersioned(raw as VersionedProjectManifest); | ||
projectManifest.validate(); | ||
return projectManifest; | ||
} | ||
|
||
export function loadEthereumProjectManifest(file: string): EthereumProjectManifestVersioned { | ||
let manifestPath = file; | ||
if (fs.existsSync(file) && fs.lstatSync(file).isDirectory()) { | ||
const yamlFilePath = path.join(file, 'project.yaml'); | ||
const jsonFilePath = path.join(file, 'project.json'); | ||
if (fs.existsSync(yamlFilePath)) { | ||
manifestPath = yamlFilePath; | ||
} else if (fs.existsSync(jsonFilePath)) { | ||
manifestPath = jsonFilePath; | ||
} else { | ||
throw new Error(`Could not find project manifest under dir ${file}`); | ||
} | ||
} | ||
|
||
const doc = loadFromJsonOrYaml(manifestPath); | ||
const projectManifest = new EthereumProjectManifestVersioned(doc as VersionedProjectManifest); | ||
projectManifest.validate(); | ||
return projectManifest; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,43 @@ | ||
// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
import fs from 'fs'; | ||
import path from 'path'; | ||
import {RunnerQueryBaseModel} from '@subql/common'; | ||
import {loadFromJsonOrYaml, RunnerQueryBaseModel} from '@subql/common'; | ||
import {validateSync} from 'class-validator'; | ||
import {DeploymentV1_0_0, EthereumRunnerNodeImpl, EthereumRunnerSpecsImpl} from '../project/versioned/v1_0_0'; | ||
import {loadEthereumProjectManifest} from './load'; | ||
import {EthereumProjectManifestVersioned, VersionedProjectManifest} from './versioned'; | ||
|
||
const projectsDir = path.join(__dirname, '../../test'); | ||
|
||
function loadEthereumProjectManifest(file: string): EthereumProjectManifestVersioned { | ||
let manifestPath = file; | ||
if (fs.existsSync(file) && fs.lstatSync(file).isDirectory()) { | ||
const yamlFilePath = path.join(file, 'project.yaml'); | ||
const jsonFilePath = path.join(file, 'project.json'); | ||
if (fs.existsSync(yamlFilePath)) { | ||
manifestPath = yamlFilePath; | ||
} else if (fs.existsSync(jsonFilePath)) { | ||
manifestPath = jsonFilePath; | ||
} else { | ||
throw new Error(`Could not find project manifest under dir ${file}`); | ||
} | ||
} | ||
|
||
const doc = loadFromJsonOrYaml(manifestPath); | ||
const projectManifest = new EthereumProjectManifestVersioned(doc as VersionedProjectManifest); | ||
projectManifest.validate(); | ||
return projectManifest; | ||
} | ||
|
||
describe('test eth project.yaml', () => { | ||
it('could get eth project template name from its deployment ', () => { | ||
it('could get eth project template name from its deployment', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. imported method |
||
const manifest = loadEthereumProjectManifest(path.join(projectsDir, 'project_1.0.0.yaml')); | ||
const deployment = manifest.toDeployment(); | ||
expect(deployment).toContain('name: Pool'); | ||
}); | ||
|
||
it('could get options in template from its deployment ', () => { | ||
it('could get options in template from its deployment', () => { | ||
const manifest = loadEthereumProjectManifest(path.join(projectsDir, 'project_1.0.0.yaml')); | ||
const deployment = manifest.toDeployment(); | ||
expect(deployment).toContain('abi: Pool'); | ||
|
@@ -53,7 +74,7 @@ | |
console.log(deployment.network.chainId); | ||
}); | ||
|
||
it.skip('can get chainId for deployment', () => { | ||
const deployment = loadEthereumProjectManifest(path.join(projectsDir, 'project_1.0.0_chainId.yaml')).asV1_0_0 | ||
.deployment; | ||
expect(deployment.network.chainId).toBe('moonbeamChainId'); | ||
|
@@ -66,16 +87,17 @@ | |
deployment.specVersion = '1.0.0'; | ||
deployment.runner = new EthereumRunnerSpecsImpl(); | ||
|
||
nodeImp.name = '@subql/node'; | ||
nodeImp.version = '0.29.1'; | ||
nodeImp.name = '@subql/node-ethereum'; | ||
nodeImp.version = '*'; | ||
deployment.runner.node = nodeImp; | ||
|
||
queryImp.name = '@subql/query'; | ||
queryImp.version = '0.213.1'; | ||
|
||
deployment.runner.query = queryImp; | ||
|
||
validateSync(deployment.runner, {whitelist: true, forbidNonWhitelisted: true}); | ||
const errors = validateSync(deployment.runner, {whitelist: true, forbidNonWhitelisted: true}); | ||
expect(errors.length).toBe(0); | ||
}); | ||
|
||
it('can validate a v1.0.0 project.yaml with unsupported runner node', () => { | ||
|
@@ -83,7 +105,7 @@ | |
}); | ||
|
||
//TODO, pre-release should be excluded | ||
it.skip('can throw error with unsupported runner version', () => { | ||
expect(() => | ||
loadEthereumProjectManifest(path.join(projectsDir, 'project_1.0.0_bad_runner_version.yaml')) | ||
).toThrow(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ | |
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
export * from './model'; | ||
export * from './types'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
line 6,
import {isCustomDs, isRuntimeDs} from '@subql/common-ethereum';
been self import