Skip to content

Commit

Permalink
ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden committed Jan 13, 2025
1 parent 25c32b8 commit 0691e5d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 57 deletions.
55 changes: 0 additions & 55 deletions bridges/snowbridge/pallets/ethereum-client/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,60 +157,5 @@ mod benchmarks {
Ok(())
}

use frame_support::parameter_types;

parameter_types! {
pub ExecutionHeaderCount: u32 = 1;
}

#[benchmark]
fn step() {
let block_root: H256 =
hex!("4e4ed8c829bf771f94c60caa052dc3b703b24165a2e6459350e3a43a80ab7a8f").into();
ExecutionHeaders::<T>::insert(
block_root,
CompactExecutionHeader {
parent_hash: hex!(
"e0a5ca63886dfa16d53347ba347289e0187f7c38320768d094fc48d331ac7a23"
)
.into(),
block_number: 48242,
state_root: hex!(
"b3f33b6950fd047b634dcea0d09f002f07431d3e6648213604e54caa822055a6"
)
.into(),
receipts_root: hex!(
"f744e1ebe846b2961a7daa3c0d9023d8b109cf9e425b9e9973f039180e487b67"
)
.into(),
},
);
ExecutionHeaderMapping::<T>::insert(0u32, block_root);
LatestExecutionState::<T>::set(ExecutionHeaderState {
beacon_block_root: hex!(
"b3f33b6950fd047b634dcea0d09f002f07431d3e6648213604e54caa822055a6"
)
.into(),
beacon_slot: 5353,
block_hash: hex!("e0a5ca63886dfa16d53347ba347289e0187f7c38320768d094fc48d331ac7a23")
.into(),
block_number: 5454,
});
ExecutionHeaderIndex::<T>::set(0);
let mut meter = WeightMeter::new();

#[block]
{
EthereumExecutionHeaderCleanup::<T, (), ExecutionHeaderCount>::step(None, &mut meter)
.unwrap();
}

// Check that the header is removed
assert_eq!(ExecutionHeaderMapping::<T>::get(0u32), H256::zero());
assert!(ExecutionHeaders::<T>::get(block_root).is_none());
assert!(LatestExecutionState::<T>::get().beacon_block_root == H256::zero());
assert!(ExecutionHeaderIndex::<T>::get() == 0);
}

impl_benchmark_test_suite!(EthereumBeaconClient, crate::mock::new_tester(), crate::mock::Test);
}
5 changes: 5 additions & 0 deletions bridges/snowbridge/pallets/ethereum-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ pub mod pallet {
origin: OriginFor<T>,
update: Box<CheckpointUpdate>,
) -> DispatchResult {
log::info!(target: LOG_TARGET,"💫 In force checkpoint.");
ensure_root(origin)?;
Self::process_checkpoint_update(&update)?;
Ok(())
Expand Down Expand Up @@ -252,6 +253,7 @@ pub mod pallet {
update.header.slot,
fork_versions.clone(),
);
log::info!(target: LOG_TARGET,"💫 sync_committee_g_index: {}.", sync_committee_g_index);
// Verifies the sync committee in the Beacon state.
ensure!(
verify_merkle_branch(
Expand All @@ -274,6 +276,7 @@ pub mod pallet {
// tree leaf.
let block_roots_g_index =
Self::block_roots_gindex_at_slot(update.header.slot, fork_versions);
log::info!(target: LOG_TARGET,"💫 block_roots_g_index: {}.", block_roots_g_index);
ensure!(
verify_merkle_branch(
update.block_roots_root,
Expand Down Expand Up @@ -627,9 +630,11 @@ pub mod pallet {
/// Returns the fork version based on the current epoch.
pub(super) fn select_fork_version(fork_versions: &ForkVersions, epoch: u64) -> ForkVersion {
if epoch >= fork_versions.electra.epoch {
log::info!(target: LOG_TARGET,"💫 Found Electra fork.");
return fork_versions.electra.version
}
if epoch >= fork_versions.deneb.epoch {
log::info!(target: LOG_TARGET,"💫 Found Deneb fork.");
return fork_versions.deneb.version
}
if epoch >= fork_versions.capella.epoch {
Expand Down
6 changes: 5 additions & 1 deletion bridges/snowbridge/pallets/inbound-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ parameter_types! {
},
deneb: Fork {
version: [4, 0, 0, 1], // 0x04000001
epoch: 4294967295,
epoch: 0,
},
electra: Fork {
version: [5, 0, 0, 0], // 0x05000000
epoch: 80000000000,
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ parameter_types! {
},
electra: Fork {
version: [5, 0, 0, 0], // 0x05000000
epoch: 0,
epoch: 20,
},
};
}
Expand Down

0 comments on commit 0691e5d

Please sign in to comment.