Search code examples
blockchainethereumsmartcontractsweb3jstruffle

Encountered an error while attempting to update latest block


I'm new to blockchain and i was just trying to deploy a simple smart contract to ropsten test net. I've used the smart contract code from https://github.com/t4sk/solidity-multi-sig-wallet. Also i'm using the account provided by truffle develop

My truffle-config.js:

networks: {
development: {
     host: "127.0.0.1",     // Localhost (default: none)
     port: 8545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
    },
ropsten: {
    provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/${infuraKey}`),
    network_id: 3,       // Ropsten's id
    gas: 5500000,        // Ropsten has a lower block limit than mainnet
    confirmations: 2,    // # of confs to wait between deployments. (default: 0)
    timeoutBlocks: 200,  // # of blocks before a deployment times out  (minimum/default: 50)
    skipDryRun: true     // Skip dry run before migrations? (default: false for public nets )
    },
mocha: {
    timeout: 100000
  },
compilers: {
    solc: {
      version: "0.5.1",    // Fetch exact version from solc-bin (default: truffle's version)
      // docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)
      // settings: {          // See the solidity docs for advice about optimization and evmVersion
        optimizer: {
          enabled: false,
          runs: 200
        },
      //  evmVersion: "byzantium"
      // }
    }
  },

Im using solidity: 0.5.1

But when i try to deploy it using truffle migrate --network ropsten im getting the following two errors

1.

This version of µWS is not compatible with your Node.js build:

Error: Cannot find module './uws_win32_x64_72.node'
Falling back to a NodeJS implementation; performance may be degraded.
1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0x673a9a02662595075c6f3aa4dc904d24203cb8e460a3e20a630869c5155cb78c
   > Blocks: 2            Seconds: 53
   > contract address:    0xde674E126884c8F7Ddd94B5013065596b81fEd6d
   > block number:        12075322
   > block timestamp:     1647065140
   > account:             0xC10352218af6Ccbb574Fd0912adcc9Ac59C22950
   > balance:             1.830076836873988898
   > gas used:            175087 (0x2abef)
   > gas price:           2.500000028 gwei
   > value sent:          0 ETH
   > total cost:          0.000437717504902436 ETH

   Pausing for 2 confirmations...

   -------------------------------

C:\Users\coolg\Desktop\hd_wallet\node_modules\request\request.js:848
          var e = new Error('ETIMEDOUT')
                  ^
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: ETIMEDOUT
    at Timeout.<anonymous> (C:\Users\coolg\Desktop\hd_wallet\node_modules\request\request.js:848:19)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
    at PollingBlockTracker._performSync (C:\Users\coolg\Desktop\hd_wallet\node_modules\eth-block-tracker\src\polling.js:51:24)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Also a transaction for the above smart contract address 0xde674E126884c8F7Ddd94B5013065596b81fEd6d is created on ropsten network.

Edit 1: I've replaced the provider link with wss://ropsten.infura.io/v3/${infuraKey}` and the 2nd issue gets resolved but now it shows another error

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

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0xb72aef24e5fc16395f1dc221965c4e2036b4d72babbe829f244f958d302baee5
   > Blocks: 7            Seconds: 228
   > contract address:    0xb81478b107D5B08B0F9ce8d0E404701a3D2292a0
   > block number:        12076445
   > block timestamp:     1647090364
   > account:             0xC10352218af6Ccbb574Fd0912adcc9Ac59C22950
   > balance:             1.828763684345799891
   > gas used:            175087 (0x2abef)
   > gas price:           2.500000007 gwei
   > value sent:          0 ETH
   > total cost:          0.000437717501225609 ETH

   Pausing for 2 confirmations...

   -------------------------------
   > confirmation number: 3 (block: 12076452)
   ⠦ Saving migration to chain.
Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.


Error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!

It says the transaction might still be mined, so how will i know when my transaction gets mined? Also in the meantime can i call the fuctions/events of my smart contract that is deployed on the ropsten_eth https://ropsten.etherscan.io/address/0xb81478b107d5b08b0f9ce8d0e404701a3d2292a0


Solution

  • The problem here by mistake may be the address you are trying to reach. I searched for what the problem might be and found two threads where people have already described the problem and sort of found a solution. Most likely one of these options should help to solve the problem.

    The first solution is here. The idea is to replace https with wss. There should be something like this:

    testnet: {
      provider: () => new HDWalletProvider(mnemonic, `wss://ropsten.infura.io/v3/${infuraKey}`),
      ...
    }
    

    Then I searched some more and found something like this. The author of the post says that the problem could be due to DNS or slow internet and suggests adding two parameters to the config:

    testnet: {
      ...,
      networkCheckTimeout: 10000,
      timeoutBlocks: 200
    }