You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+53-26Lines changed: 53 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -26,27 +26,50 @@ The `-p` is short for [publish](https://docs.docker.com/network/#published-ports
26
26
27
27
## Design
28
28
29
-
## Stages
30
-
31
-
The build is [multi-stage](https://docs.docker.com/build/building/multi-stage/) with several kinds of stages:
32
-
33
-
-`START` The very first stage, which run `ag0` instead of `agd` as the other layers do. (This was the version of `agd` before JS VM.)
34
-
-`PREPARE` For upgrade proposals: submits the proposal, votes on it, runs to halt for the next stage
35
-
-`EXECUTE` For upgrade proposals: starts `agd` with the new SDK, letting its upgrade handler upgrade the chain
36
-
-`EVAL` For core-eval proposals: submits the proposal, votes on it, and begin executing. Does not guarantee the eval will finish but does wait several blocks to give it a chance.
29
+
The build is [multi-stage](https://docs.docker.com/build/building/multi-stage/) with several kinds of stages as implemented by [dockerfileGen.ts](./packages/synthetic-chain/src/cli/dockerfileGen.ts).
| START | base | The very first stage, which run `ag0` instead of `agd` as the other layers do. (This was the version of `agd` before JS VM.) |
60
+
| PREPARE | chain software upgrade proposals | submits the proposal, votes on it, runs to halt for the next stage |
61
+
| EXECUTE | chain software upgrade proposals | starts `agd` with the new SDK, letting its upgrade handler upgrade the chain |
62
+
| EVAL | other proposals | submits the proposal, votes on it, and begin executing. Does not guarantee the eval will finish but does wait several blocks to give it a chance. |
63
+
| USE | all proposals | Perform actions to update the chain state, to persist through the chain history. E.g. adding a vault that will be tested again in the future. |
64
+
| TEST | all proposals | Test the chain state and perform new actions that should not be part of history. E.g. adding a contract that never was on Mainnet. |
65
+
| DEFAULT | tip | Run the last USE image with entrypoint `./start_agd.sh`, invoking the chain node with all passed proposals and no termination condition. This is a convenient base for further derivative images. |
42
66
43
-
The `TEST` stage does not RUN as part of the build. It only copies test files into the image and defines the ENTRYPOINT. CI runs those entrypoints to execute the tests.
67
+
`TEST` stages do not RUN as part of the build; they only copy test files into the image and define [ENTRYPOINT](https://docs.docker.com/reference/dockerfile/#entrypoint).
68
+
CI runs those entrypoints to execute the tests.
44
69
(Note that some other phases use tests too, for example to pre-test, so files like `pre.test.js` are always copied. Only `test.sh` and a `test` dir are excluded from stages before TEST.)
45
70
46
71
The `USE` stage is built into images that are pushed to the image repository. These can be used by release branches to source a particular state of the synthetic chain.
47
72
48
-
Finally there is a `DEFAULT` target which take the last `USE` image and sets its entrypoint to `./start_agd.sh` which runs the chain indefinitely. This makes it easy to source that image as a way to _run_ the synthetic chain with all passed proposals.
49
-
50
73
## Proposals
51
74
52
75
### Types
@@ -67,18 +90,22 @@ If the proposal is _pending_ and does not yet have a number, use a letter. The p
67
90
68
91
### Files
69
92
70
-
-`package.json` specifies what kind of proposal it is in a `agoricProposal` field. If it's a "Software Upgrade Proposal" it also includes additional parameters.
71
-
-`use.sh` is the script that will be run in the USE stage of the build
72
-
-`test.sh` is the script that will be _included_ in the TEST stage of the build, and run in CI
73
-
-`test` folder contents will be copied only to the `test` image
74
-
-`setup-test.sh` is an optional script which can be used to run setup steps _inside_ the container. It runs _before_ the chain starts.
75
-
-`teardown-test.sh` is an optional script which can be used to run teardown steps _inside_ the container. It runs _after_ the chain stops.
76
-
-`host` folder is the home of these scripts:
77
-
78
-
-`before-test-run.sh` is an optional script which can be used to run setup steps on the _host_ (like starting a follower). It runs _before_ the container launches.
79
-
-`after-test-run.sh` is an optional script which can be used to run teardown steps on the _host_ (like stopping a follower). It runs _after_ the container exits.
80
-
81
-
_`host` folder contents will never be copied to a Docker image_
93
+
All files are optional other than `package.json` and `test.sh`.
94
+
95
+
-`package.json` must include an object-valued `agoricProposal` field with a `type` property specifying the type of proposal (one of "/cosmos.params.v1beta1.ParameterChangeProposal", "/agoric.swingset.CoreEvalProposal", or "Software Upgrade Proposal"). `agoricProposal` may also include other properties (e.g., `upgradeInfo` as used by [agoric-sdk/a3p-integration](https://github.com/Agoric/agoric-sdk/tree/7ed74d76185ae163c4df6254e8ff6b76cfac56ce/a3p-integration)), and if the type is "Software Upgrade Proposal" then it MUST include
96
+
-`planName`: the cosmos-sdk "upgrade name" to target
97
+
-`releaseNotes`: a URL to e.g. `https://github.com/Agoric/agoric-sdk/releases/tag/$releaseName`, or `false` for an unreleased upgrade
98
+
-`sdkImageTag`: the tag to use for the output Docker image
99
+
-`prepare.sh` is executed while the chain node is running but before the proposal is submitted.
100
+
-`eval.sh` is executed in the EVAL stage while the chain node is running, as a replacement of default behavior based on `submission/`.
101
+
-`submission/` is scanned for $name.js core-eval proposal scripts, corresponding $name-permit.json permits, and referenced b1-$hash.json bundles. [Default EVAL stage behavior](https://github.com/Agoric/agoric-3-proposals/blob/main/packages/synthetic-chain/public/upgrade-test-scripts/eval_submission.js) installs the bundles and submits a core-eval proposal referencing all of the ($name-permit.json, $name.js) pairs.
102
+
-`use.sh` is executed in the USE stage while the chain node is running.
103
+
-`setup-test.sh` is executed in the TEST stage _before_ the chain node is started.
104
+
-`test.sh` is executed in the TEST stage while the chain node is running.
105
+
-`teardown-test.sh` is executed in the TEST stage _after_ the chain node is stopped.
106
+
-`test/` is copied into the TEST stage image for use by other files.
107
+
-`host/before-test-run.sh` is executed on the Docker _host_ before launching a container for the TEST stage (useful for e.g. starting a follower).
108
+
-`host/after-test-run.sh` is executed on the Docker _host_ after a container for the TEST stage exits (useful for e.g. stopping a follower).
Copy file name to clipboardExpand all lines: packages/synthetic-chain/README.md
+1-22Lines changed: 1 addition & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -22,28 +22,7 @@ doctor - diagnostics and quick fixes
22
22
23
23
## Design
24
24
25
-
It builds images starting from ag0 or an already build synthetic-chain. The build stages sequence is produced by `dockerfileGen.ts` approximately as so:
26
-
27
-
```mermaid
28
-
---
29
-
title: Build Stages
30
-
---
31
-
flowchart TD
32
-
M{Mode?}
33
-
M -- FromAg0 --> S[START]
34
-
M -- Append --> R[RESUME]
35
-
S --> NP{Proposal type}
36
-
R --> NP
37
-
NP -- Software Upgrade Proposal ----> Pr[PREPARE]
38
-
Pr ----> Exec[EXECUTE]
39
-
Exec ----> Use[USE]
40
-
Use ----> Test[TEST]
41
-
NP -- CoreEvalProposal ----> Eval[EVAL]
42
-
Eval ----> Use
43
-
Test ----> AP{Another proposal?}
44
-
AP -- Yes ----> NP
45
-
AP -- No ----> END[DEFAULT last use]
46
-
```
25
+
[dockerfileGen.ts](./src/cli/dockerfileGen.ts) generates a Dockerfile for the multi-stage build described in the [repository README](../../README.md).
0 commit comments