Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions runtime/vflow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pallet-balances = {workspace = true, features = ["insecure_zero_ed"]}
pallet-deployment-permissions = {workspace = true}
pallet-message-queue = {workspace = true}
pallet-multisig = {workspace = true}
pallet-proxy = {workspace = true}
pallet-session = {workspace = true}
pallet-collator-selection = {workspace = true}
pallet-sudo = {workspace = true}
Expand Down Expand Up @@ -154,7 +153,6 @@ std = [
"pallet-evm/std",
"pallet-message-queue/std",
"pallet-multisig/std",
"pallet-proxy/std",
"pallet-session/std",
"pallet-sudo/std",
"pallet-timestamp/std",
Expand Down Expand Up @@ -210,7 +208,6 @@ runtime-benchmarks = [
"pallet-evm/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-session/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
Expand Down Expand Up @@ -250,7 +247,6 @@ try-runtime = [
"pallet-evm/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-multisig/try-runtime",
"pallet-proxy/try-runtime",
"pallet-session/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
Expand Down
1 change: 0 additions & 1 deletion runtime/vflow/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ frame_benchmarking::define_benchmarks!(
[frame_system_extensions, SystemExtensionsBench::<Runtime>]
[cumulus_pallet_parachain_system, ParachainSystem]
[pallet_timestamp, Timestamp]
[pallet_proxy, Proxy]
[pallet_utility, Utility]
[pallet_multisig, Multisig]
[pallet_transaction_payment, TransactionPayment]
Expand Down
21 changes: 3 additions & 18 deletions runtime/vflow/src/configs/ethereum_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,13 @@

//! In this module, we provide the configurations for the ethereum-xcm pallet.

use crate::{
configs::system::{ProxyType, ReservedXcmpWeight},
AccountId, BlockNumber, Runtime,
};
use frame_support::ensure;
use crate::{configs::system::ReservedXcmpWeight, AccountId, Runtime};
use frame_system::EnsureRoot;
use sp_runtime::traits::Zero;

pub struct EthereumXcmEnsureProxy;
impl xcm_primitives::EnsureProxy<AccountId> for EthereumXcmEnsureProxy {
fn ensure_ok(delegator: AccountId, delegatee: AccountId) -> Result<(), &'static str> {
// The EVM implicitly contains an Any proxy, so we only allow for "Any" proxies
let def: pallet_proxy::ProxyDefinition<AccountId, ProxyType, BlockNumber> =
pallet_proxy::Pallet::<Runtime>::find_proxy(
&delegator,
&delegatee,
Some(ProxyType::Any),
)
.map_err(|_| "proxy error: expected `ProxyType::Any`")?;
// We only allow to use it for delay zero proxies, as the call will immediatly be executed
ensure!(def.delay.is_zero(), "proxy delay is Non-zero`");
Ok(())
fn ensure_ok(_delegator: AccountId, _delegatee: AccountId) -> Result<(), &'static str> {
Err("proxy pallet removed")
}
}

Expand Down
92 changes: 4 additions & 88 deletions runtime/vflow/src/configs/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@ use crate::{
AccountId, Aura, Balance, Balances, Block, Hash, MessageQueue, Nonce, OriginCaller, PalletInfo,
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, RuntimeTask, XcmpQueue,
};
use core::fmt::Debug;
use cumulus_pallet_parachain_system::{ParachainSetCode, RelayNumberMonotonicallyIncreases};
use cumulus_primitives_core::AggregateMessageOrigin;
use frame_support::{
derive_impl,
dispatch::DispatchClass,
pallet_prelude::{ConstU32, Decode, Encode, MaxEncodedLen, TypeInfo},
pallet_prelude::ConstU32,
parameter_types,
traits::{ConstU64, Contains, InstanceFilter},
traits::{ConstU64, Everything},
};
use frame_system::limits::{BlockLength, BlockWeights};
use polkadot_runtime_common::BlockHashCount;
use sp_runtime::traits::{BlakeTwo256, IdentityLookup};
use sp_runtime::traits::IdentityLookup;
use sp_version::RuntimeVersion;
use sp_weights::Weight;

Expand Down Expand Up @@ -77,23 +76,6 @@ parameter_types! {
pub const SS58Prefix: u16 = 0;
}

pub struct NormalFilter;
impl Contains<RuntimeCall> for NormalFilter {
fn contains(c: &RuntimeCall) -> bool {
match c {
// We filter anonymous proxy as they make "reserve" inconsistent
// See: https://github.com/paritytech/polkadot-sdk/blob/v1.9.0-rc2/substrate/frame/proxy/src/lib.rs#L260
RuntimeCall::Proxy(method) => !matches!(
method,
pallet_proxy::Call::create_pure { .. }
| pallet_proxy::Call::kill_pure { .. }
| pallet_proxy::Call::remove_proxies { .. }
),
_ => true,
}
}
}

/// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from
/// [`ParaChainDefaultConfig`](`struct@frame_system::config_preludes::ParaChainDefaultConfig`),
/// but overridden as needed.
Expand All @@ -104,7 +86,7 @@ impl frame_system::Config for Runtime {
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The basic call filter to use in dispatchable.
type BaseCallFilter = NormalFilter;
type BaseCallFilter = Everything;
/// The block type.
type Block = Block;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
Expand Down Expand Up @@ -203,69 +185,3 @@ impl pallet_timestamp::Config for Runtime {
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
type WeightInfo = weights::pallet_timestamp::ZKVEvmWeight<Runtime>;
}

parameter_types! {
pub const MaxProxies: u32 = 32;
pub const MaxPending: u32 = 32;
pub const ProxyDepositBase: Balance = deposit(1, 40);
pub const AnnouncementDepositBase: Balance = deposit(1, 48);
pub const ProxyDepositFactor: Balance = deposit(0, 33);
pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
}

/// The type used to represent the kinds of proxying allowed.
/// If you are adding new pallets, consider adding new ProxyType variant
#[derive(
Copy,
Clone,
Decode,
parity_scale_codec::DecodeWithMemTracking,
Debug,
Default,
Encode,
Eq,
MaxEncodedLen,
Ord,
PartialEq,
PartialOrd,
TypeInfo,
)]
pub enum ProxyType {
/// Allows to proxy all calls
#[default]
Any,
/// Allows all non-transfer calls
NonTransfer,
/// Allows to finish the proxy
CancelProxy,
}

impl InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &RuntimeCall) -> bool {
match self {
ProxyType::Any => true,
ProxyType::NonTransfer => !matches!(c, RuntimeCall::Balances { .. }),
ProxyType::CancelProxy => matches!(
c,
RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })
| RuntimeCall::Multisig { .. }
),
}
}
}

