mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Expand validator sets API with the rest of the events and some getters
We could've added a storage API, and fetched fields that way, except we want the storage to be opaque. That meant we needed to add the RPC routes to the node, which also simplifies other people writing RPC code and fetching these fields. Then the node could've used the storage API, except a lot of the storage in validator-sets is marked opaque and to only be read via functions, so extending the runtime made the most sense.
This commit is contained in:
@@ -33,6 +33,9 @@ pub(crate) trait Keys {
|
||||
|
||||
/// The oraclization key for a validator set.
|
||||
fn oraclization_key(set: ExternalValidatorSet) -> Option<Public>;
|
||||
|
||||
/// The external key for a validator set.
|
||||
fn external_key(set: ExternalValidatorSet) -> Option<ExternalKey>;
|
||||
}
|
||||
|
||||
impl<S: KeysStorage> Keys for S {
|
||||
@@ -53,4 +56,8 @@ impl<S: KeysStorage> Keys for S {
|
||||
fn oraclization_key(set: ExternalValidatorSet) -> Option<Public> {
|
||||
S::OraclizationKeys::get(set)
|
||||
}
|
||||
|
||||
fn external_key(set: ExternalValidatorSet) -> Option<ExternalKey> {
|
||||
S::ExternalKeys::get(set)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,6 +307,14 @@ mod pallet {
|
||||
Abstractions::<T>::selected_validators(set)
|
||||
}
|
||||
|
||||
pub fn oraclization_key(set: ExternalValidatorSet) -> Option<Public> {
|
||||
Abstractions::<T>::oraclization_key(set)
|
||||
}
|
||||
|
||||
pub fn external_key(set: ExternalValidatorSet) -> Option<ExternalKey> {
|
||||
Abstractions::<T>::external_key(set)
|
||||
}
|
||||
|
||||
/* TODO
|
||||
pub fn distribute_block_rewards(
|
||||
network: NetworkId,
|
||||
|
||||
Reference in New Issue
Block a user