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

Type errors in compiling plasm-runtime v1.9.3 #300

Closed
VadneyK opened this issue May 21, 2021 · 5 comments
Closed

Type errors in compiling plasm-runtime v1.9.3 #300

VadneyK opened this issue May 21, 2021 · 5 comments

Comments

@VadneyK
Copy link
Contributor

VadneyK commented May 21, 2021

Describe the bug
Trying to compile this repo but the Type errors in plasm-runtime v1.9.3 are preventing me

To Reproduce

  1. clone this repo (recursively download frontier)
  2. cd Plasm
  3. cargo build --release

Expected behavior
compile with no error

Screenshots
Error Message:
Screen Shot 2021-05-21 at 12 39 31 PM
Screen Shot 2021-05-21 at 12 39 42 PM
Screen Shot 2021-05-21 at 12 39 51 PM

Desktop (please complete the following information):

  • OS: MacOS BigSur ver 11.2.3 M1 chip
  • Browser [e.g. chrome, safari] Brave Browser
  • Rust Tooltip Config:

Screen Shot 2021-05-21 at 4 06 38 PM

Additional context

@realtakahashi
Copy link

I can compile correctly. My environment is following.
OS: macOS Big Sur MacBook Pro 2020, Two Thunderbolt

% rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/shin.takahashi/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin (default)
nightly-2020-04-06-x86_64-apple-darwin
nightly-x86_64-apple-darwin

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-apple-darwin

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.52.1 (9bc8c42bb 2021-05-09)

@realtakahashi
Copy link

rustup install nightly-2021-05-22 
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-05-22-x86_64-apple-darwin
 mv ~/.rustup/toolchains/nightly-2021-05-22-x86_64-apple-darwin ~/.rustup/toolchains/nightly-x86_64-apple-darwin
cargo +nightly build --release

@VadneyK
Copy link
Contributor Author

VadneyK commented May 25, 2021

I ran :
`
rustup install nightly-2021-05-22

rustup target add wasm32-unknown-unknown --toolchain nightly-2021-05-22-aarch64-apple-darwin

mv ~/.rustup/toolchains/nightly-2021-05-22-aarch64-apple-darwin ~/.rustup/toolchains/nightly-aarch64-apple-darwin

cargo +nightly build --release
`

but I still get :

Screen Shot 2021-05-24 at 5 04 25 PM

I think my issue is that I have the wrong frontier file. When I download clone this repo It doesn't automatically recursively install the file link so I go to frontier @ 5c2c9a5 and git clone the frontier folder in the vendor folder.

here is my rust config:

Screen Shot 2021-05-24 at 5 07 45 PM

and even after adding 'use alloc::format' in
/Users/kentarovadney/Desktop/code/Plasm/vendor/frontier/frame/evm/precompile/modexp/src/lib.rs
as recommended, I get:

