Give one weight per key share to validators in Tributary

This commit is contained in:
Luke Parker
2023-10-13 02:29:22 -04:00
parent bb84f7cf1d
commit 9aeece5bf6
3 changed files with 40 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
use sp_core::sr25519::{Public, Signature};
use serai_runtime::{validator_sets, ValidatorSets, Runtime};
use serai_runtime::{primitives::Amount, validator_sets, ValidatorSets, Runtime};
pub use validator_sets::primitives;
use primitives::{Session, ValidatorSet, KeyPair};
@@ -47,6 +47,23 @@ impl Serai {
self.storage(PALLET, "Participants", Some(vec![scale_value(network)]), at_hash).await
}
pub async fn get_allocation_per_key_share(
&self,
network: NetworkId,
at_hash: [u8; 32],
) -> Result<Option<Amount>, SeraiError> {
self.storage(PALLET, "AllocationPerKeyShare", Some(vec![scale_value(network)]), at_hash).await
}
pub async fn get_allocation(
&self,
network: NetworkId,
key: Public,
at_hash: [u8; 32],
) -> Result<Option<Amount>, SeraiError> {
self.storage(PALLET, "Allocations", Some(vec![scale_value(network), scale_value(key)]), at_hash).await
}
pub async fn get_validator_set_musig_key(
&self,
set: ValidatorSet,