Skip to content

Cannot compile contract with rust stable (cosmwasm master) #88

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

Closed
webmaster128 opened this issue Dec 21, 2019 · 4 comments
Closed

Cannot compile contract with rust stable (cosmwasm master) #88

webmaster128 opened this issue Dec 21, 2019 · 4 comments

Comments

@webmaster128
Copy link
Member

After upgrading cosmwasm and cosmwasm-vm in my contract with

diff --git a/erc20/Cargo.lock b/erc20/Cargo.lock
index 976eba7..a6f2ed3 100644
--- a/erc20/Cargo.lock
+++ b/erc20/Cargo.lock
@@ -161,8 +161,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "cosmwasm"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
+version = "0.5.2"
+source = "git+https://github.com/confio/cosmwasm?rev=a7e02c8b77f472906bb2b92c2c0406c7b01b751f#a7e02c8b77f472906bb2b92c2c0406c7b01b751f"
 dependencies = [
  "schemars 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -172,10 +172,10 @@ dependencies = [
 
 [[package]]
 name = "cosmwasm-vm"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
+version = "0.5.2"
+source = "git+https://github.com/confio/cosmwasm?rev=a7e02c8b77f472906bb2b92c2c0406c7b01b751f#a7e02c8b77f472906bb2b92c2c0406c7b01b751f"
 dependencies = [
- "cosmwasm 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cosmwasm 0.5.2 (git+https://github.com/confio/cosmwasm?rev=a7e02c8b77f472906bb2b92c2c0406c7b01b751f)",
  "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "lru 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -327,8 +327,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "erc20"
 version = "0.1.0"
 dependencies = [
- "cosmwasm 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "cosmwasm-vm 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cosmwasm 0.5.2 (git+https://github.com/confio/cosmwasm?rev=a7e02c8b77f472906bb2b92c2c0406c7b01b751f)",
+ "cosmwasm-vm 0.5.2 (git+https://github.com/confio/cosmwasm?rev=a7e02c8b77f472906bb2b92c2c0406c7b01b751f)",
  "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "schemars 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1157,8 +1157,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum const-random 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b641a8c9867e341f3295564203b1c250eb8ce6cb6126e007941f78c4d2ed7fe"
 "checksum const-random-macro 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c750ec12b83377637110d5a57f5ae08e895b06c4b16e2bdbf1a94ef717428c59"
 "checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120"
-"checksum cosmwasm 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "421795f63fb6b5b176ff9c0147d04eab4b450b3af3b9f058f9d5ee4acaff2c2b"
-"checksum cosmwasm-vm 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "82682509b316b6d033b240fcbdbc647c39c2ab85453a2bea8765f2e4187a430c"
+"checksum cosmwasm 0.5.2 (git+https://github.com/confio/cosmwasm?rev=a7e02c8b77f472906bb2b92c2c0406c7b01b751f)" = "<none>"
+"checksum cosmwasm-vm 0.5.2 (git+https://github.com/confio/cosmwasm?rev=a7e02c8b77f472906bb2b92c2c0406c7b01b751f)" = "<none>"
 "checksum cranelift-bforest 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fff04f4ad82c9704a22e753c6268cc6a89add76f094b837cefbba1c665411451"
 "checksum cranelift-codegen 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ff4a221ec1b95df4b1d20a99fec4fe92a28bebf3a815f2eca72b26f9a627485"
 "checksum cranelift-codegen-meta 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd47f665e2ee8f177b97d1f5ce2bd70f54d3b793abb26d92942bfaa4a381fe9f"
diff --git a/erc20/Cargo.toml b/erc20/Cargo.toml
index d1fd543..96578e1 100644
--- a/erc20/Cargo.toml
+++ b/erc20/Cargo.toml
@@ -28,7 +28,7 @@ cranelift = [ "cosmwasm-vm/default-cranelift"]
 singlepass = [ "cosmwasm-vm/default-singlepass"]
 
 [dependencies]
-cosmwasm = { version = "0.5.1" }
+cosmwasm = { git = "https://github.com/confio/cosmwasm", rev = "a7e02c8b77f472906bb2b92c2c0406c7b01b751f" }
 schemars = "0.5"
 serde = { version = "1.0.60", default-features = false, features = ["derive"] }
 snafu = { version = "0.5.0", default-features = false, features = ["rust_1_30"] }
@@ -38,5 +38,5 @@ hex = "0.4.0"
 wasm-bindgen = "0.2"
 
 [dev-dependencies]
-cosmwasm-vm = { version = "0.5.1", default-features = false }
+cosmwasm-vm = { git = "https://github.com/confio/cosmwasm", rev = "a7e02c8b77f472906bb2b92c2c0406c7b01b751f" }
 serde_json = "1.0"

and adapting my code according to the API changes,

  1. cargo build works
  2. cargo wasm works
  3. cargo unit-test fails to compile with
$ cargo unit-test
   Compiling dynasm v0.5.2
   Compiling wasmer-clif-fork-frontend v0.44.0
   Compiling cranelift-native v0.44.0
   Compiling wasmer-clif-fork-wasm v0.44.0
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /myhome/.cargo/registry/src/github.com-1ecc6299db9ec823/dynasm-0.5.2/src/lib.rs:1:1
  |
1 | #![feature(proc_macro_diagnostic)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /myhome/.cargo/registry/src/github.com-1ecc6299db9ec823/dynasm-0.5.2/src/lib.rs:2:1
  |
2 | #![feature(proc_macro_span)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling wasmer-clif-backend v0.11.0
   Compiling wasmer-runtime v0.11.0
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0554`.
error: could not compile `dynasm`.

where dynasm is known to work on rust nightly only.

There are two things I wonder:

  1. Why does this error occur now, even if my dynasm and wasmer-singlepass-backend entries in erc20/Cargo.lock did not change.
  2. Crate cosmwasm_vm is only used for integration tests. Why does the command cargo unit-test even need to compile it?
@webmaster128
Copy link
Member Author

The dependency tree looks as expected

$ cargo tree -p dynasm -i
dynasm v0.5.2
└── wasmer-singlepass-backend v0.11.0
    └── cosmwasm-vm v0.5.2 (https://github.com/confio/cosmwasm?rev=a7e02c8b77f472906bb2b92c2c0406c7b01b751f#a7e02c8b)
        [dev-dependencies]
        └── erc20 v0.1.0 (/myhome/opensource/cosmwasm/cosmwasm-examples/erc20)

Is there any change in https://github.com/confio/cosmwasm/compare/v0.5.1...a7e02c8b77f472906bb2b92c2c0406c7b01b751f that adds wasmer-singlepass-backend as build requirement for the unit-tests?

@webmaster128
Copy link
Member Author

I accidentally removed the , default-features = false } part of the cosmwasm-vm dependency during the upgrade. All good now :)

@ethanfrey
Copy link
Member

Yeah, singlepass is the default for the production vm (gas metering), but I swap the defaults in the contracts for easier testing on stable. Gas metering is only a secondary concern there.

@ethanfrey
Copy link
Member

Feel free to make this more explicit in the cosmwasm template repo if you think it will help others

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants