The write_pulse benchmark is not walking the longest branch for write_pulse, which is when BeaconConfig::<T>::get() returns Some.
For that we need to prepare the benchmark with some value in storage, something like:
let info: BeaconInfoResponse = serde_json::from_str(QUICKNET_INFO_RESPONSE).unwrap();
let config = info.try_into_beacon_config().unwrap();
BeaconConfig::<T>::put(config);
And then assert that a pulse has been written, something like:
The issue when trying this approach is that there is a missing function when verifying the payload
Error executing and verifying runtime benchmark: Invalid input: Could not call runtime API to dispatch a benchmark: Execution aborted due to trap: call to a missing function env:ext_host_calls_bls12_381_mul_projective_g2_version_1
WASM backtrace:
error while executing at wasm backtrace:
0: 0x286f7c - node_template_runtime.wasm!sp_crypto_ec_utils::bls12_381::host_calls::extern_host_function_impls::bls12_381_mul_projective_g2::haa95cf63e313aca0
1: 0x240572 - node_template_runtime.wasm!<ark_ec::models::short_weierstrass::affine::Affine<P> as ark_ec::AffineRepr>::mul_bigint::h1d89cca9cb96b892
2: 0x245b22 - node_template_runtime.wasm!<ark_bls12_381_ext::curves::g2::Config<H> as ark_ec::models::short_weierstrass::SWCurveConfig>::deserialize_with_mode::h2b9359ded5fd82ff
3: 0x2592f5 - node_template_runtime.wasm!<pallet_drand::QuicknetVerifier as pallet_drand::Verifier>::verify::he32632f1f33752fa
4: 0x163c03 - node_template_runtime.wasm!frame_support::storage::transactional::with_transaction::h5b3b8a0f1d0729ca
5: 0x9b91a - node_template_runtime.wasm!environmental::local_key::LocalKey<T>::with::h19b9f4e032b2e7cf
6: 0x1277ce - node_template_runtime.wasm!pallet_drand::benchmarking::benchmarks::<impl frame_benchmarking::utils::Benchmarking for pallet_drand::pallet::Pallet<T>>::run_benchmark::h083313cd66ea22e3
7: 0x11e274 - node_template_runtime.wasm!<node_template_runtime::Runtime as frame_benchmarking::utils::runtime_decl_for_benchmark::BenchmarkV1<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u32,sp_runtime::traits::BlakeTwo256>,sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic<sp_runtime::multiaddress::MultiAddress<<<sp_runtime::MultiSignature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId,()>,node_template_runtime::RuntimeCall,sp_runtime::MultiSignature,(frame_system::extensions::check_non_zero_sender::CheckNonZeroSender<node_template_runtime::Runtime>,frame_system::extensions::check_spec_version::CheckSpecVersion<node_template_runtime::Runtime>,frame_system::extensions::check_tx_version::CheckTxVersion<node_template_runtime::Runtime>,frame_system::extensions::check_genesis::CheckGenesis<node_template_runtime::Runtime>,frame_system::extensions::check_mortality::CheckMortality<node_template_runtime::Runtime>,frame_system::extensions::check_nonce::CheckNonce<node_template_runtime::Runtime>,frame_system::extensions::check_weight::CheckWeight<node_template_runtime::Runtime>,pallet_transaction_payment::ChargeTransactionPayment<node_template_runtime::Runtime>)>>>>::dispatch_benchmark::h8ad5282327c8e27a
8: 0x2072c1 - node_template_runtime.wasm!Benchmark_dispatch_benchmark
The following 1 benchmarks failed:
- pallet_drand::update_beacon_pulses
Error: Input("1 benchmarks failed")
The
write_pulse
benchmark is not walking the longest branch forwrite_pulse
, which is whenBeaconConfig::<T>::get()
returnsSome
. For that we need to prepare the benchmark with some value in storage, something like:And then assert that a pulse has been written, something like:
The issue when trying this approach is that there is a missing function when verifying the payload