Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pallet_drand: Benchmark the longest write_pulse branch #8

Open
juangirini opened this issue Sep 4, 2024 · 1 comment
Open

pallet_drand: Benchmark the longest write_pulse branch #8

juangirini opened this issue Sep 4, 2024 · 1 comment

Comments

@juangirini
Copy link
Contributor

juangirini commented Sep 4, 2024

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:

#[extrinsic_call]
write_pulse(RawOrigin::None, pulse_payload.clone(), None);
assert_eq!(Pulses::<T>::get(block_number), Some(p));

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")
@juangirini juangirini changed the title Benchmark the longest write_pulse branch pallet_drand: Benchmark the longest write_pulse branch Oct 31, 2024
@juangirini
Copy link
Contributor Author

The issue is that the benchmark is looking for the arkworks host functions but doesn't find them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant