Replace boolean with bool whenever make sense

This commit is contained in:
Mikhail Kalinin 2021-04-14 12:54:49 +06:00
parent 7d8570d488
commit 292fd604f8
2 changed files with 4 additions and 4 deletions

View File

@ -155,14 +155,14 @@ class ExecutionPayloadHeader(Container):
#### `is_transition_completed` #### `is_transition_completed`
```python ```python
def is_transition_completed(state: BeaconState) -> boolean: def is_transition_completed(state: BeaconState) -> bool:
return state.latest_execution_payload_header != ExecutionPayloadHeader() return state.latest_execution_payload_header != ExecutionPayloadHeader()
``` ```
#### `is_transition_block` #### `is_transition_block`
```python ```python
def is_transition_block(state: BeaconState, block_body: BeaconBlockBody) -> boolean: def is_transition_block(state: BeaconState, block_body: BeaconBlockBody) -> bool:
return not is_transition_completed(state) and block_body.execution_payload != ExecutionPayload() return not is_transition_completed(state) and block_body.execution_payload != ExecutionPayload()
``` ```
@ -191,7 +191,7 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None:
##### `validate_execution_payload` ##### `validate_execution_payload`
Let `validate_execution_payload(execution_payload: ExecutionPayload) -> boolean` be the function checking whether given `ExecutionPayload` is valid or not. Let `validate_execution_payload(execution_payload: ExecutionPayload) -> bool` be the function checking whether given `ExecutionPayload` is valid or not.
The body of the function is implementation dependent. The body of the function is implementation dependent.
##### `process_execution_payload` ##### `process_execution_payload`

View File

@ -47,7 +47,7 @@ Let `get_pow_block(block_hash: Hash32) -> PowBlock` be the function that given t
Used by fork-choice handler, `on_block`. Used by fork-choice handler, `on_block`.
```python ```python
def is_valid_transition_block(block: PowBlock) -> boolean: def is_valid_transition_block(block: PowBlock) -> bool:
is_total_difficulty_reached = block.total_difficulty >= TRANSITION_TOTAL_DIFFICULTY is_total_difficulty_reached = block.total_difficulty >= TRANSITION_TOTAL_DIFFICULTY
return block.is_valid and is_total_difficulty_reached return block.is_valid and is_total_difficulty_reached
``` ```