Skip to content
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
1 change: 1 addition & 0 deletions configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ PROPOSER_SELECTION_GAP: 2

# EIP7732
MAX_REQUEST_PAYLOADS: 128
PROPOSER_SCORE_BOOST_EIP7732: 20

# EIP7805
ATTESTATION_DEADLINE: 4
Expand Down
1 change: 1 addition & 0 deletions configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ PROPOSER_SELECTION_GAP: 1

# EIP7732
MAX_REQUEST_PAYLOADS: 128
PROPOSER_SCORE_BOOST_EIP7732: 20

# EIP7805
ATTESTATION_DEADLINE: 2
Expand Down
27 changes: 27 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,29 @@ def parse_markdown(content: str):
return gfm.parse(content)


def check_yaml_matches_spec(var_name, yaml, value_def):
"""
This function performs a sanity check for presets & configs. To a certain degree, it ensures
that the values in the specifications match those in the yaml files.
"""
if var_name == "TERMINAL_BLOCK_HASH":
# This is just Hash32() in the specs, that's fine
return

# We use a var in the definition of a new var, replace usages
# Reverse sort so that overridden values come first
updated_value = value_def.value
for var in sorted(yaml.keys(), reverse=True):
if var in updated_value:
updated_value = updated_value.replace(var, yaml[var])
try:
assert yaml[var_name] == repr(eval(updated_value)), \
f"mismatch for {var_name}: {yaml[var_name]} vs {eval(updated_value)}"
except NameError:
# Okay it's probably something more serious, let's ignore
pass


def get_spec(file_name: Path, preset: Dict[str, str], config: Dict[str, str], preset_name=str) -> SpecObject:
functions: Dict[str, str] = {}
protocols: Dict[str, ProtocolDefinition] = {}
Expand Down Expand Up @@ -300,8 +323,12 @@ def get_spec(file_name: Path, preset: Dict[str, str], config: Dict[str, str], pr

value_def = _parse_value(name, value)
if name in preset:
if preset_name == "mainnet":
check_yaml_matches_spec(name, preset, value_def)
preset_vars[name] = VariableDefinition(value_def.type_name, preset[name], value_def.comment, None)
elif name in config:
if preset_name == "mainnet":
check_yaml_matches_spec(name, config, value_def)
config_vars[name] = VariableDefinition(value_def.type_name, config[name], value_def.comment, None)
else:
if name in ('ENDIANNESS', 'KZG_ENDIANNESS'):
Expand Down
16 changes: 8 additions & 8 deletions specs/_features/eip7732/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ This is the modification of the fork choice accompanying the EIP-7732 upgrade.

## Constants

| Name | Value |
| -------------------------- | ----------------------------- |
| `PAYLOAD_TIMELY_THRESHOLD` | `PTC_SIZE // 2` (= 256) |
| `INTERVALS_PER_SLOT` | `4` # [modified in EIP-7732] |
| `PROPOSER_SCORE_BOOST` | `20` # [modified in EIP-7732] |
| `PAYLOAD_WITHHOLD_BOOST` | `40` |
| `PAYLOAD_REVEAL_BOOST` | `40` |
| Name | Value |
| ------------------------------ | ----------------------------- |
| `PAYLOAD_TIMELY_THRESHOLD` | `PTC_SIZE // 2` (= 256) |
| `INTERVALS_PER_SLOT` | `4` # [modified in EIP-7732] |
| `PROPOSER_SCORE_BOOST_EIP7732` | `20` # [modified in EIP-7732] |
| `PAYLOAD_WITHHOLD_BOOST` | `40` |
| `PAYLOAD_REVEAL_BOOST` | `40` |

## Containers

Expand Down Expand Up @@ -266,7 +266,7 @@ def compute_proposer_boost(store: Store, state: BeaconState, node: ChildNode) ->
if (node.slot < proposer_boost_slot) and (ancestor.is_payload_present != node.is_payload_present):
return Gwei(0)
committee_weight = get_total_active_balance(state) // SLOTS_PER_EPOCH
return (committee_weight * PROPOSER_SCORE_BOOST) // 100
return (committee_weight * PROPOSER_SCORE_BOOST_EIP7732) // 100
```

### New `compute_withhold_boost`
Expand Down
2 changes: 1 addition & 1 deletion specs/_features/eip7805/fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Warning: this configuration is not definitive.

| Name | Value |
| ---------------------- | ------------------------------------- |
| `EIP7805_FORK_VERSION` | `Version('0x10000000')` |
| `EIP7805_FORK_VERSION` | `Version('0x0a000000')` |
| `EIP7805_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** |

## Helper functions
Expand Down