From d785c545afc274a4bc33c0a4d37e3ed9d8c340c3 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Thu, 7 Feb 2019 16:17:25 +0100 Subject: [PATCH 1/2] All Etherscan verification at once This commit * fixes the exit status code when Etherscan submission fails * changes README so it instructs just one etherscan_verify execution --- README.rst | 14 ++------------ raiden_contracts/deploy/etherscan_verify.py | 8 ++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/README.rst b/README.rst index 46961bc14..a5f64e4bb 100644 --- a/README.rst +++ b/README.rst @@ -184,19 +184,9 @@ Verification with Etherscan :: - python -m raiden_contracts.deploy.etherscan_verify --apikey ETHERSCAN_APIKEY --contract-name EndpointRegistry --chain-id 3 + python -m raiden_contracts.deploy.etherscan_verify --apikey ETHERSCAN_APIKEY --chain-id 3 - python -m raiden_contracts.deploy.etherscan_verify --apikey ETHERSCAN_APIKEY --contract-name SecretRegistry --chain-id 3 - - python -m raiden_contracts.deploy.etherscan_verify --apikey ETHERSCAN_APIKEY --contract-name TokenNetworkRegistry --chain-id 3 - - python -m raiden_contracts.deploy.etherscan_verify --apikey ETHERSCAN_APIKEY --contract-name ServiceRegistry --chain-id 3 - - python -m raiden_contracts.deploy.etherscan_verify --apikey ETHERSCAN_APIKEY --contract-name MonitoringService --chain-id 3 - - python -m raiden_contracts.deploy.etherscan_verify --apikey ETHERSCAN_APIKEY --contract-name OneToN --chain-id 3 - - python -m raiden_contracts.deploy.etherscan_verify --apikey ETHERSCAN_APIKEY --contract-name UserDeposit --chain-id 3 +If the command exists with status code 0, Etherscan has verified all contracts against Solidity sources. Making a Release diff --git a/raiden_contracts/deploy/etherscan_verify.py b/raiden_contracts/deploy/etherscan_verify.py index 4bb280c0b..31a6a14e5 100644 --- a/raiden_contracts/deploy/etherscan_verify.py +++ b/raiden_contracts/deploy/etherscan_verify.py @@ -211,6 +211,14 @@ def etherscan_verify_contract(chain_id: int, apikey: str, source_module: str, co print('Retrying...') sleep(5) raise TimeoutError(manual_submission_guide) + else: + if content["result"] == "Contract source code already verified": + return + else: + raise ValueError( + 'Etherscan submission failed for an unknown reason\n' + + manual_submission_guide, + ) def guid_status(etherscan_api: str, guid: str): From cd5d665905a0651409d4601d6b1b99877087b61f Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Thu, 7 Feb 2019 17:19:11 +0100 Subject: [PATCH 2/2] Use pprint to show the submitted dictionary so each element stands on its own line. --- raiden_contracts/deploy/etherscan_verify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/raiden_contracts/deploy/etherscan_verify.py b/raiden_contracts/deploy/etherscan_verify.py index 31a6a14e5..62b949ca0 100644 --- a/raiden_contracts/deploy/etherscan_verify.py +++ b/raiden_contracts/deploy/etherscan_verify.py @@ -1,5 +1,6 @@ import json import click +import pprint import requests import subprocess from time import sleep @@ -157,7 +158,7 @@ def post_data_for_etherscan_verification( # Typo is intentional. Etherscan does not like the correct spelling. 'constructorArguements': constructor_args, } - print({k: v for k, v in data.items() if k is not 'sourceCode'}) + pprint.pprint({k: v for k, v in data.items() if k is not 'sourceCode'}) return data