Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pre-release keys #27

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions consensus/config/gnosis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
32 changes: 18 additions & 14 deletions scripts/assert_declare_ethereum_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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)

Expand All @@ -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}
Expand Down
Loading