Issue when deploying contracts in RSK with Foundry
I’m currently working on a starter kit with Foundry for writing, testing, and deploying contracts on the Rootstock network. In this starter kit, I have implemented a sample flow for testing and deploying a mock ERC20 token, providing developers with a practical example.
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
import {Script, console} from "forge-std/Script.sol";
import {MockERC20} from "../src/MockERC20.sol";
contract MockERC20Script is Script {
function setUp() public {}
function run() public {
uint privateKey = vm.envUint("PRIVATE_KEY");
address account = vm.addr(privateKey);
vm.startBroadcast(privateKey);
new MockERC20("RSKToken", "RSK", account);
vm.stopBroadcast();
}
}
Issue with Deployment
When I run the deployment command, the transaction starts, and a progress bar appears in the CLI. However, after some time, presumably due to a timeout, I encounter the following error:
Error:
Transaction dropped from the mempool: # a transaction id
Upon checking the transaction ID in the RSK testnet explorer, I can see that the transaction was successful. I have also tested a method of the deployed contract, and it works as expected. Despite this, the error message in the console can be confusing for developers.
Possible cause
The issue seems to be related to the RPC. When I switch to an RPC URL from another network, the error no longer appears. Our hypothesis is that Foundry might be waiting for a completion event that the RPC API, which does not support WebSocket, fails to provide. However, this hypothesis might not be entirely accurate.
Issue when deploying contracts in RSK with Foundry
I’m currently working on a starter kit with Foundry for writing, testing, and deploying contracts on the Rootstock network. In this starter kit, I have implemented a sample flow for testing and deploying a mock ERC20 token, providing developers with a practical example.
Deployment command
Deployment script
Issue with Deployment
When I run the deployment command, the transaction starts, and a progress bar appears in the CLI. However, after some time, presumably due to a timeout, I encounter the following error:
Upon checking the transaction ID in the RSK testnet explorer, I can see that the transaction was successful. I have also tested a method of the deployed contract, and it works as expected. Despite this, the error message in the console can be confusing for developers.
Possible cause
The issue seems to be related to the RPC. When I switch to an RPC URL from another network, the error no longer appears. Our hypothesis is that Foundry might be waiting for a completion event that the RPC API, which does not support WebSocket, fails to provide. However, this hypothesis might not be entirely accurate.
Repository
For testing and further details, you can find the starter kit repository here: https://github.com/chrisarevalo11/rsk-foundry-starter-kit.