Skip to content

Commit

Permalink
[upgrades] fix upgrade script generation and patch final smoke tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally authored Sep 14, 2023
1 parent 2593c98 commit 04a9e8d
Show file tree
Hide file tree
Showing 75 changed files with 3,129 additions and 3,074 deletions.
1 change: 0 additions & 1 deletion .github/workflows/cleanliness.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
clippy:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
- name: setup env
uses: ./.github/actions/build_env
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
"cwd": "${workspaceFolder}"
},
{
"name": "aptos-node",
"name": "diem-node",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/target/debug/aptos-node",
"program": "${workspaceFolder}/target/debug/diem-node",
"args": [
"test"
],
Expand Down
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ diem-sdk = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "r
diem-config = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-crypto = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-genesis = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-global-constants = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-keygen = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-logger = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-types = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
Expand Down
91 changes: 60 additions & 31 deletions docs/core_devs/dev_quick_start.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,94 @@
# 0L
# Libra Dev Quick Start
## TL;DR

A reference implementation of a neutral replicated state machine. Forked from the Libra/Diem technologies.
* You need our fork of diem before working on `libra-framework`
```
git clone https://github.com/0LNetworkCommunity/diem -b release --single-branch
```


* compile `diem` and `diem-node` to `$HOME/.cargo/bin`

## Dev Quick Start
```
cargo build --profile cli -p diem -p diem-node --target-dir ~/.cargo/bin
# make them executable
chmod +x ~/.cargo/diem
chmod +x ~/.cargo/diem-node
```
* export these env vars in your dev env, `~/.bashrc` or `~/.zshrc`

```
export RUST_MIN_STACK=104857600
export DIEM_FORGE_NODE_BIN_PATH="$HOME/.cargo/bin/diem-node"
```
## Set up environment

### Set up environment
You should have two repos that you are working with. This one `libra-framework`, as well as `diem`. We'll need to build some executables from diem and install them on your dev machine.

You should have two repos that you are working with. This one `libra-v7`, as well as `zapatos`. We'll need some executables from zapatos.
### Get the DIEM dependencies

#### check env
You need our fork of diem before working on `libra-framework`
```
git clone https://github.com/0LNetworkCommunity/diem -b release --single-branch
```
### check env
This assumes that you have a `~/.cargo/bin` which is added to your environment's $PATH.

Export the path to your `zapatos` source, to make this easier.
### build executables
You want to create a `diem` executable so you can run the `move` cli with the framework changes.

`export ZAPATOS="~/path/to/source"`
#### build executables
You want to create a `zapatos` executable so you can run the `move` cli with the framework changes.
You'll want `diem` (cli for move tests), `diem-node` (for smoke tests only).

You'll want `aptos` (cli for move tests), `aptos-framework` (framework compiler), `aptos-node` (for smoke tests only).
Note that the `--profile cli` compilation profile makes for much smaller binaries (e.g. `diem` goes from about 2GB to 30MB).

```
cd $ZAPATOS
cargo build --release -p aptos-framework -p aptos -p aptos-node --target-dir ~/.cargo/bin
cd ~/.cargo/bin
mv aptos-framework zapatos-framework
mv aptos zapatos
cargo build --profile cli -p diem -p diem-node --target-dir ~/.cargo/bin
# see you tomorrow.
# next day, make them executable.
chmod +x ~/.cargo/diem
chmod +x ~/.cargo/diem-node
```

Just check those executables appear in your path.
`which zapatos`
`which diem`

Now you can run commands as below.
## Run Move Tests
## Running Move unit tests
Change into a Move project dir (i.e., the directory with a Move.toml).

`zapatos move test`
`diem move test`


optionally with filters:

`zapatos move test -f`
`diem move test -f`

## Build a release (.mrb)
## Build a libra framework release for smoke tests (head.mrb)

Make sure you are in the root of `libra-v7`.

`zapatos-framework custom --packages ./ol-framework --rust-bindings "" --output ./ol-framework/releases/head.mrb
```
cd ./framework
cargo run release
Your release will be in head.mrb, you will need this for genesis and smoke tests.
```

Your release will be in `./releases/head.mrb`, you will need this for genesis and smoketests.

## Run smoke tests
Note for smoke tests: you must regenerate the .mrb file, EVERYTIME YOU MAKE A CHANGE TO CORE MOVE CODE. Otherwise your tests will be against the old code

Quickstart: Use the bash script `. ./util/smoke.sh`
## running smoke tests

Do it yourself:
Make sure you are in the root of `libra-v7`.
Make sure you are in the root of the project.

```
cd smoke-tests
export MRB_PATH="<path/to>/ol-framework/releases/head.mrb"
export ZAPATOS_BIN_PATH=~/.cargo/bin/
Note: there is an issue with the rust default stack size for tests which involve compiling, and then starting a local testnet

```
cd ./smoke-tests
export RUST_MIN_STACK=104857600
export DIEM_FORGE_NODE_BIN_PATH="$HOME/.cargo/bin/diem-node"
cargo test
```
Expand Down
36 changes: 36 additions & 0 deletions docs/core_devs/governance_fixtures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Governance fixtures

To test governance scripts and framework upgrade we place
tests in `tools/txs/tests` and fixture scripts in `tools/txs/tests/fixtures`.

To generate these fixtures we use the `libra-framework cli`.

## generate a noop governance script

1. A template Move script package must exist. The CLI can create a template.

```
cd libra-framework
cargo r governance --output-dir ../tools/txs/tests/fixtures --framework-local-dir ./libra-framework --only-make-template
```

2. Don't make changes to this file. It should compile as-is. Run the cli tool again.
```
cd libra-framework
cargo r governance --output-dir ../tools/txs/tests/fixtures --framework-local-dir ./libra-framework
```

3. check the files are as expected
You should have
```
../tools/txs/tests/fixtures/governance_script_template/
|
+ - /sources/
| |
| +-- governance_script_template.move
+ - Move.toml
+ - script_sha3 // hash of the script needed for authorization
+ - script.mv // compiled script which is submitted
```

You're done.
64 changes: 0 additions & 64 deletions docs/txs.md

This file was deleted.

1 change: 1 addition & 0 deletions framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rust-version = { workspace = true }
anyhow = { workspace = true }
bcs = { workspace = true }
clap = { workspace = true }
dialoguer = { workspace = true }
hex = { workspace = true }
once_cell = { workspace = true }

Expand Down
1 change: 0 additions & 1 deletion framework/libra-framework/doc_template/references.md
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
[move-book]: https://aptos.dev/guides/move-guides/book/SUMMARY
Loading

0 comments on commit 04a9e8d

Please sign in to comment.