foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.21k stars 1.71k forks source link

Error: Etherscan could not detect the deployment. #8304

Closed AbolfazlR5 closed 1 month ago

AbolfazlR5 commented 3 months ago

Component

Forge

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

What version of Foundry are you on?

forge 0.2.0

What command(s) is the bug in?

forge script ./script/Chatter.s.sol:ChatterScript --rpc-url http://localhost:1248 --broadcast --sender 0xe723db61481390dFe97558fF454f9B0F40181830 --unlocked --chain-id 11155111 --verify

Operating System

macOS (Intel)

Describe the bug

Hello everyone, I am facing an issue while trying to upload my smart contract on the Sepolia testnet network. Although the deployment is successful and I can view the transaction on Sepolia Etherscan, the input data for the contract is empty. Also when I am trying to verify the contract I receive this error "Error: Etherscan could not detect the deployment."

I would highly appreciate it if you could help me with this.

here is my script contract code

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {Script} from "forge-std/Script.sol";
import {Chatter} from "../src/Chatter.sol";

contract ChatterScript is Script {

    function run() public{
        vm.broadcast();
        new Chatter();
    }

}
klkvr commented 3 months ago

Such error usually means that you have to wait a bit while Etherscan is indexing your contract. If that happens, running script with --resume flag after some time should help

AbolfazlR5 commented 3 months ago

Such error usually means that you have to wait a bit while Etherscan is indexing your contract. If that happens, running script with --resume flag after some time should help

I did, but unfortunately I am getting the same error again. Also the contract itself has no input data on Etherscan for Sepolia network again.

klkvr commented 3 months ago

does the deployed contract has any code? can you share the deployment transaction?

AbolfazlR5 commented 3 months ago

does the deployed contract has any code? can you share the deployment transaction?

No there is no code within the contract. This is the transaction hash "0x12f248de3fd27fcb7b0f03a845d8c1819860583d54271bbdbfcc68399ea5ff1a"

klkvr commented 3 months ago

right, so this is basically a CREATE transaction with empty data, this contract can't be verified.

Can you reproduce this reliably? Does script artifacts look correct?

AbolfazlR5 commented 3 months ago

right, so this is basically a CREATE transaction with empty data, this contract can't be verified.

Can you reproduce this reliably? Does script artifacts look correct?

Yeah everything looks fine I just double checked it.

zerosnacks commented 2 months ago

Marking as invalid as the deployed contract is empty (0x)

Your contract will need to be more substantial in order to be verified

Feel free to re-open with an additional minimal reproduction

notchuks commented 1 month ago

@zerosnacks the contract has some code. I am having the exact same issue. Here is the smart contract;

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

contract Chat {
    event Message(address indexed sender, string message);

    function sendMessage(string calldata message) public {
        emit Message(msg.sender, message);
    }
}

After deploying on sepolia, the verification times out.

klkvr commented 1 month ago

@notchuks are you on latest nightly? thinking this might have been fixed by https://github.com/foundry-rs/foundry/pull/8532

notchuks commented 1 month ago

@klkvr I will run foundryup right now and retry this. Thanks for the speedy response.

notchuks commented 1 month ago

It times out with the same response: Etherscan could not detect the deployment. Here is the contract address: 0x470bCcb64Abce80b0618E6c8F59E610738F9AaAa Screenshot from 2024-08-21 18-12-03

klkvr commented 1 month ago

do you mind sharing script artifacts from broadcast/ folder? also are you using a public RPC you could share?

notchuks commented 1 month ago

Hey @klkvr, sorry for the delayed response. Here is the script artifacts; and I am using a local RPC from the frame wallet. it is exposed as http://localhost:1248 on my pc.

{
  "transactions": [
    {
      "hash": "0xfdbd47b0372574c2b2e024c5e5ebffbe6a79e93af90a6c1dac9b2a9ac3183f27",
      "transactionType": "CREATE",
      "contractName": "Chat",
      "contractAddress": "0x470bccb64abce80b0618e6c8f59e610738f9aaaa",
      "function": null,
      "arguments": null,
      "transaction": {
        "from": "0xa7a829a66f54a53023402befd45be55a2179c5df",
        "gas": "0x295fa",
        "value": "0x0",
        "input": "0x6080604052348015600f57600080fd5b506101658061001f6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063469c811014610030575b600080fd5b61004361003e36600461008c565b610045565b005b336001600160a01b03167f811f7cff0a3374ff67cccc3726035d34ba70410e0256818a891e4d6acc01d88e8383604051610080929190610100565b60405180910390a25050565b6000806020838503121561009f57600080fd5b823567ffffffffffffffff8111156100b657600080fd5b8301601f810185136100c757600080fd5b803567ffffffffffffffff8111156100de57600080fd5b8560208284010111156100f057600080fd5b6020919091019590945092505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f1916010191905056fea26469706673582212205208856c0daf8561160eed09d71758518f9d997bde7fc69d5f1320d0f32baee864736f6c634300081a0033",
        "nonce": "0x4",
        "chainId": "0xaa36a7"
      },
      "additionalContracts": [],
      "isFixedGasLimit": false
    }
  ],
  "receipts": [
    {
      "status": "0x1",
      "cumulativeGasUsed": "0xc7f56c",
      "logs": [],
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "type": "0x2",
      "transactionHash": "0xfdbd47b0372574c2b2e024c5e5ebffbe6a79e93af90a6c1dac9b2a9ac3183f27",
      "transactionIndex": "0x3d",
      "blockHash": "0x81302079eca7291d21da9c056ecb7146a3daafd681f278e008ff9e6150b73b45",
      "blockNumber": "0x63dbdc",
      "gasUsed": "0xcf08",
      "effectiveGasPrice": "0x9edd55899",
      "from": "0xa7a829a66f54a53023402befd45be55a2179c5df",
      "to": null,
      "contractAddress": "0x470bccb64abce80b0618e6c8f59e610738f9aaaa"
    }
  ],
  "libraries": [],
  "pending": [],
  "returns": {},
  "timestamp": 1724259984,
  "chain": 11155111,
  "commit": "1429e72"
}