trufflesuite / truffle-hdwallet-provider

HD Wallet-enabled Web3 provider
MIT License
401 stars 167 forks source link

Deployment errors with ^1.3.0 #111

Open KevvKo opened 3 years ago

KevvKo commented 3 years ago

Hey,

currently I am working on a simple wallet contract with an UI based on web components. After testing the contract in remix with no issues, I tried to deploy my contract with truffle to the kovan test network and I got the following issue:

1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------

Error:  *** Deployment Failed ***

"Migrations" -- Unable to decode sender address from transaction: Incompatible EIP155-based V 37 and chain id 42. See the Common parameter of the Transaction constructor to set the chain id..

    at /usr/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Migration._deploy (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:74:1)
    at Migration._load (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:61:1)
    at Migration.run (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:212:1)
    at Object.runMigrations (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at Object.runAll (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:114:1)
    at Object.run (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:79:1)
    at runMigrations (/usr/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:263:1)
    at Object.run (/usr/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:226:1)
    at Command.run (/usr/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:136:1)
Truffle v5.2.6 (core: 5.2.6)
Node v14.16.1

Dependencies in package.json:

truffle-config.js

require('dotenv').config();
const HDWalletProvider = require("@truffle/hdwallet-provider");
const { API_URL, PRIVATE_KEY } = process.env;

module.exports = {

  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    },
    develop: {
      port: 8545
    },
    kovan: {
      provider: function() {
        return new HDWalletProvider([PRIVATE_KEY], API_URL)
      },
      network_id: 42
    },
  },
  api_keys: {
    etherscan: process.env.ETHERSCAN_API_KEY
  },
  plugins: [
    'truffle-plugin-verify'
  ],
  compilers: {
    solc: {
      version: "0.8.0",
    }
  },
};

After a downgrade to hdwallet-provider@1.2.3 the deployment working as expected without any other changes:

1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0x02d67eff09753d38a8dd8437fe66092c653e15071825ccb95182db4b20b25286
   > Blocks: 1            Seconds: 4
   > contract address:    0x76113Bb153c67922cD34aAB75e4C2be882d46934
   > block number:        24697708
   > block timestamp:     1620330376
   > account:             0x3868E57fbd4a5EF4459Bd2045028748F88641474
   > balance:             10.526361663
   > gas used:            244300 (0x3ba4c)
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.004886 ETH

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:            0.004886 ETH

2_deploy_contract.js
====================

   Deploying 'MWallet'
   -------------------
   > transaction hash:    0x2c92c66014c4765c4341c7d37564e89df4f7170dfe9e47ab4dc0ba5e001b0eec
   > Blocks: 2            Seconds: 8
   > contract address:    0xDE703c365b6fec50B09a9f915F7CDf0Ac4A86869
   > block number:        24697713
   > block timestamp:     1620330396
   > account:             0x3868E57fbd4a5EF4459Bd2045028748F88641474
   > balance:             10.516564283
   > gas used:            447356 (0x6d37c)
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.00894712 ETH

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:          0.00894712 ETH

Summary
=======
> Total deployments:   2
> Final cost:          0.01383312 ETH

So, why is there a downgrade necessary to deploy the contract?

Thanks. :)