Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAX_PERSISTENT_COMMITTEE_SIZE -> TARGET_PERSISTENT_COMMITTEE_SIZE #1358

Merged
merged 1 commit into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions specs/core/1_shard-data-chains.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down Expand Up @@ -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`
Expand All @@ -164,18 +164,18 @@ 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`

```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
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down