mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
fix: 🔨 Add missing imports, and temporarily remove Identity pallet's benchmark helper method.
This commit is contained in:
parent
0628796c7e
commit
4a7c7c493e
10 changed files with 43 additions and 34 deletions
|
|
@ -2,10 +2,11 @@
|
|||
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
|
||||
use crate::{
|
||||
decompress_sync_committee_bits, Config, CurrentSyncCommittee, Pallet as EthereumBeaconClient,
|
||||
Update, ValidatorsRoot, Vec,
|
||||
Update, ValidatorsRoot,
|
||||
};
|
||||
use snowbridge_beacon_primitives::PublicKeyPrepared;
|
||||
use sp_core::H256;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
pub fn participant_pubkeys<T: Config>(
|
||||
update: &Update,
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ use crate::Pallet as ExternalValidatorsRewards;
|
|||
use {
|
||||
crate::types::BenchmarkHelper,
|
||||
frame_benchmarking::{account, v2::*, BenchmarkError},
|
||||
frame_support::traits::{Currency, EnsureOrigin},
|
||||
sp_std::prelude::*,
|
||||
frame_support::traits::Currency,
|
||||
};
|
||||
|
||||
const SEED: u32 = 0;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ use {
|
|||
pallet_session::{self as session, SessionManager},
|
||||
rand::{RngCore, SeedableRng},
|
||||
sp_runtime::{codec, traits::Convert},
|
||||
sp_std::prelude::*,
|
||||
};
|
||||
const SEED: u32 = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ use crate::Pallet as OutboundQueue;
|
|||
)]
|
||||
mod benchmarks {
|
||||
use super::*;
|
||||
use alloc::vec;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
/// Build `Upgrade` message with `MaxMessagePayloadSize`, in the worst-case.
|
||||
fn build_message<T: Config>() -> (Message, OutboundMessage) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use xcm::prelude::*;
|
|||
#[benchmarks]
|
||||
mod benchmarks {
|
||||
use super::*;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[benchmark]
|
||||
fn register_token() -> Result<(), BenchmarkError> {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ use xcm::prelude::*;
|
|||
#[benchmarks]
|
||||
mod benchmarks {
|
||||
use super::*;
|
||||
use alloc::vec::Vec;
|
||||
use alloc::boxed::Box;
|
||||
|
||||
#[benchmark]
|
||||
fn upgrade() -> Result<(), BenchmarkError> {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ pub use polkadot_parachain_primitives::primitives::{
|
|||
pub use ringbuffer::{RingBufferMap, RingBufferMapImpl};
|
||||
pub use sp_core::U256;
|
||||
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
|
||||
use frame_support::{traits::Contains, BoundedVec};
|
||||
|
|
|
|||
|
|
@ -657,17 +657,18 @@ impl pallet_identity::Config for Runtime {
|
|||
type UsernameDeposit = UsernameDeposit;
|
||||
type UsernameGracePeriod = UsernameGracePeriod;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn benchmark_helper(message: &[u8]) -> (Vec<u8>, Vec<u8>) {
|
||||
let public = sp_io::crypto::ecdsa_generate(0.into(), None);
|
||||
let eth_signer: Self::SigningPublicKey = public.into();
|
||||
let hash_msg = sp_io::hashing::keccak_256(message);
|
||||
let signature = Self::OffchainSignature::new(
|
||||
sp_io::crypto::ecdsa_sign_prehashed(0.into(), &public, &hash_msg).unwrap(),
|
||||
);
|
||||
// TODO: Replace by Identity pallet's BenchmarkHelper when available (stable2506).
|
||||
// #[cfg(feature = "runtime-benchmarks")]
|
||||
// fn benchmark_helper(message: &[u8]) -> (Vec<u8>, Vec<u8>) {
|
||||
// let public = sp_io::crypto::ecdsa_generate(0.into(), None);
|
||||
// let eth_signer: Self::SigningPublicKey = public.into();
|
||||
// let hash_msg = sp_io::hashing::keccak_256(message);
|
||||
// let signature = Self::OffchainSignature::new(
|
||||
// sp_io::crypto::ecdsa_sign_prehashed(0.into(), &public, &hash_msg).unwrap(),
|
||||
// );
|
||||
|
||||
(eth_signer.encode(), signature.encode())
|
||||
}
|
||||
// (eth_signer.encode(), signature.encode())
|
||||
// }
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
|
|
|||
|
|
@ -656,17 +656,18 @@ impl pallet_identity::Config for Runtime {
|
|||
type UsernameDeposit = UsernameDeposit;
|
||||
type UsernameGracePeriod = UsernameGracePeriod;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn benchmark_helper(message: &[u8]) -> (Vec<u8>, Vec<u8>) {
|
||||
let public = sp_io::crypto::ecdsa_generate(0.into(), None);
|
||||
let eth_signer: Self::SigningPublicKey = public.into();
|
||||
let hash_msg = sp_io::hashing::keccak_256(message);
|
||||
let signature = Self::OffchainSignature::new(
|
||||
sp_io::crypto::ecdsa_sign_prehashed(0.into(), &public, &hash_msg).unwrap(),
|
||||
);
|
||||
// TODO: Replace by Identity pallet's BenchmarkHelper when available (stable2506).
|
||||
// #[cfg(feature = "runtime-benchmarks")]
|
||||
// fn benchmark_helper(message: &[u8]) -> (Vec<u8>, Vec<u8>) {
|
||||
// let public = sp_io::crypto::ecdsa_generate(0.into(), None);
|
||||
// let eth_signer: Self::SigningPublicKey = public.into();
|
||||
// let hash_msg = sp_io::hashing::keccak_256(message);
|
||||
// let signature = Self::OffchainSignature::new(
|
||||
// sp_io::crypto::ecdsa_sign_prehashed(0.into(), &public, &hash_msg).unwrap(),
|
||||
// );
|
||||
|
||||
(eth_signer.encode(), signature.encode())
|
||||
}
|
||||
// (eth_signer.encode(), signature.encode())
|
||||
// }
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
|
|
|||
|
|
@ -659,17 +659,18 @@ impl pallet_identity::Config for Runtime {
|
|||
type UsernameDeposit = UsernameDeposit;
|
||||
type UsernameGracePeriod = UsernameGracePeriod;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn benchmark_helper(message: &[u8]) -> (Vec<u8>, Vec<u8>) {
|
||||
let public = sp_io::crypto::ecdsa_generate(0.into(), None);
|
||||
let eth_signer: Self::SigningPublicKey = public.into();
|
||||
let hash_msg = sp_io::hashing::keccak_256(message);
|
||||
let signature = Self::OffchainSignature::new(
|
||||
sp_io::crypto::ecdsa_sign_prehashed(0.into(), &public, &hash_msg).unwrap(),
|
||||
);
|
||||
// TODO: Replace by Identity pallet's BenchmarkHelper when available (stable2506).
|
||||
// #[cfg(feature = "runtime-benchmarks")]
|
||||
// fn benchmark_helper(message: &[u8]) -> (Vec<u8>, Vec<u8>) {
|
||||
// let public = sp_io::crypto::ecdsa_generate(0.into(), None);
|
||||
// let eth_signer: Self::SigningPublicKey = public.into();
|
||||
// let hash_msg = sp_io::hashing::keccak_256(message);
|
||||
// let signature = Self::OffchainSignature::new(
|
||||
// sp_io::crypto::ecdsa_sign_prehashed(0.into(), &public, &hash_msg).unwrap(),
|
||||
// );
|
||||
|
||||
(eth_signer.encode(), signature.encode())
|
||||
}
|
||||
// (eth_signer.encode(), signature.encode())
|
||||
// }
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
|
|
|||
Loading…
Reference in a new issue