impl pallet_proxy::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = MaxProxies;
type WeightInfo = weights::pallet_proxy::ZKVEvmWeight<Runtime>;
type MaxPending = MaxPending;
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
type AnnouncementDepositFactor = AnnouncementDepositFactor;
type BlockNumberProvider = frame_system::Pallet<Runtime>;
}
1 change: 0 additions & 1 deletion runtime/vflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ construct_runtime!(
ParachainSystem: cumulus_pallet_parachain_system = 1,
Timestamp: pallet_timestamp = 2,
ParachainInfo: parachain_info = 3, // No weight
Proxy: pallet_proxy = 4,
Utility: pallet_utility = 5,
Multisig: pallet_multisig = 6,
WeightReclaim: cumulus_pallet_weight_reclaim = 7,
Expand Down
9 changes: 9 additions & 0 deletions runtime/vflow/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use crate::Runtime;
use frame_support::{migrations::RemovePallet, parameter_types};

parameter_types! {
pub const ProxyPalletName: &'static str = "Proxy";
}

pub type RemoveProxyPallet =
RemovePallet<ProxyPalletName, <crate::Runtime as frame_system::Config>::DbWeight>;

/// Migrations to run on the next runtime upgrade.
pub type Unreleased = (
RemoveProxyPallet,
pallet_session::migrations::v1::MigrateV0ToV1<
Runtime,
pallet_session::migrations::v1::InitOffenceSeverity<Runtime>,
Expand Down
16 changes: 0 additions & 16 deletions runtime/vflow/src/tests/constants_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,6 @@ mod runtime_tests {
);
}

#[test]
fn proxy_constants() {
use configs::system::*;
assert_eq!(MaxProxies::get(), 32);

assert_eq!(MaxPending::get(), 32);

assert_eq!(ProxyDepositBase::get(), deposit(1, 40));

assert_eq!(AnnouncementDepositBase::get(), deposit(1, 48));

assert_eq!(ProxyDepositFactor::get(), deposit(0, 33));

assert_eq!(AnnouncementDepositFactor::get(), deposit(0, 66));
}

#[test]
fn balances_constants() {
use configs::monetary::*;
Expand Down
1 change: 0 additions & 1 deletion runtime/vflow/src/tests/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ fn verify_pallet_prefixes() {
assert_pallet_prefix::<ParachainSystem>("ParachainSystem");
assert_pallet_prefix::<Timestamp>("Timestamp");
assert_pallet_prefix::<ParachainInfo>("ParachainInfo");
assert_pallet_prefix::<Proxy>("Proxy");
assert_pallet_prefix::<Balances>("Balances");
assert_pallet_prefix::<TransactionPayment>("TransactionPayment");
assert_pallet_prefix::<Sudo>("Sudo");
Expand Down
10 changes: 0 additions & 10 deletions runtime/vflow/src/tests/use_correct_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ fn pallet_timestamp() {
);
}

#[test]
fn pallet_proxy() {
use pallet_proxy::WeightInfo;

assert_eq!(
<Runtime as pallet_proxy::Config>::WeightInfo::create_pure(1),
weights::pallet_proxy::ZKVEvmWeight::<Runtime>::create_pure(1)
);
}

#[test]
fn pallet_utility() {
use pallet_utility::WeightInfo;
Expand Down
1 change: 0 additions & 1 deletion runtime/vflow/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub mod pallet_deployment_permissions;
pub mod pallet_evm;
pub mod pallet_message_queue;
pub mod pallet_multisig;
pub mod pallet_proxy;
pub mod pallet_session;
pub mod pallet_sudo;
pub mod pallet_timestamp;
Expand Down
Loading
Loading