From 6ae579ad6c45d73177949b9a3ff95fab6708fbf5 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Fri, 10 Nov 2023 18:58:55 +0300 Subject: [PATCH] Remove pre-release keys --- consensus/config/gnosis.yaml | 14 ----------- scripts/assert_declare_ethereum_vars.py | 32 ++++++++++++++----------- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/consensus/config/gnosis.yaml b/consensus/config/gnosis.yaml index 6f27834..f76c2ce 100644 --- a/consensus/config/gnosis.yaml +++ b/consensus/config/gnosis.yaml @@ -46,15 +46,6 @@ CAPELLA_FORK_EPOCH: 648704 # 2023-08-01T11:34:20.000Z # Deneb DENEB_FORK_VERSION: 0x04000064 DENEB_FORK_EPOCH: 18446744073709551615 -# EIP6110 -EIP6110_FORK_VERSION: 0x05000064 # temporary stub -EIP6110_FORK_EPOCH: 18446744073709551615 -# EIP7002 -EIP7002_FORK_VERSION: 0x05000064 # temporary stub -EIP7002_FORK_EPOCH: 18446744073709551615 -# WHISK -WHISK_FORK_VERSION: 0x06000064 # temporary stub -WHISK_FORK_EPOCH: 18446744073709551615 # Time parameters @@ -144,8 +135,3 @@ MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 16384 # `6` BLOB_SIDECAR_SUBNET_COUNT: 6 -# Whisk -# `Epoch(2**8)` -WHISK_EPOCHS_PER_SHUFFLING_PHASE: 256 -# `Epoch(2)` -WHISK_PROPOSER_SELECTION_GAP: 2 diff --git a/scripts/assert_declare_ethereum_vars.py b/scripts/assert_declare_ethereum_vars.py index 5154da7..27193a0 100755 --- a/scripts/assert_declare_ethereum_vars.py +++ b/scripts/assert_declare_ethereum_vars.py @@ -33,7 +33,7 @@ CONSENSUS_SPEC_FILEPATH = "consensus.md" # Keys to ignore for the config / preset diff tables -IGNORE_CONFIG_KEYS = [ +IGNORE_FOR_DIFF_CONFIG_KEYS = [ # Genesis information is not relevant to display as diff 'MIN_GENESIS_TIME', 'MIN_GENESIS_ACTIVE_VALIDATOR_COUNT', @@ -50,7 +50,14 @@ '_FORK_EPOCH', '_FORK_VERSION', ] -IGNORE_CONFIG_KEYS_REGEX = [re.compile(pattern) for pattern in IGNORE_CONFIG_KEYS] +IGNORE_FROM_REMOTE_CONFIG_KEYS = [ + # Ignore pre-release + 'WHISK_EPOCHS_PER_SHUFFLING_PHASE', + 'WHISK_PROPOSER_SELECTION_GAP', + 'EIP6110_FORK_', + 'EIP7002_FORK_', + 'WHISK_FORK_' +] def read_default_commit_from_md(file_path): with open(file_path, 'r') as file: @@ -81,6 +88,11 @@ def compare_yaml_keys(github_yaml, local_yaml): return new_keys, missing_keys +def delete_prerelease_keys(d): + keys_to_delete = [key for key in d if any(re.compile(regex).search(key) for regex in IGNORE_FROM_REMOTE_CONFIG_KEYS)] + for key in keys_to_delete: + del d[key] + def assert_deep_equal_dict(a, b, id): try: assert a == b @@ -96,7 +108,7 @@ def create_diff(local_yaml, github_yaml): diff = {} all_keys = set(local_yaml.keys()).union(set(github_yaml.keys())) for key in all_keys: - if any(regex.search(key) for regex in IGNORE_CONFIG_KEYS_REGEX): + if any(re.compile(regex).search(key) for regex in IGNORE_FOR_DIFF_CONFIG_KEYS): continue local_value = local_yaml.get(key, "Not Present") github_value = github_yaml.get(key, "Not Present") @@ -141,10 +153,9 @@ def extract_preset_diff_section(md_content): url = f"{REMOTE_BASE_URL}/{commit}/{remote_url_path}" print(url) - github_yaml_str = load_str_from_github(url) - local_yaml_str = load_str_from_local(local_file_path) - github_yaml = yaml.safe_load(github_yaml_str) - local_yaml = yaml.safe_load(local_yaml_str) + github_yaml = yaml.safe_load(load_str_from_github(url)) + local_yaml = yaml.safe_load(load_str_from_local(local_file_path)) + delete_prerelease_keys(github_yaml) new_keys, missing_keys = compare_yaml_keys(github_yaml, local_yaml) @@ -156,13 +167,6 @@ def extract_preset_diff_section(md_content): else: print("No differences in keys found.") - diff = difflib.unified_diff( - github_yaml_str.splitlines(), - local_yaml_str.splitlines(), - lineterm='' - ) - print('\n'.join(line for line in diff if line.startswith(('+', '-')))) - diff = create_diff(local_yaml, github_yaml) if "config" in local_file_path: config_diff = {**config_diff, **diff}