Address Danny's comments
This commit is contained in:
parent
29129d06cf
commit
ef91ee5698
|
@ -1,5 +1,6 @@
|
|||
MIN_DEPOSIT_AMOUNT: constant(uint256) = 1000000000 # Gwei
|
||||
DEPOSIT_CONTRACT_TREE_DEPTH: constant(uint256) = 32
|
||||
MAX_DEPOSIT_COUNT: constant(uint256) = 4294967295 # 2**DEPOSIT_CONTRACT_TREE_DEPTH - 1
|
||||
PUBKEY_LENGTH: constant(uint256) = 48 # bytes
|
||||
WITHDRAWAL_CREDENTIALS_LENGTH: constant(uint256) = 32 # bytes
|
||||
AMOUNT_LENGTH: constant(uint256) = 8 # bytes
|
||||
|
@ -27,7 +28,8 @@ def __init__():
|
|||
@constant
|
||||
def to_little_endian_64(value: uint256) -> bytes[8]:
|
||||
# Reversing bytes using bitwise uint256 manipulations
|
||||
# (array accesses of bytes[] are not currently supported in Vyper)
|
||||
# Note: array accesses of bytes[] are not currently supported in Vyper
|
||||
# Note: this function is only called when `value < 2**64`
|
||||
y: uint256 = 0
|
||||
x: uint256 = value
|
||||
for _ in range(8):
|
||||
|
@ -62,8 +64,8 @@ def get_deposit_count() -> bytes[8]:
|
|||
def deposit(pubkey: bytes[PUBKEY_LENGTH],
|
||||
withdrawal_credentials: bytes[WITHDRAWAL_CREDENTIALS_LENGTH],
|
||||
signature: bytes[SIGNATURE_LENGTH]):
|
||||
# Avoid overflowing the Merkle tree
|
||||
assert self.deposit_count < 2**DEPOSIT_CONTRACT_TREE_DEPTH - 1
|
||||
# Avoid overflowing the Merkle tree (and prevent edge case in computing `self.branch`)
|
||||
assert self.deposit_count < MAX_DEPOSIT_COUNT
|
||||
|
||||
# Validate deposit data
|
||||
deposit_amount: uint256 = msg.value / as_wei_value(1, "gwei")
|
||||
|
|
|
@ -1158,7 +1158,7 @@ def slash_validator(state: BeaconState,
|
|||
|
||||
### Genesis trigger
|
||||
|
||||
Whenever the deposit contract emits a `Deposit` log call the function `is_genesis_trigger(deposits: List[Deposit], timestamp: uint64) -> bool` where:
|
||||
Before genesis has been triggered and whenever the deposit contract emits a `Deposit`, log call the function `is_genesis_trigger(deposits: List[Deposit], timestamp: uint64) -> bool` where:
|
||||
|
||||
* `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
|
||||
|
@ -1168,7 +1168,7 @@ When `is_genesis_trigger(deposits, timestamp) is True` for the first time let:
|
|||
* `genesis_deposits = deposits`
|
||||
* `genesis_time = timestamp % SECONDS_PER_DAY + 2 * SECONDS_PER_DAY` where `SECONDS_PER_DAY = 86400`
|
||||
* `genesis_eth1_data` be the object of type `Eth1Data` where:
|
||||
* `genesis_eth1_data.block_hash` is the block hash for the last deposit in `deposits`
|
||||
* `genesis_eth1_data.block_hash` is the Ethereum 1.0 block hash that emitted to log for the last deposit in `deposits`
|
||||
* `genesis_eth1_data.deposit_root` is the deposit root for the last deposit in `deposits`
|
||||
* `genesis_eth1_data.deposit_count = len(genesis_deposits)`
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ The deposit contract has a public `deposit` function to make deposits. It takes
|
|||
|
||||
#### Deposit amount
|
||||
|
||||
The ETH sent to the deposit contract, i.e. the deposit amount, is burnt on Ethereum 1.0. The minimum deposit amount is `MIN_DEPOSIT_AMOUNT` Gwei.
|
||||
The amount of ETH (rounded down to the closest Gwei) sent to the deposit contract is the deposit amount, which must be of size at least `MIN_DEPOSIT_AMOUNT` Gwei. Note that ETH consumed by the deposit contract is no longer usable on Ethereum 1.0.
|
||||
|
||||
#### Withdrawal credentials
|
||||
|
||||
|
|
Loading…
Reference in New Issue