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

Add and configure Benchmarks to runtime #39

Closed
flipchan opened this issue Aug 23, 2021 · 20 comments
Closed

Add and configure Benchmarks to runtime #39

flipchan opened this issue Aug 23, 2021 · 20 comments
Assignees

Comments

@flipchan
Copy link
Contributor

Master Issue to track all the new benchmarks that needs to be added into the runtime, I will make a list and start adding benchmarks

@flipchan flipchan self-assigned this Aug 23, 2021
@flipchan
Copy link
Contributor Author

What is being benchmarked now:
frame_system
balances
timestamp
oracle
session
collator_selection

@flipchan
Copy link
Contributor Author

todo:
xcm pallet, I will start with this

@seunlanlege
Copy link
Contributor

seunlanlege commented Aug 23, 2021

check runtime/picasso/src/lb.rs I've added TODOs in the pallets whose WeightInfo needs to be filled

@flipchan
Copy link
Contributor Author

flipchan commented Aug 23, 2021

script for running benchmarks:

filip@burko:~/rust/composable$ cat run_b.sh 
#!/bin/bash

echo "enabling Benchmarks"
cargo build --release --features runtime-benchmarks

pallet=frame_system
runtime=picasso
chain=picasso-dev
steps=10
repeat=5

pallets=(
	oracle,
	frame_system,
	balances,
	timestamp.
	session,
	collator_selection
)

echo "Running Benchmarking"

for pall in ${pallets[@]}
do
	./target/release/composable benchmark \
	--chain=$chain \
	--execution=wasm \
	--wasm-execution=compiled \
	--pallet=$pall \
	--extrinsic=* \
	--steps=$steps \
	--repeat=$repeat \
	--raw \
	--output=./runtime/$runtime/src/weights
done 

echo "Benchmarking done"

@seunlanlege
Copy link
Contributor

yeah i just added new pallets to the runtime in #40, add benchmarks for them too

@flipchan
Copy link
Contributor Author

running script:

 ./run_b.sh 
enabling Benchmarks
    Finished release [optimized] target(s) in 2.41s
Running Benchmarking
2021-08-23 22:11:13 assembling new collators for new session 0 at #0    
2021-08-23 22:11:13 assembling new collators for new session 1 at #0    
Error: Benchmark not found for this pallet.
2021-08-23 22:11:14 assembling new collators for new session 0 at #0    
2021-08-23 22:11:14 assembling new collators for new session 1 at #0    
Error: Benchmark not found for this pallet.
2021-08-23 22:11:15 assembling new collators for new session 0 at #0    
2021-08-23 22:11:15 assembling new collators for new session 1 at #0    
Error: Benchmark not found for this pallet.
2021-08-23 22:11:16 assembling new collators for new session 0 at #0    
2021-08-23 22:11:16 assembling new collators for new session 1 at #0    
Error: Benchmark not found for this pallet.
2021-08-23 22:11:17 assembling new collators for new session 0 at #0    
2021-08-23 22:11:17 assembling new collators for new session 1 at #0    
Error: Benchmark not found for this pallet.
2021-08-23 22:11:18 assembling new collators for new session 0 at #0    
2021-08-23 22:11:18 assembling new collators for new session 1 at #0    
2021-08-23 22:11:20 panicked at 'called `Result::unwrap()` on an `Err` value: <wasm:stripped>', /home/filip/.cargo/git/checkouts/cumulus-59522f43471fa161/ed6ba5d/pallets/collator-selection/src/benchmarking.rs:59:86    
Error: Input("Error executing runtime benchmark: Other(\"Wasm execution trapped: wasm trap: unreachable\\nwasm backtrace:\\n    0: 0x2202 - <unknown>!rust_begin_unwind\\n    1: 0x1fbf - <unknown>!core::panicking::panic_fmt::hec165b0930ecb32e\\n    2: 0x1cf0 - <unknown>!core::result::unwrap_failed::h07848c9b2569f830\\n    3: 0x129dd8 - <unknown>!pallet_collator_selection::benchmarking::register_candidates::h0e76143ad004aa4e\\n    4: 0x12f722 - <unknown>!pallet_collator_selection::benchmarking::<impl frame_benchmarking::utils::Benchmarking<frame_benchmarking::utils::BenchmarkResults> for pallet_collator_selection::pallet::Pallet<T>>::run_benchmark::{{closure}}::hfbef5e6f4ffaa1c9\\n    5: 0x124193 - <unknown>!pallet_collator_selection::benchmarking::<impl frame_benchmarking::utils::Benchmarking<frame_benchmarking::utils::BenchmarkResults> for pallet_collator_selection::pallet::Pallet<T>>::run_benchmark::h8653ffa034b0b937\\n    6: 0xe6559 - <unknown>!<picasso_runtime::Runtime as frame_benchmarking::utils::runtime_decl_for_Benchmark::Benchmark<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,u32>,picasso_runtime::Call,sp_runtime::MultiSignature,(frame_system::extensions::check_spec_version::CheckSpecVersion<picasso_runtime::Runtime>,frame_system::extensions::check_tx_version::CheckTxVersion<picasso_runtime::Runtime>,frame_system::extensions::check_genesis::CheckGenesis<picasso_runtime::Runtime>,frame_system::extensions::check_mortality::CheckMortality<picasso_runtime::Runtime>,frame_system::extensions::check_nonce::CheckNonce<picasso_runtime::Runtime>,frame_system::extensions::check_weight::CheckWeight<picasso_runtime::Runtime>,pallet_transaction_payment::ChargeTransactionPayment<picasso_runtime::Runtime>)>>>>::dispatch_benchmark::h9ae550026738ecda\\n    7: 0xe3016 - <unknown>!Benchmark_dispatch_benchmark\\nnote: run with `WASMTIME_BACKTRACE_DETAILS=1` environment variable to display more information\\n\")")
Benchmarking done

