sp_auto_id/
runtime_interface.rsuse crate::{DerVec, SignatureVerificationRequest, TbsCertificate};
use sp_runtime_interface::runtime_interface;
#[runtime_interface]
pub trait AutoIdRuntimeInterface {
fn verify_signature(&mut self, req: SignatureVerificationRequest) -> Option<()> {
#[cfg(feature = "runtime-benchmarks")]
{
use crate::host_functions::verify_signature;
verify_signature(req)
}
#[cfg(not(feature = "runtime-benchmarks"))]
{
use crate::host_functions::HostFunctionExtension;
use sp_externalities::ExternalitiesExt;
self.extension::<HostFunctionExtension>()
.expect("No `AutoIdHostFunctionExtension` associated for the current context!")
.verify_signature(req)
}
}
fn decode_tbs_certificate(&mut self, certificate: DerVec) -> Option<TbsCertificate> {
#[cfg(feature = "runtime-benchmarks")]
{
use crate::host_functions::decode_tbs_certificate;
decode_tbs_certificate(certificate)
}
#[cfg(not(feature = "runtime-benchmarks"))]
{
use crate::host_functions::HostFunctionExtension;
use sp_externalities::ExternalitiesExt;
self.extension::<HostFunctionExtension>()
.expect("No `AutoIdHostFunctionExtension` associated for the current context!")
.decode_tbs_certificate(certificate)
}
}
}