Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit d2e07bf

Browse files
authored
Add Stablenet Repl and Minor Docs (#403)
This patch makes it easy to connect to Stablenet via `chains> yarn repl -c stablenet`. Then you can see everything on stablenet, submit extrinsics, etc. We additionally take a quick pass at the docs to improve them with our current state. There is more work to be done, but I've removed some truly outdated documentation and replaced some items with now-correct versions.
1 parent 1149fde commit d2e07bf

File tree

6 files changed

+42
-96
lines changed

6 files changed

+42
-96
lines changed

Diff for: Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN git clone --depth 1 https://github.com/compound-finance/gateway.git -b hayes
1010
WORKDIR /code/gateway
1111

1212
RUN scripts/pull_release.sh m16
13-
RUN chmod +x releases/m16/gateway-linux-x86
13+
RUN chmod +x releases/m16/gateway-linux-x86
1414

1515
CMD releases/m16/gateway-linux-x86 \
1616
--chain chains/stablenet/chain-spec-raw.json \

Diff for: README.md

+33-65
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ Once the development environment is set up, build Gateway. This command will bui
2929
[native](https://substrate.dev/docs/en/knowledgebase/advanced/executor#native-execution) code:
3030

3131
```bash
32-
cargo +nightly build --release
32+
cargo build --release
3333
```
3434

35-
Note that we require the rust `nightly` toolchain as we rely on unstable features (notably `const_generics`).
35+
Note: that we require the rust `nightly` toolchain as we rely on unstable features (notably `const_generics`). You should make `nightly` your default rust toolchain.
3636

3737
## Test
3838

3939
To test, run:
4040

4141
```sh
42-
SKIP_WASM_BUILD=true cargo test --features stubnet
42+
cargo test -- -Z unstable-options --test-threads 1
4343
```
4444

4545
## Run
@@ -206,34 +206,25 @@ A FRAME pallet is compromised of a number of blockchain primitives:
206206

207207
### Run in Docker
208208

209-
First, install [Docker](https://docs.docker.com/get-docker/) and
210-
[Docker Compose](https://docs.docker.com/compose/install/).
209+
First, install [Docker](https://docs.docker.com/get-docker/).
211210

212-
Then run the following command to start a single node development chain.
211+
Then build the Dockerfile:
213212

214-
```bash
215-
./scripts/docker_run.sh
213+
```sh
214+
docker build -t gateway .
216215
```
217216

218-
This command will firstly compile your code, and then start a local development network. You can
219-
also replace the default command (`cargo +nightly build --release && ./target/release/gateway --dev --ws-external`)
220-
by appending your own. A few useful ones are as follow.
221-
222-
```bash
223-
# Run Substrate node without re-compiling
224-
./scripts/docker_run.sh ./target/release/gateway --dev --ws-external
217+
Next, start your chain:
225218

226-
# Purge the local dev chain
227-
./scripts/docker_run.sh ./target/release/gateway purge-chain --dev
228-
229-
# Check whether the code is compilable
230-
./scripts/docker_run.sh cargo +nightly check
219+
```sh
220+
docker run --rm -it gateway -- /bin/sh
231221
```
232222

233223
## Release Process
234224

235225
All upgrades to Gateway should happen via the release process.
236226
We need to track which features were included in the release, usually including a changelog that covers each PR that was merged.
227+
237228
Proper release management is important here, especially since releases include many varieties of breaking changes.
238229
A scenario test should be written to show that things work as expected after the upgrade takes place.
239230
The goal is to not break things on release.
@@ -244,67 +235,44 @@ Releases should be cut from the `develop` (default) branch on [Github](https://g
244235

245236
First increment the spec version in `runtime/src/lib.rs`.
246237

247-
### Update Chain Spec
248-
249-
Note: this is *only* necessary if you are deploying a new chain, the chain spec is defined at genesis.
238+
### Build Your Release Version
250239

251-
The WASM blob in the chain spec should be updated via:
252-
253-
```
254-
$ CHAIN_BIN=target/<MILESTONE TAG>/gateway-<PLATFORM> chains/build_spec.js -s -c testnet
240+
```sh
241+
scripts/build_release.sh m88 # replace with your milestone version
255242
```
256243

257-
Where `<PLATFORM>` is your local platform used to name the binary build.
244+
### Update the Dockerfile
258245

259-
### Using Github Workflows Release Process (Easier -- Recommended)
246+
Replace the release in the Dockerfile, using your tag (e.g. here `m88`):
260247

261-
Github actions have been created to respond to git tags that are pushed to the repo that begin with `m`, followed by the spec version, e.g. `m3`.
262-
263-
This process will create a draft/prerelease that can be modified and published on github once ready.
264-
265-
Create a tag and push to this repo:
266-
267-
```sh
268-
$ git tag -a <MILESTONE TAG> <OPTIONAL COMMIT HASH>
269-
$ git push origin <MILESTONE TAG>
248+
```diff
249+
- RUN scripts/pull_release.sh m16
250+
- RUN chmod +x releases/m16/gateway-linux-x86
251+
+ RUN scripts/pull_release.sh m88
252+
+ RUN chmod +x releases/m88/gateway-linux-x86
270253
```
271254

272-
### Manual Release Process
273-
274-
Cutting a release can also be accomplished manually by following the steps below.
275-
276-
#### Build Release Artifacts
255+
### Update Chain Spec
277256

278-
Build the release artifacts using the included script:
257+
Note: this is *only* necessary if you are deploying a new chain, the chain spec is defined at genesis.
279258

280259
```
281-
$ scripts/build_release.sh <MILESTONE TAG>
260+
$ gateway> chains/build_spec.js -r m88 -c stablenet # replace m88 with your version
282261
```
283262

284-
Where `<MILESTONE TAG>` should be a sequentially increasing counter beginning with `m`, followed by the spec version, e.g. `m7`, `m8`, `m9`.
285-
286-
#### Upload Release Artifacts
263+
### Using Github Workflows Release Process
287264

288-
The changes above should be committed to the `develop` branch and included in the version that is tagged in the repository below.
265+
Github actions have been created to respond to git tags that are pushed to the repo that begin with `m`, followed by the spec version, e.g. `m88`.
289266

290-
Draft a [new release on GitHub](https://github.com/compound-finance/gateway/releases/new).
291-
Tag it with the appropriate milestone tag.
292-
Title it in a style similar to other releases, describing its purpose.
293-
Put any other context or information describing what it does in the description.
267+
This process will create a draft / pre-release that can be modified and published on github once ready.
294268

295-
Attach the following files to the release, from the repository where you built the release artifacts:
269+
Create a tag and push to this repo:
296270

297-
```
298-
contracts.json
299-
gateway-darwin-arm64 # optional
300-
gateway-darwin-arm64.checksum # optional
301-
gateway-testnet.wasm
302-
gateway-testnet.wasm.checksum
303-
rpc.json
304-
types.json
271+
```sh
272+
$ git tag -a m88 # use your milestone tag
273+
$ git push origin m88
305274
```
306275

307-
These files should all exist in the `releases/<MILESTONE TAG>` directory of the repository you built from,
308-
you should be able to simply drag and drop them.
276+
### Contributing
309277

310-
This will, in the future, be automated by the process of merging certain release branches into the main development branch.
278+
Contributors are welcome, and will be held to a high standard. Please consider making an issue to discuss larger changes before making pull requests. All contributions will fall under the license on this repo, which **currently does not grant open permission of use**. Additionally, **you agree that your code will be subject to any license which is later attached to this repository as if it had been initially licensed thusly**.

Diff for: chains/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Then:
2525
yarn repl -c testnet
2626
```
2727

28+
Or:
29+
30+
```sh
31+
yarn repl -c stablenet
32+
```
33+
2834
This will connect you to a REPL to testnet, including to the Ethereum contracts.
2935

3036
### Repl Examples

Diff for: chains/stablenet/chain-config.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"eth_network": "goerli",
33
"base_chain": "testnet",
4-
"websocket": "wss://sarge.compound.cash",
5-
"rpc": "http://sarge-rpc.compound.cash:5000",
4+
"websocket": "wss://sally.compound.cash",
5+
"rpc": "http://sally-rpc.compound.cash:2095",
66
"validators": [
77
{
88
"substrate_id": "5H6Wzjt1nQ5aFx5E4FDVnpYDCWb1JHcQSwHgdqUyiiZUdbc9",

Diff for: docker-compose.yml

-18
This file was deleted.

Diff for: scripts/docker_run.sh

-10
This file was deleted.

0 commit comments

Comments
 (0)