mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
fix: 🔧 implement babe randomness for BabeDataGetter (#148)
Since we are including Storage Hub pallets and we no longer hide the compilation behind a feature flag, the tests started to fail because the nodes where panic!ing on each block finalisation. --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
This commit is contained in:
parent
757a99b7c6
commit
53fc386ce1
3 changed files with 11 additions and 9 deletions
|
|
@ -109,13 +109,15 @@ impl pallet_randomness::Config for Runtime {
|
|||
pub struct BabeDataGetter;
|
||||
impl pallet_randomness::GetBabeData<u64, Hash> for BabeDataGetter {
|
||||
fn get_epoch_index() -> u64 {
|
||||
todo!("implement `get_epoch_index`");
|
||||
pallet_babe::Pallet::<Runtime>::current_epoch().epoch_index
|
||||
}
|
||||
fn get_epoch_randomness() -> Hash {
|
||||
todo!("implement `get_epoch_randomness`");
|
||||
sp_core::H256::from(pallet_babe::Pallet::<Runtime>::current_epoch().randomness)
|
||||
}
|
||||
fn get_parent_randomness() -> Hash {
|
||||
todo!("implement `get_parent_randomness`");
|
||||
sp_core::H256::from(
|
||||
pallet_babe::Pallet::<Runtime>::author_vrf_randomness().unwrap_or_default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,13 +109,13 @@ impl pallet_randomness::Config for Runtime {
|
|||
pub struct BabeDataGetter;
|
||||
impl pallet_randomness::GetBabeData<u64, Hash> for BabeDataGetter {
|
||||
fn get_epoch_index() -> u64 {
|
||||
todo!("implement `get_epoch_index`");
|
||||
pallet_babe::Pallet::<Runtime>::current_epoch().epoch_index
|
||||
}
|
||||
fn get_epoch_randomness() -> Hash {
|
||||
todo!("implement `get_epoch_randomness`");
|
||||
sp_core::H256::from(pallet_babe::Pallet::<Runtime>::current_epoch().randomness)
|
||||
}
|
||||
fn get_parent_randomness() -> Hash {
|
||||
todo!("implement `get_parent_randomness`");
|
||||
sp_core::H256::from(pallet_babe::Pallet::<Runtime>::current_epoch().randomness)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,13 +109,13 @@ impl pallet_randomness::Config for Runtime {
|
|||
pub struct BabeDataGetter;
|
||||
impl pallet_randomness::GetBabeData<u64, Hash> for BabeDataGetter {
|
||||
fn get_epoch_index() -> u64 {
|
||||
todo!("implement `get_epoch_index`");
|
||||
pallet_babe::Pallet::<Runtime>::current_epoch().epoch_index
|
||||
}
|
||||
fn get_epoch_randomness() -> Hash {
|
||||
todo!("implement `get_epoch_randomness`");
|
||||
sp_core::H256::from(pallet_babe::Pallet::<Runtime>::current_epoch().randomness)
|
||||
}
|
||||
fn get_parent_randomness() -> Hash {
|
||||
todo!("implement `get_parent_randomness`");
|
||||
sp_core::H256::from(pallet_babe::Pallet::<Runtime>::current_epoch().randomness)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue