make it executable for basic linter checks & fix errors
This commit is contained in:
parent
dc37dcdbf2
commit
03c23c6fb1
|
@ -23,6 +23,7 @@ tests/core/pyspec/eth2spec/capella/
|
|||
tests/core/pyspec/eth2spec/deneb/
|
||||
tests/core/pyspec/eth2spec/eip6110/
|
||||
tests/core/pyspec/eth2spec/eip7002/
|
||||
tests/core/pyspec/eth2spec/eip7549/
|
||||
tests/core/pyspec/eth2spec/whisk/
|
||||
tests/core/pyspec/eth2spec/eip7594/
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ CAPELLA = 'capella'
|
|||
DENEB = 'deneb'
|
||||
EIP6110 = 'eip6110'
|
||||
EIP7002 = 'eip7002'
|
||||
EIP7549 = 'eip7549'
|
||||
WHISK = 'whisk'
|
||||
EIP7594 = 'eip7594'
|
||||
|
||||
|
|
|
@ -7,8 +7,9 @@ from .constants import (
|
|||
CAPELLA,
|
||||
DENEB,
|
||||
EIP6110,
|
||||
WHISK,
|
||||
EIP7002,
|
||||
EIP7549,
|
||||
WHISK,
|
||||
EIP7594,
|
||||
)
|
||||
|
||||
|
@ -20,6 +21,7 @@ PREVIOUS_FORK_OF = {
|
|||
CAPELLA: BELLATRIX,
|
||||
DENEB: CAPELLA,
|
||||
EIP6110: DENEB,
|
||||
EIP7549: DENEB,
|
||||
WHISK: CAPELLA,
|
||||
EIP7002: CAPELLA,
|
||||
EIP7594: DENEB,
|
||||
|
|
|
@ -5,6 +5,7 @@ from .capella import CapellaSpecBuilder
|
|||
from .deneb import DenebSpecBuilder
|
||||
from .eip6110 import EIP6110SpecBuilder
|
||||
from .eip7002 import EIP7002SpecBuilder
|
||||
from .eip7549 import EIP7549SpecBuilder
|
||||
from .whisk import WhiskSpecBuilder
|
||||
from .eip7594 import EIP7594SpecBuilder
|
||||
|
||||
|
@ -13,6 +14,6 @@ spec_builders = {
|
|||
builder.fork: builder
|
||||
for builder in (
|
||||
Phase0SpecBuilder, AltairSpecBuilder, BellatrixSpecBuilder, CapellaSpecBuilder, DenebSpecBuilder,
|
||||
EIP6110SpecBuilder, EIP7002SpecBuilder, WhiskSpecBuilder, EIP7594SpecBuilder,
|
||||
EIP6110SpecBuilder, EIP7002SpecBuilder, EIP7549SpecBuilder, WhiskSpecBuilder, EIP7594SpecBuilder,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
from .base import BaseSpecBuilder
|
||||
from ..constants import EIP7549
|
||||
|
||||
|
||||
class EIP7549SpecBuilder(BaseSpecBuilder):
|
||||
fork: str = EIP7549
|
||||
|
||||
@classmethod
|
||||
def imports(cls, preset_name: str):
|
||||
return super().imports(preset_name) + f'''
|
||||
'''
|
|
@ -41,21 +41,22 @@ This is the beacon chain specification to move the attestation committee index o
|
|||
|
||||
### Modified containers
|
||||
|
||||
#### Attestation
|
||||
#### `Attestation`
|
||||
|
||||
```python
|
||||
class Attestation(Container):
|
||||
aggregation_bits: List[Bitlist[MAX_VALIDATORS_PER_COMMITTEE], MAX_COMMITTEES_PER_SLOT] # [Modified in EIP7549]
|
||||
data: AttestationData
|
||||
committee_bits: Bitvector[MAX_COMMITTEES_PER_SLOT] # [New in EIP7549]
|
||||
signature: BLSSignature
|
||||
aggregation_bits: List[Bitlist[MAX_VALIDATORS_PER_COMMITTEE], MAX_COMMITTEES_PER_SLOT] # [Modified in EIP7549]
|
||||
data: AttestationData
|
||||
committee_bits: Bitvector[MAX_COMMITTEES_PER_SLOT] # [New in EIP7549]
|
||||
signature: BLSSignature
|
||||
```
|
||||
|
||||
#### IndexedAttestation
|
||||
#### `IndexedAttestation`
|
||||
|
||||
```python
|
||||
class IndexedAttestation(Container):
|
||||
attesting_indices: List[ValidatorIndex, MAX_VALIDATORS_PER_COMMITTEE * MAX_COMMITTEES_PER_SLOT] # [Modified in EIP7549]
|
||||
# [Modified in EIP7549]
|
||||
attesting_indices: List[ValidatorIndex, MAX_VALIDATORS_PER_COMMITTEE * MAX_COMMITTEES_PER_SLOT]
|
||||
data: AttestationData
|
||||
signature: BLSSignature
|
||||
```
|
||||
|
@ -68,7 +69,7 @@ class IndexedAttestation(Container):
|
|||
|
||||
```python
|
||||
def get_committee_indices(commitee_bits: Bitvector) -> List[CommitteeIndex]:
|
||||
return [CommitteeIndex(index) for bit, index in enumerate(commitee_bits) if bit]
|
||||
return [CommitteeIndex(index) for bit, index in enumerate(commitee_bits) if bit]
|
||||
```
|
||||
|
||||
### Beacon state accessors
|
||||
|
@ -76,7 +77,8 @@ def get_committee_indices(commitee_bits: Bitvector) -> List[CommitteeIndex]:
|
|||
#### New `get_committee_attesters`
|
||||
|
||||
```python
|
||||
def get_committee_attesters(state: BeaconState, attesting_bits: Bitlist, index: CommitteeIndex) -> Set[ValidatorIndex]:
|
||||
def get_committee_attesters(state: BeaconState, data: AttestationData,
|
||||
attesting_bits: Bitlist, index: CommitteeIndex) -> Set[ValidatorIndex]:
|
||||
committee = get_beacon_committee(state, data.slot, index)
|
||||
return set(index for i, index in enumerate(committee) if attesting_bits[i])
|
||||
```
|
||||
|
@ -93,7 +95,7 @@ def get_attesting_indices(state: BeaconState, attestation: Attestation) -> Set[V
|
|||
committee_indices = get_committee_indices(attestation.committee_bits)
|
||||
for index in committee_indices:
|
||||
attesting_bits = attestation.attesting_bits[index]
|
||||
committee_attesters = get_committee_attesters(state, attesting_bits, index)
|
||||
committee_attesters = get_committee_attesters(state, attestation.data, attesting_bits, index)
|
||||
output = output.union(committee_attesters)
|
||||
|
||||
return output
|
||||
|
|
Loading…
Reference in New Issue