darwinia-network / darwinia

Darwinia Chain, EVM+, Polkadot parachain and integrating with XCMP.
https://darwinia.network
GNU General Public License v3.0
241 stars 49 forks source link

Error deploying contract with Hardhat #1605

Closed magecnion closed 3 weeks ago

magecnion commented 1 month ago

I'm trying to deploy a contract but I'm getting an error:

ProviderError: Create pending runtime api error: Failed to call runtime API, Execution failed: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed
WASM backtrace:
error while executing at wasm backtrace:
    0: 0x585386 - <unknown>!rust_begin_unwind
    1: 0x1a646 - <unknown>!core::panicking::panic_fmt::h916104d5f54b6e68
    2: 0x20cfb - <unknown>!core::option::expect_failed::hd86ca5d4fb9d1ec9
    3: 0x484ff8 - <unknown>!<cumulus_pallet_parachain_system::pallet::Pallet<T> as frame_support::inherent::ProvideInherent>::create_inherent::h35a0fb4a0077b731
    4: 0x2d2c48 - <unknown>!<sp_inherents::InherentData as koi_runtime::InherentDataExt>::create_extrinsics::h704a5be8f56289aa
    5: 0x34d2e1 - <unknown>!BlockBuilder_inherent_extrinsics

I'm following the guide provided.

It fails on both the Koi and Crab networks. Note that for Crab, I don't even have any funds in the account. It looks like it fails before the deployment itself.

hujw77 commented 1 month ago

Deploying a contract with the latest version of hardhat requires the use of Hardhat Ignition, and the documentation needs to be synchronized and updated. Please refer: https://hardhat.org/ignition/docs/guides/creating-modules

magecnion commented 1 month ago

Deploying a contract with the latest version of hardhat requires the use of Hardhat Ignition, and the documentation needs to be synchronized and updated. Please refer: https://hardhat.org/ignition/docs/guides/creating-modules

Hey @hujw77 I have tried by using Hardhat Ignition and I got the exact same error:

npx hardhat ignition deploy ignition/modules/Lock.js --network koi      
✔ Confirm deploy to network koi (701)? … yes

Hardhat Ignition 🚀

Deploying [ StorageModule ]

Batch #1
  Executing StorageModule#Storage...

An unexpected error occurred:

ProviderError: Create pending runtime api error: Failed to call runtime API, Execution failed: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed
WASM backtrace:
error while executing at wasm backtrace:
    0: 0x585386 - <unknown>!rust_begin_unwind
    1: 0x1a646 - <unknown>!core::panicking::panic_fmt::h916104d5f54b6e68
    2: 0x20cfb - <unknown>!core::option::expect_failed::hd86ca5d4fb9d1ec9
    3: 0x484ff8 - <unknown>!<cumulus_pallet_parachain_system::pallet::Pallet<T> as frame_support::inherent::ProvideInherent>::create_inherent::h35a0fb4a0077b731
    4: 0x2d2c48 - <unknown>!<sp_inherents::InherentData as koi_runtime::InherentDataExt>::create_extrinsics::h704a5be8f56289aa
    5: 0x34d2e1 - <unknown>!BlockBuilder_inherent_extrinsics
boundless-forest commented 1 month ago

Have you ever tried deploying your contract with other SDK tools? Do they have the same problem?

magecnion commented 1 month ago

@boundless-forest Yes, I just tried it with web3.js, and it worked: https://koi-scan.darwinia.network/address/0xc01Ee7f10EA4aF4673cFff62710E1D7792aBa8f3

magecnion commented 4 weeks ago

here there has been a similar problem, apparently related to adding the pending parameter to the EVM request. However, other error messages appeared later. Hope this helps.

boundless-forest commented 4 weeks ago

Thanks for your issue, I'll take a look later.