mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 13:57:58 +00:00
* Expose 'benchmark extrinsic' command Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add test Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Split benchmarking into own mod Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Simplify code Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fixup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Cleanup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Spell Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Revert Cargo.lock updates Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * update lockfile for {"substrate"} * Fix brittle test Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Bump spec version to 9270 Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Sleep in test to make it work in CI... Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Disable failing test Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Revert "Bump spec version to 9270" This reverts commit c1c385d7a4dc849e7f4d4723740aec66c2b7be09. * Delete brittle test, see #5788 Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Disable failing test Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Delete more failing tests... Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
9b086257e2
commit
340e7be60d
+34
-10
@@ -15,12 +15,16 @@
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::cli::{Cli, Subcommand};
|
||||
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
|
||||
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
|
||||
use futures::future::TryFutureExt;
|
||||
use log::info;
|
||||
use polkadot_client::benchmarking::{
|
||||
benchmark_inherent_data, ExistentialDepositProvider, RemarkBuilder, TransferKeepAliveBuilder,
|
||||
};
|
||||
use sc_cli::{Role, RuntimeVersion, SubstrateCli};
|
||||
use service::{self, HeaderBackend, IdentifyVariant};
|
||||
use sp_core::crypto::Ss58AddressFormatRegistry;
|
||||
use sp_keyring::Sr25519Keyring;
|
||||
use std::net::ToSocketAddrs;
|
||||
|
||||
pub use crate::{error::Error, service::BlockId};
|
||||
@@ -508,22 +512,42 @@ pub fn run() -> Result<()> {
|
||||
|
||||
unwrap_client!(client, cmd.run(client.clone()).map_err(Error::SubstrateCli))
|
||||
}),
|
||||
BenchmarkCmd::Overhead(cmd) => {
|
||||
// These commands are very similar and can be handled in nearly the same way.
|
||||
BenchmarkCmd::Extrinsic(_) | BenchmarkCmd::Overhead(_) => {
|
||||
ensure_dev(chain_spec).map_err(Error::Other)?;
|
||||
runner.sync_run(|mut config| {
|
||||
use polkadot_client::benchmark_inherent_data;
|
||||
let (client, _, _, _) = service::new_chain_ops(&mut config, None)?;
|
||||
let wrapped = client.clone();
|
||||
|
||||
let header = client.header(BlockId::Number(0_u32.into())).unwrap().unwrap();
|
||||
let inherent_data = benchmark_inherent_data(header)
|
||||
.map_err(|e| format!("generating inherent data: {:?}", e))?;
|
||||
let remark_builder = RemarkBuilder::new(client.clone());
|
||||
|
||||
unwrap_client!(
|
||||
client,
|
||||
cmd.run(config, client.clone(), inherent_data, wrapped)
|
||||
.map_err(Error::SubstrateCli)
|
||||
)
|
||||
match cmd {
|
||||
BenchmarkCmd::Extrinsic(cmd) => {
|
||||
let tka_builder = TransferKeepAliveBuilder::new(
|
||||
client.clone(),
|
||||
Sr25519Keyring::Alice.to_account_id(),
|
||||
client.existential_deposit(),
|
||||
);
|
||||
|
||||
let ext_factory = ExtrinsicFactory(vec![
|
||||
Box::new(remark_builder),
|
||||
Box::new(tka_builder),
|
||||
]);
|
||||
|
||||
unwrap_client!(
|
||||
client,
|
||||
cmd.run(client.clone(), inherent_data, &ext_factory)
|
||||
.map_err(Error::SubstrateCli)
|
||||
)
|
||||
},
|
||||
BenchmarkCmd::Overhead(cmd) => unwrap_client!(
|
||||
client,
|
||||
cmd.run(config, client.clone(), inherent_data, &remark_builder)
|
||||
.map_err(Error::SubstrateCli)
|
||||
),
|
||||
_ => unreachable!("Ensured by the outside match; qed"),
|
||||
}
|
||||
})
|
||||
},
|
||||
BenchmarkCmd::Pallet(cmd) => {
|
||||
|
||||
Reference in New Issue
Block a user