Skip to content

Commit

Permalink
Test contract compiled with Rust 1.70.0
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Jun 22, 2023
1 parent 2530911 commit a2fdd07
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/vm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ docker run --rm -v "$(pwd)":/code \
&& cp artifacts/floaty.wasm packages/vm/testdata/floaty_1.2.wasm
```

The `cyberpunk_rust170.wasm` for
https://github.com/CosmWasm/cosmwasm/issues/1727 is built as follows
(non-reproducible):

```sh
cd contracts/cyberpunk
rm -r target
RUSTFLAGS='-C link-arg=-s' cargo build --release --lib --target wasm32-unknown-unknown --locked
cp target/wasm32-unknown-unknown/release/cyberpunk.wasm ../../packages/vm/testdata/cyberpunk_rust170.wasm
```

## Testing

By default, this repository is built and tested with the singlepass backend. You
Expand Down
7 changes: 7 additions & 0 deletions packages/vm/src/compatibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ mod tests {
static CONTRACT_0_14: &[u8] = include_bytes!("../testdata/hackatom_0.14.wasm");
static CONTRACT_0_15: &[u8] = include_bytes!("../testdata/hackatom_0.15.wasm");
static CONTRACT: &[u8] = include_bytes!("../testdata/hackatom.wasm");
static CONTRACT_RUST_170: &[u8] = include_bytes!("../testdata/cyberpunk_rust170.wasm");

fn default_capabilities() -> HashSet<String> {
["staking".to_string()].into_iter().collect()
Expand All @@ -274,6 +275,12 @@ mod tests {
check_wasm(CONTRACT, &default_capabilities()).unwrap();
}

#[test]
fn check_wasm_allows_sign_ext() {
// See https://github.com/CosmWasm/cosmwasm/issues/1727
check_wasm(CONTRACT_RUST_170, &default_capabilities()).unwrap();
}

#[test]
fn check_wasm_old_contract() {
match check_wasm(CONTRACT_0_15, &default_capabilities()) {
Expand Down
Binary file added packages/vm/testdata/cyberpunk_rust170.wasm
Binary file not shown.

0 comments on commit a2fdd07

Please sign in to comment.