`paint_evm :: Event` не реализован для` Event` - PullRequest
1 голос
/ 21 ноября 2019

После добавления модуля к вашей среде выполнения я пытаюсь реализовать черту Parity Substrate paint-evm для Dothereum Runtime .

Согласно моей предыдущей работе: Как реализовать черту EVM для среды выполнения субстрата?

Я реализовал черту EVM для среды выполнения Dothereum:

// Implement the EVM Trait for the Dothereum Runtime.
impl evm::Trait for Runtime {
    type FeeCalculator = FixedGasPrice;
    type ConvertAccountId = TruncatedAccountId;
    type Currency = Balances;
    type Event = Event;
    type Precompiles = ();
}

Однако черта paint_evm::Event не реализована для Event:

error: failed to run custom build command for `dothereum-runtime v0.2.2 (/home/user/.opt/dothereum/runtime)`

Caused by:
  process didn't exit successfully: `/home/user/.opt/dothereum/target/debug/build/dothereum-runtime-54902422e823ba8e/build-script-build` (exit code: 1)
--- stdout
Executing build command: "rustup" "run" "nightly" "cargo" "build" "--target=wasm32-unknown-unknown" "--manifest-path=/home/user/.opt/dothereum/target/debug/wbuild/dothereum-runtime/Cargo.toml"

--- stderr
    Blocking waiting for file lock on package cache
   Compiling wasm-build-runner-impl v1.0.0 (/home/user/.opt/dothereum/target/debug/wbuild-runner/dothereum-runtime)
    Finished dev [unoptimized + debuginfo] target(s) in 1.62s
     Running `/home/user/.opt/dothereum/target/debug/wbuild-runner/dothereum-runtime/target/debug/wasm-build-runner-impl`
   Compiling dothereum-runtime v0.2.2 (/home/user/.opt/dothereum/runtime)
error[E0277]: the trait bound `Event: core::convert::From<paint_evm::Event>` is not satisfied
   --> /home/user/.opt/dothereum/runtime/src/lib.rs:255:2
    |
251 | impl evm::Trait for Runtime {
    | --------------------------- in this `impl` item
...
255 |     type Event = Event;
    |     ^^^^^^^^^^^^^^^^^^^ the trait `core::convert::From<paint_evm::Event>` is not implemented for `Event`
    |
    = help: the following implementations were found:
              <Event as core::convert::From<paint_balances::RawEvent<substrate_primitives::crypto::AccountId32, u128, paint_balances::DefaultInstance>>>
              <Event as core::convert::From<paint_grandpa::Event>>
              <Event as core::convert::From<paint_indices::RawEvent<substrate_primitives::crypto::AccountId32, u32>>>
              <Event as core::convert::From<paint_sudo::RawEvent<substrate_primitives::crypto::AccountId32>>>
              <Event as core::convert::From<paint_system::Event>>

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `dothereum-runtime`.

To learn more, run the command again with --verbose.

Что ожидает модуль paint_evm здесь. Как это можно заменить?

1 Ответ

1 голос
/ 22 ноября 2019

Ошибка здесь вводит в заблуждение. Настоящая проблема здесь в том, что вы не поместили модуль EVM в свой макрос construct_runtime!.

Вам нужно добавить эту строку к вам construct_runtime! определение:

EVM: evm::{Module, Call, Storage, Config, Event},

Чтобы объяснитьчуть более подробно, макрос construct_runtime! будет реализовывать черту core::convert::From<YOUR_MODULE::Event> для каждого из YOUR_MODULE s. Поскольку вы не включили свой модуль в макрос, он не генерирует реализацию черты, и вы получаете сообщение об ошибке, которое вы видите здесь.

Вот почему вы видите сообщение об ошибке, предлагающее вам все другие модули, которыеРеализуйте эту черту просто потому, что они включены в ваш construct_runtime!.

Как только вы добавите эту строку, вы пройдете мимо ошибки, показанной здесь, и найдете все ошибки real , связанные с другими частями вашей конфигурации.

...