Skip to content

Commit

Permalink
[Manta] unfilter utility for batched token transfer (#284)
Browse files Browse the repository at this point in the history
* unfilter utility for batched token transfer
  • Loading branch information
stechu authored Nov 26, 2021
1 parent b3f646d commit 21df9fc
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 29 deletions.
56 changes: 32 additions & 24 deletions .github/workflows/generate_calamari_weights_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,58 +107,66 @@ jobs:
-
extrinsic:
id: '*'
name: pallet_democracy
name: calamari_vesting
pallet:
id: pallet_democracy
name: pallet_democracy
id: calamari_vesting
name: calamari_vesting
iterations: 20
-
extrinsic:
id: '*'
name: pallet_collective
name: frame_system
pallet:
id: pallet_collective
name: pallet_collective
id: frame_system
name: frame_system
iterations: 20
-
extrinsic:
id: '*'
name: pallet_membership
name: pallet_balances
pallet:
id: pallet_membership
name: pallet_membership
id: pallet_balances
name: pallet_balances
iterations: 20
-
extrinsic:
id: '*'
name: pallet_scheduler
name: pallet_collective
pallet:
id: pallet_scheduler
name: pallet_scheduler
id: pallet_collective
name: pallet_collective
iterations: 20
-
extrinsic:
id: '*'
name: pallet_balances
name: pallet_democracy
pallet:
id: pallet_balances
name: pallet_balances
id: pallet_democracy
name: pallet_democracy
iterations: 20
-
extrinsic:
id: '*'
name: calamari_vesting
name: pallet_membership
pallet:
id: calamari_vesting
name: calamari_vesting
id: pallet_membership
name: pallet_membership
iterations: 20
-
extrinsic:
id: '*'
name: frame_system
name: pallet_multisig
pallet:
id: frame_system
name: frame_system
id: pallet_multisig
name: pallet_multisig
iterations: 20
-
extrinsic:
id: '*'
name: pallet_scheduler
pallet:
id: pallet_scheduler
name: pallet_scheduler
iterations: 20
-
extrinsic:
Expand All @@ -179,10 +187,10 @@ jobs:
-
extrinsic:
id: '*'
name: pallet_multisig
name: pallet_utility
pallet:
id: pallet_multisig
name: pallet_multisig
id: pallet_utility
name: pallet_utility
iterations: 20
steps:
-
Expand Down
8 changes: 4 additions & 4 deletions runtime/calamari/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("calamari"),
impl_name: create_runtime_str!("calamari"),
authoring_version: 1,
spec_version: 3100,
spec_version: 3101,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -221,9 +221,9 @@ impl Contains<Call> for BaseFilter {
| Call::TechnicalMembership(_)
| Call::Scheduler(_)
| Call::CalamariVesting(_)
| Call::Balances(_) => true,
| Call::Balances(_)
| Call::Utility(_) => true,
_ => false,
// Filter Utility to prevent users from setting keys and selecting collator for parachain (couldn't use now).
// Filter Session and CollatorSelection to prevent users from utility operation.
// Filter XCM pallet.
}
Expand Down Expand Up @@ -333,7 +333,7 @@ impl pallet_multisig::Config for Runtime {
impl pallet_utility::Config for Runtime {
type Event = Event;
type Call = Call;
type WeightInfo = pallet_utility::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_utility::SubstrateWeight<Runtime>;
}

impl pallet_sudo::Config for Runtime {
Expand Down
1 change: 1 addition & 0 deletions runtime/calamari/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ pub mod pallet_scheduler;
pub mod pallet_session;
pub mod pallet_timestamp;
pub mod pallet_tx_pause;
pub mod pallet_utility;
85 changes: 85 additions & 0 deletions runtime/calamari/src/weights/pallet_utility.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright 2020-2021 Manta Network.
// This file is part of Manta.

// Manta is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Manta is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Manta. If not, see <http://www.gnu.org/licenses/>.

//! Autogenerated weights for pallet_utility
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-11-26, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("calamari-dev"), DB CACHE: 128
// Executed Command:
// manta
// benchmark
// --chain=calamari-dev
// --pallet=pallet_utility
// --extrinsic=*
// --execution=Wasm
// --wasm-execution=Compiled
// --heap-pages=4096
// --repeat=20
// --steps=50
// --template=.github/resources/frame-weight-template.hbs
// --output=pallet_utility.rs


#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;

/// Weight functions needed for pallet_utility.
pub trait WeightInfo {
fn batch(c: u32, ) -> Weight;
fn as_derivative() -> Weight;
fn batch_all(c: u32, ) -> Weight;
}

/// Weights for pallet_utility using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_utility::WeightInfo for SubstrateWeight<T> {
fn batch(c: u32, ) -> Weight {
(43_160_000 as Weight)
// Standard Error: 6_000
.saturating_add((14_311_000 as Weight).saturating_mul(c as Weight))
}
fn as_derivative() -> Weight {
(7_671_000 as Weight)
}
fn batch_all(c: u32, ) -> Weight {
(26_924_000 as Weight)
// Standard Error: 4_000
.saturating_add((15_469_000 as Weight).saturating_mul(c as Weight))
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
fn batch(c: u32, ) -> Weight {
(43_160_000 as Weight)
// Standard Error: 6_000
.saturating_add((14_311_000 as Weight).saturating_mul(c as Weight))
}
fn as_derivative() -> Weight {
(7_671_000 as Weight)
}
fn batch_all(c: u32, ) -> Weight {
(26_924_000 as Weight)
// Standard Error: 4_000
.saturating_add((15_469_000 as Weight).saturating_mul(c as Weight))
}
}
2 changes: 1 addition & 1 deletion runtime/manta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("manta"),
impl_name: create_runtime_str!("manta"),
authoring_version: 1,
spec_version: 3100,
spec_version: 3101,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down

0 comments on commit 21df9fc

Please sign in to comment.