Merge branch 'dev' into single-attestation
This commit is contained in:
commit
d763a6ea72
|
@ -24,12 +24,12 @@
|
|||
- [Validator cycle](#validator-cycle)
|
||||
- [Containers](#containers)
|
||||
- [New containers](#new-containers)
|
||||
- [`DepositRequest`](#depositrequest)
|
||||
- [`PendingDeposit`](#pendingdeposit)
|
||||
- [`PendingPartialWithdrawal`](#pendingpartialwithdrawal)
|
||||
- [`PendingConsolidation`](#pendingconsolidation)
|
||||
- [`DepositRequest`](#depositrequest)
|
||||
- [`WithdrawalRequest`](#withdrawalrequest)
|
||||
- [`ConsolidationRequest`](#consolidationrequest)
|
||||
- [`PendingConsolidation`](#pendingconsolidation)
|
||||
- [`SingleAttestation`](#singleattestation)
|
||||
- [`ExecutionRequests`](#executionrequests)
|
||||
- [Modified Containers](#modified-containers)
|
||||
|
@ -202,19 +202,6 @@ The following values are (non-configurable) constants used throughout the specif
|
|||
|
||||
### 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`
|
||||
|
||||
*Note*: The container is new in EIP7251.
|
||||
|
@ -238,6 +225,30 @@ class PendingPartialWithdrawal(Container):
|
|||
amount: Gwei
|
||||
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`
|
||||
|
||||
*Note*: The container is new in EIP7251:EIP7002.
|
||||
|
@ -260,16 +271,6 @@ class ConsolidationRequest(Container):
|
|||
target_pubkey: BLSPubkey
|
||||
```
|
||||
|
||||
#### `PendingConsolidation`
|
||||
|
||||
*Note*: The container is new in EIP7251.
|
||||
|
||||
```python
|
||||
class PendingConsolidation(Container):
|
||||
source_index: ValidatorIndex
|
||||
target_index: ValidatorIndex
|
||||
```
|
||||
|
||||
#### `SingleAttestation`
|
||||
|
||||
```python
|
||||
|
@ -583,10 +584,12 @@ def get_attesting_indices(state: BeaconState, attestation: Attestation) -> Set[V
|
|||
output: Set[ValidatorIndex] = set()
|
||||
committee_indices = get_committee_indices(attestation.committee_bits)
|
||||
committee_offset = 0
|
||||
for index in committee_indices:
|
||||
committee = get_beacon_committee(state, attestation.data.slot, index)
|
||||
for committee_index in committee_indices:
|
||||
committee = get_beacon_committee(state, attestation.data.slot, committee_index)
|
||||
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)
|
||||
|
||||
committee_offset += len(committee)
|
||||
|
|
|
@ -65,7 +65,14 @@ def get_default_yaml():
|
|||
def _represent_none(self, _):
|
||||
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(str, _represent_str)
|
||||
|
||||
return yaml
|
||||
|
||||
|
|
|
@ -94,6 +94,30 @@ def test_fork_pre_activation(spec, phases, state):
|
|||
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])
|
||||
@spec_test
|
||||
@with_state
|
||||
|
|
Loading…
Reference in New Issue