-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjustfile
More file actions
148 lines (123 loc) · 7.53 KB
/
justfile
File metadata and controls
148 lines (123 loc) · 7.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
CARGO_ODRA_GIT_REPO := "https://github.com/odradev/cargo-odra"
CARGO_ODRA_BRANCH := "release/0.1.6"
BINARYEN_VERSION := "version_116"
BINARYEN_CHECKSUM := "c55b74f3109cdae97490faf089b0286d3bba926bb6ea5ed00c8c784fc53718fd"
set dotenv-load := true
default:
just --list
clippy:
cargo clippy --all-targets -- -D warnings --allow unexpected_cfgs
cd examples && cargo clippy --all-targets -- -D warnings --allow unexpected_cfgs
cd examples && cargo clippy --features=livenet -- -D warnings --allow unexpected_cfgs
cd modules && cargo clippy --all-targets -- -D warnings --allow unexpected_cfgs
cd benchmark && cargo clippy --all-targets -- -D warnings --allow unexpected_cfgs
cd odra-casper/proxy-caller && cargo clippy --target=wasm32-unknown-unknown -- -D warnings --allow unexpected_cfgs
lint: clippy
cargo fmt
cd odra-casper/proxy-caller && cargo fmt
check-lint: clippy
cargo fmt -- --check
cargo check --all-targets
cd odra-casper/proxy-caller && cargo fmt -- --check
install-cargo-odra:
rustup toolchain install stable
cargo +stable install cargo-odra --git {{CARGO_ODRA_GIT_REPO}} --branch {{CARGO_ODRA_BRANCH}} --locked
prepare-test-env: install-cargo-odra
rustup target add wasm32-unknown-unknown
rustup component add llvm-tools-preview
cargo +stable install grcov
sudo apt install wabt
wget https://github.com/WebAssembly/binaryen/releases/download/{{BINARYEN_VERSION}}/binaryen-{{BINARYEN_VERSION}}-x86_64-linux.tar.gz || { echo "Download failed"; exit 1; }
sha256sum binaryen-{{BINARYEN_VERSION}}-x86_64-linux.tar.gz | grep {{BINARYEN_CHECKSUM}} || { echo "Checksum verification failed"; exit 1; }
tar -xzf binaryen-{{BINARYEN_VERSION}}-x86_64-linux.tar.gz || { echo "Extraction failed"; exit 1; }
sudo cp binaryen-{{BINARYEN_VERSION}}/bin/wasm-opt /usr/local/bin/wasm-opt
start-casper-node:
docker run --rm -it --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 makesoftware/casper-nctl
build-proxy-callers:
cd odra-casper/proxy-caller && cargo build --release --target wasm32-unknown-unknown --target-dir ../../target
wasm-strip target/wasm32-unknown-unknown/release/proxy_caller.wasm
wasm-strip target/wasm32-unknown-unknown/release/proxy_caller_with_return.wasm
wasm-opt --signext-lowering target/wasm32-unknown-unknown/release/proxy_caller.wasm -o target/wasm32-unknown-unknown/release/proxy_caller.wasm
wasm-opt --signext-lowering target/wasm32-unknown-unknown/release/proxy_caller_with_return.wasm -o target/wasm32-unknown-unknown/release/proxy_caller_with_return.wasm
cp target/wasm32-unknown-unknown/release/proxy_caller.wasm \
resources/proxy_caller.wasm
cp target/wasm32-unknown-unknown/release/proxy_caller_with_return.wasm \
resources/proxy_caller_with_return.wasm
test-odra:
cargo test
test-examples-on-odravm:
cd examples && cargo odra test
cd examples/ourcoin && cargo odra test
test-examples-on-casper:
mkdir -p examples/wasm
cp modules/wasm/Erc20.wasm examples/wasm/
cd examples && cargo odra test -b casper
cd examples/ourcoin && cargo odra test -b casper
test-examples: test-examples-on-odravm test-examples-on-casper
test-modules-on-odravm:
cd modules && cargo odra test
test-modules-on-casper:
cd modules && cargo odra test -b casper
test-modules: test-modules-on-odravm test-modules-on-casper
test: test-odra test-modules test-examples
test-template name:
cd tests && cargo odra new -n {{name}} --template {{name}} -s ../ \
&& cd {{name}} \
&& cargo odra test \
&& cargo odra test -b casper \
&& cargo odra schema \
&& cargo build --bin {{name}}_cli
test-templates:
rm -rf tests
mkdir -p tests
just test-template cep18
just test-template full
just test-template workspace
just test-template cep95
run-nctl:
docker run --rm -it --cpus=1 --name mynctl -d -p 11101:11101 -p 14101:14101 -p 18101:18101 -p 25101:25101 makesoftware/casper-nctl:v203
test-livenet:
set shell := bash
mkdir -p examples/.node-keys
cp modules/wasm/Erc20.wasm examples/wasm/
# Extract the secret keys from the local Casper node
docker exec mynctl /bin/bash -c "cat /home/casper/casper-nctl/assets/net-1/users/user-1/secret_key.pem" > examples/.node-keys/secret_key.pem
docker exec mynctl /bin/bash -c "cat /home/casper/casper-nctl/assets/net-1/users/user-2/secret_key.pem" > examples/.node-keys/secret_key_1.pem
# Run the tests
# Livenet tests
cd examples && ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 ODRA_CASPER_LIVENET_EVENTS_URL=http://localhost:18101/events ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 ODRA_CASPER_LIVENET_KEY_1=.node-keys/secret_key_1.pem cargo run --bin livenet_tests --features=livenet
# Livenet tests with validators
cd examples && ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 ODRA_CASPER_LIVENET_EVENTS_URL=http://localhost:18101/events ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 ODRA_CASPER_LIVENET_KEY_1=.node-keys/secret_key_1.pem cargo run --bin validators_on_livenet --features=livenet
# Livenet tests of upgrade
cd examples && ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 ODRA_CASPER_LIVENET_EVENTS_URL=http://localhost:18101/events ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 ODRA_CASPER_LIVENET_KEY_1=.node-keys/secret_key_1.pem cargo run --bin upgrade_on_livenet --features=livenet
rm -rf examples/.node-keys
run-example-erc20-on-livenet:
set shell := bash
mkdir -p examples/.node-keys
cp modules/wasm/Erc20.wasm examples/wasm/
docker exec mynctl /bin/bash -c "cat /home/casper/casper-nctl/assets/net-1/users/user-1/secret_key.pem" > examples/.node-keys/secret_key.pem
cd examples && ODRA_CASPER_LIVENET_SECRET_KEY_PATH=.node-keys/secret_key.pem ODRA_CASPER_LIVENET_NODE_ADDRESS=http://localhost:11101 ODRA_CASPER_LIVENET_EVENTS_URL=http://localhost:18101/events ODRA_CASPER_LIVENET_CHAIN_NAME=casper-net-1 ODRA_CASPER_LIVENET_KEY_1=.node-keys/secret_key.pem cargo run --bin erc20_on_livenet --features livenet
rm -rf examples/.node-keys
clean:
cargo clean
cd examples && cargo odra clean
cd modules && cargo odra clean
rm -f Cargo.lock
cd examples && rm -f Cargo.lock
cd modules && rm -f Cargo.lock
coverage:
rm -rf target/coverage/
mkdir -p target/coverage/
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='target/coverage/cargo-test-%p-%m.profraw' cargo test
cd examples && CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='../target/coverage/cargo-test-%p-%m.profraw' cargo test
cd modules && CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='../target/coverage/cargo-test-%p-%m.profraw' cargo test
# Uncomment the following line to generate local HTML report
# grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore '../*' --ignore "/*" -o target/coverage/html
grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/tests.lcov
benchmark:
cd benchmark && cargo odra build && ODRA_BACKEND=casper cargo run --bin benchmark --features=benchmark
evaluate-benchmark: benchmark
cd benchmark && cargo run --bin evaluate_benchmark gas_report.json base/gas_report.json
generate-schemas:
cd modules && cargo odra schema
cd examples && cargo odra schema