mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-18 13:36:29 +00:00
Merge branch 'dev' into single-attestation
This commit is contained in:
commit
d763a6ea72
@ -24,12 +24,12 @@
|
|||||||
- [Validator cycle](#validator-cycle)
|
- [Validator cycle](#validator-cycle)
|
||||||
- [Containers](#containers)
|
- [Containers](#containers)
|
||||||
- [New containers](#new-containers)
|
- [New containers](#new-containers)
|
||||||
- [`DepositRequest`](#depositrequest)
|
|
||||||
- [`PendingDeposit`](#pendingdeposit)
|
- [`PendingDeposit`](#pendingdeposit)
|
||||||
- [`PendingPartialWithdrawal`](#pendingpartialwithdrawal)
|
- [`PendingPartialWithdrawal`](#pendingpartialwithdrawal)
|
||||||
|
- [`PendingConsolidation`](#pendingconsolidation)
|
||||||
|
- [`DepositRequest`](#depositrequest)
|
||||||
- [`WithdrawalRequest`](#withdrawalrequest)
|
- [`WithdrawalRequest`](#withdrawalrequest)
|
||||||
- [`ConsolidationRequest`](#consolidationrequest)
|
- [`ConsolidationRequest`](#consolidationrequest)
|
||||||
- [`PendingConsolidation`](#pendingconsolidation)
|
|
||||||
- [`SingleAttestation`](#singleattestation)
|
- [`SingleAttestation`](#singleattestation)
|
||||||
- [`ExecutionRequests`](#executionrequests)
|
- [`ExecutionRequests`](#executionrequests)
|
||||||
- [Modified Containers](#modified-containers)
|
- [Modified Containers](#modified-containers)
|
||||||
@ -202,19 +202,6 @@ The following values are (non-configurable) constants used throughout the specif
|
|||||||
|
|
||||||
### New containers
|
### New containers
|
||||||
|
|
||||||
#### `DepositRequest`
|
|
||||||
|
|
||||||
*Note*: The container is new in EIP6110.
|
|
||||||
|
|
||||||
```python
|
|
||||||
class DepositRequest(Container):
|
|
||||||
pubkey: BLSPubkey
|
|
||||||
withdrawal_credentials: Bytes32
|
|
||||||
amount: Gwei
|
|
||||||
signature: BLSSignature
|
|
||||||
index: uint64
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `PendingDeposit`
|
#### `PendingDeposit`
|
||||||
|
|
||||||
*Note*: The container is new in EIP7251.
|
*Note*: The container is new in EIP7251.
|
||||||
@ -238,6 +225,30 @@ class PendingPartialWithdrawal(Container):
|
|||||||
amount: Gwei
|
amount: Gwei
|
||||||
withdrawable_epoch: Epoch
|
withdrawable_epoch: Epoch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### `PendingConsolidation`
|
||||||
|
|
||||||
|
*Note*: The container is new in EIP7251.
|
||||||
|
|
||||||
|
```python
|
||||||
|
class PendingConsolidation(Container):
|
||||||
|
source_index: ValidatorIndex
|
||||||
|
target_index: ValidatorIndex
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `DepositRequest`
|
||||||
|
|
||||||
|
*Note*: The container is new in EIP6110.
|
||||||
|
|
||||||
|
```python
|
||||||
|
class DepositRequest(Container):
|
||||||
|
pubkey: BLSPubkey
|
||||||
|
withdrawal_credentials: Bytes32
|
||||||
|
amount: Gwei
|
||||||
|
signature: BLSSignature
|
||||||
|
index: uint64
|
||||||
|
```
|
||||||
|
|
||||||
#### `WithdrawalRequest`
|
#### `WithdrawalRequest`
|
||||||
|
|
||||||
*Note*: The container is new in EIP7251:EIP7002.
|
*Note*: The container is new in EIP7251:EIP7002.
|
||||||
@ -260,16 +271,6 @@ class ConsolidationRequest(Container):
|
|||||||
target_pubkey: BLSPubkey
|
target_pubkey: BLSPubkey
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `PendingConsolidation`
|
|
||||||
|
|
||||||
*Note*: The container is new in EIP7251.
|
|
||||||
|
|
||||||
```python
|
|
||||||
class PendingConsolidation(Container):
|
|
||||||
source_index: ValidatorIndex
|
|
||||||
target_index: ValidatorIndex
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `SingleAttestation`
|
#### `SingleAttestation`
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@ -583,10 +584,12 @@ def get_attesting_indices(state: BeaconState, attestation: Attestation) -> Set[V
|
|||||||
output: Set[ValidatorIndex] = set()
|
output: Set[ValidatorIndex] = set()
|
||||||
committee_indices = get_committee_indices(attestation.committee_bits)
|
committee_indices = get_committee_indices(attestation.committee_bits)
|
||||||
committee_offset = 0
|
committee_offset = 0
|
||||||
for index in committee_indices:
|
for committee_index in committee_indices:
|
||||||
committee = get_beacon_committee(state, attestation.data.slot, index)
|
committee = get_beacon_committee(state, attestation.data.slot, committee_index)
|
||||||
committee_attesters = set(
|
committee_attesters = set(
|
||||||
index for i, index in enumerate(committee) if attestation.aggregation_bits[committee_offset + i])
|
attester_index for i, attester_index in enumerate(committee)
|
||||||
|
if attestation.aggregation_bits[committee_offset + i]
|
||||||
|
)
|
||||||
output = output.union(committee_attesters)
|
output = output.union(committee_attesters)
|
||||||
|
|
||||||
committee_offset += len(committee)
|
committee_offset += len(committee)
|
||||||
|
@ -65,7 +65,14 @@ def get_default_yaml():
|
|||||||
def _represent_none(self, _):
|
def _represent_none(self, _):
|
||||||
return self.represent_scalar('tag:yaml.org,2002:null', 'null')
|
return self.represent_scalar('tag:yaml.org,2002:null', 'null')
|
||||||
|
|
||||||
|
def _represent_str(self, data):
|
||||||
|
if data.startswith("0x"):
|
||||||
|
# Without this, a zero-byte hex string is represented without quotes.
|
||||||
|
return self.represent_scalar('tag:yaml.org,2002:str', data, style="'")
|
||||||
|
return self.represent_str(data)
|
||||||
|
|
||||||
yaml.representer.add_representer(type(None), _represent_none)
|
yaml.representer.add_representer(type(None), _represent_none)
|
||||||
|
yaml.representer.add_representer(str, _represent_str)
|
||||||
|
|
||||||
return yaml
|
return yaml
|
||||||
|
|
||||||
|
@ -94,6 +94,30 @@ def test_fork_pre_activation(spec, phases, state):
|
|||||||
assert len(post_state.pending_deposits) > 0
|
assert len(post_state.pending_deposits) > 0
|
||||||
|
|
||||||
|
|
||||||
|
@with_phases(phases=[DENEB], other_phases=[ELECTRA])
|
||||||
|
@spec_test
|
||||||
|
@with_state
|
||||||
|
@with_meta_tags(ELECTRA_FORK_TEST_META_TAGS)
|
||||||
|
def test_fork_pending_deposits_are_sorted(spec, phases, state):
|
||||||
|
post_spec = phases[ELECTRA]
|
||||||
|
state.validators[0].activation_epoch = spec.FAR_FUTURE_EPOCH
|
||||||
|
state.validators[0].activation_eligibility_epoch = 2
|
||||||
|
state.validators[1].activation_epoch = spec.FAR_FUTURE_EPOCH
|
||||||
|
state.validators[1].activation_eligibility_epoch = 3
|
||||||
|
state.validators[2].activation_epoch = spec.FAR_FUTURE_EPOCH
|
||||||
|
state.validators[2].activation_eligibility_epoch = 2
|
||||||
|
state.validators[3].activation_epoch = spec.FAR_FUTURE_EPOCH
|
||||||
|
state.validators[3].activation_eligibility_epoch = 1
|
||||||
|
|
||||||
|
post_state = yield from run_fork_test(post_spec, state)
|
||||||
|
|
||||||
|
assert len(post_state.pending_deposits) == 4
|
||||||
|
assert post_state.pending_deposits[0].pubkey == state.validators[3].pubkey
|
||||||
|
assert post_state.pending_deposits[1].pubkey == state.validators[0].pubkey
|
||||||
|
assert post_state.pending_deposits[2].pubkey == state.validators[2].pubkey
|
||||||
|
assert post_state.pending_deposits[3].pubkey == state.validators[1].pubkey
|
||||||
|
|
||||||
|
|
||||||
@with_phases(phases=[DENEB], other_phases=[ELECTRA])
|
@with_phases(phases=[DENEB], other_phases=[ELECTRA])
|
||||||
@spec_test
|
@spec_test
|
||||||
@with_state
|
@with_state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user