Fix setup.py parser and rename `TBH_ACTIVATION_EPOCH` -> `TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH`

This commit is contained in:
Hsiao-Wei Wang 2021-10-19 11:25:50 +08:00
parent 3bfdc917e1
commit ba582b3e3a
No known key found for this signature in database
GPG Key ID: 1111A8A81778319E
7 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ PRESET_BASE: 'mainnet'
TERMINAL_TOTAL_DIFFICULTY: 115792089237316195423570985008687907853269984665640564039457584007913129638912 TERMINAL_TOTAL_DIFFICULTY: 115792089237316195423570985008687907853269984665640564039457584007913129638912
# By default, don't use these params # By default, don't use these params
TERMINAL_BLOCK_HASH: 0x0000000000000000000000000000000000000000000000000000000000000000 TERMINAL_BLOCK_HASH: 0x0000000000000000000000000000000000000000000000000000000000000000
TBH_ACTIVATION_EPOCH: 18446744073709551615 TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615

View File

@ -9,7 +9,7 @@ PRESET_BASE: 'minimal'
TERMINAL_TOTAL_DIFFICULTY: 115792089237316195423570985008687907853269984665640564039457584007913129638912 TERMINAL_TOTAL_DIFFICULTY: 115792089237316195423570985008687907853269984665640564039457584007913129638912
# By default, don't use these params # By default, don't use these params
TERMINAL_BLOCK_HASH: 0x0000000000000000000000000000000000000000000000000000000000000000 TERMINAL_BLOCK_HASH: 0x0000000000000000000000000000000000000000000000000000000000000000
TBH_ACTIVATION_EPOCH: 18446744073709551615 TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615

View File

@ -603,7 +603,7 @@ def objects_to_spec(preset_name: str,
# Access global dict of config vars for runtime configurables # Access global dict of config vars for runtime configurables
for name in spec_object.config_vars.keys(): for name in spec_object.config_vars.keys():
functions_spec = functions_spec.replace(name, 'config.' + name) functions_spec = re.sub(r"\b%s\b" % name, 'config.' + name, functions_spec)
def format_config_var(name: str, vardef: VariableDefinition) -> str: def format_config_var(name: str, vardef: VariableDefinition) -> str:
if vardef.type_name is None: if vardef.type_name is None:

View File

@ -75,7 +75,7 @@ This patch adds transaction execution to the beacon chain as part of the Merge f
| - | - | | - | - |
| `TERMINAL_TOTAL_DIFFICULTY` | **TBD** | | `TERMINAL_TOTAL_DIFFICULTY` | **TBD** |
| `TERMINAL_BLOCK_HASH` | `Hash32()` | | `TERMINAL_BLOCK_HASH` | `Hash32()` |
| `TBH_ACTIVATION_EPOCH` | `FAR_FUTURE_EPOCH` | | `TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH` | `FAR_FUTURE_EPOCH` |
## Containers ## Containers

View File

@ -24,6 +24,6 @@ Except under exceptional scenarios, this setting is not expected to be used. Suf
To allow for transition coordination around a specific PoW block, clients must also provide `--terminal-block-hash-override` and `--terminal-block-hash-epoch-override` as configurable settings. To allow for transition coordination around a specific PoW block, clients must also provide `--terminal-block-hash-override` and `--terminal-block-hash-epoch-override` as configurable settings.
* The value provided by `--terminal-block-hash-override` takes precedence over the pre-configured `TERMINAL_BLOCK_HASH` parameter. * The value provided by `--terminal-block-hash-override` takes precedence over the pre-configured `TERMINAL_BLOCK_HASH` parameter.
* The value provided by `--terminal-block-hash-epoch-override` takes precedence over the pre-configured `TBH_ACTIVATION_EPOCH` parameter. * The value provided by `--terminal-block-hash-epoch-override` takes precedence over the pre-configured `TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH` parameter.
Except under exceptional scenarios, these settings are not expected to be used. Sufficient warning to the user about this exceptional configurable setting should be provided. Except under exceptional scenarios, these settings are not expected to be used. Sufficient warning to the user about this exceptional configurable setting should be provided.

View File

@ -114,7 +114,7 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
pow_parent = get_pow_block(pow_block.parent_hash) pow_parent = get_pow_block(pow_block.parent_hash)
assert is_valid_terminal_pow_block(pow_block, pow_parent) assert is_valid_terminal_pow_block(pow_block, pow_parent)
if TERMINAL_BLOCK_HASH != Hash32(): if TERMINAL_BLOCK_HASH != Hash32():
assert compute_epoch_at_slot(block.slot) >= TBH_ACTIVATION_EPOCH assert compute_epoch_at_slot(block.slot) >= TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH
# Add new block to the store # Add new block to the store
store.blocks[hash_tree_root(block)] = block store.blocks[hash_tree_root(block)] = block

View File

@ -128,7 +128,7 @@ def prepare_execution_payload(state: BeaconState,
execution_engine: ExecutionEngine) -> Optional[PayloadId]: execution_engine: ExecutionEngine) -> Optional[PayloadId]:
if not is_merge_complete(state): if not is_merge_complete(state):
is_tbh_override_set = TERMINAL_BLOCK_HASH != Hash32() is_tbh_override_set = TERMINAL_BLOCK_HASH != Hash32()
if is_tbh_override_set and get_current_epoch(state.slot) < TBH_ACTIVATION_EPOCH: if is_tbh_override_set and get_current_epoch(state.slot) < TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH:
# TBH is set but activation epoch is not yet reached, no prepare payload call is needed # TBH is set but activation epoch is not yet reached, no prepare payload call is needed
return None return None