-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Mox issue:
Details
We had multiple feedbacks concerning the moccasin_verify feature. It seems that on testnets like Sepolia, the contract verification step always ends up with a 404 error like the following.
File "/home/s3bc40/gh-projects/moccasin/.venv/lib/python3.12/site-packages/boa/verifiers.py", line 206, in verify
return verifier.verify(
^^^^^^^^^^^^^^^^
File "/home/s3bc40/gh-projects/moccasin/.venv/lib/python3.12/site-packages/boa/verifiers.py", line 116, in verify
response.raise_for_status()
File "/home/s3bc40/gh-projects/moccasin/.venv/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://eth-sepolia.blockscout.com/api/v2/smart-contracts/0xcA1bA233df84e64A550a70DCe643fe370dFc52fB/verification/via/vyper-standard-input?apikey=I tried to investigate on Blockscout APIs, on https://client.scalar.com/workspace/default/request/hlNBJ6a8i6Xe2DSrW7V69 :
zksync-> might be the API that still not supportv2endpoints so it's out of contextsepolia->Address is not a smart-contractfor the explanation of the404erroroptimism-> at first I get a404but requesting it on their Scalar API interface, I end up with a200success just not JSON input files (which is normal)
To validate that it was not something on mox specifically, I tried to run this specific test on titanoboa:
# tests/integration/network/sepolia/test_sepolia_env.py
@pytest.fixture(scope="module")
def simple_contract():
return boa.loads(code, STARTING_SUPPLY)
@pytest.fixture(scope="module", params=[Etherscan, Blockscout])
def verifier(request):
if request.param == Blockscout:
api_key = os.getenv("BLOCKSCOUT_API_KEY")
return Blockscout("https://eth-sepolia.blockscout.com", api_key)
elif request.param == Etherscan:
api_key = os.environ["ETHERSCAN_API_KEY"]
return Etherscan("https://api-sepolia.etherscan.io/api", api_key)
raise ValueError(f"Unknown verifier: {request.param}")
def test_verify(verifier):
# generate a random contract so the verification will actually be done again
name = "".join(sample(ascii_lowercase, 10))
value = randint(0, 2**256 - 1)
contract = boa.loads(
f"""
import module_lib
@deploy
def __init__(t: uint256):
if t == 0:
module_lib.throw()
@external
def {name}() -> uint256:
return {value}
""",
value,
name=name,
)
result = boa.verify(contract, verifier)
result.wait_for_verification()
assert result.is_verified()And here is the failing output:
11:47:38 with s3bc40 in ~/gh-projects/titanoboa via titanoboa took 1m 5.9s …
➜ pytest tests/integration/network/sepolia/test_sepolia_env.py -k test_verify -s
tests/integration/network/sepolia/test_sepolia_env.py tx broadcasted: 0x8d67ae0a7983a2c70b12f9e59ba96d31c277ec54093f1f4c1eaf06e284922a46
0x8d67ae0a7983a2c70b12f9e59ba96d31c277ec54093f1f4c1eaf06e284922a46 mined in block 0xafaa1f8aeb562d3f5176e50a91c17fb6f1c3bc9ff05ccb39768e02eab093b364!
contract deployed at 0x04D219Aa3D86198c0d97f6196566Dd45b66dC15e
Verification could not be created yet: Unable to locate ContractCode at 0x04D219Aa3D86198c0d97f6196566Dd45b66dC15e. Retrying...
Verification could not be created yet: Unable to locate ContractCode at 0x04D219Aa3D86198c0d97f6196566Dd45b66dC15e. Retrying...
Verification could not be created yet: Unable to locate ContractCode at 0x04D219Aa3D86198c0d97f6196566Dd45b66dC15e. Retrying...
Verification could not be created yet: Unable to locate ContractCode at 0x04D219Aa3D86198c0d97f6196566Dd45b66dC15e. Retrying...
Verification could not be created yet: Unable to locate ContractCode at 0x04D219Aa3D86198c0d97f6196566Dd45b66dC15e. Retrying...
Verification started with etherscan_guid uzy5dgjunjexq4wdgcyqignu1uvs3qvausviys3gxagm4ham2x
Ftx broadcasted: 0x064991fd6d94cdabc10ad64eca57029fe18114bcc226a93a623c5e312efdb052
0x064991fd6d94cdabc10ad64eca57029fe18114bcc226a93a623c5e312efdb052 mined in block 0x41933590855b7de211b0ad186d2b0a71e92e39afcff1dc9677d6f5825c4b7561!
contract deployed at 0x6793f919aCD3E1807424029bB5f650Dd15A6c595
F
FAILED tests/integration/network/sepolia/test_sepolia_env.py::test_verify[Etherscan] - ValueError: Failed to verify: Fail - Unable to verify. Unable to locate a matching contract
FAILED tests/integration/network/sepolia/test_sepolia_env.py::test_verify[Blockscout] - requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://eth-sepolia.blockscout.com/api/v2/smart-contracts/0x6793f919aCD3E1807424029bB5f650Dd15A6c595/verification/via/vype..Possibilities
I could be related on how block explorers behave with Vyper or maybe their API is moving a lot. I don't think it's coming from Boa or Vyper itself.
I do not have a great expertise on this subject, so I prefer to expose the issue we got here and see what we could do afterward. Maybe opening an issue blockscout repo or is there anything I missed?
Thanks for the help.

