MAX_PERSISTENT_COMMITTEE_SIZE -> TARGET_PERSISTENT_COMMITTEE_SIZE

This commit is contained in:
Danny Ryan 2019-08-12 19:05:16 -06:00
parent 469f3d84a3
commit c224af999e
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 10 additions and 10 deletions

View File

@ -66,7 +66,7 @@ We define the following Python custom types for type hinting and readability:
| Name | Value |
| - | - |
| `SHARD_SLOTS_PER_BEACON_SLOT` | `2**1` (= 2) |
| `MAX_PERSISTENT_COMMITTEE_SIZE` | `2**7` (= 128) |
| `TARGET_PERSISTENT_COMMITTEE_SIZE` | `2**7` (= 128) |
| `SHARD_HEADER_SIZE` | `2**9` (= 512) |
| `SHARD_BLOCK_SIZE_TARGET` | `2**14` (= 16,384) |
| `SHARD_BLOCK_SIZE_LIMIT` | `2**16` (= 65,536) |
@ -151,7 +151,7 @@ class ShardBlockCore(Container):
data_root: Hash
state_root: Hash
total_bytes: uint64
attester_bitfield: Bitvector[MAX_PERSISTENT_COMMITTEE_SIZE * 2]
attester_bitfield: Bitvector[TARGET_PERSISTENT_COMMITTEE_SIZE * 2]
```
### `ExtendedShardBlockCore`
@ -164,7 +164,7 @@ class ExtendedShardBlockCore(Container):
data: Bytes[SHARD_BLOCK_SIZE_LIMIT - SHARD_HEADER_SIZE]
state_root: Hash
total_bytes: uint64
attester_bitfield: Bitvector[MAX_PERSISTENT_COMMITTEE_SIZE * 2]
attester_bitfield: Bitvector[TARGET_PERSISTENT_COMMITTEE_SIZE * 2]
```
### `ShardState`
@ -172,10 +172,10 @@ class ExtendedShardBlockCore(Container):
```python
class ShardState(Container):
history_accumulator: Vector[Hash, HISTORY_ACCUMULATOR_VECTOR]
earlier_committee_rewards: List[uint64, MAX_PERSISTENT_COMMITTEE_SIZE]
later_committee_rewards: List[uint64, MAX_PERSISTENT_COMMITTEE_SIZE]
earlier_committee_fees: List[Gwei, MAX_PERSISTENT_COMMITTEE_SIZE]
later_committee_fees: List[Gwei, MAX_PERSISTENT_COMMITTEE_SIZE]
earlier_committee_rewards: List[uint64, TARGET_PERSISTENT_COMMITTEE_SIZE]
later_committee_rewards: List[uint64, TARGET_PERSISTENT_COMMITTEE_SIZE]
earlier_committee_fees: List[Gwei, TARGET_PERSISTENT_COMMITTEE_SIZE]
later_committee_fees: List[Gwei, TARGET_PERSISTENT_COMMITTEE_SIZE]
basefee: Gwei
slot: ShardSlot
shard: Shard
@ -230,7 +230,7 @@ def get_period_committee(state: BeaconState, epoch: Epoch, shard: Shard) -> Sequ
count=SHARD_COUNT,
)
return full_committee[:MAX_PERSISTENT_COMMITTEE_SIZE]
return full_committee[:TARGET_PERSISTENT_COMMITTEE_SIZE]
```
### `get_persistent_committee`
@ -495,7 +495,7 @@ def shard_block_transition(state: ShardState,
add_reward(state, beacon_state, validator_index, base_reward)
attestations += 1
for i in range(len(attester_committee), MAX_PERSISTENT_COMMITTEE_SIZE):
for i in range(len(attester_committee), TARGET_PERSISTENT_COMMITTEE_SIZE):
assert block.core.attester_bitfield[i] is False or block.core.attester_bitfield[i] == 0 # TODO: FIX Bitvector
assert bls_verify(

View File

@ -57,7 +57,7 @@ def build_empty_shard_block(spec,
attester_committee = spec.get_persistent_committee(beacon_state, shard_state.shard, block.core.slot)
block.core.attester_bitfield = list(
(True,) * len(attester_committee) +
(False,) * (spec.MAX_PERSISTENT_COMMITTEE_SIZE * 2 - len(attester_committee))
(False,) * (spec.TARGET_PERSISTENT_COMMITTEE_SIZE * 2 - len(attester_committee))
)
block.signatures.attestation_signature = sign_shard_attestation(
spec,