pallet_precompile_benchmarks/
lib.rs1#![cfg_attr(not(feature = "std"), no_std)]
21
22#[cfg(feature = "runtime-benchmarks")]
23mod benchmarks;
24mod mock;
25pub mod weights;
26
27pub use crate::weights::WeightInfo;
28
29pub use pallet::*;
30
31use frame_support::pallet;
32use sp_core::H256;
33
34#[pallet]
35pub mod pallet {
36 use storage_proof_primitives::RawStorageProof;
37
38 use super::*;
39
40 #[pallet::config]
41 pub trait Config: frame_system::Config + pallet_relay_storage_roots::Config {
42 type WeightInfo: WeightInfo;
43 }
44
45 #[pallet::pallet]
46 #[pallet::without_storage_info]
47 pub struct Pallet<T>(_);
48
49 #[pallet::error]
50 pub enum Error<T> {
51 BenchmarkError,
52 }
53
54 impl<T: Config> Pallet<T> {
55 pub fn verify_entry(
56 expected_root: H256,
57 proof: RawStorageProof,
58 key: &[u8],
59 ) -> Result<(), Error<T>> {
60 storage_proof_primitives::verify_entry(expected_root, proof, key)
61 .map_err(|_| Error::<T>::BenchmarkError)?;
62 Ok(())
63 }
64 }
65}