mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
bab0348372
- updates snowbridge crates to `0.9.0` - updates Cargo.toml files in preparation for publishing to crates.io - adds Kusama and Polkadot Snowbridge runtime config crates - moves runtime tests from the Snowbridge subtree into the bridge hub tests dir --------- Co-authored-by: claravanstaden <Cats 4 life!> Co-authored-by: Ron <yrong1997@gmail.com>
45 lines
1.4 KiB
Rust
45 lines
1.4 KiB
Rust
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
|
|
use crate::{
|
|
decompress_sync_committee_bits, Config, CurrentSyncCommittee, Pallet as EthereumBeaconClient,
|
|
Update, ValidatorsRoot, Vec,
|
|
};
|
|
use primitives::PublicKeyPrepared;
|
|
use sp_core::H256;
|
|
|
|
pub fn participant_pubkeys<T: Config>(
|
|
update: &Update,
|
|
) -> Result<Vec<PublicKeyPrepared>, &'static str> {
|
|
let sync_committee_bits =
|
|
decompress_sync_committee_bits(update.sync_aggregate.sync_committee_bits);
|
|
let current_sync_committee = <CurrentSyncCommittee<T>>::get();
|
|
let pubkeys = EthereumBeaconClient::<T>::find_pubkeys(
|
|
&sync_committee_bits,
|
|
(*current_sync_committee.pubkeys).as_ref(),
|
|
true,
|
|
);
|
|
Ok(pubkeys)
|
|
}
|
|
|
|
pub fn absent_pubkeys<T: Config>(update: &Update) -> Result<Vec<PublicKeyPrepared>, &'static str> {
|
|
let sync_committee_bits =
|
|
decompress_sync_committee_bits(update.sync_aggregate.sync_committee_bits);
|
|
let current_sync_committee = <CurrentSyncCommittee<T>>::get();
|
|
let pubkeys = EthereumBeaconClient::<T>::find_pubkeys(
|
|
&sync_committee_bits,
|
|
(*current_sync_committee.pubkeys).as_ref(),
|
|
false,
|
|
);
|
|
Ok(pubkeys)
|
|
}
|
|
|
|
pub fn signing_root<T: Config>(update: &Update) -> Result<H256, &'static str> {
|
|
let validators_root = <ValidatorsRoot<T>>::get();
|
|
let signing_root = EthereumBeaconClient::<T>::signing_root(
|
|
&update.attested_header,
|
|
validators_root,
|
|
update.signature_slot,
|
|
)?;
|
|
Ok(signing_root)
|
|
}
|