Should use Sequence

This commit is contained in:
Hsiao-Wei Wang 2019-06-30 03:27:25 +08:00
parent 125660c5af
commit 56caa48314
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
2 changed files with 4 additions and 4 deletions

View File

@ -1093,7 +1093,7 @@ def slash_validator(state: BeaconState,
### Genesis trigger
Before genesis has been triggered and for every Ethereum 1.0 block call `is_genesis_trigger(deposits: Sequence[Deposit], timestamp: uint64) -> bool` where:
* `deposits` is the SSZ list of all deposits, ordered chronologically, up to and including the deposit triggering the latest `Deposit` log
* `deposits` is the list of all deposits, ordered chronologically, up to and including the deposit triggering the latest `Deposit` log
* `timestamp` is the Unix timestamp in the Ethereum 1.0 block that emitted the latest `Deposit` log
When `is_genesis_trigger(deposits, timestamp) is True` for the first time, let:
@ -1105,7 +1105,7 @@ When `is_genesis_trigger(deposits, timestamp) is True` for the first time, let:
*Note*: The function `is_genesis_trigger` has yet to be agreed upon by the community, and can be updated as necessary. We define the following testing placeholder:
```python
def is_genesis_trigger(deposits: List[Deposit, 2**DEPOSIT_CONTRACT_TREE_DEPTH], timestamp: uint64) -> bool:
def is_genesis_trigger(deposits: Sequence[Deposit], timestamp: uint64) -> bool:
SECONDS_PER_DAY = 86400
# Do not deploy too early
if timestamp - timestamp % SECONDS_PER_DAY + 2 * SECONDS_PER_DAY < MIN_GENESIS_TIME:
@ -1137,7 +1137,7 @@ def is_genesis_trigger(deposits: List[Deposit, 2**DEPOSIT_CONTRACT_TREE_DEPTH],
Let `genesis_state = get_genesis_beacon_state(genesis_deposits, genesis_time, genesis_eth1_block_hash)`.
```python
def get_genesis_beacon_state(deposits: List[Deposit, 2**DEPOSIT_CONTRACT_TREE_DEPTH],
def get_genesis_beacon_state(deposits: Sequence[Deposit],
genesis_time: int,
genesis_eth1_block_hash: Hash) -> BeaconState:
state = BeaconState(

View File

@ -75,7 +75,7 @@ def prepare_genesis_deposits(spec, genesis_validator_count, amount, signed=False
)
genesis_deposits.append(deposit)
return List[spec.Deposit, 2**spec.DEPOSIT_CONTRACT_TREE_DEPTH](*genesis_deposits), root
return genesis_deposits, root
def prepare_state_and_deposit(spec, state, validator_index, amount, withdrawal_credentials=None, signed=False):