Skip to content

Commit

Permalink
Fix compile errors in beacon chain tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Jun 28, 2022
1 parent b7bee40 commit 2e9a8c0
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 66 deletions.
9 changes: 5 additions & 4 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2358,20 +2358,21 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
///
/// Returns an `Err` if the given block was invalid, or an error was encountered during
pub async fn verify_block_for_gossip(
self: Arc<Self>,
self: &Arc<Self>,
block: Arc<SignedBeaconBlock<T::EthSpec>>,
) -> Result<GossipVerifiedBlock<T>, BlockError<T::EthSpec>> {
let chain = self.clone();
self.task_executor
.clone()
.spawn_blocking_handle(
move || {
let slot = block.slot();
let graffiti_string = block.message().body().graffiti().as_utf8_lossy();

match GossipVerifiedBlock::new(block, &self) {
match GossipVerifiedBlock::new(block, &chain) {
Ok(verified) => {
debug!(
self.log,
chain.log,
"Successfully processed gossip block";
"graffiti" => graffiti_string,
"slot" => slot,
Expand All @@ -2382,7 +2383,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
}
Err(e) => {
debug!(
self.log,
chain.log,
"Rejected gossip block";
"error" => e.to_string(),
"graffiti" => graffiti_string,
Expand Down
11 changes: 9 additions & 2 deletions beacon_node/beacon_chain/tests/attestation_production.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use beacon_chain::test_utils::{AttestationStrategy, BeaconChainHarness, BlockStrategy};
use beacon_chain::{StateSkipConfig, WhenSlotSkipped};
use lazy_static::lazy_static;
use std::sync::Arc;
use tree_hash::TreeHash;
use types::{AggregateSignature, EthSpec, Keypair, MainnetEthSpec, RelativeEpoch, Slot};

Expand Down Expand Up @@ -139,7 +140,13 @@ async fn produces_attestations() {
.unwrap();
chain
.early_attester_cache
.add_head_block(block_root, block.clone(), proto_block, &state, &chain.spec)
.add_head_block(
block_root,
Arc::new(block.clone()),
proto_block,
&state,
&chain.spec,
)
.unwrap();
chain
.early_attester_cache
Expand Down Expand Up @@ -192,7 +199,7 @@ async fn early_attester_cache_old_request() {
.early_attester_cache
.add_head_block(
head.beacon_block_root,
head.beacon_block.clone(),
Arc::new(head.beacon_block.clone()),
head_proto_block,
&head.beacon_state,
&harness.chain.spec,
Expand Down
Loading

0 comments on commit 2e9a8c0

Please sign in to comment.