diff --git a/beacon_chain/types/src/shard_and_committee.rs b/beacon_chain/types/src/shard_and_committee.rs index 10b9004f4..0f3483fe8 100644 --- a/beacon_chain/types/src/shard_and_committee.rs +++ b/beacon_chain/types/src/shard_and_committee.rs @@ -1,6 +1,6 @@ #[derive(Clone, Debug, PartialEq)] pub struct ShardAndCommittee { - pub shard_id: u16, + pub shard: u16, pub committee: Vec } @@ -9,7 +9,7 @@ impl ShardAndCommittee { /// committee is an empty vector. pub fn zero() -> Self { Self { - shard_id: 0, + shard: 0, committee: vec![], } } @@ -22,7 +22,7 @@ mod tests { #[test] fn test_shard_and_committee_zero() { let s = ShardAndCommittee::zero(); - assert_eq!(s.shard_id, 0); + assert_eq!(s.shard, 0); assert_eq!(s.committee.len(), 0); } } diff --git a/beacon_chain/validator_shuffling/src/shuffle.rs b/beacon_chain/validator_shuffling/src/shuffle.rs index 4768c1cb1..6e0e89c33 100644 --- a/beacon_chain/validator_shuffling/src/shuffle.rs +++ b/beacon_chain/validator_shuffling/src/shuffle.rs @@ -86,12 +86,12 @@ fn generate_cycle( let cycle = validator_indices.honey_badger_split(cycle_length) .enumerate() .map(|(i, slot_indices)| { - let shard_id_start = crosslinking_shard_start + i * committees_per_slot / slots_per_committee; + let shard_start = crosslinking_shard_start + i * committees_per_slot / slots_per_committee; slot_indices.honey_badger_split(committees_per_slot) .enumerate() .map(|(j, shard_indices)| { ShardAndCommittee{ - shard_id: ((shard_id_start + j) % shard_count) as u16, + shard: ((shard_start + j) % shard_count) as u16, committee: shard_indices.to_vec(), } }) @@ -141,8 +141,8 @@ mod tests { slot.iter() .enumerate() .for_each(|(i, sac)| { - println!("#{:?}\tshard_id={}\tcommittee.len()={}", - &i, &sac.shard_id, &sac.committee.len()) + println!("#{:?}\tshard={}\tcommittee.len()={}", + &i, &sac.shard, &sac.committee.len()) }) }); } @@ -167,7 +167,7 @@ mod tests { let mut flattened = vec![]; for slot in cycle.iter() { for sac in slot.iter() { - flattened.push(sac.shard_id as usize); + flattened.push(sac.shard as usize); } } flattened.dedup(); @@ -181,7 +181,7 @@ mod tests { for slot in cycle.iter() { let mut shards: Vec = vec![]; for sac in slot.iter() { - shards.push(sac.shard_id as usize); + shards.push(sac.shard as usize); } shards_in_slots.push(shards); }