mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Staking pallet (#373)
* initial staking pallet * add staking pallet to runtime * support session rotation for serai * optimizations & cleaning * fix deny * add serai network to initial networks * a few tweaks & comments * fix some pr comments * Rewrite validator-sets with logarithmic algorithms Uses the fact the underlying DB is sorted to achieve sorting of potential validators by stake. Removes release of deallocated stake for now. --------- Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
@@ -164,7 +164,11 @@ pub async fn key_gen<C: Ciphersuite>(
|
||||
}
|
||||
}
|
||||
assert_eq!(
|
||||
serai.get_keys(set).await.unwrap().unwrap(),
|
||||
serai
|
||||
.get_keys(set, serai.get_block_by_number(last_serai_block).await.unwrap().unwrap().hash())
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap(),
|
||||
(Public(substrate_key), network_key.try_into().unwrap())
|
||||
);
|
||||
|
||||
|
||||
@@ -195,8 +195,13 @@ async fn mint_and_burn_test() {
|
||||
let halt_at = if additional { 5 * 10 } else { 10 * 10 };
|
||||
let print_at = halt_at / 2;
|
||||
for i in 0 .. halt_at {
|
||||
if let Some(key_pair) =
|
||||
serai.get_keys(ValidatorSet { network, session: Session(0) }).await.unwrap()
|
||||
if let Some(key_pair) = serai
|
||||
.get_keys(
|
||||
ValidatorSet { network, session: Session(0) },
|
||||
serai.get_latest_block_hash().await.unwrap(),
|
||||
)
|
||||
.await
|
||||
.unwrap()
|
||||
{
|
||||
return key_pair;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user