foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Random verification failure despite success ("Verification is still pending...")

Open CodeSandwich opened this issue 3 years ago • 2 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?

forge 0.2.0 (64fe4ac 2022-07-25T00:12:11.619094168Z)

What command(s) is the bug in?

forge create

Operating System

Linux

Describe the bug

I've been deploying a contract on Goerli using forge create --verify ... and the verification failed with a message:

Waiting for verification result...
Error: 
Checking verification result failed:

Context:
- Verification is still pending...

Despite the error and a non-zero return value the contract was properly verified. I've retried deployment a few times, but I haven't been able to reproduce this error. Was it some kind of a timeout being too impatient?

This isn't a critical bug, but instability like this can randomly crash a long, complex and expensive deployment procedure.

CodeSandwich avatar Jul 25 '22 15:07 CodeSandwich

You might have caught it just before the contract was verified. It goes through some stages: pending (what you got here), failed or successful. You can make it retry with --retries and related flags. Does that answer your question? We obviously can't really know how long verification is going to take, although we might be able to create a loop of some sort that keeps checking if the verification is pending?

onbjerg avatar Jul 25 '22 15:07 onbjerg

we might be able to create a loop of some sort that keeps checking if the verification is pending?

That would be awesome, from what you wrote that does sound like a proper solution :+1:

CodeSandwich avatar Jul 25 '22 18:07 CodeSandwich

@onbjerg I was looking into taking this as a good first contribution, but after taking a look it seems like the proposed solution is already implemented? I'm at master 01b16238ff87dc7ca8ee3f5f13e389888c2a2ee4.

Looking into cmd/forge/verify/etherscan.rs we can see that the message - Verification is still pending... is already inside a loop:

        retry
            .run_async(|| {
                async {
                    let resp = etherscan
                        .check_contract_verification_status(args.id.clone())
                        .await
                        .wrap_err("Failed to request verification status")?;

                   ...

                    if resp.result == "Pending in queue" {
                        return Err(eyre!("Verification is still pending...",));
                    }

                  ...

The loop is controlled by the args.watch and args.retry parameters, which I think is reasonable. Maybe this issue is stale? Or am I missing something?

joaquinlpereyra avatar Nov 18 '22 23:11 joaquinlpereyra

yep this has been added.

Therefore, closing this.

mattsse avatar Nov 21 '22 10:11 mattsse