Skip to content

Commit 61dfd25

Browse files
committedJan 15, 2025
fix: remove automaton configs, fix readme, refactor, upgrade hardhat version
1 parent 8b888df commit 61dfd25

File tree

8 files changed

+26
-195
lines changed

8 files changed

+26
-195
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export ETHERSCAN_EXPLORER_TOKEN=<your-etherscan-token>
3838
export OPTISCAN_EXPLORER_TOKEN=<your-etherscan-optimism-token>
3939
```
4040

41-
Set your Etherscan api to fetch verified source code,
41+
Set your Etherscan API endpoint URL to fetch verified source code,
4242

4343
```bash
4444
export L1_EXPLORER_API_HOSTNAME=<your-l1-explorer-api-hostname>

‎config_samples/optimism/automaton/automaton_config_L1.json

-52
This file was deleted.

‎config_samples/optimism/automaton/automaton_config_L2.json

-85
This file was deleted.

‎config_samples/optimism/automaton/automaton_config_L2_gov.json

-34
This file was deleted.

‎diffyscan/diffyscan.py

+4-20
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
get_contract_from_explorer,
1717
compile_contract_from_explorer,
1818
parse_compiled_contract,
19+
get_explorer_hostname,
1920
)
2021
from .utils.github import (
2122
get_file_from_github,
@@ -103,17 +104,18 @@ def run_source_diff(
103104
recursive_parsing=False,
104105
prettify=False,
105106
):
107+
explorer_hostname = get_explorer_hostname(config)
106108
logger.divider()
107109
logger.okay("Contract", contract_address_from_config)
108-
logger.okay("Blockchain explorer Hostname", get_explorer_hostname(config))
110+
logger.okay("Blockchain explorer Hostname", explorer_hostname)
109111
logger.okay("Repo", config["github_repo"]["url"])
110112
logger.okay("Repo commit", config["github_repo"]["commit"])
111113
logger.okay("Repo relative root", config["github_repo"]["relative_root"])
112114

113115
logger.divider()
114116

115117
logger.info(
116-
f"Fetching source code from blockchain explorer {get_explorer_hostname(config)} ..."
118+
f"Fetching source code from blockchain explorer {explorer_hostname} ..."
117119
)
118120

119121
source_files = (
@@ -213,24 +215,6 @@ def run_source_diff(
213215
logger.report_table(report)
214216

215217

216-
def get_explorer_hostname(config):
217-
explorer_hostname = None
218-
if "explorer_hostname_env_var" in config:
219-
explorer_hostname = load_env(
220-
config["explorer_hostname_env_var"], masked=True, required=False
221-
)
222-
if explorer_hostname is None:
223-
logger.warn(
224-
f'Failed to find an explorer hostname env in the config ("explorer_hostname_env_var")'
225-
)
226-
explorer_hostname = config["explorer_hostname"]
227-
if explorer_hostname is None:
228-
logger.warn(
229-
f'Failed to find explorer hostname in the config ("explorer_hostname")'
230-
)
231-
return explorer_hostname
232-
233-
234218
def process_config(
235219
path: str,
236220
hardhat_config_path: str,

‎diffyscan/utils/explorer.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
import os
44

5-
from .common import fetch
5+
from .common import fetch, load_env
66
from .logger import logger
77
from .compiler import (
88
get_solc_native_platform_from_os,
@@ -218,3 +218,21 @@ def parse_compiled_contract(target_compiled_contract):
218218
immutables[ref["start"]] = ref["length"]
219219

220220
return contract_creation_code_without_calldata, deployed_bytecode, immutables
221+
222+
223+
def get_explorer_hostname(config):
224+
explorer_hostname = None
225+
if "explorer_hostname_env_var" in config:
226+
explorer_hostname = load_env(
227+
config["explorer_hostname_env_var"], masked=True, required=False
228+
)
229+
if explorer_hostname is None:
230+
logger.warn(
231+
f'Failed to find an explorer hostname env in the config ("explorer_hostname_env_var")'
232+
)
233+
explorer_hostname = config["explorer_hostname"]
234+
if explorer_hostname is None:
235+
logger.warn(
236+
f'Failed to find explorer hostname in the config ("explorer_hostname")'
237+
)
238+
return explorer_hostname

‎diffyscan/utils/hardhat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def start(
7070

7171
start_time = time.time()
7272
while time.time() - start_time < self.HARDHAT_START_TIMEOUT_SEC:
73-
output = self.sub_process.stdout.readline().decode()
73+
output = self.sub_process.stdout.readline().decode().capitalize()
7474
if "WILL BE LOST" in output:
7575
logger.info("Hardhat node is ready")
7676
break

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@commitlint/config-conventional": "^19.5.0"
99
},
1010
"dependencies": {
11-
"hardhat": "^2.22.15",
11+
"hardhat": "^2.22.17",
1212
"kill-port": "^2.0.1"
1313
},
1414
"packageManager": "npm@10.8.2",

0 commit comments

Comments
 (0)
Please sign in to comment.