Skip to content

Commit

Permalink
fix beacon chain tests, impl test random
Browse files Browse the repository at this point in the history
  • Loading branch information
eserilev committed Apr 14, 2024
1 parent 1110958 commit cf9ecda
Show file tree
Hide file tree
Showing 9 changed files with 244 additions and 217 deletions.
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/src/observed_aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ mod tests {

fn get_attestation(slot: Slot, beacon_block_root: u64) -> Attestation<E> {
let mut a: Attestation<E> = test_random_instance();
a.data.slot = slot;
a.data.beacon_block_root = Hash256::from_low_u64_be(beacon_block_root);
a.data_mut().slot = slot;
a.data_mut().beacon_block_root = Hash256::from_low_u64_be(beacon_block_root);
a
}

Expand Down
12 changes: 6 additions & 6 deletions beacon_node/beacon_chain/tests/attestation_production.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,19 @@ async fn produces_attestations() {
.produce_unaggregated_attestation(slot, index)
.expect("should produce attestation");

let data = &attestation.data;
let data = attestation.data();

assert_eq!(
attestation.aggregation_bits.len(),
attestation.aggregation_bits().len(),
committee_len,
"bad committee len"
);
assert!(
attestation.aggregation_bits.is_zero(),
attestation.aggregation_bits().is_zero(),
"some committee bits are set"
);
assert_eq!(
attestation.signature,
*attestation.signature(),
AggregateSignature::empty(),
"bad signature"
);
Expand Down Expand Up @@ -329,10 +329,10 @@ async fn early_attester_cache_old_request() {
.produce_unaggregated_attestation(attest_slot, 0)
.unwrap();

assert_eq!(attestation.data.slot, attest_slot);
assert_eq!(attestation.data().slot, attest_slot);
let attested_block = harness
.chain
.get_blinded_block(&attestation.data.beacon_block_root)
.get_blinded_block(&attestation.data().beacon_block_root)
.unwrap()
.unwrap();
assert_eq!(attested_block.slot(), attest_slot);
Expand Down
Loading

0 comments on commit cf9ecda

Please sign in to comment.