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/deneb/
|
||||||
tests/core/pyspec/eth2spec/eip6110/
|
tests/core/pyspec/eth2spec/eip6110/
|
||||||
tests/core/pyspec/eth2spec/eip7002/
|
tests/core/pyspec/eth2spec/eip7002/
|
||||||
|
tests/core/pyspec/eth2spec/eip7549/
|
||||||
tests/core/pyspec/eth2spec/whisk/
|
tests/core/pyspec/eth2spec/whisk/
|
||||||
tests/core/pyspec/eth2spec/eip7594/
|
tests/core/pyspec/eth2spec/eip7594/
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ CAPELLA = 'capella'
|
||||||
DENEB = 'deneb'
|
DENEB = 'deneb'
|
||||||
EIP6110 = 'eip6110'
|
EIP6110 = 'eip6110'
|
||||||
EIP7002 = 'eip7002'
|
EIP7002 = 'eip7002'
|
||||||
|
EIP7549 = 'eip7549'
|
||||||
WHISK = 'whisk'
|
WHISK = 'whisk'
|
||||||
EIP7594 = 'eip7594'
|
EIP7594 = 'eip7594'
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,9 @@ from .constants import (
|
||||||
CAPELLA,
|
CAPELLA,
|
||||||
DENEB,
|
DENEB,
|
||||||
EIP6110,
|
EIP6110,
|
||||||
WHISK,
|
|
||||||
EIP7002,
|
EIP7002,
|
||||||
|
EIP7549,
|
||||||
|
WHISK,
|
||||||
EIP7594,
|
EIP7594,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ PREVIOUS_FORK_OF = {
|
||||||
CAPELLA: BELLATRIX,
|
CAPELLA: BELLATRIX,
|
||||||
DENEB: CAPELLA,
|
DENEB: CAPELLA,
|
||||||
EIP6110: DENEB,
|
EIP6110: DENEB,
|
||||||
|
EIP7549: DENEB,
|
||||||
WHISK: CAPELLA,
|
WHISK: CAPELLA,
|
||||||
EIP7002: CAPELLA,
|
EIP7002: CAPELLA,
|
||||||
EIP7594: DENEB,
|
EIP7594: DENEB,
|
||||||
|
|
|
@ -5,6 +5,7 @@ from .capella import CapellaSpecBuilder
|
||||||
from .deneb import DenebSpecBuilder
|
from .deneb import DenebSpecBuilder
|
||||||
from .eip6110 import EIP6110SpecBuilder
|
from .eip6110 import EIP6110SpecBuilder
|
||||||
from .eip7002 import EIP7002SpecBuilder
|
from .eip7002 import EIP7002SpecBuilder
|
||||||
|
from .eip7549 import EIP7549SpecBuilder
|
||||||
from .whisk import WhiskSpecBuilder
|
from .whisk import WhiskSpecBuilder
|
||||||
from .eip7594 import EIP7594SpecBuilder
|
from .eip7594 import EIP7594SpecBuilder
|
||||||
|
|
||||||
|
@ -13,6 +14,6 @@ spec_builders = {
|
||||||
builder.fork: builder
|
builder.fork: builder
|
||||||
for builder in (
|
for builder in (
|
||||||
Phase0SpecBuilder, AltairSpecBuilder, BellatrixSpecBuilder, CapellaSpecBuilder, DenebSpecBuilder,
|
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
|
### Modified containers
|
||||||
|
|
||||||
#### Attestation
|
#### `Attestation`
|
||||||
|
|
||||||
```python
|
```python
|
||||||
class Attestation(Container):
|
class Attestation(Container):
|
||||||
aggregation_bits: List[Bitlist[MAX_VALIDATORS_PER_COMMITTEE], MAX_COMMITTEES_PER_SLOT] # [Modified in EIP7549]
|
aggregation_bits: List[Bitlist[MAX_VALIDATORS_PER_COMMITTEE], MAX_COMMITTEES_PER_SLOT] # [Modified in EIP7549]
|
||||||
data: AttestationData
|
data: AttestationData
|
||||||
committee_bits: Bitvector[MAX_COMMITTEES_PER_SLOT] # [New in EIP7549]
|
committee_bits: Bitvector[MAX_COMMITTEES_PER_SLOT] # [New in EIP7549]
|
||||||
signature: BLSSignature
|
signature: BLSSignature
|
||||||
```
|
```
|
||||||
|
|
||||||
#### IndexedAttestation
|
#### `IndexedAttestation`
|
||||||
|
|
||||||
```python
|
```python
|
||||||
class IndexedAttestation(Container):
|
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
|
data: AttestationData
|
||||||
signature: BLSSignature
|
signature: BLSSignature
|
||||||
```
|
```
|
||||||
|
@ -68,7 +69,7 @@ class IndexedAttestation(Container):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def get_committee_indices(commitee_bits: Bitvector) -> List[CommitteeIndex]:
|
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
|
### Beacon state accessors
|
||||||
|
@ -76,7 +77,8 @@ def get_committee_indices(commitee_bits: Bitvector) -> List[CommitteeIndex]:
|
||||||
#### New `get_committee_attesters`
|
#### New `get_committee_attesters`
|
||||||
|
|
||||||
```python
|
```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)
|
committee = get_beacon_committee(state, data.slot, index)
|
||||||
return set(index for i, index in enumerate(committee) if attesting_bits[i])
|
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)
|
committee_indices = get_committee_indices(attestation.committee_bits)
|
||||||
for index in committee_indices:
|
for index in committee_indices:
|
||||||
attesting_bits = attestation.attesting_bits[index]
|
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)
|
output = output.union(committee_attesters)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
Loading…
Reference in New Issue