Skip to content

Commit

Permalink
Add committees at slot field
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Sep 9, 2020
1 parent 1c788af commit cd94717
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions beacon_node/http_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ pub fn serve<T: BeaconChainTypes>(
Ok(api_types::AttesterData {
pubkey: pubkey.into(),
validator_index,
committees_at_slot: duty.committees_at_slot,
committee_index: duty.index,
committee_length: duty.committee_len as u64,
validator_committee_index: duty.committee_position as u64,
Expand Down
1 change: 1 addition & 0 deletions beacon_node/http_api/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ impl ApiTester {
let expected = AttesterData {
pubkey: state.validators[i as usize].pubkey.clone().into(),
validator_index: i,
committees_at_slot: duty.committees_at_slot,
committee_index: duty.index,
committee_length: duty.committee_len as u64,
validator_committee_index: duty.committee_position as u64,
Expand Down
2 changes: 2 additions & 0 deletions common/eth2/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ pub struct AttesterData {
#[serde(with = "serde_utils::quoted_u64")]
pub validator_index: u64,
#[serde(with = "serde_utils::quoted_u64")]
pub committees_at_slot: u64,
#[serde(with = "serde_utils::quoted_u64")]
pub committee_index: CommitteeIndex,
#[serde(with = "serde_utils::quoted_u64")]
pub committee_length: u64,
Expand Down
2 changes: 2 additions & 0 deletions consensus/types/src/attestation_duty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ pub struct AttestationDuty {
pub committee_position: usize,
/// The total number of attesters in the committee.
pub committee_len: usize,
/// The committee count at `attestation_slot`.
pub committees_at_slot: u64,
}
1 change: 1 addition & 0 deletions consensus/types/src/beacon_state/committee_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ impl CommitteeCache {
index,
committee_position,
committee_len,
committees_at_slot: self.committees_per_slot(),
})
})
}
Expand Down

0 comments on commit cd94717

Please sign in to comment.