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

sendTransaction times out #4555

Open
nandlab opened this issue Jan 19, 2024 · 3 comments
Open

sendTransaction times out #4555

nandlab opened this issue Jan 19, 2024 · 3 comments
Assignees
Labels
investigate Under investigation and may be a bug. v5 Issues regarding legacy-v5

Comments

@nandlab
Copy link

nandlab commented Jan 19, 2024

Ethers Version

5.7.1

Search Terms

transaction signer

Describe the Problem

I am using Remix IDE with the Remix VM (Shanghai) environment.

In a Javascript unit test, I would like to send Ether from the main account to another account, but the sendTransaction() function times out.

Code Snippet

/* eslint-disable no-undef */
// Right click on the script name and hit "Run" to execute
const { expect } = require("chai");
const { ethers } = require("hardhat");

describe("Ether transaction", function () {
  it("test transaction", async function () {
    console.log(ethers.version);
    let [owner] = await ethers.getSigners();
    let balance = (await owner.getBalance()).toBigInt();
    console.log(`Current balance is: ${balance}`);
    let value = ethers.utils.parseEther("1.0");
    expect(balance).to.be.at.least(value);
    let recipient = "<another address>";
    console.log(`Sending some ETH to recipient ${recipient}`);
    await owner.sendTransaction({
        "to": recipient,
        "value": value
    });
    let newBalance = (await owner.getBalance()).toBigInt();
    console.log(`New balance is: ${newBalance}`);
    expect(newBalance - balance).to.be(value);
  });
});

Contract ABI

No response

Errors

test transaction (50738 ms)
  Message: Timeout of 50000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

Environment

Hardhat

Environment (Other)

Remix IDE

@nandlab nandlab added investigate Under investigation and may be a bug. v5 Issues regarding legacy-v5 labels Jan 19, 2024
@ricmoo
Copy link
Member

ricmoo commented Jan 19, 2024

How are you using Remix with ethers? Does it provide an EIP-1193 provider?

Have you tried ethers v6, which has much more flexibility for connecting to exotic environments?

Regardless, in v5 you can decrease the polling interval to increase the speed which the internals operated, scanning for new blocks, which on a test environment should occur quite quickly using provider.pollingInterval = 200 (which will poll every 200ms).

@nandlab
Copy link
Author

nandlab commented Jan 19, 2024

@ricmoo, thank you for the fast reply!

How are you using Remix with ethers? Does it provide an EIP-1193 provider?

I have written the script in tests/transaction.test.js and I am just running it. I don't know if it is an EIP-1193 provider.

Have you tried ethers v6, which has much more flexibility for connecting to exotic environments?

I don't know how to use another version. 5.7.1 is just the default version I get in Remix IDE. Sorry, I am quite new to Ethereum so I am a bit overwhelmed 😅

Regardless, in v5 you can decrease the polling interval to increase the speed which the internals operated, scanning for new blocks, which on a test environment should occur quite quickly using provider.pollingInterval = 200 (which will poll every 200ms).

I added the line owner.provider.pollingInterval = 200; after let [owner] = await ethers.getSigners(); but it did not help.

@ricmoo
Copy link
Member

ricmoo commented Jan 20, 2024

I have opened an issue on Remix to see if I can help out too. :)

ethereum/remix-project#4479

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v5 Issues regarding legacy-v5
Projects
None yet
Development

No branches or pull requests

2 participants