-
Notifications
You must be signed in to change notification settings - Fork 25
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
chore(pact-project-proposal): initial proposal #1686
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Concept of project management for Pact projects | ||
|
||
Inspired by npm package- and tsconfig project-management. | ||
|
||
A `pact-project.json` needs to be in every package. | ||
|
||
> When that doesn't exist, it can be made by a depending project. It'll then | ||
> include a "source" property that points to the source files. | ||
|
||
The `pact-project.json` has properties that'll describe the project: | ||
|
||
- `name` (optional): is used to reference the project, or show in logs or error | ||
messages | ||
- `description` (optional): description of the contents of the pact project | ||
- `dependencies` (optional): an list of dependencies that need to be made | ||
available for the project to work properly | ||
- `dependencyTree`: an list of objects that define a smart contract and its | ||
dependencies (recursively through `dependencies`) | ||
- `path`: the path to the contract that needs to be available for the | ||
depending project to work | ||
- `dependencies`: a list of object that define this contracts' dependencies. | ||
|
||
# How should this be used | ||
|
||
A tool can interpret the `pact-project.json` to do various tasks | ||
|
||
## `kadena project` | ||
|
||
- `install` make dependencies available through downloading or other mechanism | ||
- `verify` verify that all dependencies are available | ||
- `deploy` will check whether the target network has the contracts available, | ||
and deploys them where needed (new or upgrade deployment) | ||
|
||
# Example files | ||
|
||
There are 3 files in this project | ||
|
||
- [`./pact-project.json`](./pact-project.json) an example of a project config | ||
- [`./chainweb-pact-project.json`](./chainweb-pact-project.json) an example of | ||
what a project file could look like when the target project has no | ||
`pact-project.json` | ||
- [`structure.graphql`](./structure.graphql) a formalized description of the | ||
contents of a `pact-project.json` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "chainweb-pact", | ||
"description": "Chainweb Pact Project", | ||
"source": "[email protected]:kadena-io/chainweb-pact.git", | ||
"dependencies": [ | ||
"[email protected]:other-user/my-other-dependency.git" | ||
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. I like the idea of content address-ability here. We should figure out how to reference contract hashes directly with some nice syntax. Having github support would be killer to mix with that. 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. Another thought a day later: supporting commit hashes, as opposed to git repos would be preferable. 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. I'd like this to be similar to how NPM allows to use dependencies. This includes various ways of specifying versions, git urls, github urls ( https://docs.npmjs.com/cli/v10/configuring-npm/package-json#dependencies 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. That's fine by me, but we should specify the variations in syntax that we plan to support beforehand. |
||
], | ||
"contracts": [ | ||
{ | ||
"path": "./utils.pact", | ||
"dependencies": [ | ||
{ | ||
"path": "./some-other-contract.pact" | ||
} | ||
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. hash or checksum would be nice to include here. |
||
] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "my-pact-project", | ||
"dependencies": [ | ||
"[email protected]:alber70g/my-project.git/pact/pact-project.json", | ||
"./chainweb-config.json" | ||
], | ||
"dependencyTree": [ | ||
{ | ||
"path": "./coin.pact", | ||
"dependencies": [ | ||
{ | ||
"path": "./fungible-v2.pact" | ||
} | ||
] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" | ||
Project file that describes the structure of a pact project | ||
`pact-project.json` | ||
""" | ||
type PactConfig { | ||
name: String | ||
description: String | ||
|
||
""" | ||
optional: sources if the pact smart contracts are external | ||
Used to map the content of "source" to a "pact-project" | ||
""" | ||
source: String | ||
dependencies: [ConfigPointerString!] | ||
dependencyTree: [SmartContract!] | ||
} | ||
|
||
type ConfigPointerString { | ||
value: String | ||
} | ||
|
||
type SmartContract { | ||
path: String! | ||
dependencies: [SmartContract] | ||
} |
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.
So this makes sense, but we need to tease out some structure here:
tx.yaml
or smth) as a field in this distribution. I imaginedeploy
would only understand how to upload and deploy to a network if that were present.Together, i think 1 and 2 would be enough of a start to talk about a fully fledged "Pact Project" .
HTH