foundry icon indicating copy to clipboard operation
foundry copied to clipboard

"Transaction dropped from memory pool" when transaction is successful on-chain

Open 0xkinley opened this issue 3 years ago • 14 comments

Component

Forge

Have you ensured that all of these are up to date?

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

0.2.0

What command(s) is the bug in?

forge script forge-scripts/deploy_contracts.sol \ --rpc-url $RPC \ --private-key $PRIVATE_KEY \ --broadcast

Operating System

macOS (Apple Silicon)

Describe the bug

while running the command the error received is : Transaction dropped from the mempool: 0xaa6d6cf356d14eaed26585cdacc143087a7b2271cb03b1a845554ad91a7ea88b Transaction dropped from the mempool: 0x9711633969b6cc81a9983c44db9c09e4d2aae2c2e68b31af20e849a76c74aedb

But when checked on https://testnet.snowtrace.io/ these transaction hash show successful transaction.

And after the script is updated to "forge script forge-scripts/deploy_contracts.sol
--rpc-url $RPC
--private-key $PRIVATE_KEY
--broadcast --resume" to resume the transaction the error received is (code: -32000, message: nonce too low: address 0xC470686e8cb845246DCDF5BCcAf509883A4859AE current nonce (7) > tx nonce (6), data: None)

0xkinley avatar Dec 12 '22 14:12 0xkinley

Same behaviour, Ubuntu 22.04

foundryup: installed - forge 0.2.0 (8c4294c 2022-12-22T00:03:55.083004205Z) foundryup: installed - cast 0.2.0 (8c4294c 2022-12-22T00:03:55.083004205Z) foundryup: installed - anvil 0.1.0 (8c4294c 2022-12-22T00:04:20.109568457Z)

I'm deploying 5 contracts, only the last 2 or 3 tx are incorrectly flagged as dropped (and have no receipt in the broadcast json)

@aliceho if needed, for me, this consistently happened with Infura -> changing rpc provider (Ankr) fixed it!

simon-something avatar Dec 22 '22 15:12 simon-something

Also running into this on Optimism and Optimism Goerli on latest foundry. For N transactions I need to run the script N times. Wonder if it's due to fast block times?

emo-eth avatar Dec 26 '22 22:12 emo-eth

I am having the same issue on fuji testnet, exactly as described by @aliceho. ~I havent tried it with a different rpc provider since i am not aware of any easily accessible, free rpc provider for Fuji~. I have tried it with a QuickNode Fuji RPC url but this also didnt help me.

I have also tried with --slow, and the issue still persists.

Sending only 1 tx per forge script ... run seems to sometimes remedy this but it really is cumbersome to deploy multiple contracts this way.

It seems like the dropped tx always goes thru (in N transactions the very first one seems to always go thru) but my main problem is the verification. It directly fails in a dropped tx scenario and manually verifying (even with forge verify-contract) is quite tedious work.

kontrol-apa avatar Jan 02 '23 14:01 kontrol-apa

fixed by #4010

joshieDo avatar Jan 03 '23 13:01 joshieDo

@joshieDo I still got the error. Here's the error says:

Transactions saved to: /home/rizary/smart-contract/broadcast/Deploy.s.sol/80001/run-latest.json

Error: 
Transaction dropped from the mempool: 0xc6a1f6cec634ad525bd75c916224fb594621113235b5c276c6f8dc5977b1a1e3

here's my Deploy.s.sol script

pragma solidity ^0.8.15;

import "forge-std/Script.sol";
import "../src/1.0/FractionalizedNFT.sol";
import "../src/1.0/FractionToken.sol";
import "../src/1.0/SoonanTsoorNFT.sol";
import "../src/1.0/StakingFractionNFT.sol";

contract Deploy is Script {
    address public fractionalizedNFT;
    address public fractionToken;
    address public soonanTsoorNFT;
    address public stakingFractionNFT;
    address public USDCAddress;

    constructor() Script() {
    }

    function run() external {
        USDCAddress = vm.envAddress("USDC_ADDRESS");
        vm.startBroadcast();
        // deploy SoonanTsoorNFT contract
        SoonanTsoorNFT soonanTsoorNFTContract = new SoonanTsoorNFT(USDCAddress);
        soonanTsoorNFT = address(soonanTsoorNFTContract);
        
        FractionToken fractionTokenContract = new FractionToken();
        fractionToken = address(fractionTokenContract);

        // deploy FractionalizedNFT contract
        FractionalizedNFT fractionalizedNFTContract = new FractionalizedNFT(fractionToken, soonanTsoorNFT, USDCAddress);
        fractionalizedNFT = address(fractionalizedNFTContract);

        // deploy StakingFractionNFT contract
        StakingFractionNFT stakingFractionNFTContract = new StakingFractionNFT();
        stakingFractionNFT = address(stakingFractionNFTContract);
        
        vm.stopBroadcast();
    }
}

rizary avatar Feb 16 '23 06:02 rizary

This sucks, it is not helping

RafaBlockDev avatar Mar 09 '24 01:03 RafaBlockDev

Still facing this on forge 0.2.0 (e5318c3 2024-03-21T00:17:26.798143000Z) on the moonbase alpha chain (does not seem chain related though)

yohanelly95 avatar Mar 21 '24 11:03 yohanelly95

Still facing this on forge 0.2.0 (e5318c3 2024-03-21T00:17:26.798143000Z) on the zircuit testnet.

skyline9981 avatar Mar 24 '24 02:03 skyline9981

I also encounter this error, my version is forge 0.2.0 (440ec52 2024-04-11T00:18:58.806922049Z).

1712877751761

gzliudan avatar Apr 11 '24 23:04 gzliudan

same error

Eoous avatar May 09 '24 06:05 Eoous

Same issue with forge 0.2.0 on Holesky image actually all succesfull https://holesky.etherscan.io/tx/0xb398f6e842e545bdfba4f2133310abe8d1243bd10270d4475da0b1458d883e98

TomOthentic avatar Jun 06 '24 14:06 TomOthentic

getting also this lately in Holesky or Sepolia testnets, foundry outputs the error but is actually confirmed on-chain

kartojal avatar Jun 11 '24 12:06 kartojal

I have observed this issue as well. Some notes:

  • I have not encountered this when using Alchemy for RPC.
  • I have consistently encountered this when using Fireblocks for RPC.
  • In my use case, I'm lucky: I can use Fireblocks to send the Tx, then switch to Alchemy to confirm it. This is a peculiar feature of Fireblocks' integration utility (fireblocks-json-rpc), which allows you to specify a non-Fireblocks RPC provider for non-send-tx operations.

I'd wager that some upstream library (used by some RPC providers, but not all) is formatting the response in a way that forge is unable to recognize as success. But that's a shot in the dark; unfortunately I'm unable to dig any deeper at this time.

intoverflow avatar Jun 12 '24 05:06 intoverflow

@intoverflow It depends on RPC providers.

In my case, i encountered the error when foundry received NullResponse by get_receipt from RPC. NullResponse is not valid response so that foundry would throw this.

For more, check codes.

Eoous avatar Jul 11 '24 18:07 Eoous