fix: Complete snowbridge pezpallet rebrand and critical bug fixes

- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs)
- pallet/ directories → pezpallet/ (4 locations)
- Fixed pezpallet.rs self-include recursion bug
- Fixed sc-chain-spec hardcoded crate name in derive macro
- Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API)
- Added BizinikiwiConfig type alias for zombienet tests
- Deleted obsolete session state files

Verified: pezsnowbridge-pezpallet-*, pezpallet-staking,
pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
2025-12-16 09:57:23 +03:00
parent eea003e14d
commit 3139ffa25e
3022 changed files with 42157 additions and 23579 deletions
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Benchmarks for the contracts pallet
//! Benchmarks for the contracts pezpallet
#![cfg(feature = "runtime-benchmarks")]
mod call_builder;
@@ -33,7 +33,7 @@ use crate::{
},
storage::WriteOutcome,
wasm::BenchEnv,
Pallet as Contracts, *,
Pezpallet as Contracts, *,
};
use alloc::{vec, vec::Vec};
use codec::{Encode, MaxEncodedLen};
@@ -101,7 +101,7 @@ where
module: WasmModule<T>,
data: Vec<u8>,
) -> Result<Contract<T>, &'static str> {
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
T::Currency::set_balance(&caller, caller_funding::<T>());
let salt = vec![0xff];
let addr = Contracts::<T>::contract_address(&caller, &module.hash, &data, &salt);
@@ -223,8 +223,8 @@ fn caller_funding<T: Config>() -> BalanceOf<T> {
where
<BalanceOf<T> as codec::HasCompact>::Type: Clone + Eq + PartialEq + core::fmt::Debug + scale_info::TypeInfo + codec::Encode,
T: Config + pezpallet_balances::Config,
BalanceOf<T>: From<<pezpallet_balances::Pallet<T> as Currency<T::AccountId>>::Balance>,
<pezpallet_balances::Pallet<T> as Currency<T::AccountId>>::Balance: From<BalanceOf<T>>,
BalanceOf<T>: From<<pezpallet_balances::Pezpallet<T> as Currency<T::AccountId>>::Balance>,
<pezpallet_balances::Pezpallet<T> as Currency<T::AccountId>>::Balance: From<BalanceOf<T>>,
)]
mod benchmarks {
use super::*;
@@ -272,11 +272,11 @@ mod benchmarks {
let contract =
<Contract<T>>::with_caller(whitelisted_caller(), WasmModule::dummy(), vec![])?;
v10::store_old_contract_info::<T, pezpallet_balances::Pallet<T>>(
v10::store_old_contract_info::<T, pezpallet_balances::Pezpallet<T>>(
contract.account_id.clone(),
contract.info()?,
);
let mut m = v10::Migration::<T, pezpallet_balances::Pallet<T>>::default();
let mut m = v10::Migration::<T, pezpallet_balances::Pezpallet<T>>::default();
#[block]
{
@@ -304,11 +304,11 @@ mod benchmarks {
// and repay deposits).
#[benchmark(pov_mode = Measured)]
fn v12_migration_step(c: Linear<0, { T::MaxCodeLen::get() }>) {
v12::store_old_dummy_code::<T, pezpallet_balances::Pallet<T>>(
v12::store_old_dummy_code::<T, pezpallet_balances::Pezpallet<T>>(
c as usize,
account::<T::AccountId>("account", 0, 0),
);
let mut m = v12::Migration::<T, pezpallet_balances::Pallet<T>>::default();
let mut m = v12::Migration::<T, pezpallet_balances::Pezpallet<T>>::default();
#[block]
{
@@ -338,8 +338,8 @@ mod benchmarks {
fn v14_migration_step() {
let account = account::<T::AccountId>("account", 0, 0);
T::Currency::set_balance(&account, caller_funding::<T>());
v14::store_dummy_code::<T, pezpallet_balances::Pallet<T>>(account);
let mut m = v14::Migration::<T, pezpallet_balances::Pallet<T>>::default();
v14::store_dummy_code::<T, pezpallet_balances::Pezpallet<T>>(account);
let mut m = v14::Migration::<T, pezpallet_balances::Pezpallet<T>>::default();
#[block]
{
@@ -378,7 +378,7 @@ mod benchmarks {
{
m.step(&mut WeightMeter::new());
}
let ed = Pallet::<T>::min_balance();
let ed = Pezpallet::<T>::min_balance();
let info = v16::ContractInfoOf::<T>::get(&contract.account_id).unwrap();
assert_eq!(info.storage_base_deposit, base_deposit - ed);
Ok(())
@@ -388,25 +388,25 @@ mod benchmarks {
#[benchmark(pov_mode = Measured)]
fn migration_noop() {
let version = LATEST_MIGRATION_VERSION;
StorageVersion::new(version).put::<Pallet<T>>();
StorageVersion::new(version).put::<Pezpallet<T>>();
#[block]
{
Migration::<T>::migrate(&mut WeightMeter::new());
}
assert_eq!(StorageVersion::get::<Pallet<T>>(), version);
assert_eq!(StorageVersion::get::<Pezpallet<T>>(), version);
}
// This benchmarks the weight of dispatching migrate to execute 1 `NoopMigration`
#[benchmark(pov_mode = Measured)]
fn migrate() {
let latest_version = LATEST_MIGRATION_VERSION;
StorageVersion::new(latest_version - 2).put::<Pallet<T>>();
StorageVersion::new(latest_version - 2).put::<Pezpallet<T>>();
<Migration<T, false> as pezframe_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade();
#[extrinsic_call]
_(RawOrigin::Signed(whitelisted_caller()), Weight::MAX);
assert_eq!(StorageVersion::get::<Pallet<T>>(), latest_version - 1);
assert_eq!(StorageVersion::get::<Pezpallet<T>>(), latest_version - 1);
}
// This benchmarks the weight of running on_runtime_upgrade when there are no migration in
@@ -414,7 +414,7 @@ mod benchmarks {
#[benchmark(pov_mode = Measured)]
fn on_runtime_upgrade_noop() {
let latest_version = LATEST_MIGRATION_VERSION;
StorageVersion::new(latest_version).put::<Pallet<T>>();
StorageVersion::new(latest_version).put::<Pezpallet<T>>();
#[block]
{
<Migration<T, false> as pezframe_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade();
@@ -427,7 +427,7 @@ mod benchmarks {
#[benchmark(pov_mode = Measured)]
fn on_runtime_upgrade_in_progress() {
let latest_version = LATEST_MIGRATION_VERSION;
StorageVersion::new(latest_version - 2).put::<Pallet<T>>();
StorageVersion::new(latest_version - 2).put::<Pezpallet<T>>();
let v = vec![42u8].try_into().ok();
MigrationInProgress::<T>::set(v.clone());
#[block]
@@ -443,7 +443,7 @@ mod benchmarks {
#[benchmark(pov_mode = Measured)]
fn on_runtime_upgrade() {
let latest_version = LATEST_MIGRATION_VERSION;
StorageVersion::new(latest_version - 2).put::<Pallet<T>>();
StorageVersion::new(latest_version - 2).put::<Pezpallet<T>>();
#[block]
{
<Migration<T, false> as pezframe_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade();
@@ -466,7 +466,7 @@ mod benchmarks {
WasmModule::sized(c, Location::Deploy, false),
vec![],
)?;
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
let callee = instance.addr;
#[extrinsic_call]
@@ -486,7 +486,7 @@ mod benchmarks {
) {
let input = vec![42u8; i as usize];
let salt = vec![42u8; s as usize];
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
let caller = whitelisted_caller();
T::Currency::set_balance(&caller, caller_funding::<T>());
let WasmModule { code, hash, .. } = WasmModule::<T>::sized(c, Location::Call, false);
@@ -502,10 +502,10 @@ mod benchmarks {
T::Currency::balance_on_hold(&HoldReason::CodeUploadDepositReserve.into(), &caller);
assert_eq!(
T::Currency::balance(&caller),
caller_funding::<T>() - value - deposit - code_deposit - Pallet::<T>::min_balance(),
caller_funding::<T>() - value - deposit - code_deposit - Pezpallet::<T>::min_balance(),
);
// contract has the full value
assert_eq!(T::Currency::balance(&addr), value + Pallet::<T>::min_balance());
assert_eq!(T::Currency::balance(&addr), value + Pezpallet::<T>::min_balance());
}
// `i`: Size of the input in bytes.
@@ -517,7 +517,7 @@ mod benchmarks {
) -> Result<(), BenchmarkError> {
let input = vec![42u8; i as usize];
let salt = vec![42u8; s as usize];
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
let caller = whitelisted_caller();
T::Currency::set_balance(&caller, caller_funding::<T>());
let WasmModule { code, hash, .. } = WasmModule::<T>::dummy();
@@ -532,10 +532,10 @@ mod benchmarks {
// value was removed from the caller
assert_eq!(
T::Currency::balance(&caller),
caller_funding::<T>() - value - deposit - Pallet::<T>::min_balance(),
caller_funding::<T>() - value - deposit - Pezpallet::<T>::min_balance(),
);
// contract has the full value
assert_eq!(T::Currency::balance(&addr), value + Pallet::<T>::min_balance());
assert_eq!(T::Currency::balance(&addr), value + Pezpallet::<T>::min_balance());
Ok(())
}
@@ -552,7 +552,7 @@ mod benchmarks {
let data = vec![42u8; 1024];
let instance =
Contract::<T>::with_caller(whitelisted_caller(), WasmModule::dummy(), vec![])?;
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
let origin = RawOrigin::Signed(instance.caller.clone());
let callee = instance.addr.clone();
let before = T::Currency::balance(&instance.account_id);
@@ -565,7 +565,7 @@ mod benchmarks {
// value and value transferred via call should be removed from the caller
assert_eq!(
T::Currency::balance(&instance.caller),
caller_funding::<T>() - instance.value - value - deposit - Pallet::<T>::min_balance(),
caller_funding::<T>() - instance.value - value - deposit - Pezpallet::<T>::min_balance(),
);
// contract should have received the value
assert_eq!(T::Currency::balance(&instance.account_id), before + value);
@@ -1587,7 +1587,7 @@ mod benchmarks {
#[benchmark(pov_mode = Measured)]
fn seal_transfer() {
let account = account::<T::AccountId>("receiver", 0, 0);
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
assert!(value > 0u32.into());
let mut setup = CallSetup::<T>::default();
@@ -1716,7 +1716,7 @@ mod benchmarks {
let mut setup = CallSetup::<T>::default();
setup.set_origin(Origin::from_account_id(setup.contract().account_id.clone()));
setup.set_balance(value + (Pallet::<T>::min_balance() * 2u32.into()));
setup.set_balance(value + (Pezpallet::<T>::min_balance() * 2u32.into()));
let account_id = &setup.contract().account_id.clone();
let (mut ext, _) = setup.ext();
@@ -1761,7 +1761,7 @@ mod benchmarks {
assert_ok!(result);
assert!(ContractInfoOf::<T>::get(&addr).is_some());
assert_eq!(T::Currency::balance(&addr), Pallet::<T>::min_balance() + value);
assert_eq!(T::Currency::balance(&addr), Pezpallet::<T>::min_balance() + value);
Ok(())
}
@@ -18,14 +18,14 @@
//! A mechanism for runtime authors to augment the functionality of contracts.
//!
//! The runtime is able to call into any contract and retrieve the result using
//! [`bare_call`](crate::Pallet::bare_call). This already allows customization of runtime
//! [`bare_call`](crate::Pezpallet::bare_call). This already allows customization of runtime
//! behaviour by user generated code (contracts). However, often it is more straightforward
//! to allow the reverse behaviour: The contract calls into the runtime. We call the latter
//! one a "chain extension" because it allows the chain to extend the set of functions that are
//! callable by a contract.
//!
//! In order to create a chain extension the runtime author implements the [`ChainExtension`]
//! trait and declares it in this pallet's [configuration Trait](crate::Config). All types
//! trait and declares it in this pezpallet's [configuration Trait](crate::Config). All types
//! required for this endeavour are defined or re-exported in this module. There is an
//! implementation on `()` which can be used to signal that no chain extension is available.
//!
@@ -53,7 +53,7 @@
//! [`charge_weight`](Environment::charge_weight) function must be called **before**
//! carrying out any action that causes the consumption of the chargeable weight.
//! It cannot be overstated how delicate of a process the creation of a chain extension
//! is. Check whether using [`bare_call`](crate::Pallet::bare_call) suffices for the
//! is. Check whether using [`bare_call`](crate::Pezpallet::bare_call) suffices for the
//! use case at hand.
//!
//! # Benchmarking
@@ -90,7 +90,7 @@ pub type Result<T> = core::result::Result<T, DispatchError>;
/// A trait used to extend the set of contract callable functions.
///
/// In order to create a custom chain extension this trait must be implemented and supplied
/// to the pallet contracts configuration trait as the associated type of the same name.
/// to the pezpallet contracts configuration trait as the associated type of the same name.
/// Consult the [module documentation](self) for a general explanation of chain extensions.
///
/// # Lifetime
+3 -3
View File
@@ -22,7 +22,7 @@ use crate::{
storage::{self, meter::Diff, WriteOutcome},
transient_storage::TransientStorage,
BalanceOf, CodeHash, CodeInfo, CodeInfoOf, Config, ContractInfo, ContractInfoOf,
DebugBufferVec, Determinism, Error, Event, Nonce, Origin, Pallet as Contracts, Schedule,
DebugBufferVec, Determinism, Error, Event, Nonce, Origin, Pezpallet as Contracts, Schedule,
LOG_TARGET,
};
use alloc::vec::Vec;
@@ -818,7 +818,7 @@ where
gas_meter,
storage_meter,
timestamp: T::Time::now(),
block_number: <pezframe_system::Pallet<T>>::block_number(),
block_number: <pezframe_system::Pezpallet<T>>::block_number(),
nonce,
first_frame,
frames: Default::default(),
@@ -1727,7 +1727,7 @@ mod tests {
use pezsp_runtime::{traits::Hash, DispatchError};
use std::{cell::RefCell, collections::hash_map::HashMap, rc::Rc};
type System = pezframe_system::Pallet<Test>;
type System = pezframe_system::Pezpallet<Test>;
type MockStack<'a> = Stack<'a, Test, MockExecutable>;
+118 -118
View File
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! # Contracts Pallet
//! # Contracts Pezpallet
//!
//! The Contracts module provides functionality for the runtime to deploy and execute WebAssembly
//! smart-contracts.
@@ -63,19 +63,19 @@
//!
//! ### Dispatchable functions
//!
//! * [`Pallet::instantiate_with_code`] - Deploys a new contract from the supplied Wasm binary,
//! * [`Pezpallet::instantiate_with_code`] - Deploys a new contract from the supplied Wasm binary,
//! optionally transferring
//! some balance. This instantiates a new smart contract account with the supplied code and
//! calls its constructor to initialize the contract.
//! * [`Pallet::instantiate`] - The same as `instantiate_with_code` but instead of uploading new
//! * [`Pezpallet::instantiate`] - The same as `instantiate_with_code` but instead of uploading new
//! code an existing `code_hash` is supplied.
//! * [`Pallet::call`] - Makes a call to an account, optionally transferring some balance.
//! * [`Pallet::upload_code`] - Uploads new code without instantiating a contract from it.
//! * [`Pallet::remove_code`] - Removes the stored code and refunds the deposit to its owner. Only
//! * [`Pezpallet::call`] - Makes a call to an account, optionally transferring some balance.
//! * [`Pezpallet::upload_code`] - Uploads new code without instantiating a contract from it.
//! * [`Pezpallet::remove_code`] - Removes the stored code and refunds the deposit to its owner. Only
//! allowed to code owner.
//! * [`Pallet::set_code`] - Changes the code of an existing contract. Only allowed to `Root`
//! * [`Pezpallet::set_code`] - Changes the code of an existing contract. Only allowed to `Root`
//! origin.
//! * [`Pallet::migrate`] - Runs migration steps of current multi-block migration in priority,
//! * [`Pezpallet::migrate`] - Runs migration steps of current multi-block migration in priority,
//! before [`Hooks::on_idle`][pezframe_support::traits::Hooks::on_idle] activates.
//!
//! ## Usage
@@ -132,7 +132,7 @@ use pezframe_support::{
use pezframe_system::{
ensure_signed,
pezpallet_prelude::{BlockNumberFor, OriginFor},
EventRecord, Pallet as System,
EventRecord, Pezpallet as System,
};
use scale_info::TypeInfo;
use smallvec::Array;
@@ -146,7 +146,7 @@ pub use crate::{
debug::Tracing,
exec::Frame,
migration::{MigrateSequence, Migration, NoopMigration},
pallet::*,
pezpallet::*,
schedule::{InstructionWeights, Limits, Schedule},
wasm::Determinism,
};
@@ -167,7 +167,7 @@ type EventRecordOf<T> =
/// The old weight type.
///
/// This is a copy of the [`pezframe_support::weights::OldWeight`] type since the contracts pallet
/// This is a copy of the [`pezframe_support::weights::OldWeight`] type since the contracts pezpallet
/// needs to support it indefinitely.
type OldWeight = u64;
@@ -237,8 +237,8 @@ fn api_version_is_up_to_date() {
);
}
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use super::*;
use crate::debug::Debugger;
use pezframe_support::pezpallet_prelude::*;
@@ -248,11 +248,11 @@ pub mod pallet {
/// The in-code storage version.
pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(16);
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
#[pezpallet::storage_version(STORAGE_VERSION)]
pub struct Pezpallet<T>(_);
#[pallet::config(with_default)]
#[pezpallet::config(with_default)]
pub trait Config: pezframe_system::Config {
/// The time implementation used to supply timestamps to contracts through `seal_now`.
type Time: Time;
@@ -265,29 +265,29 @@ pub mod pallet {
/// be instantiated from existing codes that use this deprecated functionality. It will
/// be removed eventually. Hence for new `pezpallet-contracts` deployments it is okay
/// to supply a dummy implementation for this type (because it is never used).
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type Randomness: Randomness<Self::Hash, BlockNumberFor<Self>>;
/// The fungible in which fees are paid and contract balances are held.
#[pallet::no_default]
#[pezpallet::no_default]
type Currency: Inspect<Self::AccountId>
+ Mutate<Self::AccountId>
+ MutateHold<Self::AccountId, Reason = Self::RuntimeHoldReason>;
/// The overarching event type.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// The overarching call type.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type RuntimeCall: Dispatchable<RuntimeOrigin = Self::RuntimeOrigin, PostInfo = PostDispatchInfo>
+ GetDispatchInfo
+ codec::Decode
+ IsType<<Self as pezframe_system::Config>::RuntimeCall>;
/// Overarching hold reason.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type RuntimeHoldReason: From<HoldReason>;
/// Filter that is applied to calls dispatched by contracts.
@@ -311,13 +311,13 @@ pub mod pallet {
/// be exploited to drive the runtime into a panic.
///
/// This filter does not apply to XCM transact calls. To impose restrictions on XCM transact
/// calls, you must configure them separately within the XCM pallet itself.
#[pallet::no_default_bounds]
/// calls, you must configure them separately within the XCM pezpallet itself.
#[pezpallet::no_default_bounds]
type CallFilter: Contains<<Self as pezframe_system::Config>::RuntimeCall>;
/// Used to answer contracts' queries regarding the current weight price. This is **not**
/// used to calculate the actual fee and is only for informational purposes.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type WeightPrice: Convert<Weight, BalanceOf<Self>>;
/// Describes the weights of the dispatchables of this module and is also used to
@@ -325,12 +325,12 @@ pub mod pallet {
type WeightInfo: WeightInfo;
/// Type that allows the runtime authors to add new host functions for a contract to call.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type ChainExtension: chain_extension::ChainExtension<Self> + Default;
/// Cost schedule and limits.
#[pallet::constant]
#[pallet::no_default]
#[pezpallet::constant]
#[pezpallet::no_default]
type Schedule: Get<Schedule<Self>>;
/// The type of the call stack determines the maximum nesting depth of contract calls.
@@ -341,7 +341,7 @@ pub mod pallet {
///
/// This setting along with [`MaxCodeLen`](#associatedtype.MaxCodeLen) directly affects
/// memory usage of your runtime.
#[pallet::no_default]
#[pezpallet::no_default]
type CallStack: Array<Item = Frame<Self>>;
/// The amount of balance a caller has to pay for each byte of storage.
@@ -349,13 +349,13 @@ pub mod pallet {
/// # Note
///
/// Changing this value for an existing chain might need a storage migration.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type DepositPerByte: Get<BalanceOf<Self>>;
/// Fallback value to limit the storage deposit if it's not being set by the caller.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type DefaultDepositLimit: Get<BalanceOf<Self>>;
/// The amount of balance a caller has to pay for each storage item.
@@ -363,19 +363,19 @@ pub mod pallet {
/// # Note
///
/// Changing this value for an existing chain might need a storage migration.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type DepositPerItem: Get<BalanceOf<Self>>;
/// The percentage of the storage deposit that should be held for using a code hash.
/// Instantiating a contract, or calling [`chain_extension::Ext::lock_delegate_dependency`]
/// protects the code from being removed. In order to prevent abuse these actions are
/// protected with a percentage of the code deposit.
#[pallet::constant]
#[pezpallet::constant]
type CodeHashLockupDepositPercent: Get<Perbill>;
/// The address generator used to generate the addresses of contracts.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type AddressGenerator: AddressGenerator<Self>;
/// The maximum length of a contract code in bytes.
@@ -383,21 +383,21 @@ pub mod pallet {
/// The value should be chosen carefully taking into the account the overall memory limit
/// your runtime has, as well as the [maximum allowed callstack
/// depth](#associatedtype.CallStack). Look into the `integrity_test()` for some insights.
#[pallet::constant]
#[pezpallet::constant]
type MaxCodeLen: Get<u32>;
/// The maximum allowable length in bytes for storage keys.
#[pallet::constant]
#[pezpallet::constant]
type MaxStorageKeyLen: Get<u32>;
/// The maximum size of the transient storage in bytes.
/// This includes keys, values, and previous entries used for storage rollback.
#[pallet::constant]
#[pezpallet::constant]
type MaxTransientStorageSize: Get<u32>;
/// The maximum number of delegate_dependencies that a contract can lock with
/// [`chain_extension::Ext::lock_delegate_dependency`].
#[pallet::constant]
#[pezpallet::constant]
type MaxDelegateDependencies: Get<u32>;
/// Make contract callable functions marked as `#[unstable]` available.
@@ -409,18 +409,18 @@ pub mod pallet {
/// # Warning
///
/// Do **not** set to `true` on productions chains.
#[pallet::constant]
#[pezpallet::constant]
type UnsafeUnstableInterface: Get<bool>;
/// The maximum length of the debug buffer in bytes.
#[pallet::constant]
#[pezpallet::constant]
type MaxDebugBufferLen: Get<u32>;
/// Origin allowed to upload code.
///
/// By default, it is safe to set this to `EnsureSigned`, allowing anyone to upload contract
/// code.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type UploadOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>;
/// Origin allowed to instantiate code.
@@ -433,7 +433,7 @@ pub mod pallet {
///
/// By default, it is safe to set this to `EnsureSigned`, allowing anyone to instantiate
/// contract code.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type InstantiateOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>;
/// The sequence of migration steps that will be applied during a migration.
@@ -459,27 +459,27 @@ pub mod pallet {
/// For most production chains, it's recommended to use the `()` implementation of this
/// trait. This implementation offers additional logging when the log target
/// "runtime::contracts" is set to trace.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type Debug: Debugger<Self>;
/// Type that bundles together all the runtime configurable interface types.
///
/// This is not a real config. We just mention the type here as constant so that
/// its type appears in the metadata. Only valid value is `()`.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type Environment: Get<Environment<Self>>;
/// The version of the HostFn APIs that are available in the runtime.
///
/// Only valid value is `()`.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type ApiVersion: Get<ApiVersion>;
/// A type that exposes XCM APIs, allowing contracts to interact with other teyrchains, and
/// execute XCM programs.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type Xcm: xcm_builder::Controller<
OriginFor<Self>,
<Self as pezframe_system::Config>::RuntimeCall,
@@ -487,7 +487,7 @@ pub mod pallet {
>;
}
/// Container for different types that implement [`DefaultConfig`]` of this pallet.
/// Container for different types that implement [`DefaultConfig`]` of this pezpallet.
pub mod config_preludes {
use super::*;
use pezframe_support::{
@@ -514,7 +514,7 @@ pub mod pallet {
pub const MaxDelegateDependencies: u32 = 32;
}
/// A type providing default configurations for this pallet in testing environment.
/// A type providing default configurations for this pezpallet in testing environment.
pub struct TestDefaultConfig;
impl<Output, BlockNumber> Randomness<Output, BlockNumber> for TestDefaultConfig {
@@ -577,8 +577,8 @@ pub mod pallet {
}
}
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
#[pezpallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
fn on_idle(_block: BlockNumberFor<T>, limit: Weight) -> Weight {
use migration::MigrateResult::*;
let mut meter = WeightMeter::with_limit(limit);
@@ -624,7 +624,7 @@ pub mod pallet {
// encoded one. This is because even a single-byte wasm instruction has 16-byte size in
// wasmi. This gives us `MaxCodeLen*16` safety margin.
//
// Next, the pallet keeps the Wasm blob for each
// Next, the pezpallet keeps the Wasm blob for each
// contract, hence we add up `MaxCodeLen` to the safety margin.
//
// The inefficiencies of the freeing-bump allocator
@@ -636,7 +636,7 @@ pub mod pallet {
// memory should be available. Note that maximum allowed heap memory and stack size per
// each contract (stack frame) should also be counted.
//
// The pallet holds transient storage with a size up to `max_transient_storage_size`.
// The pezpallet holds transient storage with a size up to `max_transient_storage_size`.
//
// Finally, we allow 50% of the runtime memory to be utilized by the contracts call
// stack, keeping the rest for other facilities, such as PoV, etc.
@@ -734,21 +734,21 @@ pub mod pallet {
}
}
#[pallet::call]
impl<T: Config> Pallet<T>
#[pezpallet::call]
impl<T: Config> Pezpallet<T>
where
<BalanceOf<T> as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode,
{
/// Deprecated version if [`Self::call`] for use in an in-storage `Call`.
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::call().saturating_add(<Pallet<T>>::compat_weight_limit(*gas_limit)))]
#[pezpallet::call_index(0)]
#[pezpallet::weight(T::WeightInfo::call().saturating_add(<Pezpallet<T>>::compat_weight_limit(*gas_limit)))]
#[allow(deprecated)]
#[deprecated(note = "1D weight is used in this extrinsic, please migrate to `call`")]
pub fn call_old_weight(
origin: OriginFor<T>,
dest: AccountIdLookupOf<T>,
#[pallet::compact] value: BalanceOf<T>,
#[pallet::compact] gas_limit: OldWeight,
#[pezpallet::compact] value: BalanceOf<T>,
#[pezpallet::compact] gas_limit: OldWeight,
storage_deposit_limit: Option<<BalanceOf<T> as codec::HasCompact>::Type>,
data: Vec<u8>,
) -> DispatchResultWithPostInfo {
@@ -756,17 +756,17 @@ pub mod pallet {
origin,
dest,
value,
<Pallet<T>>::compat_weight_limit(gas_limit),
<Pezpallet<T>>::compat_weight_limit(gas_limit),
storage_deposit_limit,
data,
)
}
/// Deprecated version if [`Self::instantiate_with_code`] for use in an in-storage `Call`.
#[pallet::call_index(1)]
#[pallet::weight(
#[pezpallet::call_index(1)]
#[pezpallet::weight(
T::WeightInfo::instantiate_with_code(code.len() as u32, data.len() as u32, salt.len() as u32)
.saturating_add(<Pallet<T>>::compat_weight_limit(*gas_limit))
.saturating_add(<Pezpallet<T>>::compat_weight_limit(*gas_limit))
)]
#[allow(deprecated)]
#[deprecated(
@@ -774,8 +774,8 @@ pub mod pallet {
)]
pub fn instantiate_with_code_old_weight(
origin: OriginFor<T>,
#[pallet::compact] value: BalanceOf<T>,
#[pallet::compact] gas_limit: OldWeight,
#[pezpallet::compact] value: BalanceOf<T>,
#[pezpallet::compact] gas_limit: OldWeight,
storage_deposit_limit: Option<<BalanceOf<T> as codec::HasCompact>::Type>,
code: Vec<u8>,
data: Vec<u8>,
@@ -784,7 +784,7 @@ pub mod pallet {
Self::instantiate_with_code(
origin,
value,
<Pallet<T>>::compat_weight_limit(gas_limit),
<Pezpallet<T>>::compat_weight_limit(gas_limit),
storage_deposit_limit,
code,
data,
@@ -793,16 +793,16 @@ pub mod pallet {
}
/// Deprecated version if [`Self::instantiate`] for use in an in-storage `Call`.
#[pallet::call_index(2)]
#[pallet::weight(
T::WeightInfo::instantiate(data.len() as u32, salt.len() as u32).saturating_add(<Pallet<T>>::compat_weight_limit(*gas_limit))
#[pezpallet::call_index(2)]
#[pezpallet::weight(
T::WeightInfo::instantiate(data.len() as u32, salt.len() as u32).saturating_add(<Pezpallet<T>>::compat_weight_limit(*gas_limit))
)]
#[allow(deprecated)]
#[deprecated(note = "1D weight is used in this extrinsic, please migrate to `instantiate`")]
pub fn instantiate_old_weight(
origin: OriginFor<T>,
#[pallet::compact] value: BalanceOf<T>,
#[pallet::compact] gas_limit: OldWeight,
#[pezpallet::compact] value: BalanceOf<T>,
#[pezpallet::compact] gas_limit: OldWeight,
storage_deposit_limit: Option<<BalanceOf<T> as codec::HasCompact>::Type>,
code_hash: CodeHash<T>,
data: Vec<u8>,
@@ -811,7 +811,7 @@ pub mod pallet {
Self::instantiate(
origin,
value,
<Pallet<T>>::compat_weight_limit(gas_limit),
<Pezpallet<T>>::compat_weight_limit(gas_limit),
storage_deposit_limit,
code_hash,
data,
@@ -843,8 +843,8 @@ pub mod pallet {
/// Use [`Determinism::Relaxed`] exclusively for non-deterministic code. If the uploaded
/// code is deterministic, specifying [`Determinism::Relaxed`] will be disregarded and
/// result in higher gas costs.
#[pallet::call_index(3)]
#[pallet::weight(
#[pezpallet::call_index(3)]
#[pezpallet::weight(
match determinism {
Determinism::Enforced => T::WeightInfo::upload_code_determinism_enforced(code.len() as u32),
Determinism::Relaxed => T::WeightInfo::upload_code_determinism_relaxed(code.len() as u32),
@@ -866,8 +866,8 @@ pub mod pallet {
///
/// A code can only be removed by its original uploader (its owner) and only if it is
/// not used by any contract.
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::remove_code())]
#[pezpallet::call_index(4)]
#[pezpallet::weight(T::WeightInfo::remove_code())]
pub fn remove_code(
origin: OriginFor<T>,
code_hash: CodeHash<T>,
@@ -889,8 +889,8 @@ pub mod pallet {
/// This does **not** change the address of the contract in question. This means
/// that the contract address is no longer derived from its code hash after calling
/// this dispatchable.
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::set_code())]
#[pezpallet::call_index(5)]
#[pezpallet::weight(T::WeightInfo::set_code())]
pub fn set_code(
origin: OriginFor<T>,
dest: AccountIdLookupOf<T>,
@@ -933,12 +933,12 @@ pub mod pallet {
/// * If the account is a regular account, any value will be transferred.
/// * If no account exists and the call value is not less than `existential_deposit`,
/// a regular account will be created and any value will be transferred.
#[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::call().saturating_add(*gas_limit))]
#[pezpallet::call_index(6)]
#[pezpallet::weight(T::WeightInfo::call().saturating_add(*gas_limit))]
pub fn call(
origin: OriginFor<T>,
dest: AccountIdLookupOf<T>,
#[pallet::compact] value: BalanceOf<T>,
#[pezpallet::compact] value: BalanceOf<T>,
gas_limit: Weight,
storage_deposit_limit: Option<<BalanceOf<T> as codec::HasCompact>::Type>,
data: Vec<u8>,
@@ -978,7 +978,7 @@ pub mod pallet {
/// from the caller to pay for the storage consumed.
/// * `code`: The contract code to deploy in raw bytes.
/// * `data`: The input data to pass to the contract constructor.
/// * `salt`: Used for the address derivation. See [`Pallet::contract_address`].
/// * `salt`: Used for the address derivation. See [`Pezpallet::contract_address`].
///
/// Instantiation is executed as follows:
///
@@ -988,14 +988,14 @@ pub mod pallet {
/// - The smart-contract account is created at the computed address.
/// - The `value` is transferred to the new account.
/// - The `deploy` function is executed in the context of the newly-created account.
#[pallet::call_index(7)]
#[pallet::weight(
#[pezpallet::call_index(7)]
#[pezpallet::weight(
T::WeightInfo::instantiate_with_code(code.len() as u32, data.len() as u32, salt.len() as u32)
.saturating_add(*gas_limit)
)]
pub fn instantiate_with_code(
origin: OriginFor<T>,
#[pallet::compact] value: BalanceOf<T>,
#[pezpallet::compact] value: BalanceOf<T>,
gas_limit: Weight,
storage_deposit_limit: Option<<BalanceOf<T> as codec::HasCompact>::Type>,
code: Vec<u8>,
@@ -1054,13 +1054,13 @@ pub mod pallet {
/// This function is identical to [`Self::instantiate_with_code`] but without the
/// code deployment step. Instead, the `code_hash` of an on-chain deployed wasm binary
/// must be supplied.
#[pallet::call_index(8)]
#[pallet::weight(
#[pezpallet::call_index(8)]
#[pezpallet::weight(
T::WeightInfo::instantiate(data.len() as u32, salt.len() as u32).saturating_add(*gas_limit)
)]
pub fn instantiate(
origin: OriginFor<T>,
#[pallet::compact] value: BalanceOf<T>,
#[pezpallet::compact] value: BalanceOf<T>,
gas_limit: Weight,
storage_deposit_limit: Option<<BalanceOf<T> as codec::HasCompact>::Type>,
code_hash: CodeHash<T>,
@@ -1094,10 +1094,10 @@ pub mod pallet {
/// When a migration is in progress, this dispatchable can be used to run migration steps.
/// Calls that contribute to advancing the migration have their fees waived, as it's helpful
/// for the chain. Note that while the migration is in progress, the pallet will also
/// for the chain. Note that while the migration is in progress, the pezpallet will also
/// leverage the `on_idle` hooks to run migration steps.
#[pallet::call_index(9)]
#[pallet::weight(T::WeightInfo::migrate().saturating_add(*weight_limit))]
#[pezpallet::call_index(9)]
#[pezpallet::weight(T::WeightInfo::migrate().saturating_add(*weight_limit))]
pub fn migrate(origin: OriginFor<T>, weight_limit: Weight) -> DispatchResultWithPostInfo {
use migration::MigrateResult::*;
ensure_signed(origin)?;
@@ -1127,7 +1127,7 @@ pub mod pallet {
}
}
#[pallet::event]
#[pezpallet::event]
pub enum Event<T: Config> {
/// Contract deployed by address at the specified address.
Instantiated { deployer: T::AccountId, contract: T::AccountId },
@@ -1214,7 +1214,7 @@ pub mod pallet {
},
}
#[pallet::error]
#[pezpallet::error]
pub enum Error<T> {
/// Invalid schedule supplied, e.g. with zero weight of a basic operation.
InvalidSchedule,
@@ -1270,7 +1270,7 @@ pub mod pallet {
TerminatedInConstructor,
/// A call tried to invoke a contract that is flagged as non-reentrant.
/// The only other cause is that a call from a contract into the runtime tried to call back
/// into `pezpallet-contracts`. This would make the whole pallet reentrant with regard to
/// into `pezpallet-contracts`. This would make the whole pezpallet reentrant with regard to
/// contract code execution which is not supported.
ReentranceDenied,
/// A contract attempted to invoke a state modifying API while being in read-only mode.
@@ -1313,21 +1313,21 @@ pub mod pallet {
OutOfTransientStorage,
}
/// A reason for the pallet contracts placing a hold on funds.
#[pallet::composite_enum]
/// A reason for the pezpallet contracts placing a hold on funds.
#[pezpallet::composite_enum]
pub enum HoldReason {
/// The Pallet has reserved it for storing code on-chain.
/// The Pezpallet has reserved it for storing code on-chain.
CodeUploadDepositReserve,
/// The Pallet has reserved it for storage deposit.
/// The Pezpallet has reserved it for storage deposit.
StorageDepositReserve,
}
/// A mapping from a contract's code hash to its code.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type PristineCode<T: Config> = StorageMap<_, Identity, CodeHash<T>, CodeVec<T>>;
/// A mapping from a contract's code hash to its code info.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type CodeInfoOf<T: Config> = StorageMap<_, Identity, CodeHash<T>, CodeInfo<T>>;
/// This is a **monotonic** counter incremented on contract instantiation.
@@ -1352,13 +1352,13 @@ pub mod pallet {
///
/// Do not use it to determine the number of contracts. It won't be decremented if
/// a contract is destroyed.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type Nonce<T: Config> = StorageValue<_, u64, ValueQuery>;
/// The code associated with a given account.
///
/// TWOX-NOTE: SAFE since `AccountId` is a secure hash.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type ContractInfoOf<T: Config> =
StorageMap<_, Twox64Concat, T::AccountId, ContractInfo<T>>;
@@ -1366,23 +1366,23 @@ pub mod pallet {
///
/// Child trie deletion is a heavy operation depending on the amount of storage items
/// stored in said trie. Therefore this operation is performed lazily in `on_idle`.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type DeletionQueue<T: Config> = StorageMap<_, Twox64Concat, u32, TrieId>;
/// A pair of monotonic counters used to track the latest contract marked for deletion
/// and the latest deleted contract in queue.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type DeletionQueueCounter<T: Config> =
StorageValue<_, DeletionQueueManager<T>, ValueQuery>;
/// A migration can span across multiple blocks. This storage defines a cursor to track the
/// progress of the migration, enabling us to resume from the last completed position.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type MigrationInProgress<T: Config> =
StorageValue<_, migration::Cursor, OptionQuery>;
}
/// The type of origins supported by the contracts pallet.
/// The type of origins supported by the contracts pezpallet.
#[derive(
Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, TypeInfo, RuntimeDebugNoBound,
)]
@@ -1668,7 +1668,7 @@ macro_rules! ensure_no_migration_in_progress {
};
}
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
/// Perform a call to a specified contract.
///
/// This function is similar to [`Self::call`], but doesn't perform any address lookups
@@ -1904,14 +1904,14 @@ impl<T: Config> Pallet<T> {
Ok(())
}
/// Deposit a pallet contracts event.
/// Deposit a pezpallet contracts event.
fn deposit_event(event: Event<T>) {
<pezframe_system::Pallet<T>>::deposit_event(<T as Config>::RuntimeEvent::from(event))
<pezframe_system::Pezpallet<T>>::deposit_event(<T as Config>::RuntimeEvent::from(event))
}
/// Deposit a pallet contracts indexed event.
/// Deposit a pezpallet contracts indexed event.
fn deposit_indexed_event(topics: Vec<T::Hash>, event: Event<T>) {
<pezframe_system::Pallet<T>>::deposit_event_indexed(
<pezframe_system::Pezpallet<T>>::deposit_event_indexed(
&topics,
<T as Config>::RuntimeEvent::from(event).into(),
)
@@ -1943,7 +1943,7 @@ pezsp_api::decl_runtime_apis! {
{
/// Perform a call from a specified account to a given contract.
///
/// See [`crate::Pallet::bare_call`].
/// See [`crate::Pezpallet::bare_call`].
fn call(
origin: AccountId,
dest: AccountId,
@@ -1955,7 +1955,7 @@ pezsp_api::decl_runtime_apis! {
/// Instantiate a new contract.
///
/// See `[crate::Pallet::bare_instantiate]`.
/// See `[crate::Pezpallet::bare_instantiate]`.
fn instantiate(
origin: AccountId,
value: Balance,
@@ -1968,7 +1968,7 @@ pezsp_api::decl_runtime_apis! {
/// Upload new code without instantiating a contract from it.
///
/// See [`crate::Pallet::bare_upload_code`].
/// See [`crate::Pezpallet::bare_upload_code`].
fn upload_code(
origin: AccountId,
code: Vec<u8>,
+20 -20
View File
@@ -51,7 +51,7 @@
//!
//! If the [`MigrationInProgress`] storage item exists, it means a migration is in progress, and its
//! value holds a cursor for the current migration step. These migration steps are executed during
//! [`Hooks<BlockNumber>::on_idle`] or when the [`Pallet::migrate`] dispatchable is
//! [`Hooks<BlockNumber>::on_idle`] or when the [`Pezpallet::migrate`] dispatchable is
//! called.
//!
//! While the migration is in progress, all dispatchables except `migrate`, are blocked, and returns
@@ -67,7 +67,7 @@ pub mod v15;
pub mod v16;
include!(concat!(env!("OUT_DIR"), "/migration_codegen.rs"));
use crate::{weights::WeightInfo, Config, Error, MigrationInProgress, Pallet, Weight, LOG_TARGET};
use crate::{weights::WeightInfo, Config, Error, MigrationInProgress, Pezpallet, Weight, LOG_TARGET};
use codec::{Codec, Decode};
use core::marker::PhantomData;
use pezframe_support::{
@@ -237,9 +237,9 @@ pub struct Migration<T: Config, const TEST_ALL_STEPS: bool = true>(PhantomData<T
impl<T: Config, const TEST_ALL_STEPS: bool> Migration<T, TEST_ALL_STEPS> {
fn run_all_steps() -> Result<(), TryRuntimeError> {
let mut meter = &mut WeightMeter::new();
let name = <Pallet<T>>::name();
let name = <Pezpallet<T>>::name();
loop {
let in_progress_version = <Pallet<T>>::on_chain_storage_version() + 1;
let in_progress_version = <Pezpallet<T>>::on_chain_storage_version() + 1;
let state = T::Migrations::pre_upgrade_step(in_progress_version)?;
let before = meter.consumed();
let status = Self::migrate(&mut meter);
@@ -255,7 +255,7 @@ impl<T: Config, const TEST_ALL_STEPS: bool> Migration<T, TEST_ALL_STEPS> {
}
}
let name = <Pallet<T>>::name();
let name = <Pezpallet<T>>::name();
log::info!(target: LOG_TARGET, "{name}: Migration steps weight = {}", meter.consumed());
Ok(())
}
@@ -263,9 +263,9 @@ impl<T: Config, const TEST_ALL_STEPS: bool> Migration<T, TEST_ALL_STEPS> {
impl<T: Config, const TEST_ALL_STEPS: bool> OnRuntimeUpgrade for Migration<T, TEST_ALL_STEPS> {
fn on_runtime_upgrade() -> Weight {
let name = <Pallet<T>>::name();
let in_code_version = <Pallet<T>>::in_code_storage_version();
let on_chain_version = <Pallet<T>>::on_chain_storage_version();
let name = <Pezpallet<T>>::name();
let in_code_version = <Pezpallet<T>>::in_code_storage_version();
let on_chain_version = <Pezpallet<T>>::on_chain_storage_version();
if on_chain_version == in_code_version {
log::warn!(
@@ -309,8 +309,8 @@ impl<T: Config, const TEST_ALL_STEPS: bool> OnRuntimeUpgrade for Migration<T, TE
// We can't really do much here as our migrations do not happen during the runtime upgrade.
// Instead, we call the migrations `pre_upgrade` and `post_upgrade` hooks when we iterate
// over our migrations.
let on_chain_version = <Pallet<T>>::on_chain_storage_version();
let in_code_version = <Pallet<T>>::in_code_storage_version();
let on_chain_version = <Pezpallet<T>>::on_chain_storage_version();
let in_code_version = <Pezpallet<T>>::in_code_storage_version();
if on_chain_version == in_code_version {
return Ok(Default::default());
@@ -319,7 +319,7 @@ impl<T: Config, const TEST_ALL_STEPS: bool> OnRuntimeUpgrade for Migration<T, TE
log::debug!(
target: LOG_TARGET,
"Requested migration of {} from {:?}(on-chain storage version) to {:?}(in-code storage version)",
<Pallet<T>>::name(), on_chain_version, in_code_version
<Pezpallet<T>>::name(), on_chain_version, in_code_version
);
ensure!(
@@ -388,7 +388,7 @@ impl<T: Config, const TEST_ALL_STEPS: bool> Migration<T, TEST_ALL_STEPS> {
/// Execute the multi-step migration.
/// Returns whether or not a migration is in progress
pub(crate) fn migrate(mut meter: &mut WeightMeter) -> MigrateResult {
let name = <Pallet<T>>::name();
let name = <Pezpallet<T>>::name();
if meter.try_consume(T::WeightInfo::migrate()).is_err() {
return MigrateResult::NoMigrationPerformed;
@@ -401,7 +401,7 @@ impl<T: Config, const TEST_ALL_STEPS: bool> Migration<T, TEST_ALL_STEPS> {
};
// if a migration is running it is always upgrading to the next version
let storage_version = <Pallet<T>>::on_chain_storage_version();
let storage_version = <Pezpallet<T>>::on_chain_storage_version();
let in_progress_version = storage_version + 1;
log::info!(
@@ -419,8 +419,8 @@ impl<T: Config, const TEST_ALL_STEPS: bool> Migration<T, TEST_ALL_STEPS> {
MigrateResult::InProgress { steps_done }
},
StepResult::Completed { steps_done } => {
in_progress_version.put::<Pallet<T>>();
if <Pallet<T>>::in_code_storage_version() != in_progress_version {
in_progress_version.put::<Pezpallet<T>>();
if <Pezpallet<T>>::in_code_storage_version() != in_progress_version {
log::info!(
target: LOG_TARGET,
"{name}: Next migration is {:?},",
@@ -578,7 +578,7 @@ mod test {
#[test]
fn test_storage_version_matches_last_migration_file() {
assert_eq!(StorageVersion::new(LATEST_MIGRATION_VERSION), crate::pallet::STORAGE_VERSION);
assert_eq!(StorageVersion::new(LATEST_MIGRATION_VERSION), crate::pezpallet::STORAGE_VERSION);
}
#[test]
@@ -619,7 +619,7 @@ mod test {
type TestMigration = Migration<Test>;
ExtBuilder::default().build().execute_with(|| {
assert_eq!(StorageVersion::get::<Pallet<Test>>(), LATEST_MIGRATION_VERSION);
assert_eq!(StorageVersion::get::<Pezpallet<Test>>(), LATEST_MIGRATION_VERSION);
assert_eq!(
TestMigration::migrate(&mut WeightMeter::new()),
MigrateResult::NoMigrationInProgress
@@ -635,7 +635,7 @@ mod test {
.set_storage_version(LATEST_MIGRATION_VERSION - 2)
.build()
.execute_with(|| {
assert_eq!(StorageVersion::get::<Pallet<Test>>(), LATEST_MIGRATION_VERSION - 2);
assert_eq!(StorageVersion::get::<Pezpallet<Test>>(), LATEST_MIGRATION_VERSION - 2);
TestMigration::on_runtime_upgrade();
for (version, status) in [
(LATEST_MIGRATION_VERSION - 1, MigrateResult::InProgress { steps_done: 1 }),
@@ -643,7 +643,7 @@ mod test {
] {
assert_eq!(TestMigration::migrate(&mut WeightMeter::new()), status);
assert_eq!(
<Pallet<Test>>::on_chain_storage_version(),
<Pezpallet<Test>>::on_chain_storage_version(),
StorageVersion::new(version)
);
}
@@ -652,7 +652,7 @@ mod test {
TestMigration::migrate(&mut WeightMeter::new()),
MigrateResult::NoMigrationInProgress
);
assert_eq!(StorageVersion::get::<Pallet<Test>>(), LATEST_MIGRATION_VERSION);
assert_eq!(StorageVersion::get::<Pezpallet<Test>>(), LATEST_MIGRATION_VERSION);
});
}
}
@@ -20,7 +20,7 @@
use crate::{
migration::{IsFinished, MigrationStep},
weights::WeightInfo,
CodeHash, Config, Determinism, Pallet, Weight, LOG_TARGET,
CodeHash, Config, Determinism, Pezpallet, Weight, LOG_TARGET,
};
use alloc::vec::Vec;
use codec::{Decode, Encode};
@@ -46,7 +46,7 @@ mod v8 {
#[storage_alias]
pub type CodeStorage<T: Config> =
StorageMap<Pallet<T>, Identity, CodeHash<T>, PrefabWasmModule>;
StorageMap<Pezpallet<T>, Identity, CodeHash<T>, PrefabWasmModule>;
}
#[cfg(feature = "runtime-benchmarks")]
@@ -75,7 +75,7 @@ struct PrefabWasmModule {
}
#[storage_alias]
type CodeStorage<T: Config> = StorageMap<Pallet<T>, Identity, CodeHash<T>, PrefabWasmModule>;
type CodeStorage<T: Config> = StorageMap<Pezpallet<T>, Identity, CodeHash<T>, PrefabWasmModule>;
#[derive(Encode, Decode, MaxEncodedLen, DefaultNoBound)]
pub struct Migration<T: Config> {
@@ -22,7 +22,7 @@ use crate::{
exec::AccountIdOf,
migration::{IsFinished, MigrationStep},
weights::WeightInfo,
CodeHash, Config, Pallet, TrieId, Weight, LOG_TARGET,
CodeHash, Config, Pezpallet, TrieId, Weight, LOG_TARGET,
};
use codec::{Decode, Encode};
use core::{
@@ -74,7 +74,7 @@ mod v9 {
#[storage_alias]
pub type ContractInfoOf<T: Config, OldCurrency> = StorageMap<
Pallet<T>,
Pezpallet<T>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
ContractInfo<T, OldCurrency>,
@@ -136,7 +136,7 @@ pub struct Migration<T: Config, OldCurrency = ()> {
#[storage_alias]
type ContractInfoOf<T: Config, OldCurrency> = StorageMap<
Pallet<T>,
Pezpallet<T>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
ContractInfo<T, OldCurrency>,
@@ -21,7 +21,7 @@
use crate::{
migration::{IsFinished, MigrationStep},
weights::WeightInfo,
Config, Pallet, TrieId, Weight, LOG_TARGET,
Config, Pezpallet, TrieId, Weight, LOG_TARGET,
};
use alloc::vec::Vec;
use codec::{Decode, Encode};
@@ -39,7 +39,7 @@ mod v10 {
}
#[storage_alias]
pub type DeletionQueue<T: Config> = StorageValue<Pallet<T>, Vec<DeletedContract>>;
pub type DeletionQueue<T: Config> = StorageValue<Pezpallet<T>, Vec<DeletedContract>>;
}
#[derive(Encode, Decode, TypeInfo, MaxEncodedLen, DefaultNoBound, Clone)]
@@ -60,10 +60,10 @@ pub fn fill_old_queue<T: Config>(len: usize) {
}
#[storage_alias]
type DeletionQueue<T: Config> = StorageMap<Pallet<T>, Twox64Concat, u32, TrieId>;
type DeletionQueue<T: Config> = StorageMap<Pezpallet<T>, Twox64Concat, u32, TrieId>;
#[storage_alias]
type DeletionQueueCounter<T: Config> = StorageValue<Pallet<T>, DeletionQueueManager<T>, ValueQuery>;
type DeletionQueueCounter<T: Config> = StorageValue<Pezpallet<T>, DeletionQueueManager<T>, ValueQuery>;
#[derive(Encode, Decode, MaxEncodedLen, DefaultNoBound)]
pub struct Migration<T: Config> {
@@ -21,7 +21,7 @@
use crate::{
migration::{IsFinished, MigrationStep},
weights::WeightInfo,
AccountIdOf, BalanceOf, CodeHash, Config, Determinism, Pallet, Weight, LOG_TARGET,
AccountIdOf, BalanceOf, CodeHash, Config, Determinism, Pezpallet, Weight, LOG_TARGET,
};
use alloc::vec::Vec;
use codec::{Decode, Encode};
@@ -72,11 +72,11 @@ mod v11 {
#[storage_alias]
pub type OwnerInfoOf<T: Config, OldCurrency> =
StorageMap<Pallet<T>, Identity, CodeHash<T>, OwnerInfo<T, OldCurrency>>;
StorageMap<Pezpallet<T>, Identity, CodeHash<T>, OwnerInfo<T, OldCurrency>>;
#[storage_alias]
pub type CodeStorage<T: Config> =
StorageMap<Pallet<T>, Identity, CodeHash<T>, PrefabWasmModule>;
StorageMap<Pezpallet<T>, Identity, CodeHash<T>, PrefabWasmModule>;
}
#[derive(Encode, Decode, scale_info::TypeInfo, MaxEncodedLen)]
@@ -97,10 +97,10 @@ where
#[storage_alias]
pub type CodeInfoOf<T: Config, OldCurrency> =
StorageMap<Pallet<T>, Identity, CodeHash<T>, CodeInfo<T, OldCurrency>>;
StorageMap<Pezpallet<T>, Identity, CodeHash<T>, CodeInfo<T, OldCurrency>>;
#[storage_alias]
pub type PristineCode<T: Config> = StorageMap<Pallet<T>, Identity, CodeHash<T>, Vec<u8>>;
pub type PristineCode<T: Config> = StorageMap<Pezpallet<T>, Identity, CodeHash<T>, Vec<u8>>;
#[cfg(feature = "runtime-benchmarks")]
pub fn store_old_dummy_code<T: Config, OldCurrency>(len: usize, account: T::AccountId)
@@ -21,7 +21,7 @@
use crate::{
migration::{IsFinished, MigrationStep},
weights::WeightInfo,
AccountIdOf, BalanceOf, CodeHash, Config, Pallet, TrieId, Weight, LOG_TARGET,
AccountIdOf, BalanceOf, CodeHash, Config, Pezpallet, TrieId, Weight, LOG_TARGET,
};
use codec::{Decode, Encode};
use pezframe_support::{pezpallet_prelude::*, storage_alias, weights::WeightMeter, DefaultNoBound};
@@ -45,7 +45,7 @@ mod v12 {
#[storage_alias]
pub type ContractInfoOf<T: Config> = StorageMap<
Pallet<T>,
Pezpallet<T>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
ContractInfo<T>,
@@ -73,7 +73,7 @@ pub fn store_old_contract_info<T: Config>(account: T::AccountId, info: crate::Co
#[storage_alias]
pub type ContractInfoOf<T: Config> =
StorageMap<Pallet<T>, Twox64Concat, <T as pezframe_system::Config>::AccountId, ContractInfo<T>>;
StorageMap<Pezpallet<T>, Twox64Concat, <T as pezframe_system::Config>::AccountId, ContractInfo<T>>;
#[derive(Encode, Decode, CloneNoBound, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[scale_info(skip_type_params(T))]
@@ -24,7 +24,7 @@ use crate::{
exec::AccountIdOf,
migration::{IsFinished, MigrationStep},
weights::WeightInfo,
BalanceOf, CodeHash, Config, Determinism, HoldReason, Pallet, Weight, LOG_TARGET,
BalanceOf, CodeHash, Config, Determinism, HoldReason, Pezpallet, Weight, LOG_TARGET,
};
#[cfg(feature = "try-runtime")]
use alloc::collections::btree_map::BTreeMap;
@@ -71,7 +71,7 @@ mod v13 {
#[storage_alias]
pub type CodeInfoOf<T: Config, OldCurrency> =
StorageMap<Pallet<T>, Identity, CodeHash<T>, CodeInfo<T, OldCurrency>>;
StorageMap<Pezpallet<T>, Identity, CodeHash<T>, CodeInfo<T, OldCurrency>>;
}
#[cfg(feature = "runtime-benchmarks")]
@@ -25,7 +25,7 @@
use crate::{
migration::{IsFinished, MigrationStep},
weights::WeightInfo,
AccountIdOf, BalanceOf, CodeHash, Config, HoldReason, Pallet, TrieId, Weight, LOG_TARGET,
AccountIdOf, BalanceOf, CodeHash, Config, HoldReason, Pezpallet, TrieId, Weight, LOG_TARGET,
};
#[cfg(feature = "try-runtime")]
use alloc::vec::Vec;
@@ -41,7 +41,7 @@ use pezframe_support::{
weights::WeightMeter,
BoundedBTreeMap, DefaultNoBound,
};
use pezframe_system::Pallet as System;
use pezframe_system::Pezpallet as System;
use pezsp_core::hexdisplay::HexDisplay;
#[cfg(feature = "try-runtime")]
use pezsp_runtime::TryRuntimeError;
@@ -69,7 +69,7 @@ mod v14 {
#[storage_alias]
pub type ContractInfoOf<T: Config> = StorageMap<
Pallet<T>,
Pezpallet<T>,
Twox64Concat,
<T as pezframe_system::Config>::AccountId,
ContractInfo<T>,
@@ -112,7 +112,7 @@ struct ContractInfo<T: Config> {
#[storage_alias]
type ContractInfoOf<T: Config> =
StorageMap<Pallet<T>, Twox64Concat, <T as pezframe_system::Config>::AccountId, ContractInfo<T>>;
StorageMap<Pezpallet<T>, Twox64Concat, <T as pezframe_system::Config>::AccountId, ContractInfo<T>>;
#[derive(Encode, Decode, MaxEncodedLen, DefaultNoBound)]
pub struct Migration<T: Config> {
@@ -21,7 +21,7 @@
use crate::{
migration::{IsFinished, MigrationStep},
weights::WeightInfo,
BalanceOf, CodeHash, Config, Pallet, TrieId, Weight, WeightMeter, LOG_TARGET,
BalanceOf, CodeHash, Config, Pezpallet, TrieId, Weight, WeightMeter, LOG_TARGET,
};
use codec::{Decode, Encode};
use pezframe_support::{pezpallet_prelude::*, storage_alias, DefaultNoBound};
@@ -32,7 +32,7 @@ pub fn store_old_contract_info<T: Config>(
account: T::AccountId,
info: &crate::ContractInfo<T>,
) -> BalanceOf<T> {
let storage_base_deposit = Pallet::<T>::min_balance() + 1u32.into();
let storage_base_deposit = Pezpallet::<T>::min_balance() + 1u32.into();
ContractInfoOf::<T>::insert(
account,
ContractInfo {
@@ -52,7 +52,7 @@ pub fn store_old_contract_info<T: Config>(
#[storage_alias]
pub type ContractInfoOf<T: Config> =
StorageMap<Pallet<T>, Twox64Concat, <T as pezframe_system::Config>::AccountId, ContractInfo<T>>;
StorageMap<Pezpallet<T>, Twox64Concat, <T as pezframe_system::Config>::AccountId, ContractInfo<T>>;
#[derive(Encode, Decode, CloneNoBound, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[scale_info(skip_type_params(T))]
@@ -89,7 +89,7 @@ impl<T: Config> MigrationStep for Migration<T> {
if let Some(key) = iter.next() {
log::debug!(target: LOG_TARGET, "Migrating contract {:?}", key);
ContractInfoOf::<T>::mutate(key.clone(), |info| {
let ed = Pallet::<T>::min_balance();
let ed = Pezpallet::<T>::min_balance();
let mut updated_info = info.take().expect("Item exists; qed");
updated_info.storage_base_deposit.saturating_reduce(ed);
*info = Some(updated_info);
@@ -19,7 +19,7 @@
use crate::{
storage::ContractInfo, AccountIdOf, BalanceOf, CodeInfo, Config, Error, Event, HoldReason,
Inspect, Origin, Pallet, StorageDeposit as Deposit, System, LOG_TARGET,
Inspect, Origin, Pezpallet, StorageDeposit as Deposit, System, LOG_TARGET,
};
use alloc::vec::Vec;
@@ -440,7 +440,7 @@ where
debug_assert!(matches!(self.contract_state(), ContractState::Alive));
// We need to make sure that the contract's account exists.
let ed = Pallet::<T>::min_balance();
let ed = Pezpallet::<T>::min_balance();
self.total_deposit = Deposit::Charge(ed);
T::Currency::transfer(origin, contract, ed, Preservation::Preserve)?;
@@ -520,7 +520,7 @@ impl<T: Config> Ext<T> for ReservingExt {
// as free balance after accounting for all deposits.
let max = T::Currency::reducible_balance(origin, Preservation::Preserve, Polite)
.saturating_sub(min_leftover)
.saturating_sub(Pallet::<T>::min_balance());
.saturating_sub(Pezpallet::<T>::min_balance());
let default = max.min(T::DefaultDepositLimit::get());
let limit = limit.unwrap_or(default);
ensure!(
@@ -552,7 +552,7 @@ impl<T: Config> Ext<T> for ReservingExt {
Fortitude::Polite,
)?;
Pallet::<T>::deposit_event(Event::StorageDepositTransferredAndHeld {
Pezpallet::<T>::deposit_event(Event::StorageDepositTransferredAndHeld {
from: origin.clone(),
to: contract.clone(),
amount: *amount,
@@ -569,7 +569,7 @@ impl<T: Config> Ext<T> for ReservingExt {
Fortitude::Polite,
)?;
Pallet::<T>::deposit_event(Event::StorageDepositTransferredAndReleased {
Pezpallet::<T>::deposit_event(Event::StorageDepositTransferredAndReleased {
from: contract.clone(),
to: origin.clone(),
amount: transferred,
@@ -19,7 +19,7 @@ use super::GAS_LIMIT;
use crate::{
AccountIdLookupOf, AccountIdOf, BalanceOf, Code, CodeHash, CollectEvents, Config,
ContractExecResult, ContractInstantiateResult, DebugInfo, Determinism, EventRecordOf,
ExecReturnValue, InstantiateReturnValue, OriginFor, Pallet, Weight,
ExecReturnValue, InstantiateReturnValue, OriginFor, Pezpallet, Weight,
};
use codec::{Encode, HasCompact};
use core::fmt::Debug;
@@ -64,7 +64,7 @@ macro_rules! builder {
#[doc = concat!("Build the ", stringify!($method), " call")]
pub fn build(self) -> $result {
Pallet::<T>::$method(
Pezpallet::<T>::$method(
$(self.$field,)*
)
}
+6 -6
View File
@@ -37,7 +37,7 @@ use crate::{
weights::WeightInfo,
Array, BalanceOf, Code, CodeHash, CodeInfoOf, CollectEvents, Config, ContractInfo,
ContractInfoOf, DebugInfo, DefaultAddressGenerator, DeletionQueueCounter, Error, HoldReason,
MigrationInProgress, Origin, Pallet, PristineCode, Schedule,
MigrationInProgress, Origin, Pezpallet, PristineCode, Schedule,
};
use assert_matches::assert_matches;
use codec::{Decode, Encode};
@@ -399,7 +399,7 @@ impl pezpallet_proxy::Config for Test {
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = ConstU64<1>;
type AnnouncementDepositFactor = ConstU64<1>;
type BlockNumberProvider = pezframe_system::Pallet<Test>;
type BlockNumberProvider = pezframe_system::Pezpallet<Test>;
}
impl pezpallet_dummy::Config for Test {}
@@ -561,9 +561,9 @@ impl ExtBuilder {
ext.execute_with(|| {
use pezframe_support::traits::OnGenesis;
Pallet::<Test>::on_genesis();
Pezpallet::<Test>::on_genesis();
if let Some(storage_version) = self.storage_version {
storage_version.put::<Pallet<Test>>();
storage_version.put::<Pezpallet<Test>>();
}
System::set_block_number(1)
});
@@ -647,7 +647,7 @@ fn migration_on_idle_hooks_works() {
.execute_with(|| {
MigrationInProgress::<Test>::set(Some(Default::default()));
Contracts::on_idle(System::block_number(), weight);
assert_eq!(StorageVersion::get::<Pallet<Test>>(), expected_version);
assert_eq!(StorageVersion::get::<Pezpallet<Test>>(), expected_version);
});
}
}
@@ -2545,7 +2545,7 @@ fn failed_deposit_charge_should_roll_back_call() {
let transfer_call =
Box::new(RuntimeCall::Balances(pezpallet_balances::Call::transfer_allow_death {
dest: CHARLIE,
value: pezpallet_balances::Pallet::<Test>::free_balance(&ALICE) - 2 * ED,
value: pezpallet_balances::Pezpallet::<Test>::free_balance(&ALICE) - 2 * ED,
}));
// Wrap the transfer call in a proxy call.
@@ -15,10 +15,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
pub use pallet::*;
pub use pezpallet::*;
#[pezframe_support::pallet(dev_mode)]
pub mod pallet {
#[pezframe_support::pezpallet(dev_mode)]
pub mod pezpallet {
use pezframe_support::{
dispatch::{Pays, PostDispatchInfo},
ensure,
@@ -27,19 +27,19 @@ pub mod pallet {
};
use pezframe_system::pezpallet_prelude::*;
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
pub struct Pezpallet<T>(_);
#[pallet::config]
#[pezpallet::config]
pub trait Config: pezframe_system::Config {}
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pezpallet::call]
impl<T: Config> Pezpallet<T> {
/// Dummy function that overcharges the predispatch weight, allowing us to test the correct
/// values of [`ContractResult::gas_consumed`] and [`ContractResult::gas_required`] in
/// tests.
#[pallet::call_index(1)]
#[pallet::weight(*pre_charge)]
#[pezpallet::call_index(1)]
#[pezpallet::weight(*pre_charge)]
pub fn overestimate_pre_charge(
origin: OriginFor<T>,
pre_charge: Weight,
@@ -46,7 +46,7 @@ use crate::{
gas::{GasMeter, Token},
weights::WeightInfo,
AccountIdOf, BadOrigin, BalanceOf, CodeHash, CodeInfoOf, CodeVec, Config, Error, Event,
HoldReason, Pallet, PristineCode, Schedule, Weight, LOG_TARGET,
HoldReason, Pezpallet, PristineCode, Schedule, Weight, LOG_TARGET,
};
use alloc::vec::Vec;
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
@@ -126,7 +126,7 @@ pub enum Determinism {
/// Allow calling or uploading an indeterministic code.
///
/// This is only possible when calling into `pezpallet-contracts` directly via
/// [`crate::Pallet::bare_call`].
/// [`crate::Pezpallet::bare_call`].
///
/// # Note
///
@@ -191,7 +191,7 @@ impl<T: Config> WasmBlob<T> {
*existing = None;
<PristineCode<T>>::remove(&code_hash);
<Pallet<T>>::deposit_event(Event::CodeRemoved {
<Pezpallet<T>>::deposit_event(Event::CodeRemoved {
code_hash,
deposit_released,
remover,
@@ -279,7 +279,7 @@ impl<T: Config> WasmBlob<T> {
self.code_info.refcount = 0;
<PristineCode<T>>::insert(code_hash, &self.code);
*stored_code_info = Some(self.code_info.clone());
<Pallet<T>>::deposit_event(Event::CodeStored {
<Pezpallet<T>>::deposit_event(Event::CodeStored {
code_hash,
deposit_held: deposit,
uploader: self.code_info.owner.clone(),
@@ -512,7 +512,7 @@ mod tests {
storage::WriteOutcome,
tests::{RuntimeCall, Test, ALICE, BOB},
transient_storage::TransientStorage,
BalanceOf, CodeHash, Error, Origin, Pallet as Contracts,
BalanceOf, CodeHash, Error, Origin, Pezpallet as Contracts,
};
use assert_matches::assert_matches;
use pezframe_support::{
@@ -246,7 +246,7 @@ impl LoadedModule {
///
/// 1. General engine-side validation makes sure the module is consistent and does not contain
/// forbidden WebAssembly features.
/// 2. Additional checks which are specific to smart contracts eligible for this pallet.
/// 2. Additional checks which are specific to smart contracts eligible for this pezpallet.
fn validate<E, T>(
code: &[u8],
schedule: &Schedule<T>,
@@ -293,7 +293,7 @@ where
)?,
};
// The we check that module satisfies constraints the pallet puts on contracts.
// The we check that module satisfies constraints the pezpallet puts on contracts.
contract_module.scan_exports()?;
contract_module.scan_imports::<T>(schedule)?;
Ok(contract_module)
+2 -2
View File
@@ -44,10 +44,10 @@
// frame-omni-bencher
// v1
// benchmark
// pallet
// pezpallet
// --extrinsic=*
// --runtime=target/production/wbuild/pez-kitchensink-runtime/pez_kitchensink_runtime.wasm
// --pallet=pezpallet_contracts
// --pezpallet=pezpallet_contracts
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/contracts/src/weights.rs
// --wasm-execution=compiled