mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-31 21:05:24 +00:00
avoid zero constant for deposits fork-version, just default to it
This commit is contained in:
parent
b075a7a0ab
commit
6b5f4b44ea
@ -175,7 +175,6 @@ These configurations are updated for releases, but may be out of sync during `de
|
||||
| Name | Value |
|
||||
| - | - |
|
||||
| `DEPOSIT_CONTRACT_TREE_DEPTH` | `2**5` (= 32) |
|
||||
| `DEPOSIT_FORK_VERSION` | `b'\x00' * 4` |
|
||||
|
||||
### Gwei values
|
||||
|
||||
@ -634,9 +633,9 @@ The `hash` function is SHA256.
|
||||
### `bls_domain`
|
||||
|
||||
```python
|
||||
def bls_domain(domain_type: int, fork_version: bytes) -> int:
|
||||
def bls_domain(domain_type: int, fork_version=b'\x00\x00\x00\x00') -> int:
|
||||
"""
|
||||
Return the bls domain given by the ``domain_type`` and 4 byte ``fork_version``..
|
||||
Return the bls domain given by the ``domain_type`` and optional 4 byte ``fork_version`` (defaults to zero).
|
||||
"""
|
||||
return bytes_to_int(int_to_bytes(domain_type, length=4) + fork_version)
|
||||
```
|
||||
@ -1779,7 +1778,7 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
|
||||
# Verify the deposit signature (proof of possession)
|
||||
# Note: deposits are valid across forks, hence the deposit domain is retrieved directly from `bls_domain`
|
||||
if not bls_verify(
|
||||
pubkey, signing_root(deposit.data), deposit.data.signature, bls_domain(DOMAIN_DEPOSIT, DEPOSIT_FORK_VERSION)
|
||||
pubkey, signing_root(deposit.data), deposit.data.signature, bls_domain(DOMAIN_DEPOSIT)
|
||||
):
|
||||
return
|
||||
|
||||
|
@ -98,7 +98,7 @@ To submit a deposit:
|
||||
* Pack the validator's [initialization parameters](#initialization) into `deposit_data`, a [`DepositData`](../core/0_beacon-chain.md#depositdata) SSZ object.
|
||||
* Let `amount` be the amount in Gwei to be deposited by the validator where `MIN_DEPOSIT_AMOUNT <= amount <= MAX_EFFECTIVE_BALANCE`.
|
||||
* Set `deposit_data.amount = amount`.
|
||||
* Let `signature` be the result of `bls_sign` of the `signing_root(deposit_data)` with `domain=bls_domain(DOMAIN_DEPOSIT, DEPOSIT_FORK_VERSION)`. (Deposits are valid regardless of fork version, hence the static fork version being directly passed into `bls_domain`).
|
||||
* Let `signature` be the result of `bls_sign` of the `signing_root(deposit_data)` with `domain=bls_domain(DOMAIN_DEPOSIT)`. (Deposits are valid regardless of fork version, `bls_domain` will default to zeroes there).
|
||||
* Send a transaction on the Ethereum 1.0 chain to `DEPOSIT_CONTRACT_ADDRESS` executing `def deposit(pubkey: bytes[48], withdrawal_credentials: bytes[32], signature: bytes[96])` along with a deposit of `amount` Gwei.
|
||||
|
||||
*Note*: Deposits made for the same `pubkey` are treated as for the same validator. A singular `Validator` will be added to `state.validator_registry` with each additional deposit amount added to the validator's balance. A validator can only be activated when total deposits for the validator pubkey meet or exceed `MAX_EFFECTIVE_BALANCE`.
|
||||
|
@ -147,7 +147,6 @@ def build_deposit_data(state, pubkey, privkey, amount):
|
||||
privkey=privkey,
|
||||
domain=bls_domain(
|
||||
spec.DOMAIN_DEPOSIT,
|
||||
spec.DEPOSIT_FORK_VERSION,
|
||||
)
|
||||
)
|
||||
deposit_data.signature = signature
|
||||
|
Loading…
x
Reference in New Issue
Block a user