mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
Keep current block randomness in state (#9294)
* Keep current block randomness in state Instead of killing it at the end of the block, it stays in the block for inspection. This is required by parachains to get access to this randomness of the relay chain. * Fix tests
This commit is contained in:
@@ -95,7 +95,7 @@ fn first_block_epoch_zero_start() {
|
||||
assert_eq!(SegmentIndex::<Test>::get(), 0);
|
||||
assert_eq!(UnderConstruction::<Test>::get(0), vec![vrf_randomness]);
|
||||
assert_eq!(Babe::randomness(), [0; 32]);
|
||||
assert_eq!(Babe::author_vrf_randomness(), None);
|
||||
assert_eq!(Babe::author_vrf_randomness(), Some(vrf_randomness));
|
||||
assert_eq!(NextRandomness::<Test>::get(), [0; 32]);
|
||||
|
||||
assert_eq!(header.digest.logs.len(), 2);
|
||||
@@ -130,14 +130,13 @@ fn author_vrf_output_for_primary() {
|
||||
&primary_pre_digest,
|
||||
Default::default(),
|
||||
);
|
||||
assert_eq!(Babe::author_vrf_randomness(), None);
|
||||
|
||||
Babe::do_initialize(1);
|
||||
assert_eq!(Babe::author_vrf_randomness(), Some(vrf_randomness));
|
||||
|
||||
Babe::on_finalize(1);
|
||||
System::finalize();
|
||||
assert_eq!(Babe::author_vrf_randomness(), None);
|
||||
assert_eq!(Babe::author_vrf_randomness(), Some(vrf_randomness));
|
||||
})
|
||||
}
|
||||
|
||||
@@ -156,14 +155,13 @@ fn author_vrf_output_for_secondary_vrf() {
|
||||
&secondary_vrf_pre_digest,
|
||||
Default::default(),
|
||||
);
|
||||
assert_eq!(Babe::author_vrf_randomness(), None);
|
||||
|
||||
Babe::do_initialize(1);
|
||||
assert_eq!(Babe::author_vrf_randomness(), Some(vrf_randomness));
|
||||
|
||||
Babe::on_finalize(1);
|
||||
System::finalize();
|
||||
assert_eq!(Babe::author_vrf_randomness(), None);
|
||||
assert_eq!(Babe::author_vrf_randomness(), Some(vrf_randomness));
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user