openethereum / sol-rs

Solaris - Solidity testing framework in Rust.
GNU General Public License v3.0
54 stars 14 forks source link

Can't compile / run tests? (wasm version mismatch?) #28

Closed axelchalon closed 6 years ago

axelchalon commented 6 years ago

Hey, so I'm working on implementing changes to ethabi right now and I would like at some point to make sure that sol-rs and the tests still work fine with the new version. However if I simply clone the sol-rs repo and run cargo test on master right now I get the following error: https://gist.github.com/axelchalon/1db3284c11adf373dbe57648120dd678. Is this expected? This is the same error as on the CI (except I also get this error for previous commits)

might be because there's no cargo.lock and stuff changed?

any pointers appreciated! cheers

tomusdrw commented 6 years ago

Yes. I think we either need to include Cargo.lock or rather better update ethcore crate to specify a revision inside ethcore/Cargo.toml within Parity repo (more hassle for wasm guys when they want to update it).

snd commented 6 years ago

running into the same problem. also for a weekend project that uses the ethcore crate.

i assume any project that has a dependency on the ethcore crate will fail to build (unless ) because of this. tried using the stable branch. didn't help.

would be great if this could get fixed so at least the following compiles:

ethcore = { git = "https://github.com/paritytech/parity.git", branch = "stable" }

stuck here. what's a temporary solution?

snd commented 6 years ago

tried with newest master and different branches. ran into different similar compilation errors. all wasm version mismatch related.

tomusdrw commented 6 years ago

The workaround is to:

  1. Create a new project that uses sol-rs as a dependency
  2. See a compilation failure
  3. Go to parity repo and check parity_wasm version in Cargo.lock
  4. Run cargo update -p parity-wasm --precise <hash-found-in-parity> in your project.
snd commented 6 years ago

what exactly do you mean by <hash-found-in-parity>? not finding any (commit) hash for parity-wasm in https://github.com/paritytech/parity/blob/master/Cargo.lock.

if i try cargo update -p parity-wasm --precise 0.25.0 i get:

error: There are multiple `parity-wasm` packages in your project, and the specification `parity-wasm` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
  parity-wasm:0.25.0
  parity-wasm:0.23.0

if i then try cargo update -p parity-wasm:0.23.0 --precise 0.25.0:

    Updating registry `https://github.com/rust-lang/crates.io-index`
error: no matching version `^0.23` found for package `parity-wasm` (required by `wasm`)
location searched: registry `https://github.com/rust-lang/crates.io-index`
versions found: 0.25.0

fresh project. only dependency is ethcore = { git = "https://github.com/paritytech/parity.git" }

tomusdrw commented 6 years ago

Weird. Just noticed that we are using a branch of parity. Made a PR: https://github.com/paritytech/parity/pull/7964

snd commented 6 years ago

PR: great!

i'm having these 2 wasm versions problems with the current master (01d9bff3cf6aca8bb436defd090090fbb5776b61) as well as the td-evm branch. previous comment was about master

tomusdrw commented 6 years ago

can you try removing Cargo.lock now? I've updated td-evm to reflect current master, so there should be only one version included now.

snd commented 6 years ago

should i try with td-evm?

snd commented 6 years ago

in current master only 0.23 is specified explicitly (https://github.com/paritytech/parity/blob/c060d9584dae34e0e215f061bd61b2ebd375956b/ethcore/wasm/Cargo.toml#L10) and locked. something else that's also using parity-wasm seems to be pulling in 0.25

snd commented 6 years ago

that something else is wasm-utils 0.1 which is locked to 0.1 in parity master and depends on parity-wasm 0.25.0 whereas the rest of parity depends on parity-wasm 0.23.0

snd commented 6 years ago

https://github.com/paritytech/wasm-utils/blob/master/Cargo.toml#L7

tomusdrw commented 6 years ago

@snd so just pin wasm-utils to previous version before this commit: https://github.com/paritytech/wasm-utils/commit/fbb5d1d7543a8143e630d6187adac4d1c839faaf

$ cargo update -p wasm-utils --precise 9e92237c4ddf136782fb1e76bddc6499ec663463

snd commented 6 years ago

@tomusdrw thanks!

using td-evm at https://github.com/paritytech/parity/commit/d06ccbb072af47ac3996681bbd205ef58d229075 resulted the same 2 versions error.

after pinning wasm-utils as you described i'm getting:

   Compiling wasm v0.1.0 (https://github.com/paritytech/parity.git?branch=td-evm#d06ccbb0)
error[E0053]: method `invoke_index` has an incompatible type for trait
   --> /Users/basilisk/.cargo/git/checkouts/parity-dc9825eb65b3adf1/d06ccbb/ethcore/wasm/src/runtime.rs:662:3
    |
662 |           fn invoke_index(
    |  _________^
663 | |             &mut self,
664 | |             index: usize,
665 | |             args: RuntimeArgs,
...   |
693 | |             }
694 | |         }
    | |_________^ expected struct `wasmi::Trap`, found enum `wasmi::Error`
    |
    = note: expected type `fn(&mut runtime::Runtime<'a>, usize, wasmi::RuntimeArgs<'_>) -> std::result::Result<std::option::Option<wasmi::RuntimeValue>, wasmi::Trap>`
               found type `fn(&mut runtime::Runtime<'a>, usize, wasmi::RuntimeArgs<'_>) -> std::result::Result<std::option::Option<wasmi::RuntimeValue>, wasmi::Error>`

error: aborting due to previous error

error: Could not compile `wasm`.
snd commented 6 years ago

that's no longer related to parity-wasm but wasmi instead. making progress. though it would be really nice if the versions of the wasm related crates would match up and be compatible with each other.

snd commented 6 years ago

this no longer seems to be an issue. keeping this open until we have master pass CI again

snd commented 6 years ago

seems resolved on https://github.com/paritytech/sol-rs/pull/31. will reopen if this appears again