-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Sovereign-Labs/blaze/readme_exec
Add sov-rollup-starter.sh to CI
- Loading branch information
Showing
4 changed files
with
77 additions
and
14 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,40 @@ | ||
|
||
# This is still work in progress. | ||
|
||
This package is a convenient starting point for building a rollup using the Sovereign SDK: | ||
|
||
|
||
# How to run the sov-rollup-starter: | ||
1. `cd crates/rollup/` | ||
#### 1. Change the working directory: | ||
|
||
```shell,test-ci | ||
$ cd crates/rollup/ | ||
``` | ||
|
||
2. Starting the node: | ||
#### 2. Cleanup database: | ||
```sh,test-ci | ||
$ make clean-db | ||
``` | ||
|
||
#### 3. Starting the node: | ||
If you want to run a fresh rollup remove the `rollup-starter-data` folder. | ||
This will compile and start the rollup node: | ||
|
||
```shell | ||
cargo run --bin node | ||
```shell,test-ci,bashtestmd:long-running,bashtestmd:wait-until=RPC | ||
$ cargo run --bin node | ||
``` | ||
|
||
#### 4. In another shell run: | ||
|
||
```sh,test-ci | ||
$ make test-create-token | ||
``` | ||
|
||
3. In another shell run: | ||
#### 5. Test if token creation succeeded | ||
|
||
```shell | ||
make test-create-token | ||
```sh,test-ci | ||
$ make test-bank-supply-of | ||
``` | ||
|
||
4. Test if token creation succeeded | ||
#### 6. The output of the above script: | ||
|
||
```shell | ||
make test-bank-supply-of | ||
```bash,test-ci,bashtestmd:compare-output | ||
$ curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"bank_supplyOf","params":["sov1zdwj8thgev2u3yyrrlekmvtsz4av4tp3m7dm5mx5peejnesga27svq9m72"],"id":1}' http://127.0.0.1:12345 | ||
{"jsonrpc":"2.0","result":{"amount":1000},"id":1} | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
trap 'jobs -p | xargs -r kill' EXIT | ||
echo 'Running: '\''cd crates/rollup/'\''' | ||
cd crates/rollup/ | ||
if [ $? -ne 0 ]; then | ||
echo "Expected exit code 0, got $?" | ||
exit 1 | ||
fi | ||
echo 'Running: '\''make clean-db'\''' | ||
make clean-db | ||
if [ $? -ne 0 ]; then | ||
echo "Expected exit code 0, got $?" | ||
exit 1 | ||
fi | ||
echo 'Running: '\''cargo run --bin node'\''' | ||
cargo run --bin node & | ||
sleep 20 | ||
echo 'Running: '\''make test-create-token'\''' | ||
make test-create-token | ||
if [ $? -ne 0 ]; then | ||
echo "Expected exit code 0, got $?" | ||
exit 1 | ||
fi | ||
echo 'Running: '\''make test-bank-supply-of'\''' | ||
make test-bank-supply-of | ||
if [ $? -ne 0 ]; then | ||
echo "Expected exit code 0, got $?" | ||
exit 1 | ||
fi | ||
echo 'Running: '\''curl -X POST -H "Content-Type: application/json" -d '\''{"jsonrpc":"2.0","method":"bank_supplyOf","params":["sov1zdwj8thgev2u3yyrrlekmvtsz4av4tp3m7dm5mx5peejnesga27svq9m72"],"id":1}'\'' http://127.0.0.1:12345'\''' | ||
|
||
output=$(curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"bank_supplyOf","params":["sov1zdwj8thgev2u3yyrrlekmvtsz4av4tp3m7dm5mx5peejnesga27svq9m72"],"id":1}' http://127.0.0.1:12345) | ||
expected='{"jsonrpc":"2.0","result":{"amount":1000},"id":1} | ||
' | ||
# Either of the two must be a substring of the other. This kinda protects us | ||
# against whitespace differences, trimming, etc. | ||
if ! [[ $output == *"$expected"* || $expected == *"$output"* ]]; then | ||
echo "'$expected' not found in text:" | ||
echo "'$output'" | ||
exit 1 | ||
fi | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Expected exit code 0, got $?" | ||
exit 1 | ||
fi | ||
echo "All tests passed!"; exit 0 |