still needs improvements, but syntax works for running benchmarks

@flipchan
Copy link
Contributor Author

benchmarks to be added:

  • scheduler
  • collective
  • membership
  • pallet_xcm
  • treasury

@flipchan
Copy link
Contributor Author

current pallets used in runtime:

filip@burko:~/rust/composable/runtime/picasso$ cat Cargo.toml | grep -i Pallet 
| cut -d ' ' -f 1 | uniq                                                                      
aura                                                                                          
authorship                                                                                    
balances                                                                                      
indices                                                                                       
randomness-collective-flip                                                                    
collective                                                                                    
membership                                                                                    
scheduler                                                                                     
session                                                                                       
sudo                                                                                          
timestamp                                                                                     
treasury                                                                                      
democracy                                                                                     
transaction-payment                                                                           
oracle                                                                                        
transaction-payment-rpc-runtime-api                                                           
cumulus-pallet-aura-ext                                                                       
cumulus-pallet-parachain-system                                                               
cumulus-pallet-dmp-queue                                                                      
cumulus-pallet-xcm                                                                            
cumulus-pallet-xcmp-queue                                                                     
collator-selection                                                                            
session-benchmarking                                                                          
pallet-xcm                                                                                    
        "cumulus-pallet-aura-ext/std",                                                        
        "cumulus-pallet-parachain-system/std",                                                
        "cumulus-pallet-xcmp-queue/std",                                                      
        "cumulus-pallet-xcm/std",                                                             
        "pallet-xcm/runtime-benchmarks",                                                      

@seunlanlege
Copy link
Contributor

you really only want to benchmark pallets that have a Call enum

@seunlanlege
Copy link
Contributor

seunlanlege commented Aug 24, 2021

  • democracy
  • collator-selection
  • scheduler
  • collective

@flipchan
Copy link
Contributor Author

I'm working on scheduler right now

@flipchan
Copy link
Contributor Author

todo: add the list_benchmark feature

@flipchan
Copy link
Contributor Author

Scheduler pr #43, working from pallets weight and not the local once

@seunlanlege
Copy link
Contributor

try to add collator-selection, democracy and collective to the same pr

@flipchan
Copy link
Contributor Author

adding democracy, collator-selection and collective now

@andor0
Copy link
Contributor

andor0 commented Aug 24, 2021

added pallet-collective and pallet-democracy
PR #46

@andor0
Copy link
Contributor

andor0 commented Aug 25, 2021

added pallet-collator-selection
PR #50

@andor0
Copy link
Contributor

andor0 commented Aug 25, 2021

writing missing benchmarks for extrinsics of pallet-oracle

@flipchan
Copy link
Contributor Author

flipchan commented Aug 25, 2021

@andor0 very nice with the collator-selection!
I got collective and democracy pallet in a branch(https://github.com/ComposableFi/composable/tree/pallet_collective_democracy), will push soon (was a bit slow on the trigger here..)

Great work @andor0 !

@seunlanlege
Copy link
Contributor

This can now be marked as close

seunlanlege pushed a commit that referenced this issue Sep 20, 2021
PALL-79 lending math and tests fixes
seunlanlege pushed a commit that referenced this issue Oct 6, 2022
fix client state conversion
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

3 participants