1

I can deploy a few Ethereum smart contracts into my parachain via Hardhat.

But those are only normal contracts. All the upgradeable contracts and ERC777 contract cannot be deployed with the ExhaustsResources error:

ProviderError: submit transaction to pool failed: 
Pool(InvalidTransaction(InvalidTransaction::ExhaustsResources))

Reference: https://wiki.polkadot.network/docs/maintain-errors.

my hardhat.config.ts

const config: HardhatUserConfig = {
  defaultNetwork: "hardhat",
  networks: {
    parachain: {
      url: `${PARACHAIN_CHAIN_URL}`,
      chainId: 1345,
      //gasPrice:...//causes Payment error
      gas: 25e6,//these also work: 7e6, 2e6
      accounts: {
        mnemonic: `${MNEMONIC}`,
        path: "m/44'/60'/0'/0",
        initialIndex: 0,
        count: 20,
        passphrase: "",
      },
    },
    rinkeby: {
      url: `https://rinkeby.infura.io/v3/${INFURA_API_KEY}`,
      chainId: 4,
      gasPrice: ethers.utils.parseUnits("20", "gwei").toNumber(),
      gas: 25e6,
      accounts: [`0x${OWNERPK}`, `0x${USER1PK}`, `0x${USER2PK}`],
    },
  },
};

I can run the same deployment script to deploy contracts to Rinkeby network, but why the same script cannot deploy upgradeable and ERC777 contracts to my parachain???

I suspect my parachain has certain limitations on deployment sizes...

  • Where is that set?
  • How can I increase such limitation?
1

2 Answers 2

1

BlockWeights was set here.

Tips:

If you have sudo pallet on your chain. You could try sudo_unchecked_weight. To verify if this is the root cause.

1
  • I can go to Polkadot.js > Developer > Sudo > SudoUncheckedWeight(call, weight) ... then there are so many different options for function names. What should I do?
    – Russo
    Jul 28, 2022 at 9:01
0

It turns out to be the problem of the deployer Hardhat!

See this post: How to add Frontier code as a dependency to substrate-parachain-template based parachain?

All the upgradeable contracts and ERC777 could not be deployed because Hardhat was running too fast and that overwhelmed my parachain, hence "ExhaustsResources" error!

Now I can deploy all my upgradeable contracts and ERC777(deploy ERC1820 first!) via Hardhat or Truffle.

my hardhat.config.ts:

const config: HardhatUserConfig = {
  defaultNetwork: "hardhat",
  networks: {
    parachain: {
      url: `${PARACHAIN_EVM_ENDPOINT}`,
      chainId: 1234,
      //gasPrice: 0,
      //gasPrice: ethers.utils.parseUnits("1", "gwei").toNumber(),//causing Payment error
      gas: 25e6,//7e6,
      accounts: {
        mnemonic: `${MNEMONIC}`,
        path: "m/44'/60'/0'/0",
        initialIndex: 0,
        count: 20,
        passphrase: "",
      },
    },
}

AND you must use await for all asynchronous operations!

AND you must wait for block confirmation as shown below for Hardhat code:

token = await Token.deploy(tokenName, tokenSymbol);
await token.deployTransaction.wait(blockConfirmation);

For Truffle, add this confirmations in your truffle-config.js:

    parachain: {
      provider: () => new HDWalletProvider(MNEMONIC, `${PARA_CHAIN_URL}`),//PARA_CHAIN_URL=http://127.0.0.1:7272
      network_id: 2045,
      production: true, 
      confirmations: 2, //to wait for enough confirmation
      skipDryRun: true, //true to skip simulations
    },

This confirmation slows the deployment down so the parachain can have time to make deployment properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.