Skip to content

Commit

Permalink
hore(target_chains/starknet): automate test data generation (#1587)
Browse files Browse the repository at this point in the history
  • Loading branch information
Riateche authored May 21, 2024
1 parent f4cc195 commit 74f02c4
Show file tree
Hide file tree
Showing 10 changed files with 815 additions and 783 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci-starknet-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ jobs:
run: cargo fmt --manifest-path ./target_chains/starknet/tools/test_vaas/Cargo.toml -- --check
- name: Run clippy
run: cargo clippy --manifest-path ./target_chains/starknet/tools/test_vaas/Cargo.toml --all-targets -- --deny warnings
- name: Run wormhole_mainnet_upgrades binary
run: cargo run --manifest-path ./target_chains/starknet/tools/test_vaas/Cargo.toml --bin wormhole_mainnet_upgrades
- name: Run generate_keypair binary
run: cargo run --manifest-path ./target_chains/starknet/tools/test_vaas/Cargo.toml --bin generate_keypair
- name: Run generate_wormhole_vaas binary
run: cargo run --manifest-path ./target_chains/starknet/tools/test_vaas/Cargo.toml --bin generate_wormhole_vaas
- name: Check test data
run: |
cargo run --manifest-path ./target_chains/starknet/tools/test_vaas/Cargo.toml --bin generate_test_data > /tmp/data.cairo
if ! diff ./target_chains/starknet/contracts/tests/data.cairo /tmp/data.cairo; then
>&2 echo "Re-run generate_test_data to update data.cairo"
exit 1
fi
8 changes: 3 additions & 5 deletions target_chains/starknet/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ The `.tool-versions` file in this directory specifies the tool versions used by

Run `snforge test` in this directory to run the contract unit tests and integration tests.

Some tests contain input data that was generated with `test_vaas` tool.
To run it, use the following commands from the repository root (requires Rust installation):
The `tests/data.cairo` file contains input data that was generated with `test_vaas` tool.
To regenerate it, run the following commands from the repository root (requires Rust installation):

```
cd target_chains/starknet/tools/test_vaas
cargo run --bin re_sign_price_updates
cargo run --bin generate_wormhole_vaas
cargo run --bin wormhole_mainnet_upgrades
cargo run --bin generate_test_data > ../../contracts/tests/data.cairo
```

## Formatting
Expand Down
450 changes: 450 additions & 0 deletions target_chains/starknet/contracts/tests/data.cairo

Large diffs are not rendered by default.

243 changes: 20 additions & 223 deletions target_chains/starknet/contracts/tests/pyth.cairo

Large diffs are not rendered by default.

316 changes: 20 additions & 296 deletions target_chains/starknet/contracts/tests/wormhole.cairo

Large diffs are not rendered by default.

275 changes: 275 additions & 0 deletions target_chains/starknet/tools/test_vaas/src/bin/generate_test_data.rs

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 74f02c4

Please sign in to comment.