hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

Deployment issue using hardhat-ledger, error message vague

Open yohanelly95 opened this issue 1 year ago • 4 comments

Version of Hardhat

2.20.1

What happened?

Running a deploy script, that deploys a set of contracts on chain using a ledger hardware wallet using the package "@nomicfoundation/hardhat-ledger": "^1.0.2". Note: The issue seems to specific to the RPC/network. Need to know what the exact issue so I can try resolving it. The same script works on Polygon for eg.

npx hardhat run scripts/deployBridge.js --network skaleChain

The error received:

Deploying ResultManager contract...
✔ [hardhat-ledger] Connecting wallet
✔ [hardhat-ledger] Waiting for confirmation
ProviderError: Invalid RPC parameters.
    at HttpProvider.request (bridge-proxy/node_modules/hardhat/src/internal/core/providers/http.ts:88:21)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at LedgerProvider.request (bridge-proxy/node_modules/@nomicfoundation/hardhat-ledger/src/provider.ts:137:18)
    at EthersProviderWrapper.send (bridge-proxy/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)

Minimal reproduction steps

The deployBridge script:

const hre = require("hardhat");
require('dotenv').config();

const SIGNER_ADDRESS = process.env.SIGNER_ADDRESS ||
const { checkTimeDifference } = require('./validateTimestamp');

async function main() {
  console.log("Validating block timestamp of the deploying chain")

  await checkTimeDifference()
  .then(() => console.log('Finished checking time difference.'))
  .catch(error => console.error('An error occurred:', error));


  console.log("Deploying ResultManager contract...");
  const signer = await hre.ethers.getSigner();

  const ResultManager = await hre.ethers.getContractFactory("ResultManager");
  const resultManager = await ResultManager.deploy(SIGNER_ADDRESS);
  console.log("ResultManager contract deployed at:", resultManager.address);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Hardhat config of the network used:

skaleChain: {
      chainId: 1564830818,
      url: "https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague",
      ledgerAccounts: [
        "", // specify Ledger Address here (required) 
      ],
      timeout: 600000, 
    }

Search terms

hardhat-ledger

yohanelly95 avatar Feb 20 '24 10:02 yohanelly95

Are you able to run this script (or a similar script) without using ledger? Basically can we isolate whether the RPC error is due to hardhat-ledger or the general interaction of Hardhat and the skaleChain.

kanej avatar Feb 20 '24 10:02 kanej

Are you able to run this script (or a similar script) without using ledger? Basically can we isolate whether the RPC error is due to hardhat-ledger or the general interaction of Hardhat and the skaleChain.

you're right, I could run the script using accounts["PRIVATE_KEY"](not using ledgerAccounts). Error seems to be specific to hardhat-ledger. I need to deploy using these contracts using the hardware wallet though @kanej any suggestions on how to go about this. I cannot export the hardware wallets private key

yohanelly95 avatar Feb 20 '24 10:02 yohanelly95

We will have to investigate what is happening in hardhat-ledger - intuitively a transaction that works without going through ledger should work when it does so. Is there any information in skaleChain community that suggests with Ledger based transactions?

kanej avatar Feb 21 '24 09:02 kanej

We will have to investigate what is happening in hardhat-ledger - intuitively a transaction that works without going through ledger should work when it does so. Is there any information in skaleChain community that suggests with Ledger based transactions?

I will check with the Skale chain community and get back. In the mean time;

yohanelly95 avatar Feb 23 '24 09:02 yohanelly95