Compiling sp-npos-elections v3.0.0 Compiling substrate-prometheus-endpoint v0.9.0 Compiling hyper-rustls v0.21.0 error: failed to run custom build command forplasm-runtime v1.9.3 (/Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime)`

Caused by:
process didn't exit successfully: /Users/kentarovadney/Desktop/code/Plasm/target/debug/build/plasm-runtime-4e1f14bb9b77edb6/build-script-build (exit status: 1)
--- stdout
Executing build command: "/Users/kentarovadney/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/Users/kentarovadney/Desktop/code/Plasm/target/debug/wbuild/plasm-runtime/Cargo.toml" "--color=always" "--release"

--- stderr
Compiling wasm-build-runner-impl v1.0.0 (/Users/kentarovadney/Desktop/code/Plasm/target/debug/wbuild-runner/plasm-runtime5118081892803062445)
Finished dev [unoptimized + debuginfo] target(s) in 0.86s
Running /Users/kentarovadney/Desktop/code/Plasm/target/debug/wbuild-runner/plasm-runtime5118081892803062445/target/aarch64-apple-darwin/debug/wasm-build-runner-impl
warning: Patch sc-client-api v3.0.0 was not used in the crate graph.
Patch sc-finality-grandpa v0.9.0 was not used in the crate graph.
Patch sc-network v0.9.0 was not used in the crate graph.
Patch sc-service v0.9.0 was not used in the crate graph.
Patch sp-blockchain v3.0.0 was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run cargo update to use the new
version. This may also occur with an optional dependency that is not enabled.
Compiling sp-runtime v3.0.0
Compiling pallet-evm-precompile-modexp v3.0.0 (/Users/kentarovadney/Desktop/code/Plasm/vendor/frontier/frame/evm/precompile/modexp)
Compiling sp-version v3.0.0
Compiling sp-staking v3.0.0
Compiling sp-authorship v3.0.0
Compiling pallet-contracts-primitives v3.0.0
Compiling sp-consensus-vrf v0.9.0
Compiling sp-consensus-slots v0.9.0
Compiling fp-consensus v0.1.0 (/Users/kentarovadney/Desktop/code/Plasm/vendor/frontier/primitives/consensus)
Compiling frame-support v3.0.0
Compiling sp-api v3.0.0
Compiling sp-timestamp v3.0.0
Compiling sp-session v3.0.0
Compiling sp-finality-grandpa v3.0.0
Compiling fp-rpc v0.1.0 (/Users/kentarovadney/Desktop/code/Plasm/vendor/frontier/primitives/rpc)
Compiling sp-transaction-pool v3.0.0
Compiling pallet-contracts-rpc-runtime-api v3.0.0
Compiling sp-offchain v3.0.0
Compiling sp-block-builder v3.0.0
Compiling frame-system-rpc-runtime-api v3.0.0
Compiling sp-consensus-babe v0.9.0
Compiling frame-system v3.0.0
Compiling pallet-timestamp v3.0.0
Compiling pallet-authorship v3.0.0
Compiling pallet-balances v3.0.0
Compiling pallet-contracts v3.0.0
Compiling pallet-transaction-payment v3.0.0
Compiling pallet-sudo v3.0.0
Compiling frame-executive v3.0.0
Compiling pallet-utility v3.0.0
Compiling plasm-primitives v1.9.3 (/Users/kentarovadney/Desktop/code/Plasm/bin/node/primitives)
Compiling pallet-randomness-collective-flip v3.0.0
Compiling pallet-scheduler v3.0.0
Compiling pallet-nicks v3.0.0
Compiling pallet-indices v3.0.0
Compiling pallet-custom-signatures v1.9.0 (/Users/kentarovadney/Desktop/code/Plasm/frame/custom-signatures)
Compiling pallet-session v3.0.0
Compiling pallet-transaction-payment-rpc-runtime-api v3.0.0
Compiling pallet-evm v3.0.0 (/Users/kentarovadney/Desktop/code/Plasm/vendor/frontier/frame/evm)
Compiling pallet-offences v3.0.0
Compiling pallet-im-online v3.0.0
Compiling pallet-ethereum v0.1.0 (/Users/kentarovadney/Desktop/code/Plasm/vendor/frontier/frame/ethereum)
warning: unused variable: n
--> /Users/kentarovadney/Desktop/code/Plasm/vendor/frontier/frame/ethereum/src/lib.rs:213:20
|
213 | fn on_initialize(n: T::BlockNumber) -> Weight {
| ^ help: if this is intentional, prefix it with an underscore: _n
|
= note: #[warn(unused_variables)] on by default

warning: unused variable: n
--> /Users/kentarovadney/Desktop/code/Plasm/vendor/frontier/frame/ethereum/src/lib.rs:209:18
|
209 | fn on_finalize(n: T::BlockNumber) {
| ^ help: if this is intentional, prefix it with an underscore: _n

warning: 2 warnings emitted

 Compiling pallet-plasm-operator v1.10.0 (/Users/kentarovadney/Desktop/code/Plasm/frame/plasm-operator)
 Compiling pallet-staking v3.0.0
 Compiling pallet-babe v3.0.0
 Compiling pallet-grandpa v3.0.0
 Compiling pallet-plasm-rewards v1.9.0 (/Users/kentarovadney/Desktop/code/Plasm/frame/plasm-rewards)
 Compiling pallet-plasm-validator v1.9.0 (/Users/kentarovadney/Desktop/code/Plasm/frame/plasm-validator)
 Compiling plasm-runtime v1.9.3 (/Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime)

error[E0053]: method execute has an incompatible type for trait
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:22:18
|
22 | context: &Context,
| ^^^^^^^^
| |
| expected struct evm_runtime::context::Context, found struct evm::Context
| help: change the parameter type to match the trait: &evm_runtime::context::Context
|
= note: expected fn pointer fn(sp_core::H160, &[u8], Option<_>, &evm_runtime::context::Context) -> Option<Result<(pallet_evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), pallet_evm::ExitError>>
found fn pointer fn(sp_core::H160, &[u8], Option<_>, &evm::Context) -> Option<Result<(evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), evm::ExitError>>

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:26:77
|
26 | a if a == hash(1) => Some(ECRecover::execute(input, target_gas, context)),
| ^^^^^^^ expected struct evm_runtime::context::Context, found struct evm::Context
|
= note: expected reference &evm_runtime::context::Context
found reference &evm::Context
= note: perhaps two different versions of crate evm_runtime are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:26:39
|
26 | a if a == hash(1) => Some(ECRecover::execute(input, target_gas, context)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum evm::ExitSucceed, found enum pallet_evm::ExitSucceed
|
= note: expected enum Result<(evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), evm::ExitError>
found enum Result<(pallet_evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), pallet_evm::ExitError>
= note: perhaps two different versions of crate evm_core are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:27:74
|
27 | a if a == hash(2) => Some(Sha256::execute(input, target_gas, context)),
| ^^^^^^^ expected struct evm_runtime::context::Context, found struct evm::Context
|
= note: expected reference &evm_runtime::context::Context
found reference &evm::Context
= note: perhaps two different versions of crate evm_runtime are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:27:39
|
27 | a if a == hash(2) => Some(Sha256::execute(input, target_gas, context)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum evm::ExitSucceed, found enum pallet_evm::ExitSucceed
|
= note: expected enum Result<(evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), evm::ExitError>
found enum Result<(pallet_evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), pallet_evm::ExitError>
= note: perhaps two different versions of crate evm_core are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:28:77
|
28 | a if a == hash(3) => Some(Ripemd160::execute(input, target_gas, context)),
| ^^^^^^^ expected struct evm_runtime::context::Context, found struct evm::Context
|
= note: expected reference &evm_runtime::context::Context
found reference &evm::Context
= note: perhaps two different versions of crate evm_runtime are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:28:39
|
28 | a if a == hash(3) => Some(Ripemd160::execute(input, target_gas, context)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum evm::ExitSucceed, found enum pallet_evm::ExitSucceed
|
= note: expected enum Result<(evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), evm::ExitError>
found enum Result<(pallet_evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), pallet_evm::ExitError>
= note: perhaps two different versions of crate evm_core are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:29:76
|
29 | a if a == hash(4) => Some(Identity::execute(input, target_gas, context)),
| ^^^^^^^ expected struct evm_runtime::context::Context, found struct evm::Context
|
= note: expected reference &evm_runtime::context::Context
found reference &evm::Context
= note: perhaps two different versions of crate evm_runtime are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:29:39
|
29 | a if a == hash(4) => Some(Identity::execute(input, target_gas, context)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum evm::ExitSucceed, found enum pallet_evm::ExitSucceed
|
= note: expected enum Result<(evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), evm::ExitError>
found enum Result<(pallet_evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), pallet_evm::ExitError>
= note: perhaps two different versions of crate evm_core are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:30:74
|
30 | a if a == hash(5) => Some(Modexp::execute(input, target_gas, context)),
| ^^^^^^^ expected struct evm_runtime::context::Context, found struct evm::Context
|
= note: expected reference &evm_runtime::context::Context
found reference &evm::Context
= note: perhaps two different versions of crate evm_runtime are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:30:39
|
30 | a if a == hash(5) => Some(Modexp::execute(input, target_gas, context)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum evm::ExitSucceed, found enum pallet_evm::ExitSucceed
|
= note: expected enum Result<(evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), evm::ExitError>
found enum Result<(pallet_evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), pallet_evm::ExitError>
= note: perhaps two different versions of crate evm_core are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:31:76
|
31 | a if a == hash(6) => Some(Bn128Add::execute(input, target_gas, context)),
| ^^^^^^^ expected struct evm_runtime::context::Context, found struct evm::Context
|
= note: expected reference &evm_runtime::context::Context
found reference &evm::Context
= note: perhaps two different versions of crate evm_runtime are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:31:39
|
31 | a if a == hash(6) => Some(Bn128Add::execute(input, target_gas, context)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum evm::ExitSucceed, found enum pallet_evm::ExitSucceed
|
= note: expected enum Result<(evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), evm::ExitError>
found enum Result<(pallet_evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), pallet_evm::ExitError>
= note: perhaps two different versions of crate evm_core are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:32:76
|
32 | a if a == hash(7) => Some(Bn128Mul::execute(input, target_gas, context)),
| ^^^^^^^ expected struct evm_runtime::context::Context, found struct evm::Context
|
= note: expected reference &evm_runtime::context::Context
found reference &evm::Context
= note: perhaps two different versions of crate evm_runtime are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:32:39
|
32 | a if a == hash(7) => Some(Bn128Mul::execute(input, target_gas, context)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum evm::ExitSucceed, found enum pallet_evm::ExitSucceed
|
= note: expected enum Result<(evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), evm::ExitError>
found enum Result<(pallet_evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), pallet_evm::ExitError>
= note: perhaps two different versions of crate evm_core are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:33:80
|
33 | a if a == hash(8) => Some(Bn128Pairing::execute(input, target_gas, context)),
| ^^^^^^^ expected struct evm_runtime::context::Context, found struct evm::Context
|
= note: expected reference &evm_runtime::context::Context
found reference &evm::Context
= note: perhaps two different versions of crate evm_runtime are being used?

error[E0308]: mismatched types
--> /Users/kentarovadney/Desktop/code/Plasm/bin/node/runtime/src/precompiles.rs:33:39
|
33 | a if a == hash(8) => Some(Bn128Pairing::execute(input, target_gas, context)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum evm::ExitSucceed, found enum pallet_evm::ExitSucceed
|
= note: expected enum Result<(evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), evm::ExitError>
found enum Result<(pallet_evm::ExitSucceed, hidden_include::dispatch::Vec<_>, _), pallet_evm::ExitError>
= note: perhaps two different versions of crate evm_core are being used?

error: aborting due to 17 previous errors

Some errors have detailed explanations: E0053, E0308.
For more information about an error, try rustc --explain E0053.
error: could not compile plasm-runtime

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
`

@VadneyK
Copy link
Contributor Author

VadneyK commented May 25, 2021

not sure what the issue was but I removed the folder and reinstalled via:
cargo +nightly install --locked --force --git https://github.com/staketechnologies/Plasm --tag v1.9.0-dusty plasm

and I get a very long error.
This seems to from an incompatibility of M1 chip and librocksdb-sys v6.11.4, which is fixed in 6.17.3
rust-rocksdb/rust-rocksdb#503

but the Cargo.lock requires the most up to date 6.17.3 version so I'm confused as to why it's installing librocksdb-sys v6.11.4

Screen Shot 2021-05-24 at 5 56 11 PM

@VadneyK
Copy link
Contributor Author

VadneyK commented May 25, 2021

Not sure why but

cargo +nightly install --locked --force --git https://github.com/staketechnologies/Plasm then plasm did the trick!

@VadneyK VadneyK closed this as completed May 25, 2021
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