Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(target_chains/starknet): automate test data generation #1587

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading