Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProviderError: the method has been deprecated: eth_accounts #5572

Closed
fisherpro opened this issue Aug 3, 2024 · 6 comments · Fixed by #5655
Closed

ProviderError: the method has been deprecated: eth_accounts #5572

fisherpro opened this issue Aug 3, 2024 · 6 comments · Fixed by #5655
Assignees
Labels
status:ready This issue is ready to be worked on

Comments

@fisherpro
Copy link

Version of Hardhat

2.22.7

What happened?

I am not able to deploy my hardhat contracts when using newer providers.

Running the following code:

import { ethers } from 'hardhat';
async function main() {
    const [deployer] = await ethers.getSigners();
}

With command:
npx hardhat --network erigon run scripts/test.ts

Produces this error:

ProviderError: the method has been deprecated: eth_accounts
    at HttpProvider.request (C:\src\node_modules\hardhat\src\internal\core\providers\http.ts:96:21)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getSigners (C:\src\node_modules\@nomicfoundation\hardhat-ethers\src\internal\helpers.ts:43:30)
    at async main (C:\src\scripts\deploy-all.ts:13:24)

This is the code in hardhat-ethers from the stack (helpers.ts). This is called all the time by high level functions such as ethers.getContractFactory()... :

export async function getSigners(
  hre: HardhatRuntimeEnvironment
): Promise<HardhatEthersSigner[]> {
  const accounts: string[] = await hre.ethers.provider.send("eth_accounts", []);

  const signersWithAddress = await Promise.all(
    accounts.map((account) => getSigner(hre, account))
  );

  return signersWithAddress;
}

My provider is a local instance of Erigon. I tried using Erigon 3 and 2.60.0 and both produced the above error.

On the Erigon side I see this error:
WARN[08-03|21:48:26.995] [rpc] served conn=10.0.0.74:60977 method=eth_accounts reqid=2 t=31.49µs err="the method has been deprecated: eth_accounts"

Some articles:
https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-personal
https://github.com/ethereum/go-ethereum/releases/tag/v1.11.0

Geth is also getting rid of these "personal" methods as well.
Thank you.

Minimal reproduction steps

Run the below code against Geth or Erigon without api personal defined.

import { ethers } from 'hardhat'
async function main() {
      const contractFact = await ethers.getContractFactory("UniswapV3Factory")
}

Search terms

erigon personal eth_accounts deprecated

@kanej
Copy link
Member

kanej commented Aug 6, 2024

Taking a look at this, we think we should guard against the deprecation of the eth_accounts call and return []. Effectively we fall back from there as though there where no unlocked accounts available from the node.

@kanej kanej added status:ready This issue is ready to be worked on and removed status:triaging labels Aug 6, 2024
@kanej kanej moved this from Backlog to To-do in Hardhat Aug 6, 2024
@kanej kanej assigned kanej and unassigned kanej Aug 6, 2024
@borka-s
Copy link

borka-s commented Aug 15, 2024

Is there a workaround for this?

kanej added a commit that referenced this issue Aug 19, 2024
Erigon now responds that `eth_accounts` is deprecated. Instead of
crashing we now return an empty set of accounts, the same as if running
against mainnet.

Fixes #5572.
kanej added a commit that referenced this issue Aug 19, 2024
Erigon now responds that `eth_accounts` is deprecated when we make an
RPC call. Instead of erroring we now return an empty set of accounts
from `getSigners` if `eth_accounts` is deprecated.

Fixes #5572.
kanej added a commit that referenced this issue Aug 19, 2024
Erigon now responds that `eth_accounts` is deprecated when we make an
RPC call. Instead of erroring we now return an empty set of accounts
from `getSigners` if `eth_accounts` is deprecated.

Fixes #5572.
@kanej kanej moved this from To-do to In Review in Hardhat Aug 19, 2024
@kanej kanej closed this as completed in 93b30d5 Aug 19, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in Hardhat Aug 19, 2024
@kanej
Copy link
Member

kanej commented Aug 21, 2024

This has been fixed and released as part of [email protected]

@fisherpro
Copy link
Author

Is there a workaround for this?

Yes. Just supply the signer when calling functions that interact with the chain. It's only when the signer is not supplied that eth_accounts was used to lookup the accounts.

@entin-hun
Copy link

entin-hun commented Sep 9, 2024

This has been fixed and released as part of [email protected]
Unfortunately, the issue persists (using 3.0.8)
image

@borka-s
Copy link

borka-s commented Sep 12, 2024

Is there a workaround for this?

Yes. Just supply the signer when calling functions that interact with the chain. It's only when the signer is not supplied that eth_accounts was used to lookup the accounts.

Yup, this worked.

Thanks ^_^

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready This issue is ready to be worked on
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants