foundry: bug(`forge test`): --fork-url etherscan: Failed to deserialize response
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge 0.2.0 (73fb616 2023-12-19T00:16:21.131413571Z)
What command(s) is the bug in?
forge test --fork-url $SEPOLIA_RPC_URL
Operating System
Linux
Describe the bug
i found #3621 which is very similar to my issue to be closed in lieu of #6079, so i apologize if this is dup issue,
there is nothing special about my test, and everything passes and completes without issues. unlike @amusingaxl however, trace shows no problems with rate limiting, traces all look pretty standard:
2023-12-21T23:26:59.714575Z WARN etherscanidentifier: could not get etherscan info: Serde(Error("expected value", line: 1, column: 1))
response (captcha):
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="robots" content="noindex,nofollow">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet">
<meta http-equiv="refresh" content="375">
</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">Enable JavaScript and cookies to continue</span>
</div>
</div>
</noscript>
</div>
</div>
<script>
(function(){
// challenge function
}());
</script>
</body>
</html>
i am working on a remote server thru vscode remote ssh, not sure if that’s a factor
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 27 (5 by maintainers)
Thanks @0xV4L3NT1N3!
The HTML error that gets thrown originates from Blockscout due to a misclassification in the Alloy Chain’s configuration, adding a fix here: https://github.com/alloy-rs/chains/pull/109. Should land in Foundry soon.
In the meantime as a workaround @hernandp, please directly pass in the
--verifier-urlas follows:--verifier-url https://api-alfajores.celoscan.io/apiwith an accompanying--etherscan-api-key <API_KEY>.Am able to reproduce it reliably on the Celoscan Alfajores testnet upon verification:
I’ll reach out to Etherscan to see if we can get this fixed for Celo
Unfortunately it looks like there is no direct action Foundry can take here
trying to compile Optimism L2 on Sepolia Testnet getting the error even with –verifier etherscan --etherscan-api-key ************************ --verifier-url https://api-sepolia.etherscan.io/api The difference is in my case it returns Access Denied error using the latest forge version forge 0.2.0 (b320027 2024-01-12T00:17:44.209192793Z) please advise
@zerosnacks thank you.
@grandizzy @zerosnacks Sidenote, manual submission of data to Celoscan using generated JSON with
--show-json-standard-inputin forge command line works. So I guess is the RPC/HTTP interfacing which is failing.thanks, is that celoscan to support this? @zerosnacks wdyt?
It worked in Sepolia/Arbitrum Sepolia now, thanks.
In particular, Celo both Testnet/Mainnet does not support
forge verify-contractand still displays this error.I think this is all just related to receiving some kind of non-JSON formatted HTML error / gate page that Etherscan may throw. We could attempt to implement an error handler to give the user a more descriptive error but I don’t see a practical way we can actually resolve this. It clearly happens sporadically and under certain conditions.
this one works for me
This worked for me, though (probably because I was running from a script?)
unset ETHERSCAN_API_KEYwas insufficient, and I neededexport ETHERSCAN_API_KEY="".and
I ran into a similar issue (see above), here’s what I discovered:
ETHERSCAN_API_KEYis set in the environment, forge will try resolving the etherscan API and fetch contracts info.--verifyflag, forge will still execute the previous step multiples times anyways.PS: the etherscan key must be commented out from the .env if using it, as unsetting the variable doesn’t prevent forge from loading the environment file.