Skip to content

Commit 50d0b6f

Browse files
authored
Merge pull request #1743 from CosmWasm/sign_ext
Allow sign extension Wasm opcodes in static validation
2 parents 2530911 + 54f32f4 commit 50d0b6f

File tree

5 files changed

+22
-1
lines changed

5 files changed

+22
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ and this project adheres to
1919
- cosmwasm-vm: Add `Cache::save_wasm_unchecked` to save Wasm blobs that have
2020
been checked before. This is useful for state-sync where we know the Wasm code
2121
was checked when it was first uploaded. ([#1635])
22+
- cosmwasm-vm: Allow sign extension Wasm opcodes in static validation. This
23+
allows contracts to be compiled with Rust 1.70.0 and above. ([#1727])
2224

2325
[#1635]: https://github.com/CosmWasm/cosmwasm/pull/1635
2426
[#1647]: https://github.com/CosmWasm/cosmwasm/pull/1647
2527
[#1684]: https://github.com/CosmWasm/cosmwasm/pull/1684
2628
[#1687]: https://github.com/CosmWasm/cosmwasm/pull/1687
29+
[#1727]: https://github.com/CosmWasm/cosmwasm/issues/1727
2730

2831
### Changed
2932

packages/vm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ crc32fast = "1.3.2"
4545
cosmwasm-std = { path = "../std", version = "1.2.7", default-features = false }
4646
cosmwasm-crypto = { path = "../crypto", version = "1.2.7" }
4747
hex = "0.4"
48-
parity-wasm = "0.45"
48+
parity-wasm = { version = "0.45", features = ["sign_ext"] }
4949
schemars = "0.8.3"
5050
serde = { version = "1.0.103", default-features = false, features = ["derive", "alloc"] }
5151
serde_json = "1.0.40"

packages/vm/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ docker run --rm -v "$(pwd)":/code \
7575
&& cp artifacts/floaty.wasm packages/vm/testdata/floaty_1.2.wasm
7676
```
7777

78+
The `cyberpunk_rust170.wasm` for
79+
https://github.com/CosmWasm/cosmwasm/issues/1727 is built as follows
80+
(non-reproducible):
81+
82+
```sh
83+
cd contracts/cyberpunk
84+
rm -r target
85+
RUSTFLAGS='-C link-arg=-s' cargo build --release --lib --target wasm32-unknown-unknown --locked
86+
cp target/wasm32-unknown-unknown/release/cyberpunk.wasm ../../packages/vm/testdata/cyberpunk_rust170.wasm
87+
```
88+
7889
## Testing
7990

8091
By default, this repository is built and tested with the singlepass backend. You

packages/vm/src/compatibility.rs

+7
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ mod tests {
263263
static CONTRACT_0_14: &[u8] = include_bytes!("../testdata/hackatom_0.14.wasm");
264264
static CONTRACT_0_15: &[u8] = include_bytes!("../testdata/hackatom_0.15.wasm");
265265
static CONTRACT: &[u8] = include_bytes!("../testdata/hackatom.wasm");
266+
static CONTRACT_RUST_170: &[u8] = include_bytes!("../testdata/cyberpunk_rust170.wasm");
266267

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

278+
#[test]
279+
fn check_wasm_allows_sign_ext() {
280+
// See https://github.com/CosmWasm/cosmwasm/issues/1727
281+
check_wasm(CONTRACT_RUST_170, &default_capabilities()).unwrap();
282+
}
283+
277284
#[test]
278285
fn check_wasm_old_contract() {
279286
match check_wasm(CONTRACT_0_15, &default_capabilities()) {
193 KB
Binary file not shown.

0 commit comments

Comments
 (0)