polkadot-evm / frontier

Ethereum compatibility layer for Substrate.
Apache License 2.0
567 stars 480 forks source link

How to import `pallet-evm` & `pallet-ethereum` with default-features disabled. #1486

Open vatsa287 opened 1 month ago

vatsa287 commented 1 month ago

Question

I am trying to import pallet-evm & pallet-ethereum as below.

pallet-evm = { git = "https://github.com/polkadot-evm/frontier", default-features = false, branch = "polkadot-v1.11.0"}
pallet-ethereum = { git = "https://github.com/polkadot-evm/frontier", default-features = false, branch = "polkadot-v1.11.0"}

But it seems that even after setting default-features=false. It still pulls the underlying dependecies, example sp-io, frame-support etc. Which are already declared in my toml file with version v1.15.0.

I see in Cargo.lock that 2 names of packages exist, one of which is coming from here.

How to disable such flow?

Thanks.!

boundless-forest commented 1 month ago

You'd better not mix the dependencies in your repo, whether using GitHub branches or crate versions. I suggest changing all of them to GitHub branches, as I have never tested the crate versions yet.

vatsa287 commented 1 month ago

@boundless-forest Those are coming from Github branch of polkadot-sdk, not importing crates directly.

Many packages which are dependencies of pallet-evm are getting loaded again.

Example:

  error[E0152]: duplicate lang item in crate `sp_io` (which `frame_support` depends on): `panic_impl`.
    |
    = note: the lang item is first defined in crate `sp_io` (which `sp_application_crypto` depends on)
    = note: first definition in `sp_io` loaded from /Users/vatsa/cord/target/release/wbuild/cord-braid-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-2ab5cbca6b12f779.rmeta
    = note: second definition in `sp_io` loaded from /Users/vatsa/cord/target/release/wbuild/cord-braid-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-f6db557f37b91e30.rmeta
boundless-forest commented 1 month ago

Would you be willing to share your code base? It's difficult to identify the issue based on the information provided above.

vatsa287 commented 1 month ago

@boundless-forest https://github.com/dhiway/cord is the substrate based chain for which I am building Ethereum capability. It is based on polkadot-v1.15.0 for all.

I have added below into root Cargo.toml

pallet-evm = { git = "https://github.com/polkadot-evm/frontier", default-features = false, branch = "polkadot-v1.11.0"}
pallet-ethereum = { git = "https://github.com/polkadot-evm/frontier", default-features = false, branch = "polkadot-v1.11.0"}

Then below into runtime's Cargo.toml dependencies and into std.

pallet-evm = { workspace = true, optional = true }
pallet-ethereum = { workspace = true, optional = true }

But not able to compile.