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
+1 -1
View File
@@ -6,7 +6,7 @@ edition.workspace = true
license = "Apache-2.0"
homepage.workspace = true
repository.workspace = true
description = "FRAME pallet for PolkaVM contracts."
description = "FRAME pezpallet for PolkaVM contracts."
readme = "README.md"
include = ["CHANGELOG.md", "README.md", "build.rs", "src/**/*"]
documentation = "https://docs.rs/pezpallet-revive"
+5 -5
View File
@@ -1,4 +1,4 @@
# Revive Pallet
# Revive Pezpallet
This is an **experimental** module that provides functionality for the runtime to deploy and execute PolkaVM
smart-contracts. It is a heavily modified `pallet_contracts` fork.
@@ -32,7 +32,7 @@ One `ref_time` `Weight` is defined as one picosecond of execution time on the ru
#### Event-Aware Weight Accounting
The pallet includes **event-aware weight accounting** for `finalize_block()` operations through the `OnFinalizeBlockParts`
The pezpallet includes **event-aware weight accounting** for `finalize_block()` operations through the `OnFinalizeBlockParts`
trait. The weight model uses differential benchmarking to precisely account for the computational cost of processing
events during Ethereum block construction:
@@ -43,7 +43,7 @@ Total Weight = fixed_part +
```
**High-Level Weight API (`OnFinalizeBlockParts` trait):**
The pallet exposes these weight calculation methods for runtime use:
The pezpallet exposes these weight calculation methods for runtime use:
- **Fixed cost**: `on_finalize_block_fixed()` - Base overhead regardless of transaction/event count
- **Per-transaction cost**: `on_finalize_block_per_tx(payload_size)` - Applied incrementally during each `eth_call()`
- **Per-event cost**: `on_finalize_block_per_event(data_len)` - Applied dynamically during each `deposit_event()`
@@ -79,7 +79,7 @@ to handle that failure, either proceeding or reverting A's changes.
### Dispatchable functions
Those are documented in the [reference
documentation](https://docs.pezkuwichain.io/sdk/master/pallet_revive/pallet/dispatchables/index.html).
documentation](https://docs.pezkuwichain.io/sdk/master/pallet_revive/pezpallet/dispatchables/index.html).
## Usage
@@ -103,7 +103,7 @@ cargo run --release -- --dev -lerror,runtime::revive::strace=trace,runtime::revi
## Unstable Interfaces
Driven by the desire to have an iterative approach in developing new contract interfaces this pallet contains the
Driven by the desire to have an iterative approach in developing new contract interfaces this pezpallet contains the
concept of an unstable interface. Akin to the rust nightly compiler it allows us to add new interfaces but mark them as
unstable so that contract languages can experiment with them and give feedback before we stabilize those.
@@ -237,29 +237,29 @@ mod runtime {
)]
pub struct Runtime;
/// Mandatory system pallet that should always be included in a FRAME runtime.
/// Mandatory system pezpallet that should always be included in a FRAME runtime.
#[runtime::pezpallet_index(0)]
pub type System = pezframe_system::Pallet<Runtime>;
pub type System = pezframe_system::Pezpallet<Runtime>;
/// Provides a way for consensus systems to set and check the onchain time.
#[runtime::pezpallet_index(1)]
pub type Timestamp = pezpallet_timestamp::Pallet<Runtime>;
pub type Timestamp = pezpallet_timestamp::Pezpallet<Runtime>;
/// Provides the ability to keep track of balances.
#[runtime::pezpallet_index(2)]
pub type Balances = pezpallet_balances::Pallet<Runtime>;
pub type Balances = pezpallet_balances::Pezpallet<Runtime>;
/// Provides a way to execute privileged functions.
#[runtime::pezpallet_index(3)]
pub type Sudo = pezpallet_sudo::Pallet<Runtime>;
pub type Sudo = pezpallet_sudo::Pezpallet<Runtime>;
/// Provides the ability to charge for extrinsic execution.
#[runtime::pezpallet_index(4)]
pub type TransactionPayment = pezpallet_transaction_payment::Pallet<Runtime>;
pub type TransactionPayment = pezpallet_transaction_payment::Pezpallet<Runtime>;
/// Provides the ability to execute Smart Contracts.
#[runtime::pezpallet_index(5)]
pub type Revive = pezpallet_revive::Pallet<Runtime>;
pub type Revive = pezpallet_revive::Pezpallet<Runtime>;
}
/// We assume that ~10% of the block weight is consumed by `on_initialize` handlers.
@@ -294,7 +294,7 @@ parameter_types! {
.build_or_panic();
}
/// Implements the types required for the system pallet.
/// Implements the types required for the system pezpallet.
#[derive_impl(pezframe_system::config_preludes::SolochainDefaultConfig)]
impl pezframe_system::Config for Runtime {
type Block = Block;
@@ -309,7 +309,7 @@ parameter_types! {
pub const ExistentialDeposit: Balance = CENTS;
}
// Implements the types required for the balances pallet.
// Implements the types required for the balances pezpallet.
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for Runtime {
type AccountStore = System;
@@ -317,11 +317,11 @@ impl pezpallet_balances::Config for Runtime {
type ExistentialDeposit = ExistentialDeposit;
}
// Implements the types required for the sudo pallet.
// Implements the types required for the sudo pezpallet.
#[derive_impl(pezpallet_sudo::config_preludes::TestDefaultConfig)]
impl pezpallet_sudo::Config for Runtime {}
// Implements the types required for the sudo pallet.
// Implements the types required for the sudo pezpallet.
#[derive_impl(pezpallet_timestamp::config_preludes::TestDefaultConfig)]
impl pezpallet_timestamp::Config for Runtime {}
@@ -330,7 +330,7 @@ parameter_types! {
pub FeeMultiplier: Multiplier = Multiplier::one();
}
// Implements the types required for the transaction payment pallet.
// Implements the types required for the transaction payment pezpallet.
#[derive_impl(pezpallet_transaction_payment::config_preludes::TestDefaultConfig)]
impl pezpallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pezpallet_transaction_payment::FungibleAdapter<Balances, ()>;
+1 -1
View File
@@ -710,7 +710,7 @@ impl Client {
// This could potentially fail under below circumstances:
// - state has been pruned
// - the block author cannot be obtained from the digest logs (highly unlikely)
// - the node we are targeting has an outdated revive pallet (or ETH block functionality is
// - the node we are targeting has an outdated revive pezpallet (or ETH block functionality is
// disabled)
match self.runtime_api(block.hash()).eth_block().await {
Ok(mut eth_block) => {
@@ -295,7 +295,7 @@ impl ReceiptExtractor {
})
.collect();
// Sanity check we received enough data from the pallet revive.
// Sanity check we received enough data from the pezpallet revive.
if receipt_data.len() != extrinsics.len() {
log::error!(
target: LOG_TARGET,
+76 -76
View File
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Benchmarks for the revive pallet.
//! Benchmarks for the revive pezpallet.
#![cfg(feature = "runtime-benchmarks")]
use crate::{
@@ -41,7 +41,7 @@ use crate::{
evm::{instructions, instructions::utility::IntoAddress, Interpreter},
pvm,
},
Pallet as Contracts, *,
Pezpallet as Contracts, *,
};
use alloc::{vec, vec::Vec};
use alloy_core::sol_types::{SolInterface, SolValue};
@@ -100,10 +100,10 @@ macro_rules! build_runtime(
};
);
/// Get the pallet account and whitelist it for benchmarking.
/// Get the pezpallet account and whitelist it for benchmarking.
/// The account is warmed up `on_initialize` so read should not impact the PoV.
fn whitelisted_pallet_account<T: Config>() -> T::AccountId {
let pezpallet_account = Pallet::<T>::account_id();
let pezpallet_account = Pezpallet::<T>::account_id();
whitelist_account!(pezpallet_account);
pezpallet_account
}
@@ -156,7 +156,7 @@ mod benchmarks {
fn call_with_pvm_code_per_byte(c: Linear<0, { 100 * 1024 }>) -> Result<(), BenchmarkError> {
let instance =
Contract::<T>::with_caller(whitelisted_caller(), VmBinaryModule::sized(c), vec![])?;
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
let storage_deposit = default_deposit_limit::<T>();
#[extrinsic_call]
@@ -179,7 +179,7 @@ mod benchmarks {
fn call_with_evm_code_per_byte(c: Linear<1, { 10 * 1024 }>) -> Result<(), BenchmarkError> {
let instance =
Contract::<T>::with_caller(whitelisted_caller(), VmBinaryModule::evm_sized(c), vec![])?;
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
let storage_deposit = default_deposit_limit::<T>();
#[extrinsic_call]
@@ -212,12 +212,12 @@ mod benchmarks {
VmBinaryModule::with_num_instructions(limits::code::BASIC_BLOCK_SIZE),
vec![],
)?;
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
let storage_deposit = default_deposit_limit::<T>();
#[block]
{
Pallet::<T>::call(
Pezpallet::<T>::call(
RawOrigin::Signed(instance.caller.clone()).into(),
instance.address,
value,
@@ -240,7 +240,7 @@ mod benchmarks {
let pezpallet_account = whitelisted_pallet_account::<T>();
let input = vec![42u8; i as usize];
let salt = [42u8; 32];
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 VmBinaryModule { code, .. } = VmBinaryModule::sized(c);
@@ -255,7 +255,7 @@ mod benchmarks {
let deposit =
T::Currency::balance_on_hold(&HoldReason::StorageDepositReserve.into(), &account_id);
// uploading the code reserves some balance in the pallet's account
// uploading the code reserves some balance in the pezpallet's account
let code_deposit = T::Currency::balance_on_hold(
&HoldReason::CodeUploadDepositReserve.into(),
&pezpallet_account,
@@ -267,10 +267,10 @@ mod benchmarks {
caller_funding::<T>() -
value - deposit -
code_deposit - mapping_deposit -
Pallet::<T>::min_balance(),
Pezpallet::<T>::min_balance(),
);
// contract has the full value
assert_eq!(T::Currency::balance(&account_id), value + Pallet::<T>::min_balance());
assert_eq!(T::Currency::balance(&account_id), value + Pezpallet::<T>::min_balance());
}
// `c`: Size of the code in bytes.
@@ -287,11 +287,11 @@ mod benchmarks {
// Use an `effective_gas_price` that is not a multiple of `T::NativeToEthRatio`
// to hit the code that charge the rounding error so that tx_cost == effective_gas_price *
// gas_used
let effective_gas_price = Pallet::<T>::evm_base_fee() + 1;
let value = Pallet::<T>::min_balance();
let effective_gas_price = Pezpallet::<T>::evm_base_fee() + 1;
let value = Pezpallet::<T>::min_balance();
let dust = 42u32 * d;
let evm_value =
Pallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust));
Pezpallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust));
let caller = whitelisted_caller();
T::Currency::set_balance(&caller, caller_funding::<T>());
let VmBinaryModule { code, .. } = VmBinaryModule::sized(c);
@@ -320,7 +320,7 @@ mod benchmarks {
);
// contract has the full value
assert_eq!(Pallet::<T>::evm_balance(&addr), evm_value);
assert_eq!(Pezpallet::<T>::evm_balance(&addr), evm_value);
Ok(())
}
@@ -328,7 +328,7 @@ mod benchmarks {
fn deposit_eth_extrinsic_revert_event() {
#[block]
{
Pallet::<T>::deposit_event(Event::<T>::EthExtrinsicRevert {
Pezpallet::<T>::deposit_event(Event::<T>::EthExtrinsicRevert {
dispatch_error: crate::Error::<T>::BenchmarkingError.into(),
});
}
@@ -341,7 +341,7 @@ mod benchmarks {
let pezpallet_account = whitelisted_pallet_account::<T>();
let input = vec![42u8; i as usize];
let salt = [42u8; 32];
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 origin = RawOrigin::Signed(caller.clone());
@@ -371,10 +371,10 @@ mod benchmarks {
caller_funding::<T>() -
value - deposit -
code_deposit - mapping_deposit -
Pallet::<T>::min_balance(),
Pezpallet::<T>::min_balance(),
);
// contract has the full value
assert_eq!(T::Currency::balance(&account_id), value + Pallet::<T>::min_balance());
assert_eq!(T::Currency::balance(&account_id), value + Pezpallet::<T>::min_balance());
Ok(())
}
@@ -392,7 +392,7 @@ mod benchmarks {
let data = vec![42u8; 1024];
let instance =
Contract::<T>::with_caller(whitelisted_caller(), VmBinaryModule::dummy(), vec![])?;
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
let origin = RawOrigin::Signed(instance.caller.clone());
let before = T::Currency::balance(&instance.account_id);
let storage_deposit = default_deposit_limit::<T>();
@@ -414,7 +414,7 @@ mod benchmarks {
caller_funding::<T>() -
value - deposit -
code_deposit - mapping_deposit -
Pallet::<T>::min_balance()
Pezpallet::<T>::min_balance()
);
// contract should have received the value
assert_eq!(T::Currency::balance(&instance.account_id), before + value);
@@ -434,11 +434,11 @@ mod benchmarks {
// Use an `effective_gas_price` that is not a multiple of `T::NativeToEthRatio`
// to hit the code that charge the rounding error so that tx_cost == effective_gas_price *
// gas_used
let effective_gas_price = Pallet::<T>::evm_base_fee() + 1;
let value = Pallet::<T>::min_balance();
let effective_gas_price = Pezpallet::<T>::evm_base_fee() + 1;
let value = Pezpallet::<T>::min_balance();
let dust = 42u32 * d;
let evm_value =
Pallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust));
Pezpallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust));
// need to pass the overdraw check
<T as Config>::FeeInfo::deposit_txfee(
@@ -446,7 +446,7 @@ mod benchmarks {
);
let origin = Origin::EthTransaction(instance.caller.clone());
let before = Pallet::<T>::evm_balance(&instance.address);
let before = Pezpallet::<T>::evm_balance(&instance.address);
#[extrinsic_call]
_(
@@ -461,7 +461,7 @@ mod benchmarks {
);
// contract should have received the value
assert_eq!(Pallet::<T>::evm_balance(&instance.address), before + evm_value);
assert_eq!(Pezpallet::<T>::evm_balance(&instance.address), before + evm_value);
// contract should still exist
instance.info()?;
@@ -493,7 +493,7 @@ mod benchmarks {
let storage_deposit = default_deposit_limit::<T>();
#[extrinsic_call]
_(origin, code, storage_deposit);
// uploading the code reserves some balance in the pallet's account
// uploading the code reserves some balance in the pezpallet's account
assert!(T::Currency::total_balance_on_hold(&pezpallet_account) > 0u32.into());
assert!(<Contract<T>>::code_exists(&hash));
}
@@ -817,7 +817,7 @@ mod benchmarks {
fn seal_balance() {
build_runtime!(runtime, contract, memory: [[0u8;32], ]);
contract.set_balance(BalanceWithDust::new_unchecked::<T>(
Pallet::<T>::min_balance() * 2u32.into(),
Pezpallet::<T>::min_balance() * 2u32.into(),
42u32,
));
@@ -829,8 +829,8 @@ mod benchmarks {
assert_ok!(result);
assert_eq!(
U256::from_little_endian(&memory[..]),
Pallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(
Pallet::<T>::min_balance(),
Pezpallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(
Pezpallet::<T>::min_balance(),
42
))
);
@@ -843,7 +843,7 @@ mod benchmarks {
<T as Config>::AddressMapper::map_no_deposit(&account).unwrap();
let address = T::AddressMapper::to_address(&account);
let balance = Pallet::<T>::min_balance() * 2u32.into();
let balance = Pezpallet::<T>::min_balance() * 2u32.into();
T::Currency::set_balance(&account, balance);
AccountInfoOf::<T>::insert(&address, AccountInfo { dust: 42, ..Default::default() });
@@ -858,8 +858,8 @@ mod benchmarks {
assert_ok!(result);
assert_eq!(
U256::from_little_endian(&memory[..len]),
Pallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(
Pallet::<T>::min_balance(),
Pezpallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(
Pezpallet::<T>::min_balance(),
42
))
);
@@ -938,7 +938,7 @@ mod benchmarks {
input_bytes,
);
}
let min: U256 = crate::Pallet::<T>::convert_native_to_evm(T::Currency::minimum_balance());
let min: U256 = crate::Pezpallet::<T>::convert_native_to_evm(T::Currency::minimum_balance());
let min =
crate::precompiles::alloy::primitives::aliases::U256::abi_decode(&min.to_big_endian())
.unwrap();
@@ -988,7 +988,7 @@ mod benchmarks {
{
result = runtime.bench_gas_limit(&mut memory);
}
assert_eq!(U256::from(result.unwrap()), <Pallet<T>>::evm_block_gas_limit());
assert_eq!(U256::from(result.unwrap()), <Pezpallet<T>>::evm_block_gas_limit());
}
#[benchmark(pov_mode = Measured)]
@@ -999,7 +999,7 @@ mod benchmarks {
{
result = runtime.bench_gas_price(memory.as_mut_slice());
}
assert_eq!(U256::from(result.unwrap()), <Pallet<T>>::evm_base_fee());
assert_eq!(U256::from(result.unwrap()), <Pezpallet<T>>::evm_base_fee());
}
#[benchmark(pov_mode = Measured)]
@@ -1011,7 +1011,7 @@ mod benchmarks {
result = runtime.bench_base_fee(memory.as_mut_slice(), 0);
}
assert_ok!(result);
assert_eq!(U256::from_little_endian(&memory[..]), <crate::Pallet<T>>::evm_base_fee());
assert_eq!(U256::from_little_endian(&memory[..]), <crate::Pezpallet<T>>::evm_base_fee());
}
#[benchmark(pov_mode = Measured)]
@@ -1034,16 +1034,16 @@ mod benchmarks {
// To get safe benchmark results despite that, populate it with a bunch of random logs to
// ensure iteration over many items (we just overestimate the cost of the API).
for i in 0..16 {
pezframe_system::Pallet::<T>::deposit_log(DigestItem::PreRuntime(
pezframe_system::Pezpallet::<T>::deposit_log(DigestItem::PreRuntime(
[i, i, i, i],
vec![i; 128],
));
pezframe_system::Pallet::<T>::deposit_log(DigestItem::Consensus(
pezframe_system::Pezpallet::<T>::deposit_log(DigestItem::Consensus(
[i, i, i, i],
vec![i; 128],
));
pezframe_system::Pallet::<T>::deposit_log(DigestItem::Seal([i, i, i, i], vec![i; 128]));
pezframe_system::Pallet::<T>::deposit_log(DigestItem::Other(vec![i; 128]));
pezframe_system::Pezpallet::<T>::deposit_log(DigestItem::Seal([i, i, i, i], vec![i; 128]));
pezframe_system::Pezpallet::<T>::deposit_log(DigestItem::Other(vec![i; 128]));
}
// The content of the pre-runtime digest log depends on the configured consensus.
@@ -1054,22 +1054,22 @@ mod benchmarks {
let primary_pre_digest = vec![0; <PrimaryPreDigest as MaxEncodedLen>::max_encoded_len()];
let pre_digest =
PreDigest::Primary(PrimaryPreDigest::decode(&mut &primary_pre_digest[..]).unwrap());
pezframe_system::Pallet::<T>::deposit_log(DigestItem::PreRuntime(
pezframe_system::Pezpallet::<T>::deposit_log(DigestItem::PreRuntime(
BABE_ENGINE_ID,
pre_digest.encode(),
));
pezframe_system::Pallet::<T>::deposit_log(DigestItem::Seal(
pezframe_system::Pezpallet::<T>::deposit_log(DigestItem::Seal(
BABE_ENGINE_ID,
pre_digest.encode(),
));
// Construct a `Digest` log fixture returning some value in AURA
let slot = Slot::default();
pezframe_system::Pallet::<T>::deposit_log(DigestItem::PreRuntime(
pezframe_system::Pezpallet::<T>::deposit_log(DigestItem::PreRuntime(
AURA_ENGINE_ID,
slot.encode(),
));
pezframe_system::Pallet::<T>::deposit_log(DigestItem::Seal(AURA_ENGINE_ID, slot.encode()));
pezframe_system::Pezpallet::<T>::deposit_log(DigestItem::Seal(AURA_ENGINE_ID, slot.encode()));
let result;
#[block]
@@ -1225,7 +1225,7 @@ mod benchmarks {
assert!(PristineCode::<T>::get(code_hash).is_some());
T::Currency::set_balance(&instance.account_id, Pallet::<T>::min_balance() * 10u32.into());
T::Currency::set_balance(&instance.account_id, Pezpallet::<T>::min_balance() * 10u32.into());
let result;
#[block]
@@ -1248,7 +1248,7 @@ mod benchmarks {
// Check that the beneficiary received the balance
let balance = <T as Config>::Currency::balance(&beneficiary);
assert_eq!(balance, Pallet::<T>::min_balance() + Pallet::<T>::min_balance() * 9u32.into());
assert_eq!(balance, Pezpallet::<T>::min_balance() + Pezpallet::<T>::min_balance() * 9u32.into());
Ok(())
}
@@ -1869,7 +1869,7 @@ mod benchmarks {
let value: BalanceOf<T> = (1_000_000u32 * t).into();
let dust = 100u32 * d;
let evm_value =
Pallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust));
Pezpallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust));
let value_bytes = evm_value.encode();
let deposit: BalanceOf<T> = (u32::MAX - 100).into();
@@ -1882,7 +1882,7 @@ mod benchmarks {
// This is why we set the input here instead of passig it as pointer to the `bench_call`.
setup.set_data(vec![42; i as usize]);
setup.set_origin(ExecOrigin::from_account_id(setup.contract().account_id.clone()));
setup.set_balance(value + 1u32.into() + Pallet::<T>::min_balance());
setup.set_balance(value + 1u32.into() + Pezpallet::<T>::min_balance());
let (mut ext, _) = setup.ext();
let mut runtime = pvm::Runtime::<_, [u8]>::new(&mut ext, vec![]);
@@ -1904,7 +1904,7 @@ mod benchmarks {
assert_eq!(result.unwrap(), ReturnErrorCode::Success);
assert_eq!(
Pallet::<T>::evm_balance(&callee_addr),
Pezpallet::<T>::evm_balance(&callee_addr),
evm_value,
"{callee_addr:?} balance should hold {evm_value:?}"
);
@@ -2025,7 +2025,7 @@ mod benchmarks {
let value: BalanceOf<T> = (1_000_000u32 * t).into();
let dust = 100u32 * d;
let evm_value =
Pallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust));
Pezpallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust));
let value_bytes = evm_value.encode();
let value_len = value_bytes.len() as u32;
@@ -2035,7 +2035,7 @@ mod benchmarks {
let mut setup = CallSetup::<T>::default();
setup.set_origin(ExecOrigin::from_account_id(setup.contract().account_id.clone()));
setup.set_balance(value + 1u32.into() + (Pallet::<T>::min_balance() * 2u32.into()));
setup.set_balance(value + 1u32.into() + (Pezpallet::<T>::min_balance() * 2u32.into()));
let account_id = &setup.contract().account_id.clone();
let (mut ext, _) = setup.ext();
@@ -2076,7 +2076,7 @@ mod benchmarks {
assert!(AccountInfo::<T>::load_contract(&addr).is_some());
assert_eq!(
Pallet::<T>::evm_balance(&addr),
Pezpallet::<T>::evm_balance(&addr),
evm_value,
"{addr:?} balance should hold {evm_value:?}"
);
@@ -2103,7 +2103,7 @@ mod benchmarks {
let value = {
let value: BalanceOf<T> = (1_000_000u32 * t).into();
let dust = 100u32 * d;
Pallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust))
Pezpallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, dust))
};
let init_code = vec![BENCH_INIT_CODE; i as usize];
@@ -2126,8 +2126,8 @@ mod benchmarks {
assert!(result.is_continue());
let addr = interpreter.stack.top().unwrap().into_address();
assert!(AccountInfo::<T>::load_contract(&addr).is_some());
assert_eq!(Pallet::<T>::code(&addr).len(), revm::primitives::eip170::MAX_CODE_SIZE);
assert_eq!(Pallet::<T>::evm_balance(&addr), value, "balance should hold {value:?}");
assert_eq!(Pezpallet::<T>::code(&addr).len(), revm::primitives::eip170::MAX_CODE_SIZE);
assert_eq!(Pezpallet::<T>::evm_balance(&addr), value, "balance should hold {value:?}");
Ok(())
}
@@ -2741,13 +2741,13 @@ mod benchmarks {
let instance =
Contract::<T>::with_caller(signer_caller.clone(), VmBinaryModule::dummy(), vec![])?;
let storage_deposit = default_deposit_limit::<T>();
let value = Pallet::<T>::min_balance();
let value = Pezpallet::<T>::min_balance();
let evm_value =
Pallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, 0));
Pezpallet::<T>::convert_native_to_evm(BalanceWithDust::new_unchecked::<T>(value, 0));
// Setup block
let current_block = BlockNumberFor::<T>::from(1u32);
pezframe_system::Pallet::<T>::set_block_number(current_block);
pezframe_system::Pezpallet::<T>::set_block_number(current_block);
Ok((instance, storage_deposit, evm_value, signer_key, current_block))
}
@@ -2779,13 +2779,13 @@ mod benchmarks {
// Pre-populate InflightTransactions with n transactions of fixed size
if n > 0 {
// Initialize block
let _ = Pallet::<T>::on_initialize(current_block);
let _ = Pezpallet::<T>::on_initialize(current_block);
// Create input data of fixed size for consistent transaction payloads
let input_data = vec![0x42u8; fixed_payload_size];
let receipt_gas_info = ReceiptGasInfo {
gas_used: U256::from(1_000_000),
effective_gas_price: Pallet::<T>::evm_base_fee(),
effective_gas_price: Pezpallet::<T>::evm_base_fee(),
};
for _ in 0..n {
@@ -2821,11 +2821,11 @@ mod benchmarks {
#[block]
{
// Measure only the finalization cost with n transactions of fixed size
let _ = Pallet::<T>::on_finalize(current_block);
let _ = Pezpallet::<T>::on_finalize(current_block);
}
// Verify transaction count
assert_eq!(Pallet::<T>::eth_block().transactions.len(), n as usize);
assert_eq!(Pezpallet::<T>::eth_block().transactions.len(), n as usize);
Ok(())
}
@@ -2855,13 +2855,13 @@ mod benchmarks {
let fixed_tx_count = 10u32;
// Initialize block
let _ = Pallet::<T>::on_initialize(current_block);
let _ = Pezpallet::<T>::on_initialize(current_block);
// Create input data of variable size p for realistic transaction payloads
let input_data = vec![0x42u8; d as usize];
let receipt_gas_info = ReceiptGasInfo {
gas_used: U256::from(1_000_000),
effective_gas_price: Pallet::<T>::evm_base_fee(),
effective_gas_price: Pezpallet::<T>::evm_base_fee(),
};
for _ in 0..fixed_tx_count {
@@ -2896,11 +2896,11 @@ mod benchmarks {
#[block]
{
// Measure only the finalization cost with fixed count, variable payload size
let _ = Pallet::<T>::on_finalize(current_block);
let _ = Pezpallet::<T>::on_finalize(current_block);
}
// Verify transaction count
assert_eq!(Pallet::<T>::eth_block().transactions.len(), fixed_tx_count as usize);
assert_eq!(Pezpallet::<T>::eth_block().transactions.len(), fixed_tx_count as usize);
Ok(())
}
@@ -2938,7 +2938,7 @@ mod benchmarks {
let receipt_gas_info = ReceiptGasInfo {
gas_used: U256::from(1_000_000),
effective_gas_price: Pallet::<T>::evm_base_fee(),
effective_gas_price: Pezpallet::<T>::evm_base_fee(),
};
// Store transaction
@@ -2967,14 +2967,14 @@ mod benchmarks {
#[block]
{
// Initialize block
let _ = Pallet::<T>::on_initialize(current_block);
let _ = Pezpallet::<T>::on_initialize(current_block);
// Measure the finalization cost with e events
let _ = Pallet::<T>::on_finalize(current_block);
let _ = Pezpallet::<T>::on_finalize(current_block);
}
// Verify transaction count
assert_eq!(Pallet::<T>::eth_block().transactions.len(), 1);
assert_eq!(Pezpallet::<T>::eth_block().transactions.len(), 1);
Ok(())
}
@@ -3003,7 +3003,7 @@ mod benchmarks {
let receipt_gas_info = ReceiptGasInfo {
gas_used: U256::from(1_000_000),
effective_gas_price: Pallet::<T>::evm_base_fee(),
effective_gas_price: Pezpallet::<T>::evm_base_fee(),
};
// Store transaction
@@ -3052,14 +3052,14 @@ mod benchmarks {
#[block]
{
// Initialize block
let _ = Pallet::<T>::on_initialize(current_block);
let _ = Pezpallet::<T>::on_initialize(current_block);
// Measure the finalization cost with d bytes of event data
let _ = Pallet::<T>::on_finalize(current_block);
let _ = Pezpallet::<T>::on_finalize(current_block);
}
// Verify transaction count
assert_eq!(Pallet::<T>::eth_block().transactions.len(), 1);
assert_eq!(Pezpallet::<T>::eth_block().transactions.len(), 1);
Ok(())
}
@@ -33,7 +33,7 @@ use crate::{
transient_storage::MeterEntry,
vm::pvm::{PreparedCall, Runtime},
AccountInfo, BalanceOf, BalanceWithDust, Code, CodeInfoOf, Config, ContractBlob, ContractInfo,
Error, ExecConfig, ExecOrigin as Origin, GasMeter, OriginFor, Pallet as Contracts,
Error, ExecConfig, ExecOrigin as Origin, GasMeter, OriginFor, Pezpallet as Contracts,
PristineCode, Weight,
};
use alloc::{vec, vec::Vec};
@@ -25,7 +25,7 @@ use crate::{
},
Block, HashesOrTransactionInfos, TYPE_EIP1559, TYPE_EIP2930, TYPE_EIP4844, TYPE_EIP7702,
},
Config, Pallet, ReceiptGasInfo,
Config, Pezpallet, ReceiptGasInfo,
};
use alloc::{vec, vec::Vec};
@@ -41,7 +41,7 @@ const LOG_TARGET: &str = "runtime::revive::block_builder";
/// Ethereum block builder designed to incrementally build the transaction and receipt trie roots.
///
/// This builder is optimized to minimize memory usage and pallet storage by leveraging the internal
/// This builder is optimized to minimize memory usage and pezpallet storage by leveraging the internal
/// structure of the Ethereum trie and the RLP encoding of receipts.
#[cfg_attr(test, derive(pezframe_support::DefaultNoBound))]
pub struct EthereumBlockBuilder<T> {
@@ -59,7 +59,7 @@ pub struct EthereumBlockBuilder<T> {
impl<T: crate::Config> EthereumBlockBuilder<T> {
/// Converts the builder into an intermediate representation.
///
/// The intermediate representation is extracted from the pallet storage.
/// The intermediate representation is extracted from the pezpallet storage.
pub fn to_ir(self) -> EthereumBlockBuilderIR<T> {
EthereumBlockBuilderIR {
transaction_root_builder: self.transaction_root_builder.to_ir(),
@@ -76,7 +76,7 @@ impl<T: crate::Config> EthereumBlockBuilder<T> {
/// Converts the intermediate representation back into a builder.
///
/// The intermediate representation is placed into the pallet storage.
/// The intermediate representation is placed into the pezpallet storage.
pub fn from_ir(ir: EthereumBlockBuilderIR<T>) -> Self {
Self {
transaction_root_builder: IncrementalHashBuilder::from_ir(ir.transaction_root_builder),
@@ -91,12 +91,12 @@ impl<T: crate::Config> EthereumBlockBuilder<T> {
}
}
/// Store the first transaction and receipt in pallet storage.
/// Store the first transaction and receipt in pezpallet storage.
fn pezpallet_put_first_values(&mut self, values: (Vec<u8>, Vec<u8>)) {
crate::EthBlockBuilderFirstValues::<T>::put(Some(values));
}
/// Take the first transaction and receipt from pallet storage.
/// Take the first transaction and receipt from pezpallet storage.
fn pezpallet_take_first_values(&mut self) -> Option<(Vec<u8>, Vec<u8>)> {
crate::EthBlockBuilderFirstValues::<T>::take()
}
@@ -131,17 +131,17 @@ impl<T: crate::Config> EthereumBlockBuilder<T> {
self.gas_info.push(receipt_gas_info);
// The first transaction and receipt are returned to be stored in the pallet storage.
// The first transaction and receipt are returned to be stored in the pezpallet storage.
// The index of the incremental hash builders already expects the next items.
if self.tx_hashes.len() == 1 {
log::trace!(target: LOG_TARGET, "Storing first transaction and receipt in pallet storage");
log::trace!(target: LOG_TARGET, "Storing first transaction and receipt in pezpallet storage");
self.pezpallet_put_first_values((transaction_encoded, encoded_receipt));
return;
}
if self.transaction_root_builder.needs_first_value(BuilderPhase::ProcessingValue) {
if let Some((first_tx, first_receipt)) = self.pezpallet_take_first_values() {
log::trace!(target: LOG_TARGET, "Loaded first transaction and receipt from pallet storage");
log::trace!(target: LOG_TARGET, "Loaded first transaction and receipt from pezpallet storage");
self.transaction_root_builder.set_first_value(first_tx);
self.receipts_root_builder.set_first_value(first_receipt);
} else {
@@ -166,7 +166,7 @@ impl<T: crate::Config> EthereumBlockBuilder<T> {
};
// Eth uses timestamps in seconds
let timestamp = (T::Time::now() / 1000u32.into()).into();
let block_author = Pallet::<T>::block_author();
let block_author = Pezpallet::<T>::block_author();
let eth_block_num: U256 = block_number.into();
self.build_block_with_params(eth_block_num, parent_hash, timestamp, block_author)
@@ -278,8 +278,8 @@ impl<T: Config> Default for EthereumBlockBuilderIR<T> {
gas_used: U256::zero(),
tx_hashes: Vec::new(),
gas_info: Vec::new(),
base_fee_per_gas: Pallet::<T>::evm_base_fee(),
block_gas_limit: Pallet::<T>::evm_block_gas_limit(),
base_fee_per_gas: Pezpallet::<T>::evm_base_fee(),
block_gas_limit: Pezpallet::<T>::evm_block_gas_limit(),
_phantom: core::marker::PhantomData,
}
}
@@ -104,7 +104,7 @@ pub struct IncrementalHashBuilder {
impl Default for IncrementalHashBuilder {
fn default() -> Self {
Self {
// First deserialization time from the pallet storage, is expected
// First deserialization time from the pezpallet storage, is expected
// to contain index 1.
index: 1,
hash_builder: HashBuilder::default(),
@@ -429,7 +429,7 @@ impl IncrementalHashBuilderIR {
impl Default for IncrementalHashBuilderIR {
fn default() -> Self {
Self {
// First deserialization time from the pallet storage, is expected
// First deserialization time from the pezpallet storage, is expected
// to contain index 1.
index: 1,
key: Vec::new(),
@@ -25,7 +25,7 @@ use crate::{
pezsp_runtime::traits::{One, Zero},
weights::WeightInfo,
AccountIdOf, BalanceOf, BalanceWithDust, BlockHash, BlockNumberFor, Config, ContractResult,
Error, EthBlockBuilderIR, EthereumBlock, Event, ExecReturnValue, Pallet, ReceiptGasInfo,
Error, EthBlockBuilderIR, EthereumBlock, Event, ExecReturnValue, Pezpallet, ReceiptGasInfo,
ReceiptInfoData, StorageDeposit, Weight, H160, H256, LOG_TARGET,
};
use alloc::vec::Vec;
@@ -75,7 +75,7 @@ impl EthereumCallResult {
info: &DispatchInfo,
effective_gas_price: U256,
) -> Self {
let effective_gas_price = effective_gas_price.max(Pallet::<T>::evm_base_fee());
let effective_gas_price = effective_gas_price.max(Pezpallet::<T>::evm_base_fee());
if let Ok(retval) = &output.result {
if retval.did_revert() {
@@ -94,7 +94,7 @@ impl EthereumCallResult {
let native_fee = T::FeeInfo::compute_actual_fee(encoded_len, &info, &result);
let result = T::FeeInfo::ensure_not_overdrawn(native_fee, result);
let fee = Pallet::<T>::convert_native_to_evm(match output.storage_deposit {
let fee = Pezpallet::<T>::convert_native_to_evm(match output.storage_deposit {
StorageDeposit::Refund(refund) => native_fee.saturating_sub(refund),
StorageDeposit::Charge(amount) => native_fee.saturating_add(amount),
});
@@ -192,7 +192,7 @@ pub fn with_ethereum_context<T: Config>(
}
fn deposit_eth_extrinsic_revert_event<T: Config>(dispatch_error: DispatchError) {
Pallet::<T>::deposit_event(Event::<T>::EthExtrinsicRevert { dispatch_error });
Pezpallet::<T>::deposit_event(Event::<T>::EthExtrinsicRevert { dispatch_error });
}
/// Clear the storage used to capture the block hash related data.
@@ -201,7 +201,7 @@ pub fn on_initialize<T: Config>() {
EthereumBlock::<T>::kill();
}
/// Build the ethereum block and store it into the pallet storage.
/// Build the ethereum block and store it into the pezpallet storage.
pub fn on_finalize_build_eth_block<T: Config>(block_number: BlockNumberFor<T>) {
let block_builder_ir = EthBlockBuilderIR::<T>::get();
EthBlockBuilderIR::<T>::kill();
@@ -265,7 +265,7 @@ pub fn process_transaction<T: Config>(
// WASM instance).
//
// For this reason, we need to account for the memory used by the `EthereumBlockBuilder`
// and for the pallet storage consumed by the `EthereumBlockBuilderIR`.
// and for the pezpallet storage consumed by the `EthereumBlockBuilderIR`.
//
// ## Memory Usage Analysis
//
@@ -295,7 +295,7 @@ pub fn process_transaction<T: Config>(
// `limits::MAX_TRANSACTION_PAYLOAD_SIZE`, while the maximum size of a receipt is
// limited by `limits::EVENT_BYTES`.
//
// Similarly, this is the amount of pallet storage consumed by the
// Similarly, this is the amount of pezpallet storage consumed by the
// `EthereumBlockBuilderIR` object, plus a marginal book-keeping overhead.
pub fn block_builder_bytes_usage(max_events_size: u32) -> u32 {
// A block builder requires 3 times the maximum size of the entry.
+3 -3
View File
@@ -19,7 +19,7 @@
use crate::{
evm::{fees::InfoT, runtime::SetWeightLimit},
extract_code_and_data, BalanceOf, CallOf, Config, GenericTransaction, Pallet, Weight, Zero,
extract_code_and_data, BalanceOf, CallOf, Config, GenericTransaction, Pezpallet, Weight, Zero,
LOG_TARGET, RUNTIME_PALLETS_ADDR, U256,
};
use alloc::{boxed::Box, vec::Vec};
@@ -56,7 +56,7 @@ where
T: Config,
CallOf<T>: SetWeightLimit,
{
let base_fee = <Pallet<T>>::evm_base_fee();
let base_fee = <Pezpallet<T>>::evm_base_fee();
let Some(gas) = tx.gas else {
log::debug!(target: LOG_TARGET, "No gas provided");
@@ -181,7 +181,7 @@ where
call.set_weight_limit(weight_limit);
let info = <T as Config>::FeeInfo::dispatch_info(&call);
let max_weight =
if apply_weight_cap { <Pallet<T>>::evm_max_extrinsic_weight() } else { Weight::MAX };
if apply_weight_cap { <Pezpallet<T>>::evm_max_extrinsic_weight() } else { Weight::MAX };
let overweight_by = info.total_weight().saturating_sub(max_weight);
let capped_weight = weight_limit.saturating_sub(overweight_by);
call.set_weight_limit(capped_weight);
+2 -2
View File
@@ -36,7 +36,7 @@ use pezframe_support::{
use pezframe_system::Config as SysConfig;
use num_traits::Zero;
use pezpallet_transaction_payment::{
Config as TxConfig, MultiplierUpdate, NextFeeMultiplier, Pallet as TxPallet, TxCreditHold,
Config as TxConfig, MultiplierUpdate, NextFeeMultiplier, Pezpallet as TxPallet, TxCreditHold,
};
use pezsp_runtime::{
generic::UncheckedExtrinsic,
@@ -48,7 +48,7 @@ use pezsp_runtime::{
type CreditOf<T> = Credit<<T as pezframe_system::Config>::AccountId, <T as Config>::Currency>;
/// The only [`WeightToFee`] implementation that is supported by this pallet.
/// The only [`WeightToFee`] implementation that is supported by this pezpallet.
///
/// `P,Q`: Rational number that defines the ref_time to fee mapping.
///
@@ -21,7 +21,7 @@ use crate::{
create_call,
fees::InfoT,
},
AccountIdOf, AddressMapper, BalanceOf, CallOf, Config, Pallet, Zero, LOG_TARGET,
AccountIdOf, AddressMapper, BalanceOf, CallOf, Config, Pezpallet, Zero, LOG_TARGET,
};
use codec::{Decode, DecodeWithMemTracking, Encode};
use pezframe_support::{
@@ -306,7 +306,7 @@ pub trait EthExtra {
})?;
let signer = <Self::Config as Config>::AddressMapper::to_fallback_account_id(&signer_addr);
let base_fee = <Pallet<Self::Config>>::evm_base_fee();
let base_fee = <Pezpallet<Self::Config>>::evm_base_fee();
let tx = GenericTransaction::from_signed(tx, base_fee, None);
let nonce = tx.nonce.unwrap_or_default().try_into().map_err(|_| {
log::debug!(target: LOG_TARGET, "Failed to convert nonce");
@@ -329,7 +329,7 @@ pub trait EthExtra {
<Self::Config as Config>::FeeInfo::deposit_txfee(storage_credit);
crate::tracing::if_tracing(|tracer| {
tracer.watch_address(&Pallet::<Self::Config>::block_author());
tracer.watch_address(&Pezpallet::<Self::Config>::block_author());
tracer.watch_address(&signer_addr);
});
@@ -430,8 +430,8 @@ mod test {
Self::fund_account(&account);
let dry_run =
crate::Pallet::<Test>::dry_run_eth_transact(self.tx.clone(), Default::default());
self.tx.gas_price = Some(<Pallet<Test>>::evm_base_fee());
crate::Pezpallet::<Test>::dry_run_eth_transact(self.tx.clone(), Default::default());
self.tx.gas_price = Some(<Pezpallet<Test>>::evm_base_fee());
match dry_run {
Ok(dry_run) => {
@@ -531,7 +531,7 @@ mod test {
let (expected_encoded_len, call, _, tx, gas_required, signed_transaction) =
builder.check().unwrap();
let expected_effective_gas_price =
ExtBuilder::default().build().execute_with(|| Pallet::<Test>::evm_base_fee());
ExtBuilder::default().build().execute_with(|| Pezpallet::<Test>::evm_base_fee());
match call {
RuntimeCall::Contracts(crate::Call::eth_call::<Test> {
@@ -569,7 +569,7 @@ mod test {
let (expected_encoded_len, call, _, tx, gas_required, signed_transaction) =
builder.check().unwrap();
let expected_effective_gas_price =
ExtBuilder::default().build().execute_with(|| Pallet::<Test>::evm_base_fee());
ExtBuilder::default().build().execute_with(|| Pezpallet::<Test>::evm_base_fee());
let expected_value = tx.value.unwrap_or_default().as_u64().into();
match call {
@@ -17,7 +17,7 @@
use crate::{
evm::{Bytes, PrestateTrace, PrestateTraceInfo, PrestateTracerConfig},
tracing::Tracing,
AccountInfo, Code, Config, ExecReturnValue, Key, Pallet, PristineCode, Weight,
AccountInfo, Code, Config, ExecReturnValue, Key, Pezpallet, PristineCode, Weight,
};
use alloc::{
collections::{BTreeMap, BTreeSet},
@@ -122,7 +122,7 @@ where
let post_info = post.entry(*addr).or_insert_with_key(|addr| {
Self::prestate_info(
addr,
Pallet::<T>::evm_balance(addr),
Pezpallet::<T>::evm_balance(addr),
include_code.then(|| Self::bytecode(addr)).flatten(),
)
});
@@ -189,7 +189,7 @@ where
/// Update the prestate info for the given address.
fn update_prestate_info(entry: &mut PrestateTraceInfo, addr: &H160, code: Option<Bytes>) {
let info = Self::prestate_info(addr, Pallet::<T>::evm_balance(addr), code);
let info = Self::prestate_info(addr, Pezpallet::<T>::evm_balance(addr), code);
entry.balance = info.balance;
entry.nonce = info.nonce;
entry.code = info.code;
@@ -200,7 +200,7 @@ where
let mut info = PrestateTraceInfo::default();
info.balance = Some(balance);
info.code = code;
let nonce = Pallet::<T>::evm_nonce(addr);
let nonce = Pezpallet::<T>::evm_nonce(addr);
info.nonce = if nonce > 0 { Some(nonce) } else { None };
info
}
@@ -211,7 +211,7 @@ where
get_entry!(self, addr).or_insert_with_key(|addr| {
Self::prestate_info(
addr,
Pallet::<T>::evm_balance(addr),
Pezpallet::<T>::evm_balance(addr),
include_code.then(|| Self::bytecode(addr)).flatten(),
)
});
@@ -227,7 +227,7 @@ where
self.trace.0.entry(*addr).or_insert_with_key(|addr| {
Self::prestate_info(
addr,
Pallet::<T>::evm_balance(addr),
Pezpallet::<T>::evm_balance(addr),
include_code.then(|| Self::bytecode(addr)).flatten(),
)
});
@@ -246,7 +246,7 @@ where
) {
self.destructed_addrs.insert(contract_address);
self.trace.0.entry(beneficiary_address).or_insert_with_key(|addr| {
Self::prestate_info(addr, Pallet::<T>::evm_balance(addr), None)
Self::prestate_info(addr, Pezpallet::<T>::evm_balance(addr), None)
});
}
@@ -186,7 +186,7 @@ mod tests {
use crate::{
test_utils::{ALICE_ADDR, BOB_ADDR},
tests::{builder, test_utils::set_balance_with_dust, ExtBuilder, Test},
Config, Error, Pallet, H160,
Config, Error, Pezpallet, H160,
};
use pezframe_support::{assert_err, traits::Get};
use pezsp_runtime::{traits::Zero, DispatchError};
@@ -349,11 +349,11 @@ mod tests {
set_balance_with_dust(&to, to_balance);
let total_issuance = <Test as Config>::Currency::total_issuance();
let evm_value = Pallet::<Test>::convert_native_to_evm(amount);
let evm_value = Pezpallet::<Test>::convert_native_to_evm(amount);
let (value, dust) = amount.deconstruct();
assert_eq!(Pallet::<Test>::has_dust(evm_value), !dust.is_zero());
assert_eq!(Pallet::<Test>::has_balance(evm_value), !value.is_zero());
assert_eq!(Pezpallet::<Test>::has_dust(evm_value), !dust.is_zero());
assert_eq!(Pezpallet::<Test>::has_balance(evm_value), !value.is_zero());
let result = builder::bare_call(to).evm_value(evm_value).build();
@@ -368,14 +368,14 @@ mod tests {
}
assert_eq!(
Pallet::<Test>::evm_balance(&from),
Pallet::<Test>::convert_native_to_evm(expected_from_balance),
Pezpallet::<Test>::evm_balance(&from),
Pezpallet::<Test>::convert_native_to_evm(expected_from_balance),
"{description}: invalid from balance"
);
assert_eq!(
Pallet::<Test>::evm_balance(&to),
Pallet::<Test>::convert_native_to_evm(expected_to_balance),
Pezpallet::<Test>::evm_balance(&to),
Pezpallet::<Test>::convert_native_to_evm(expected_to_balance),
"{description}: invalid to balance"
);
+9 -9
View File
@@ -32,7 +32,7 @@ use crate::{
transient_storage::TransientStorage,
AccountInfo, AccountInfoOf, BalanceOf, BalanceWithDust, Code, CodeInfo, CodeInfoOf,
CodeRemoved, Config, ContractInfo, Error, Event, HoldReason, ImmutableData, ImmutableDataOf,
Pallet as Contracts, RuntimeCosts, TrieId, LOG_TARGET,
Pezpallet as Contracts, RuntimeCosts, TrieId, LOG_TARGET,
};
use alloc::{
collections::{BTreeMap, BTreeSet},
@@ -54,7 +54,7 @@ use pezframe_support::{
};
use pezframe_system::{
pezpallet_prelude::{BlockNumberFor, OriginFor},
Pallet as System, RawOrigin,
Pezpallet as System, RawOrigin,
};
use pezsp_core::{
ecdsa::Public as ECDSAPublic,
@@ -152,7 +152,7 @@ impl<T: Into<DispatchError>> From<T> for ExecError {
}
}
/// The type of origins supported by the revive pallet.
/// The type of origins supported by the revive pezpallet.
#[derive(Clone, Encode, Decode, PartialEq, TypeInfo, RuntimeDebugNoBound)]
pub enum Origin<T: Config> {
Root,
@@ -953,7 +953,7 @@ where
};
let mut timestamp = T::Time::now();
let mut block_number = <pezframe_system::Pallet<T>>::block_number();
let mut block_number = <pezframe_system::Pezpallet<T>>::block_number();
// if dry run with timestamp override is provided we simulate the run in a `pending` block
if let Some(timestamp_override) =
exec_config.is_dry_run.as_ref().and_then(|cfg| cfg.timestamp_override)
@@ -1234,7 +1234,7 @@ where
// if we reached this point the origin has an associated account.
let origin = &self.origin.account_id()?;
if !pezframe_system::Pallet::<T>::account_exists(&account_id) {
if !pezframe_system::Pezpallet::<T>::account_exists(&account_id) {
let ed = <Contracts<T>>::min_balance();
frame.nested_storage.record_charge(&StorageDeposit::Charge(ed))?;
<Contracts<T>>::charge_deposit(None, origin, account_id, ed, self.exec_config)?;
@@ -1712,7 +1712,7 @@ where
/// Returns the *free* balance of the supplied AccountId.
fn account_balance(&self, who: &T::AccountId) -> U256 {
let balance = AccountInfo::<T>::balance_of(AccountIdOrAddress::AccountId(who.clone()));
crate::Pallet::<T>::convert_native_to_evm(balance)
crate::Pezpallet::<T>::convert_native_to_evm(balance)
}
/// Certain APIs, e.g. `{set,get}_immutable_data` behave differently depending
@@ -1741,7 +1741,7 @@ where
// Fallback to the system block hash for older blocks
// 256 entries should suffice for all use cases, this mostly ensures
// our benchmarks are passing.
match crate::Pallet::<T>::eth_block_hash_from_number(block_number.into()) {
match crate::Pezpallet::<T>::eth_block_hash_from_number(block_number.into()) {
Some(hash) => Some(hash),
None => {
use codec::Decode;
@@ -1812,7 +1812,7 @@ where
addr,
*beneficiary,
self.top_frame().nested_gas.gas_left(),
crate::Pallet::<T>::evm_balance(&addr),
crate::Pezpallet::<T>::evm_balance(&addr),
);
});
let frame = top_frame_mut!(self);
@@ -2223,7 +2223,7 @@ where
fn minimum_balance(&self) -> U256 {
let min = T::Currency::minimum_balance();
crate::Pallet::<T>::convert_native_to_evm(min)
crate::Pezpallet::<T>::convert_native_to_evm(min)
}
fn deposit_event(&mut self, topics: Vec<H256>, data: Vec<u8>) {
+19 -19
View File
@@ -30,7 +30,7 @@ use crate::{
test_utils::{get_balance, place_contract, set_balance},
ExtBuilder, RuntimeEvent as MetaEvent, Test,
},
AddressMapper, Error, Pallet,
AddressMapper, Error, Pezpallet,
};
use assert_matches::assert_matches;
use pezframe_support::{assert_err, assert_ok, parameter_types};
@@ -41,7 +41,7 @@ use pezsp_io::hashing::keccak_256;
use pezsp_runtime::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>;
@@ -250,7 +250,7 @@ fn transfer_works() {
&origin,
&ALICE,
&BOB,
Pallet::<Test>::convert_native_to_evm(value),
Pezpallet::<Test>::convert_native_to_evm(value),
Preservation::Preserve,
&mut storage_meter,
&ExecConfig::new_bizinikiwi_tx(),
@@ -278,7 +278,7 @@ fn transfer_to_nonexistent_account_works() {
ExtBuilder::default().build().execute_with(|| {
let ed = <Test as Config>::Currency::minimum_balance();
let value = 1024;
let evm_value = Pallet::<Test>::convert_native_to_evm(value);
let evm_value = Pezpallet::<Test>::convert_native_to_evm(value);
let mut storage_meter = storage::meter::Meter::new(u64::MAX);
// Transfers to nonexistent accounts should work
@@ -337,7 +337,7 @@ fn transfer_to_nonexistent_account_works() {
#[test]
fn correct_transfer_on_call() {
let value = 55;
let evm_value = Pallet::<Test>::convert_native_to_evm(value);
let evm_value = Pezpallet::<Test>::convert_native_to_evm(value);
let success_ch = MockLoader::insert(Call, move |ctx, _| {
assert_eq!(ctx.ext.value_transferred(), evm_value);
@@ -370,7 +370,7 @@ fn correct_transfer_on_call() {
#[test]
fn correct_transfer_on_delegate_call() {
let value = 35;
let evm_value = Pallet::<Test>::convert_native_to_evm(value);
let evm_value = Pezpallet::<Test>::convert_native_to_evm(value);
let success_ch = MockLoader::insert(Call, move |ctx, _| {
assert_eq!(ctx.ext.value_transferred(), evm_value);
@@ -499,7 +499,7 @@ fn balance_too_low() {
&Origin::from_account_id(ALICE),
&from,
&dest,
Pallet::<Test>::convert_native_to_evm(100u64).as_u64().into(),
Pezpallet::<Test>::convert_native_to_evm(100u64).as_u64().into(),
Preservation::Preserve,
&mut storage_meter,
&ExecConfig::new_bizinikiwi_tx(),
@@ -1126,7 +1126,7 @@ fn instantiation_work_with_success_output() {
executable,
&mut gas_meter,
&mut storage_meter,
Pallet::<Test>::convert_native_to_evm(min_balance),
Pezpallet::<Test>::convert_native_to_evm(min_balance),
vec![],
Some(&[0 ;32]),
&ExecConfig::new_bizinikiwi_tx(),
@@ -1177,7 +1177,7 @@ fn instantiation_fails_with_failing_output() {
executable,
&mut gas_meter,
&mut storage_meter,
Pallet::<Test>::convert_native_to_evm(min_balance),
Pezpallet::<Test>::convert_native_to_evm(min_balance),
vec![],
Some(&[0; 32]),
&ExecConfig::new_bizinikiwi_tx(),
@@ -1211,7 +1211,7 @@ fn instantiation_from_contract() {
Weight::MAX,
U256::MAX,
Code::Existing(dummy_ch),
Pallet::<Test>::convert_native_to_evm(min_balance),
Pezpallet::<Test>::convert_native_to_evm(min_balance),
vec![],
Some(&[48; 32]),
)
@@ -1240,7 +1240,7 @@ fn instantiation_from_contract() {
BOB_ADDR,
&mut GasMeter::<Test>::new(GAS_LIMIT),
&mut storage_meter,
Pallet::<Test>::convert_native_to_evm(min_balance * 10),
Pezpallet::<Test>::convert_native_to_evm(min_balance * 10),
vec![],
&ExecConfig::new_bizinikiwi_tx(),
),
@@ -1271,7 +1271,7 @@ fn instantiation_traps() {
move |ctx, _| {
// Instantiate a contract and save it's address in `instantiated_contract_address`.
let min_balance = <Test as Config>::Currency::minimum_balance();
let value = Pallet::<Test>::convert_native_to_evm(min_balance);
let value = Pezpallet::<Test>::convert_native_to_evm(min_balance);
assert_matches!(
ctx.ext.instantiate(
@@ -1340,7 +1340,7 @@ fn termination_from_instantiate_succeeds() {
executable,
&mut gas_meter,
&mut storage_meter,
Pallet::<Test>::convert_native_to_evm(100u64),
Pezpallet::<Test>::convert_native_to_evm(100u64),
vec![],
Some(&[0; 32]),
&ExecConfig::new_bizinikiwi_tx(),
@@ -1619,7 +1619,7 @@ fn call_deny_reentry() {
#[test]
fn minimum_balance_must_return_converted_balance() {
let min_balance: BalanceOf<Test> = <Test as Config>::Currency::minimum_balance();
let min_balance_evm_value: U256 = Pallet::<Test>::convert_native_to_evm(min_balance);
let min_balance_evm_value: U256 = Pezpallet::<Test>::convert_native_to_evm(min_balance);
let succ_fail_code = MockLoader::insert(Constructor, move |ctx, _| {
// The value returned by `Ext::minimum_balance` is `U256`, it must
@@ -1708,7 +1708,7 @@ fn nonce() {
.build()
.execute_with(|| {
let min_balance = <Test as Config>::Currency::minimum_balance();
let min_balance_evm_value: U256 = Pallet::<Test>::convert_native_to_evm(min_balance);
let min_balance_evm_value: U256 = Pezpallet::<Test>::convert_native_to_evm(min_balance);
let mut gas_meter = GasMeter::<Test>::new(GAS_LIMIT);
let fail_executable = MockExecutable::from_storage(fail_code, &mut gas_meter).unwrap();
@@ -2400,7 +2400,7 @@ fn last_frame_output_works_on_instantiate() {
let instantiator_ch = MockLoader::insert(Call, {
move |ctx, _| {
let min_balance = <Test as Config>::Currency::minimum_balance();
let value = Pallet::<Test>::convert_native_to_evm(min_balance);
let value = Pezpallet::<Test>::convert_native_to_evm(min_balance);
// Successful instantiation should set the output
let address = ctx
@@ -2418,7 +2418,7 @@ fn last_frame_output_works_on_instantiate() {
Weight::MAX,
U256::MAX,
&address,
Pallet::<Test>::convert_native_to_evm(1),
Pezpallet::<Test>::convert_native_to_evm(1),
vec![],
true,
false,
@@ -2632,7 +2632,7 @@ fn immutable_data_access_checks_work() {
let instantiator_ch = MockLoader::insert(Call, {
move |ctx, _| {
let min_balance = <Test as Config>::Currency::minimum_balance();
let value = Pallet::<Test>::convert_native_to_evm(min_balance);
let value = Pezpallet::<Test>::convert_native_to_evm(min_balance);
assert_eq!(
ctx.ext.set_immutable_data(vec![0, 1, 2, 3].try_into().unwrap()),
@@ -2804,7 +2804,7 @@ fn immutable_data_set_errors_with_empty_data() {
let instantiator_ch = MockLoader::insert(Call, {
move |ctx, _| {
let min_balance = <Test as Config>::Currency::minimum_balance();
let value = Pallet::<Test>::convert_native_to_evm(min_balance);
let value = Pezpallet::<Test>::convert_native_to_evm(min_balance);
ctx.ext
.instantiate(Weight::MAX, U256::MAX, Code::Existing(dummy_ch), value, vec![], None)
@@ -17,7 +17,7 @@
//! Implementation of the `fungibles::*` family of traits for `pezpallet-revive`.
//!
//! This is meant to allow ERC20 tokens stored on this pallet to be used with
//! This is meant to allow ERC20 tokens stored on this pezpallet to be used with
//! the fungibles traits.
//! This is only meant for tests since gas limits are not taken into account,
//! the feature flags make sure of that.
@@ -42,12 +42,12 @@ use pezframe_support::{
use pezsp_core::{H160, U256};
use pezsp_runtime::{traits::AccountIdConversion, DispatchError};
use super::{address::AddressMapper, pallet, Config, ContractResult, ExecConfig, Pallet, Weight};
use super::{address::AddressMapper, pezpallet, Config, ContractResult, ExecConfig, Pezpallet, Weight};
use pez_ethereum_standards::IERC20;
const GAS_LIMIT: Weight = Weight::from_parts(500_000_000_000, 10 * 1024 * 1024);
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
// Test checking account for the `fungibles::*` implementation.
//
// Still needs to be mapped in tests for it to be usable.
@@ -56,7 +56,7 @@ impl<T: Config> Pallet<T> {
}
}
impl<T: Config> fungibles::Inspect<<T as pezframe_system::Config>::AccountId> for Pallet<T> {
impl<T: Config> fungibles::Inspect<<T as pezframe_system::Config>::AccountId> for Pezpallet<T> {
// The asset id of an ERC20 is its origin contract's address.
type AssetId = H160;
// The balance is always u128.
@@ -70,7 +70,7 @@ impl<T: Config> fungibles::Inspect<<T as pezframe_system::Config>::AccountId> fo
asset_id,
U256::zero(),
GAS_LIMIT,
<<T as pallet::Config>::Currency as fungible::Inspect<_>>::total_issuance(),
<<T as pezpallet::Config>::Currency as fungible::Inspect<_>>::total_issuance(),
data,
ExecConfig::new_bizinikiwi_tx(),
);
@@ -105,7 +105,7 @@ impl<T: Config> fungibles::Inspect<<T as pezframe_system::Config>::AccountId> fo
asset_id,
U256::zero(),
GAS_LIMIT,
<<T as pallet::Config>::Currency as fungible::Inspect<_>>::total_issuance(),
<<T as pezpallet::Config>::Currency as fungible::Inspect<_>>::total_issuance(),
data,
ExecConfig::new_bizinikiwi_tx(),
);
@@ -156,7 +156,7 @@ impl<T: Config> fungibles::Inspect<<T as pezframe_system::Config>::AccountId> fo
// We implement `fungibles::Mutate` to override `burn_from` and `mint_to`.
//
// These functions are used in [`xcm_builder::FungiblesAdapter`].
impl<T: Config> fungibles::Mutate<<T as pezframe_system::Config>::AccountId> for Pallet<T> {
impl<T: Config> fungibles::Mutate<<T as pezframe_system::Config>::AccountId> for Pezpallet<T> {
fn burn_from(
asset_id: Self::AssetId,
who: &T::AccountId,
@@ -174,7 +174,7 @@ impl<T: Config> fungibles::Mutate<<T as pezframe_system::Config>::AccountId> for
asset_id,
U256::zero(),
GAS_LIMIT,
<<T as pallet::Config>::Currency as fungible::Inspect<_>>::total_issuance(),
<<T as pezpallet::Config>::Currency as fungible::Inspect<_>>::total_issuance(),
data,
ExecConfig::new_bizinikiwi_tx(),
);
@@ -210,7 +210,7 @@ impl<T: Config> fungibles::Mutate<<T as pezframe_system::Config>::AccountId> for
asset_id,
U256::zero(),
GAS_LIMIT,
<<T as pallet::Config>::Currency as fungible::Inspect<_>>::total_issuance(),
<<T as pezpallet::Config>::Currency as fungible::Inspect<_>>::total_issuance(),
data,
ExecConfig::new_bizinikiwi_tx(),
);
@@ -237,7 +237,7 @@ impl<T: Config> fungibles::Mutate<<T as pezframe_system::Config>::AccountId> for
// However, we don't have this type of access to smart contracts.
// Withdraw and deposit happen via the custom `fungibles::Mutate` impl above.
// Because of this, all functions here return an error, when possible.
impl<T: Config> fungibles::Unbalanced<<T as pezframe_system::Config>::AccountId> for Pallet<T> {
impl<T: Config> fungibles::Unbalanced<<T as pezframe_system::Config>::AccountId> for Pezpallet<T> {
fn handle_raw_dust(_: Self::AssetId, _: Self::Balance) {}
fn handle_dust(_: fungibles::Dust<T::AccountId, Self>) {}
fn write_balance(
@@ -380,7 +380,7 @@ mod tests {
#[test]
fn mint_into_impl_works() {
ExtBuilder::default().existential_deposit(1).build().execute_with(|| {
let checking_account = Pallet::<Test>::checking_account();
let checking_account = Pezpallet::<Test>::checking_account();
let _ =
<<Test as Config>::Currency as fungible::Mutate<_>>::set_balance(&ALICE, 1_000_000);
let _ = <<Test as Config>::Currency as fungible::Mutate<_>>::set_balance(
+164 -164
View File
@@ -82,7 +82,7 @@ use pezframe_support::{
use pezframe_system::{
ensure_signed,
pezpallet_prelude::{BlockNumberFor, OriginFor},
Pallet as System,
Pezpallet as System,
};
use scale_info::TypeInfo;
use pezsp_runtime::{
@@ -100,7 +100,7 @@ pub use crate::{
ReceiptInfo,
},
exec::{DelegateInfo, Executable, Key, MomentOf, Origin as ExecOrigin},
pallet::{genesis, *},
pezpallet::{genesis, *},
storage::{AccountInfo, ContractInfo},
vm::{BytecodeType, ContractBlob},
};
@@ -135,8 +135,8 @@ const SENTINEL: u32 = u32::MAX;
/// Example: `RUST_LOG=runtime::revive=debug my_code --dev`
const LOG_TARGET: &str = "runtime::revive";
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use super::*;
use pezframe_support::{pezpallet_prelude::*, traits::FindAuthor};
use pezframe_system::pezpallet_prelude::*;
@@ -146,11 +146,11 @@ pub mod pallet {
/// The in-code storage version.
pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);
#[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<Moment: Into<U256>>;
@@ -158,23 +158,23 @@ pub mod pallet {
/// The balance type of [`Self::Currency`].
///
/// Just added here to add additional trait bounds.
#[pallet::no_default]
#[pezpallet::no_default]
type Balance: Balance + TryFrom<U256> + Into<U256> + Bounded + UniqueSaturatedInto<u64>;
/// The fungible in which fees are paid and contract balances are held.
#[pallet::no_default]
#[pezpallet::no_default]
type Currency: Inspect<Self::AccountId, Balance = Self::Balance>
+ Mutate<Self::AccountId>
+ MutateHold<Self::AccountId, Reason = Self::RuntimeHoldReason>
+ Balanced<Self::AccountId>;
/// 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: Parameter
+ Dispatchable<
RuntimeOrigin = OriginFor<Self>,
@@ -186,13 +186,13 @@ pub mod pallet {
+ GetDispatchInfo;
/// The overarching origin type.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type RuntimeOrigin: IsType<OriginFor<Self>>
+ From<Origin<Self>>
+ Into<Result<Origin<Self>, OriginFor<Self>>>;
/// Overarching hold reason.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type RuntimeHoldReason: From<HoldReason>;
/// Describes the weights of the dispatchables of this module and is also used to
@@ -202,7 +202,7 @@ pub mod pallet {
/// Type that allows the runtime authors to add new host functions for a contract to call.
///
/// Pass in a tuple of types that implement [`precompiles::Precompile`].
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
#[allow(private_bounds)]
type Precompiles: precompiles::Precompiles<Self>;
@@ -214,8 +214,8 @@ pub mod pallet {
/// # Note
///
/// It is safe to change this value on a live chain as all refunds are pro rata.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type DepositPerByte: Get<BalanceOf<Self>>;
/// The amount of balance a caller has to pay for each storage item.
@@ -223,8 +223,8 @@ pub mod pallet {
/// # Note
///
/// It is safe to change this value on a live chain as all refunds are pro rata.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type DepositPerItem: Get<BalanceOf<Self>>;
/// The amount of balance a caller has to pay for each child trie storage item.
@@ -236,18 +236,18 @@ pub mod pallet {
/// # Note
///
/// It is safe to change this value on a live chain as all refunds are pro rata.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type DepositPerChildTrieItem: Get<BalanceOf<Self>>;
/// The percentage of the storage deposit that should be held for using a code hash.
/// Instantiating a contract, 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>;
/// Use either valid type is [`address::AccountId32Mapper`] or [`address::H160Mapper`].
#[pallet::no_default]
#[pezpallet::no_default]
type AddressMapper: AddressMapper<Self>;
/// Make contract callable functions marked as `#[unstable]` available.
@@ -259,18 +259,18 @@ pub mod pallet {
/// # Warning
///
/// Do **not** set to `true` on productions chains.
#[pallet::constant]
#[pezpallet::constant]
type UnsafeUnstableInterface: Get<bool>;
/// Allow EVM bytecode to be uploaded and instantiated.
#[pallet::constant]
#[pezpallet::constant]
type AllowEVMBytecode: Get<bool>;
/// 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<OriginFor<Self>, Success = Self::AccountId>;
/// Origin allowed to instantiate code.
@@ -283,19 +283,19 @@ 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<OriginFor<Self>, Success = Self::AccountId>;
/// The amount of memory in bytes that teyrchain nodes a lot to the runtime.
///
/// This is used in [`Pallet::integrity_test`] to make sure that the runtime has enough
/// memory to support this pallet if set to the correct value.
/// This is used in [`Pezpallet::integrity_test`] to make sure that the runtime has enough
/// memory to support this pezpallet if set to the correct value.
type RuntimeMemory: Get<u32>;
/// The amount of memory in bytes that relay chain validators a lot to the PoV.
///
/// This is used in [`Pallet::integrity_test`] to make sure that the runtime has enough
/// memory to support this pallet if set to the correct value.
/// This is used in [`Pezpallet::integrity_test`] to make sure that the runtime has enough
/// memory to support this pezpallet if set to the correct value.
///
/// This value is usually higher than [`Self::RuntimeMemory`] to account for the fact
/// that validators have to hold all storage items in PvF memory.
@@ -305,18 +305,18 @@ pub mod pallet {
///
/// This is a unique identifier assigned to each blockchain network,
/// preventing replay attacks.
#[pallet::constant]
#[pezpallet::constant]
type ChainId: Get<u64>;
/// The ratio between the decimal representation of the native token and the ETH token.
#[pallet::constant]
#[pezpallet::constant]
type NativeToEthRatio: Get<u32>;
/// Set to [`crate::evm::fees::Info`] for a production runtime.
///
/// For mock runtimes that do not need to interact with any eth compat functionality
/// the default value of `()` will suffice.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type FeeInfo: FeeInfo<Self>;
/// The fraction the maximum extrinsic weight `eth_transact` extrinsics are capped to.
@@ -331,15 +331,15 @@ pub mod pallet {
/// necessary.
///
/// Default: `0.5`.
#[pallet::constant]
#[pezpallet::constant]
type MaxEthExtrinsicWeight: Get<FixedU128>;
/// Allows debug-mode configuration, such as enabling unlimited contract size.
#[pallet::constant]
#[pezpallet::constant]
type DebugEnabled: Get<bool>;
}
/// 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::{
@@ -367,7 +367,7 @@ pub mod pallet {
pub const MaxEthExtrinsicWeight: FixedU128 = FixedU128::from_rational(9, 10);
}
/// 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 Time for TestDefaultConfig {
@@ -422,7 +422,7 @@ pub mod pallet {
}
}
#[pallet::event]
#[pezpallet::event]
pub enum Event<T: Config> {
/// A custom event emitted by the contract.
ContractEmitted {
@@ -448,7 +448,7 @@ pub mod pallet {
EthExtrinsicRevert { dispatch_error: DispatchError },
}
#[pallet::error]
#[pezpallet::error]
#[repr(u8)]
pub enum Error<T> {
/// Invalid schedule supplied, e.g. with zero weight of a basic operation.
@@ -492,7 +492,7 @@ pub mod pallet {
TerminatedInConstructor = 0x13,
/// A call tried to invoke a contract that is flagged as non-reentrant.
ReentranceDenied = 0x14,
/// A contract called into the runtime which then called back into this pallet.
/// A contract called into the runtime which then called back into this pezpallet.
ReenteredPallet = 0x15,
/// A contract attempted to invoke a state modifying API while being in read-only mode.
StateChangeDenied = 0x16,
@@ -541,9 +541,9 @@ pub mod pallet {
/// Immutable data can only be set during deploys and only be read during calls.
/// Additionally, it is only valid to set the data once and it must not be empty.
InvalidImmutableAccess = 0x2A,
/// An `AccountID32` account tried to interact with the pallet without having a mapping.
/// An `AccountID32` account tried to interact with the pezpallet without having a mapping.
///
/// Call [`Pallet::map_account`] in order to create a mapping for the account.
/// Call [`Pezpallet::map_account`] in order to create a mapping for the account.
AccountUnmapped = 0x2B,
/// Tried to map an account that is already mapped.
AccountAlreadyMapped = 0x2C,
@@ -595,12 +595,12 @@ pub mod pallet {
BenchmarkingError = 0xFF,
}
/// A reason for the pallet revive placing a hold on funds.
#[pallet::composite_enum]
/// A reason for the pezpallet revive 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,
/// Deposit for creating an address mapping in [`OriginalAccount`].
AddressMapping,
@@ -617,7 +617,7 @@ pub mod pallet {
TypeInfo,
RuntimeDebug,
)]
#[pallet::origin]
#[pezpallet::origin]
pub enum Origin<T: Config> {
EthTransaction(T::AccountId),
}
@@ -625,32 +625,32 @@ pub mod pallet {
/// A mapping from a contract's code hash to its code.
/// The code's size is bounded by [`crate::limits::BLOB_BYTES`] for PVM and
/// [`revm::primitives::eip170::MAX_CODE_SIZE`] for EVM bytecode.
#[pallet::storage]
#[pallet::unbounded]
#[pezpallet::storage]
#[pezpallet::unbounded]
pub(crate) type PristineCode<T: Config> = StorageMap<_, Identity, H256, Vec<u8>>;
/// A mapping from a contract's code hash to its code info.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type CodeInfoOf<T: Config> = StorageMap<_, Identity, H256, CodeInfo<T>>;
/// The data associated to a contract or externally owned account.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type AccountInfoOf<T: Config> = StorageMap<_, Identity, H160, AccountInfo<T>>;
/// The immutable data associated with a given account.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type ImmutableDataOf<T: Config> = StorageMap<_, Identity, H160, ImmutableData>;
/// Evicted contracts that await child trie deletion.
///
/// 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>;
@@ -658,9 +658,9 @@ pub mod pallet {
///
/// When deriving a `H160` from an `AccountId32` we use a hash function. In order to
/// reconstruct the original account we need to store the reverse mapping here.
/// Register your `AccountId32` using [`Pallet::map_account`] in order to
/// use it with this pallet.
#[pallet::storage]
/// Register your `AccountId32` using [`Pezpallet::map_account`] in order to
/// use it with this pezpallet.
#[pezpallet::storage]
pub(crate) type OriginalAccount<T: Config> = StorageMap<_, Identity, H160, AccountId32>;
/// The current Ethereum block that is stored in the `on_finalize` method.
@@ -672,14 +672,14 @@ pub mod pallet {
///
/// Since the block is convenient to have around, and the extra details are capped
/// by a few hashes and the vector of transaction hashes, we store the block here.
#[pallet::storage]
#[pallet::unbounded]
#[pezpallet::storage]
#[pezpallet::unbounded]
pub(crate) type EthereumBlock<T> = StorageValue<_, EthBlock, ValueQuery>;
/// Mapping for block number and hashes.
///
/// The maximum number of elements stored is capped by the block hash count `BLOCK_HASH_COUNT`.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type BlockHash<T: Config> =
StorageMap<_, Identity, BlockNumberFor<T>, H256, ValueQuery>;
@@ -689,13 +689,13 @@ pub mod pallet {
///
/// NOTE: The item is unbound and should therefore never be read on chain.
/// It could otherwise inflate the PoV size of a block.
#[pallet::storage]
#[pallet::unbounded]
#[pezpallet::storage]
#[pezpallet::unbounded]
pub(crate) type ReceiptInfoData<T: Config> = StorageValue<_, Vec<ReceiptGasInfo>, ValueQuery>;
/// Incremental ethereum block builder.
#[pallet::storage]
#[pallet::unbounded]
#[pezpallet::storage]
#[pezpallet::unbounded]
pub(crate) type EthBlockBuilderIR<T: Config> =
StorageValue<_, EthereumBlockBuilderIR<T>, ValueQuery>;
@@ -703,13 +703,13 @@ pub mod pallet {
///
/// These values are moved out of the `EthBlockBuilderIR` to avoid serializing and
/// deserializing them on every transaction. Instead, they are loaded when needed.
#[pallet::storage]
#[pallet::unbounded]
#[pezpallet::storage]
#[pezpallet::unbounded]
pub(crate) type EthBlockBuilderFirstValues<T: Config> =
StorageValue<_, Option<(Vec<u8>, Vec<u8>)>, ValueQuery>;
/// Debugging settings that can be configured when DebugEnabled config is true.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type DebugSettingsOf<T: Config> = StorageValue<_, DebugSettings, ValueQuery>;
pub mod genesis {
@@ -742,7 +742,7 @@ pub mod pallet {
}
}
#[pallet::genesis_config]
#[pezpallet::genesis_config]
#[derive(Debug, PartialEq, pezframe_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
/// List of native Bizinikiwi accounts (typically `AccountId32`) to be mapped at genesis
@@ -759,15 +759,15 @@ pub mod pallet {
pub debug_settings: Option<DebugSettings>,
}
#[pallet::genesis_build]
#[pezpallet::genesis_build]
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) {
use crate::{exec::Key, vm::ContractBlob};
use pezframe_support::traits::fungible::Mutate;
if !System::<T>::account_exists(&Pallet::<T>::account_id()) {
if !System::<T>::account_exists(&Pezpallet::<T>::account_id()) {
let _ = T::Currency::mint_into(
&Pallet::<T>::account_id(),
&Pezpallet::<T>::account_id(),
T::Currency::minimum_balance(),
);
}
@@ -778,7 +778,7 @@ pub mod pallet {
}
}
let owner = Pallet::<T>::account_id();
let owner = Pezpallet::<T>::account_id();
for genesis::Account { address, balance, nonce, contract_data } in &self.accounts {
let account_id = T::AddressMapper::to_account_id(address);
@@ -837,7 +837,7 @@ pub mod pallet {
},
}
let _ = Pallet::<T>::set_evm_balance(address, *balance).inspect_err(|err| {
let _ = Pezpallet::<T>::set_evm_balance(address, *balance).inspect_err(|err| {
log::error!(target: LOG_TARGET, "Failed to set EVM balance for {address:?}: {err:?}");
});
}
@@ -846,7 +846,7 @@ pub mod pallet {
block_storage::on_finalize_build_eth_block::<T>(
// Make sure to use the block number from storage instead of the hardcoded 0.
// This enables testing tools like anvil to customise the genesis block number.
pezframe_system::Pallet::<T>::block_number(),
pezframe_system::Pezpallet::<T>::block_number(),
);
// Set debug settings.
@@ -856,8 +856,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 {
let mut meter = WeightMeter::with_limit(limit);
ContractInfo::<T>::process_deletion_queue_batch(&mut meter);
@@ -868,8 +868,8 @@ pub mod pallet {
// Kill related ethereum block storage items.
block_storage::on_initialize::<T>();
// Warm up the pallet account.
System::<T>::account_exists(&Pallet::<T>::account_id());
// Warm up the pezpallet account.
System::<T>::account_exists(&Pezpallet::<T>::account_id());
// Account for the fixed part of the costs incurred in `on_finalize`.
<T as Config>::WeightInfo::on_finalize_block_fixed()
}
@@ -950,7 +950,7 @@ pub mod pallet {
// for transactions. Transactions are bounded to `MAX_TRANSACTION_PAYLOAD_SIZE`.
//
// To determine the maximum size of the receipts, we know the following:
// - (I) first receipt is stored into pallet storage and not given to the hasher until
// - (I) first receipt is stored into pezpallet storage and not given to the hasher until
// finalization.
// - (II) the hasher will not consume more memory than the receipts we are giving it.
// - (III) the hasher is capped by 3 x maximum entry for 3 or more transactions.
@@ -960,7 +960,7 @@ pub mod pallet {
// The worst case scenario for having one single transaction is for the transaction
// to emit the maximum receipt size (ie `max_events_size`). In this case,
// the maximum storage (and memory) consumed is bounded by `max_events_size` (II). The
// receipt is stored in pallet storage, and loaded from storage in the
// receipt is stored in pezpallet storage, and loaded from storage in the
// `on_finalize` hook (I).
//
// # Case 2. Two transactions
@@ -1030,8 +1030,8 @@ pub mod pallet {
}
}
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pezpallet::call]
impl<T: Config> Pezpallet<T> {
/// A raw EVM transaction, typically dispatched by an Ethereum JSON-RPC server.
///
/// # Parameters
@@ -1045,8 +1045,8 @@ pub mod pallet {
/// runtime converts it into a [`pezsp_runtime::generic::CheckedExtrinsic`] by recovering the
/// signer and validating the transaction.
#[allow(unused_variables)]
#[pallet::call_index(0)]
#[pallet::weight(Weight::MAX)]
#[pezpallet::call_index(0)]
#[pezpallet::weight(Weight::MAX)]
pub fn eth_transact(origin: OriginFor<T>, payload: Vec<u8>) -> DispatchResultWithPostInfo {
Err(pezframe_system::Error::CallFiltered::<T>.into())
}
@@ -1067,21 +1067,21 @@ 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(1)]
#[pallet::weight(<T as Config>::WeightInfo::call().saturating_add(*gas_limit))]
#[pezpallet::call_index(1)]
#[pezpallet::weight(<T as Config>::WeightInfo::call().saturating_add(*gas_limit))]
pub fn call(
origin: OriginFor<T>,
dest: H160,
#[pallet::compact] value: BalanceOf<T>,
#[pezpallet::compact] value: BalanceOf<T>,
gas_limit: Weight,
#[pallet::compact] storage_deposit_limit: BalanceOf<T>,
#[pezpallet::compact] storage_deposit_limit: BalanceOf<T>,
data: Vec<u8>,
) -> DispatchResultWithPostInfo {
Self::ensure_non_contract_if_signed(&origin)?;
let mut output = Self::bare_call(
origin,
dest,
Pallet::<T>::convert_native_to_evm(value),
Pezpallet::<T>::convert_native_to_evm(value),
gas_limit,
storage_deposit_limit,
data,
@@ -1101,15 +1101,15 @@ 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 vm binary
/// must be supplied.
#[pallet::call_index(2)]
#[pallet::weight(
#[pezpallet::call_index(2)]
#[pezpallet::weight(
<T as Config>::WeightInfo::instantiate(data.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,
#[pallet::compact] storage_deposit_limit: BalanceOf<T>,
#[pezpallet::compact] storage_deposit_limit: BalanceOf<T>,
code_hash: pezsp_core::H256,
data: Vec<u8>,
salt: Option<[u8; 32]>,
@@ -1118,7 +1118,7 @@ pub mod pallet {
let data_len = data.len() as u32;
let mut output = Self::bare_instantiate(
origin,
Pallet::<T>::convert_native_to_evm(value),
Pezpallet::<T>::convert_native_to_evm(value),
gas_limit,
storage_deposit_limit,
Code::Existing(code_hash),
@@ -1165,16 +1165,16 @@ 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(3)]
#[pallet::weight(
#[pezpallet::call_index(3)]
#[pezpallet::weight(
<T as Config>::WeightInfo::instantiate_with_code(code.len() as u32, data.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,
#[pallet::compact] storage_deposit_limit: BalanceOf<T>,
#[pezpallet::compact] storage_deposit_limit: BalanceOf<T>,
code: Vec<u8>,
data: Vec<u8>,
salt: Option<[u8; 32]>,
@@ -1184,7 +1184,7 @@ pub mod pallet {
let data_len = data.len() as u32;
let mut output = Self::bare_instantiate(
origin,
Pallet::<T>::convert_native_to_evm(value),
Pezpallet::<T>::convert_native_to_evm(value),
gas_limit,
storage_deposit_limit,
Code::Upload(code),
@@ -1225,9 +1225,9 @@ pub mod pallet {
/// via the `CheckNonce` transaction extension. In contrast, [`Self::instantiate_with_code`]
/// also bumps the nonce after contract instantiation, since it may be invoked multiple
/// times within a batch call transaction.
#[pallet::call_index(10)]
#[pallet::weight(
<T as Config>::WeightInfo::eth_instantiate_with_code(code.len() as u32, data.len() as u32, Pallet::<T>::has_dust(*value).into())
#[pezpallet::call_index(10)]
#[pezpallet::weight(
<T as Config>::WeightInfo::eth_instantiate_with_code(code.len() as u32, data.len() as u32, Pezpallet::<T>::has_dust(*value).into())
.saturating_add(T::WeightInfo::on_finalize_block_per_tx(transaction_encoded.len() as u32))
.saturating_add(*gas_limit)
)]
@@ -1287,9 +1287,9 @@ pub mod pallet {
/// Same as [`Self::call`], but intended to be dispatched **only**
/// by an EVM transaction through the EVM compatibility layer.
#[pallet::call_index(11)]
#[pallet::weight(
T::WeightInfo::eth_call(Pallet::<T>::has_dust(*value).into())
#[pezpallet::call_index(11)]
#[pezpallet::weight(
T::WeightInfo::eth_call(Pezpallet::<T>::has_dust(*value).into())
.saturating_add(*gas_limit)
.saturating_add(T::WeightInfo::on_finalize_block_per_tx(transaction_encoded.len() as u32))
)]
@@ -1357,8 +1357,8 @@ pub mod pallet {
/// * `origin`: Must be an [`Origin::EthTransaction`] origin.
/// * `call`: The Bizinikiwi runtime call to execute.
/// * `transaction_encoded`: The RLP encoding of the Ethereum transaction,
#[pallet::call_index(12)]
#[pallet::weight(T::WeightInfo::eth_bizinikiwi_call(transaction_encoded.len() as u32).saturating_add(call.get_dispatch_info().call_weight))]
#[pezpallet::call_index(12)]
#[pezpallet::weight(T::WeightInfo::eth_bizinikiwi_call(transaction_encoded.len() as u32).saturating_add(call.get_dispatch_info().call_weight))]
pub fn eth_bizinikiwi_call(
origin: OriginFor<T>,
call: Box<<T as Config>::RuntimeCall>,
@@ -1409,12 +1409,12 @@ pub mod pallet {
///
/// If the refcount of the code reaches zero after terminating the last contract that
/// references this code, the code will be removed automatically.
#[pallet::call_index(4)]
#[pallet::weight(<T as Config>::WeightInfo::upload_code(code.len() as u32))]
#[pezpallet::call_index(4)]
#[pezpallet::weight(<T as Config>::WeightInfo::upload_code(code.len() as u32))]
pub fn upload_code(
origin: OriginFor<T>,
code: Vec<u8>,
#[pallet::compact] storage_deposit_limit: BalanceOf<T>,
#[pezpallet::compact] storage_deposit_limit: BalanceOf<T>,
) -> DispatchResult {
Self::ensure_non_contract_if_signed(&origin)?;
Self::bare_upload_code(origin, code, storage_deposit_limit).map(|_| ())
@@ -1424,8 +1424,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(5)]
#[pallet::weight(<T as Config>::WeightInfo::remove_code())]
#[pezpallet::call_index(5)]
#[pezpallet::weight(<T as Config>::WeightInfo::remove_code())]
pub fn remove_code(
origin: OriginFor<T>,
code_hash: pezsp_core::H256,
@@ -1446,8 +1446,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(6)]
#[pallet::weight(<T as Config>::WeightInfo::set_code())]
#[pezpallet::call_index(6)]
#[pezpallet::weight(<T as Config>::WeightInfo::set_code())]
pub fn set_code(
origin: OriginFor<T>,
dest: H160,
@@ -1475,8 +1475,8 @@ pub mod pallet {
///
/// This will error if the origin is already mapped or is a eth native `Address20`. It will
/// take a deposit that can be released by calling [`Self::unmap_account`].
#[pallet::call_index(7)]
#[pallet::weight(<T as Config>::WeightInfo::map_account())]
#[pezpallet::call_index(7)]
#[pezpallet::weight(<T as Config>::WeightInfo::map_account())]
pub fn map_account(origin: OriginFor<T>) -> DispatchResult {
Self::ensure_non_contract_if_signed(&origin)?;
let origin = ensure_signed(origin)?;
@@ -1487,8 +1487,8 @@ pub mod pallet {
///
/// There is no reason to ever call this function other than freeing up the deposit.
/// This is only useful when the account should no longer be used.
#[pallet::call_index(8)]
#[pallet::weight(<T as Config>::WeightInfo::unmap_account())]
#[pezpallet::call_index(8)]
#[pezpallet::weight(<T as Config>::WeightInfo::unmap_account())]
pub fn unmap_account(origin: OriginFor<T>) -> DispatchResult {
let origin = ensure_signed(origin)?;
T::AddressMapper::unmap(&origin)
@@ -1499,8 +1499,8 @@ pub mod pallet {
/// Every `AccountId32` can control its corresponding fallback account. The fallback account
/// is the `AccountId20` with the last 12 bytes set to `0xEE`. This is essentially a
/// recovery function in case an `AccountId20` was used without creating a mapping first.
#[pallet::call_index(9)]
#[pallet::weight({
#[pezpallet::call_index(9)]
#[pezpallet::weight({
let dispatch_info = call.get_dispatch_info();
(
<T as Config>::WeightInfo::dispatch_as_fallback_account().saturating_add(dispatch_info.call_weight),
@@ -1536,7 +1536,7 @@ fn dispatch_result<R>(
.map_err(|e| DispatchErrorWithPostInfo { post_info, error: e })
}
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
/// A generalized version of [`Self::call`].
///
/// Identical to [`Self::call`] but tailored towards being called by other code within the
@@ -1590,7 +1590,7 @@ impl<T: Config> Pallet<T> {
pub fn prepare_dry_run(account: &T::AccountId) {
// Bump the nonce to simulate what would happen
// `pre-dispatch` if the transaction was executed.
pezframe_system::Pallet::<T>::inc_account_nonce(account);
pezframe_system::Pezpallet::<T>::inc_account_nonce(account);
}
/// A generalized version of [`Self::instantiate`] or [`Self::instantiate_with_code`].
@@ -1750,7 +1750,7 @@ impl<T: Config> Pallet<T> {
if let Some(from) = &from {
let fees = if gas.is_some() { fees } else { Zero::zero() };
let balance = Self::evm_balance(from);
if balance < Pallet::<T>::convert_native_to_evm(fees).saturating_add(value) {
if balance < Pezpallet::<T>::convert_native_to_evm(fees).saturating_add(value) {
return Err(EthTransactError::Message(format!(
"insufficient funds for gas * price + value ({fees:?}): address {from:?} have {balance:?} (supplied gas {gas:?})",
)));
@@ -1792,7 +1792,7 @@ impl<T: Config> Pallet<T> {
Default::default()
} else {
// Dry run the call.
let result = crate::Pallet::<T>::bare_call(
let result = crate::Pezpallet::<T>::bare_call(
OriginFor::<T>::signed(origin),
dest,
value,
@@ -1833,7 +1833,7 @@ impl<T: Config> Pallet<T> {
};
// Dry run the call.
let result = crate::Pallet::<T>::bare_instantiate(
let result = crate::Pezpallet::<T>::bare_instantiate(
OriginFor::<T>::signed(origin),
value,
call_info.weight_limit,
@@ -2177,7 +2177,7 @@ impl<T: Config> Pallet<T> {
.map_err(ContractAccessError::StorageWriteFailed)
}
/// Pallet account, used to hold funds for contracts upload deposit.
/// Pezpallet account, used to hold funds for contracts upload deposit.
pub fn account_id() -> T::AccountId {
use pezframe_support::PalletId;
use pezsp_runtime::traits::AccountIdConversion;
@@ -2188,7 +2188,7 @@ impl<T: Config> Pallet<T> {
pub fn block_author() -> H160 {
use pezframe_support::traits::FindAuthor;
let digest = <pezframe_system::Pallet<T>>::digest();
let digest = <pezframe_system::Pezpallet<T>>::digest();
let pre_runtime_digests = digest.logs.iter().filter_map(|d| d.as_pre_runtime());
T::FindAuthor::find_author(pre_runtime_digests)
@@ -2227,7 +2227,7 @@ impl<T: Config> Pallet<T> {
Ok((module, deposit))
}
/// Run the supplied function `f` if no other instance of this pallet is on the stack.
/// Run the supplied function `f` if no other instance of this pezpallet is on the stack.
fn run_guarded<R, F: FnOnce() -> Result<R, ExecError>>(f: F) -> Result<R, ExecError> {
executing_contract::using_once(&mut false, || {
executing_contract::with(|f| {
@@ -2352,7 +2352,7 @@ impl<T: Config> Pallet<T> {
let available = T::Currency::balance_on_hold(&hold_reason, from);
if available < amount {
// The storage deposit accounting got out of sync with the balance: This would be a
// straight up bug in this pallet.
// straight up bug in this pezpallet.
log::error!(
target: LOG_TARGET,
"Failed to refund storage deposit {:?} from contract {:?} to origin {:?}. Not enough deposit: {:?}. This is a bug.",
@@ -2389,12 +2389,12 @@ impl<T: Config> Pallet<T> {
<T::Currency as Inspect<AccountIdOf<T>>>::minimum_balance()
}
/// Deposit a pallet revive event.
/// Deposit a pezpallet revive event.
///
/// This method will be called by the EVM to deposit events emitted by the contract.
/// Therefore all events must be contract emitted events.
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))
}
// Returns Ok with the account that signed the eth transaction.
@@ -2482,7 +2482,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: H160,
@@ -2494,7 +2494,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,
@@ -2509,12 +2509,12 @@ pezsp_api::decl_runtime_apis! {
/// Perform an Ethereum call.
///
/// Deprecated use `v2` version instead.
/// See [`crate::Pallet::dry_run_eth_transact`]
/// See [`crate::Pezpallet::dry_run_eth_transact`]
fn eth_transact(tx: GenericTransaction) -> Result<EthTransactInfo<Balance>, EthTransactError>;
/// Perform an Ethereum call.
///
/// See [`crate::Pallet::dry_run_eth_transact`]
/// See [`crate::Pezpallet::dry_run_eth_transact`]
fn eth_transact_with_config(
tx: GenericTransaction,
config: DryRunConfig<Moment>,
@@ -2522,7 +2522,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>,
@@ -2618,7 +2618,7 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
impl $crate::evm::runtime::SetWeightLimit for RuntimeCall {
fn set_weight_limit(&mut self, weight_limit: Weight) -> Weight {
use $crate::pallet::Call as ReviveCall;
use $crate::pezpallet::Call as ReviveCall;
match self {
Self::$Revive(
ReviveCall::eth_call{ gas_limit, .. } |
@@ -2640,37 +2640,37 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
impl pezpallet_revive::ReviveApi<Block, AccountId, Balance, Nonce, BlockNumber, __ReviveMacroMoment> for $Runtime
{
fn eth_block() -> $crate::EthBlock {
$crate::Pallet::<Self>::eth_block()
$crate::Pezpallet::<Self>::eth_block()
}
fn eth_block_hash(number: $crate::U256) -> Option<$crate::H256> {
$crate::Pallet::<Self>::eth_block_hash_from_number(number)
$crate::Pezpallet::<Self>::eth_block_hash_from_number(number)
}
fn eth_receipt_data() -> Vec<$crate::ReceiptGasInfo> {
$crate::Pallet::<Self>::eth_receipt_data()
$crate::Pezpallet::<Self>::eth_receipt_data()
}
fn balance(address: $crate::H160) -> $crate::U256 {
$crate::Pallet::<Self>::evm_balance(&address)
$crate::Pezpallet::<Self>::evm_balance(&address)
}
fn block_author() -> $crate::H160 {
$crate::Pallet::<Self>::block_author()
$crate::Pezpallet::<Self>::block_author()
}
fn block_gas_limit() -> $crate::U256 {
$crate::Pallet::<Self>::evm_block_gas_limit()
$crate::Pezpallet::<Self>::evm_block_gas_limit()
}
fn gas_price() -> $crate::U256 {
$crate::Pallet::<Self>::evm_base_fee()
$crate::Pezpallet::<Self>::evm_base_fee()
}
fn nonce(address: $crate::H160) -> Nonce {
use $crate::AddressMapper;
let account = <Self as $crate::Config>::AddressMapper::to_account_id(&address);
$crate::pezframe_system::Pallet::<Self>::account_nonce(account)
$crate::pezframe_system::Pezpallet::<Self>::account_nonce(account)
}
fn address(account_id: AccountId) -> $crate::H160 {
@@ -2686,7 +2686,7 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
pezsp_runtime::traits::TransactionExtension,
pezsp_runtime::traits::Block as BlockT
};
$crate::Pallet::<Self>::dry_run_eth_transact(tx, Default::default())
$crate::Pezpallet::<Self>::dry_run_eth_transact(tx, Default::default())
}
fn eth_transact_with_config(
@@ -2698,7 +2698,7 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
pezsp_runtime::traits::TransactionExtension,
pezsp_runtime::traits::Block as BlockT
};
$crate::Pallet::<Self>::dry_run_eth_transact(tx, config)
$crate::Pezpallet::<Self>::dry_run_eth_transact(tx, config)
}
fn call(
@@ -2713,11 +2713,11 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
let blockweights: $crate::BlockWeights =
<Self as $crate::pezframe_system::Config>::BlockWeights::get();
$crate::Pallet::<Self>::prepare_dry_run(&origin);
$crate::Pallet::<Self>::bare_call(
$crate::Pezpallet::<Self>::prepare_dry_run(&origin);
$crate::Pezpallet::<Self>::bare_call(
<Self as $crate::pezframe_system::Config>::RuntimeOrigin::signed(origin),
dest,
$crate::Pallet::<Self>::convert_native_to_evm(value),
$crate::Pezpallet::<Self>::convert_native_to_evm(value),
gas_limit.unwrap_or(blockweights.max_block),
storage_deposit_limit.unwrap_or(u128::MAX),
input_data,
@@ -2738,10 +2738,10 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
let blockweights: $crate::BlockWeights =
<Self as $crate::pezframe_system::Config>::BlockWeights::get();
$crate::Pallet::<Self>::prepare_dry_run(&origin);
$crate::Pallet::<Self>::bare_instantiate(
$crate::Pezpallet::<Self>::prepare_dry_run(&origin);
$crate::Pezpallet::<Self>::bare_instantiate(
<Self as $crate::pezframe_system::Config>::RuntimeOrigin::signed(origin),
$crate::Pallet::<Self>::convert_native_to_evm(value),
$crate::Pezpallet::<Self>::convert_native_to_evm(value),
gas_limit.unwrap_or(blockweights.max_block),
storage_deposit_limit.unwrap_or(u128::MAX),
code,
@@ -2758,7 +2758,7 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
) -> $crate::CodeUploadResult<Balance> {
let origin =
<Self as $crate::pezframe_system::Config>::RuntimeOrigin::signed(origin);
$crate::Pallet::<Self>::bare_upload_code(
$crate::Pezpallet::<Self>::bare_upload_code(
origin,
code,
storage_deposit_limit.unwrap_or(u128::MAX),
@@ -2769,11 +2769,11 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
address: $crate::H160,
key: Vec<u8>,
) -> $crate::GetStorageResult {
$crate::Pallet::<Self>::get_storage_var_key(address, key)
$crate::Pezpallet::<Self>::get_storage_var_key(address, key)
}
fn get_storage(address: $crate::H160, key: [u8; 32]) -> $crate::GetStorageResult {
$crate::Pallet::<Self>::get_storage(address, key)
$crate::Pezpallet::<Self>::get_storage(address, key)
}
fn trace_block(
@@ -2785,7 +2785,7 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
let (header, extrinsics) = block.deconstruct();
<$Executive>::initialize_block(&header);
for (index, ext) in extrinsics.into_iter().enumerate() {
let mut tracer = $crate::Pallet::<Self>::evm_tracer(tracer_type.clone());
let mut tracer = $crate::Pezpallet::<Self>::evm_tracer(tracer_type.clone());
let t = tracer.as_tracing();
let _ = trace(t, || <$Executive>::apply_extrinsic(ext));
@@ -2804,7 +2804,7 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
) -> Option<$crate::evm::Trace> {
use $crate::{pezsp_runtime::traits::Block, tracing::trace};
let mut tracer = $crate::Pallet::<Self>::evm_tracer(tracer_type);
let mut tracer = $crate::Pezpallet::<Self>::evm_tracer(tracer_type);
let (header, extrinsics) = block.deconstruct();
<$Executive>::initialize_block(&header);
@@ -2826,11 +2826,11 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
tracer_type: $crate::evm::TracerType,
) -> Result<$crate::evm::Trace, $crate::EthTransactError> {
use $crate::tracing::trace;
let mut tracer = $crate::Pallet::<Self>::evm_tracer(tracer_type.clone());
let mut tracer = $crate::Pezpallet::<Self>::evm_tracer(tracer_type.clone());
let t = tracer.as_tracing();
t.watch_address(&tx.from.unwrap_or_default());
t.watch_address(&$crate::Pallet::<Self>::block_author());
t.watch_address(&$crate::Pezpallet::<Self>::block_author());
let result = trace(t, || Self::eth_transact(tx));
if let Some(trace) = tracer.collect_trace() {
@@ -2838,7 +2838,7 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
} else if let Err(err) = result {
Err(err)
} else {
Ok($crate::Pallet::<Self>::evm_tracer(tracer_type).empty_trace())
Ok($crate::Pezpallet::<Self>::evm_tracer(tracer_type).empty_trace())
}
}
@@ -2847,7 +2847,7 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
}
fn code(address: $crate::H160) -> Vec<u8> {
$crate::Pallet::<Self>::code(&address)
$crate::Pezpallet::<Self>::code(&address)
}
fn account_id(address: $crate::H160) -> AccountId {
@@ -2856,7 +2856,7 @@ macro_rules! impl_runtime_apis_plus_revive_traits {
}
fn new_balance_with_dust(balance: $crate::U256) -> Result<(Balance, u32), $crate::BalanceConversionError> {
$crate::Pallet::<Self>::new_balance_with_dust(balance)
$crate::Pezpallet::<Self>::new_balance_with_dust(balance)
}
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ pub const EVENT_BYTES: u32 = 64 * 1024;
/// The extra ref time charge of deposit event per byte.
///
/// This ensure the block builder has enough memory and pallet storage
/// This ensure the block builder has enough memory and pezpallet storage
/// to operate under worst case scenarios.
pub const EXTRA_EVENT_CHARGE_PER_BYTE: u64 = 256 * 1024;
@@ -38,12 +38,12 @@ use alloc::vec::Vec;
/// Module containing the old storage items.
pub mod old {
use super::Config;
use crate::{pallet::Pallet, ContractInfo, H160};
use crate::{pezpallet::Pezpallet, ContractInfo, H160};
use pezframe_support::{storage_alias, Identity};
#[storage_alias]
/// The storage item that is being migrated from.
pub type ContractInfoOf<T: Config> = StorageMap<Pallet<T>, Identity, H160, ContractInfo<T>>;
pub type ContractInfoOf<T: Config> = StorageMap<Pezpallet<T>, Identity, H160, ContractInfo<T>>;
}
/// Migrates the items of the [`old::ContractInfoOf`] map into [`crate::AccountInfoOf`].
+11 -11
View File
@@ -19,11 +19,11 @@
//!
//! - migrate the old `CodeInfoOf` storage to the new `CodeInfoOf` which add the new `code_type`
//! field.
//! - Unhold the deposit on the owner and transfer it to the pallet account.
//! - Unhold the deposit on the owner and transfer it to the pezpallet account.
extern crate alloc;
use super::PALLET_MIGRATIONS_ID;
use crate::{vm::BytecodeType, weights::WeightInfo, Config, Pallet, H256, LOG_TARGET};
use crate::{vm::BytecodeType, weights::WeightInfo, Config, Pezpallet, H256, LOG_TARGET};
use pezframe_support::{
migrations::{MigrationId, SteppedMigration, SteppedMigrationError},
pezpallet_prelude::PhantomData,
@@ -43,7 +43,7 @@ use pezframe_support::{pezsp_runtime::TryRuntimeError, traits::fungible::Inspect
/// Module containing the old storage items.
mod old {
use super::Config;
use crate::{pallet::Pallet, AccountIdOf, BalanceOf, H256};
use crate::{pezpallet::Pezpallet, AccountIdOf, BalanceOf, H256};
use codec::{Decode, Encode};
use pezframe_support::{storage_alias, Identity};
@@ -60,12 +60,12 @@ mod old {
#[storage_alias]
/// The storage item that is being migrated from.
pub type CodeInfoOf<T: Config> = StorageMap<Pallet<T>, Identity, H256, CodeInfo<T>>;
pub type CodeInfoOf<T: Config> = StorageMap<Pezpallet<T>, Identity, H256, CodeInfo<T>>;
}
mod new {
use super::{BytecodeType, Config};
use crate::{pallet::Pallet, AccountIdOf, BalanceOf, H256};
use crate::{pezpallet::Pezpallet, AccountIdOf, BalanceOf, H256};
use codec::{Decode, Encode};
use pezframe_support::{storage_alias, DebugNoBound, Identity};
@@ -83,7 +83,7 @@ mod new {
#[storage_alias]
/// The storage item that is being migrated to.
pub type CodeInfoOf<T: Config> = StorageMap<Pallet<T>, Identity, H256, CodeInfo<T>>;
pub type CodeInfoOf<T: Config> = StorageMap<Pezpallet<T>, Identity, H256, CodeInfo<T>>;
}
/// Migrates the items of the [`old::CodeInfoOf`] map into [`crate::CodeInfoOf`] by adding the
@@ -107,9 +107,9 @@ impl<T: Config> SteppedMigration for Migration<T> {
return Err(SteppedMigrationError::InsufficientWeight { required });
}
if !pezframe_system::Pallet::<T>::account_exists(&Pallet::<T>::account_id()) {
if !pezframe_system::Pezpallet::<T>::account_exists(&Pezpallet::<T>::account_id()) {
let _ =
T::Currency::mint_into(&Pallet::<T>::account_id(), T::Currency::minimum_balance());
T::Currency::mint_into(&Pezpallet::<T>::account_id(), T::Currency::minimum_balance());
}
loop {
@@ -127,7 +127,7 @@ impl<T: Config> SteppedMigration for Migration<T> {
if let Err(err) = T::Currency::transfer_on_hold(
&crate::HoldReason::CodeUploadDepositReserve.into(),
&value.owner,
&Pallet::<T>::account_id(),
&Pezpallet::<T>::account_id(),
value.deposit,
Precision::Exact,
Restriction::OnHold,
@@ -194,7 +194,7 @@ impl<T: Config> SteppedMigration for Migration<T> {
assert_eq!(
<T as Config>::Currency::balance_on_hold(
&crate::HoldReason::CodeUploadDepositReserve.into(),
&Pallet::<T>::account_id(),
&Pezpallet::<T>::account_id(),
),
deposit_sum,
);
@@ -219,7 +219,7 @@ impl<T: Config> Migration<T> {
behaviour_version: u32,
) -> old::CodeInfo<T> {
use pezframe_support::traits::fungible::Mutate;
T::Currency::mint_into(&owner, Pallet::<T>::min_balance() + deposit)
T::Currency::mint_into(&owner, Pezpallet::<T>::min_balance() + deposit)
.expect("Failed to mint into owner account");
T::Currency::hold(&crate::HoldReason::CodeUploadDepositReserve.into(), &owner, deposit)
.expect("Failed to hold the deposit on the owner account");
+2 -2
View File
@@ -22,11 +22,11 @@
use pezframe_system::pezpallet_prelude::OriginFor;
use pezsp_core::{H160, U256};
use crate::{exec::Origin, pallet, DelegateInfo, ExecReturnValue};
use crate::{exec::Origin, pezpallet, DelegateInfo, ExecReturnValue};
/// A trait that provides hooks for mocking EVM contract calls and callers.
/// This is useful for testing and simulating contract interactions within foundry forge tests.
pub trait MockHandler<T: pallet::Config> {
pub trait MockHandler<T: pezpallet::Config> {
/// Mock an EVM contract call.
///
/// Returns `Some(ExecReturnValue)` if the call is mocked, otherwise `None`.
@@ -19,7 +19,7 @@
//!
//! In order to add a pre-compile:
//!
//! - Implement [`Precompile`] on a type. Most likely another pallet.
//! - Implement [`Precompile`] on a type. Most likely another pezpallet.
//! - Add the type to a tuple passed into [`Config::Precompiles`].
//! - Use the types inside the `run` module to test and benchmark your pre-compile.
//!
@@ -62,7 +62,7 @@ pub(crate) const EVM_REVERT: [u8; 5] = pezsp_core::hex2array!("60006000fd");
/// The composition of all available pre-compiles.
///
/// This is how the rest of the pallet discovers and calls pre-compiles.
/// This is how the rest of the pezpallet discovers and calls pre-compiles.
pub(crate) type All<T> = (Builtin<T>, <T as Config>::Precompiles);
/// Used by [`Precompile`] in order to declare at which addresses it will be called.
@@ -107,7 +107,7 @@ mod tests {
use crate::{
address::AddressMapper,
call_builder::{caller_funding, CallSetup},
pallet,
pezpallet,
precompiles::{
alloy::sol_types::{sol_data::Bytes, SolType},
tests::run_test_vectors,
@@ -158,9 +158,9 @@ mod tests {
ExtBuilder::default().build().execute_with(|| {
// given
let mapped_address = {
<Test as pallet::Config>::Currency::set_balance(&EVE, caller_funding::<Test>());
let _ = <Test as pallet::Config>::AddressMapper::map(&EVE);
<Test as pallet::Config>::AddressMapper::to_address(&EVE)
<Test as pezpallet::Config>::Currency::set_balance(&EVE, caller_funding::<Test>());
let _ = <Test as pezpallet::Config>::AddressMapper::map(&EVE);
<Test as pezpallet::Config>::AddressMapper::to_address(&EVE)
};
let mut call_setup = CallSetup::<Test>::default();
@@ -19,7 +19,7 @@
use crate::{
storage::ContractInfo, BalanceOf, Config, Error, ExecConfig, ExecOrigin as Origin, HoldReason,
Pallet, StorageDeposit as Deposit, LOG_TARGET,
Pezpallet, StorageDeposit as Deposit, LOG_TARGET,
};
use alloc::vec::Vec;
use core::{fmt::Debug, marker::PhantomData};
@@ -468,7 +468,7 @@ impl<T: Config> Ext<T> for ReservingExt {
match amount {
Deposit::Charge(amount) | Deposit::Refund(amount) if amount.is_zero() => (),
Deposit::Charge(amount) => {
<Pallet<T>>::charge_deposit(
<Pezpallet<T>>::charge_deposit(
Some(HoldReason::StorageDepositReserve),
origin,
contract,
@@ -477,7 +477,7 @@ impl<T: Config> Ext<T> for ReservingExt {
)?;
},
Deposit::Refund(amount) => {
<Pallet<T>>::refund_deposit(
<Pezpallet<T>>::refund_deposit(
HoldReason::StorageDepositReserve,
contract,
origin,
@@ -18,7 +18,7 @@
use super::{deposit_limit, GAS_LIMIT};
use crate::{
address::AddressMapper, evm::TransactionSigned, AccountIdOf, BalanceOf, Code, Config,
ContractResult, ExecConfig, ExecReturnValue, InstantiateReturnValue, OriginFor, Pallet, Weight,
ContractResult, ExecConfig, ExecReturnValue, InstantiateReturnValue, OriginFor, Pezpallet, Weight,
U256,
};
use alloc::{vec, vec::Vec};
@@ -60,7 +60,7 @@ macro_rules! builder {
#[doc = concat!("Build the ", stringify!($method), " call")]
pub fn build(self) -> $result {
Pallet::<T>::$method(
Pezpallet::<T>::$method(
$(self.$field,)*
)
}
@@ -151,7 +151,7 @@ builder!(
/// Set the call's evm_value using a native_value amount.
pub fn native_value(mut self, value: BalanceOf<T>) -> Self {
self.evm_value = Pallet::<T>::convert_native_to_evm(value);
self.evm_value = Pezpallet::<T>::convert_native_to_evm(value);
self
}
@@ -221,7 +221,7 @@ builder!(
/// Set the call's evm_value using a native_value amount.
pub fn native_value(mut self, value: BalanceOf<T>) -> Self {
self.evm_value = Pallet::<T>::convert_native_to_evm(value);
self.evm_value = Pezpallet::<T>::convert_native_to_evm(value);
self
}
+13 -13
View File
@@ -33,7 +33,7 @@ use crate::{
mock::MockHandler,
test_utils::*,
AccountId32Mapper, AddressMapper, BalanceOf, BalanceWithDust, Call, CodeInfoOf, Config,
DelegateInfo, ExecOrigin as Origin, ExecReturnValue, GenesisConfig, OriginFor, Pallet,
DelegateInfo, ExecOrigin as Origin, ExecReturnValue, GenesisConfig, OriginFor, Pezpallet,
PristineCode,
};
use pezframe_support::{
@@ -313,7 +313,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>;
}
parameter_types! {
@@ -455,7 +455,7 @@ impl Default for ExtBuilder {
}
impl ExtBuilder {
/// The pallet genesis config to use, or None if you don't want to include it.
/// The pezpallet genesis config to use, or None if you don't want to include it.
pub fn genesis_config(mut self, config: Option<crate::GenesisConfig<Test>>) -> Self {
self.genesis_config = config;
self
@@ -484,7 +484,7 @@ impl ExtBuilder {
.assimilate_storage(&mut t)
.unwrap();
let checking_account = Pallet::<Test>::checking_account();
let checking_account = Pezpallet::<Test>::checking_account();
pezpallet_balances::GenesisConfig::<Test> {
balances: vec![(checking_account.clone(), 1_000_000_000_000)],
@@ -501,9 +501,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)
});
@@ -513,7 +513,7 @@ impl ExtBuilder {
}
});
ext.execute_with(|| {
assert_ok!(Pallet::<Test>::map_account(RuntimeOrigin::signed(checking_account)));
assert_ok!(Pezpallet::<Test>::map_account(RuntimeOrigin::signed(checking_account)));
});
ext
}
@@ -531,7 +531,7 @@ impl Default for Origin<Test> {
}
/// A mock handler implementation for testing purposes.
pub struct MockHandlerImpl<T: crate::pallet::Config> {
pub struct MockHandlerImpl<T: crate::pezpallet::Config> {
// Always return this caller if set.
mock_caller: Option<H160>,
// Map of callee address to mocked call return value.
@@ -540,7 +540,7 @@ pub struct MockHandlerImpl<T: crate::pallet::Config> {
mock_delegate_caller: HashMap<Vec<u8>, DelegateInfo<T>>,
}
impl<T: crate::pallet::Config> MockHandler<T> for MockHandlerImpl<T> {
impl<T: crate::pezpallet::Config> MockHandler<T> for MockHandlerImpl<T> {
fn mock_caller(&self, _frames_len: usize) -> Option<OriginFor<T>> {
self.mock_caller.as_ref().map(|mock_caller| {
OriginFor::<T>::signed(T::AddressMapper::to_fallback_account_id(mock_caller))
@@ -607,7 +607,7 @@ fn ext_builder_with_genesis_config_works() {
assert!(<Test as Config>::AddressMapper::is_mapped(&EVE));
// EOA is created
assert_eq!(Pallet::<Test>::evm_balance(&eoa.address), eoa.balance);
assert_eq!(Pezpallet::<Test>::evm_balance(&eoa.address), eoa.balance);
// Contract is created
for contract in [pvm_contract, evm_contract] {
@@ -622,12 +622,12 @@ fn ext_builder_with_genesis_config_works() {
PristineCode::<Test>::get(&contract_info.code_hash).unwrap(),
contract_data.code
);
assert_eq!(Pallet::<Test>::evm_nonce(&contract.address), contract.nonce);
assert_eq!(Pallet::<Test>::evm_balance(&contract.address), contract.balance);
assert_eq!(Pezpallet::<Test>::evm_nonce(&contract.address), contract.nonce);
assert_eq!(Pezpallet::<Test>::evm_balance(&contract.address), contract.balance);
for (key, value) in contract_data.storage.iter() {
assert_eq!(
Pallet::<Test>::get_storage(contract.address, key.0),
Pezpallet::<Test>::get_storage(contract.address, key.0),
Ok(Some(value.0.to_vec()))
);
}
@@ -22,7 +22,7 @@ use crate::{
test_utils::{builder::Contract, deposit_limit, ALICE},
tests::{assert_ok, builder, Contracts, ExtBuilder, RuntimeOrigin, System, Test, Timestamp},
BalanceWithDust, Code, Config, EthBlock, EthBlockBuilderFirstValues, EthBlockBuilderIR,
EthereumBlock, Pallet, ReceiptGasInfo, ReceiptInfoData,
EthereumBlock, Pezpallet, ReceiptGasInfo, ReceiptInfoData,
};
use alloy_consensus::RlpEncodableReceipt;
use alloy_core::primitives::{FixedBytes, Log as AlloyLog};
@@ -87,7 +87,7 @@ fn transactions_are_captured() {
let Contract { addr: addr2, .. } =
builder::bare_instantiate(Code::Upload(gas_binary.clone())).build_and_unwrap_contract();
let balance =
Pallet::<Test>::convert_native_to_evm(BalanceWithDust::new_unchecked::<Test>(100, 10));
Pezpallet::<Test>::convert_native_to_evm(BalanceWithDust::new_unchecked::<Test>(100, 10));
<Test as Config>::FeeInfo::deposit_txfee(<Test as Config>::Currency::issue(5_000_000_000));
@@ -145,7 +145,7 @@ fn events_are_captured() {
// Bare call must not be captured.
builder::bare_instantiate(Code::Existing(code_hash)).build_and_unwrap_contract();
let balance =
Pallet::<Test>::convert_native_to_evm(BalanceWithDust::new_unchecked::<Test>(100, 10));
Pezpallet::<Test>::convert_native_to_evm(BalanceWithDust::new_unchecked::<Test>(100, 10));
<Test as Config>::FeeInfo::deposit_txfee(<Test as Config>::Currency::issue(
500_000_000_000,
@@ -155,7 +155,7 @@ fn events_are_captured() {
// The contract address is not exposed by the `eth_instantiate_with_code` call.
// Instead, extract the address from the frame system's last event.
let events = pezframe_system::Pallet::<Test>::events();
let events = pezframe_system::Pezpallet::<Test>::events();
let contract = events
.into_iter()
.filter_map(|event_record| match event_record.event {
@@ -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,
+52 -52
View File
@@ -41,7 +41,7 @@ use crate::{
tracing::trace,
weights::WeightInfo,
AccountInfo, AccountInfoOf, BalanceWithDust, Code, Combinator, Config, ContractInfo,
DebugSettings, DeletionQueueCounter, Error, ExecConfig, HoldReason, Origin, Pallet,
DebugSettings, DeletionQueueCounter, Error, ExecConfig, HoldReason, Origin, Pezpallet,
PristineCode, StorageDeposit, H160,
};
use assert_matches::assert_matches;
@@ -77,13 +77,13 @@ fn eth_call_transfer_with_dust_works() {
<Test as Config>::FeeInfo::deposit_txfee(<Test as Config>::Currency::issue(5_000_000_000));
let balance =
Pallet::<Test>::convert_native_to_evm(BalanceWithDust::new_unchecked::<Test>(100, 10));
Pezpallet::<Test>::convert_native_to_evm(BalanceWithDust::new_unchecked::<Test>(100, 10));
assert_ok!(builder::eth_call(addr)
.origin(Origin::EthTransaction(ALICE).into())
.value(balance)
.build());
assert_eq!(Pallet::<Test>::evm_balance(&addr), balance);
assert_eq!(Pezpallet::<Test>::evm_balance(&addr), balance);
});
}
@@ -91,10 +91,10 @@ fn eth_call_transfer_with_dust_works() {
fn set_evm_balance_for_eoa_works() {
ExtBuilder::default().existential_deposit(200).build().execute_with(|| {
let native_with_dust = BalanceWithDust::new_unchecked::<Test>(100, 10);
let evm_balance = Pallet::<Test>::convert_native_to_evm(native_with_dust);
let _ = Pallet::<Test>::set_evm_balance(&ALICE_ADDR, evm_balance);
let evm_balance = Pezpallet::<Test>::convert_native_to_evm(native_with_dust);
let _ = Pezpallet::<Test>::set_evm_balance(&ALICE_ADDR, evm_balance);
assert_eq!(Pallet::<Test>::evm_balance(&ALICE_ADDR), evm_balance);
assert_eq!(Pezpallet::<Test>::evm_balance(&ALICE_ADDR), evm_balance);
});
}
@@ -106,11 +106,11 @@ fn set_evm_balance_works() {
let Contract { addr, .. } =
builder::bare_instantiate(Code::Upload(binary)).build_and_unwrap_contract();
let native_with_dust = BalanceWithDust::new_unchecked::<Test>(100, 10);
let evm_value = Pallet::<Test>::convert_native_to_evm(native_with_dust);
let evm_value = Pezpallet::<Test>::convert_native_to_evm(native_with_dust);
assert_ok!(Pallet::<Test>::set_evm_balance(&addr, evm_value));
assert_ok!(Pezpallet::<Test>::set_evm_balance(&addr, evm_value));
assert_eq!(Pallet::<Test>::evm_balance(&addr), evm_value);
assert_eq!(Pezpallet::<Test>::evm_balance(&addr), evm_value);
});
}
@@ -128,10 +128,10 @@ fn contract_call_transfer_with_dust_works() {
builder::bare_instantiate(Code::Upload(binary_callee)).build_and_unwrap_contract();
let balance =
Pallet::<Test>::convert_native_to_evm(BalanceWithDust::new_unchecked::<Test>(100, 10));
Pezpallet::<Test>::convert_native_to_evm(BalanceWithDust::new_unchecked::<Test>(100, 10));
assert_ok!(builder::call(addr_caller).data((balance, addr_callee).encode()).build());
assert_eq!(Pallet::<Test>::evm_balance(&addr_callee), balance);
assert_eq!(Pezpallet::<Test>::evm_balance(&addr_callee), balance);
});
}
@@ -1019,7 +1019,7 @@ fn self_destruct_by_precompile_works() {
reason: <Test as Config>::RuntimeHoldReason::Contracts(
HoldReason::CodeUploadDepositReserve,
),
source: Pallet::<Test>::account_id(),
source: Pezpallet::<Test>::account_id(),
dest: ALICE,
amount: upload_deposit,
}),
@@ -1254,7 +1254,7 @@ fn call_return_code() {
// Contract calls into Django which is no valid contract
// This will be a balance transfer into a new account
// with more than the contract has which will make the transfer fail
let value = Pallet::<Test>::convert_native_to_evm(min_balance * 200);
let value = Pezpallet::<Test>::convert_native_to_evm(min_balance * 200);
let result = builder::bare_call(bob.addr)
.data(
AsRef::<[u8]>::as_ref(&DJANGO_ADDR)
@@ -1271,7 +1271,7 @@ fn call_return_code() {
let alice_before = get_balance(&ALICE_FALLBACK);
assert_eq!(get_balance(&DJANGO_FALLBACK), 0);
let value = Pallet::<Test>::convert_native_to_evm(1u64);
let value = Pezpallet::<Test>::convert_native_to_evm(1u64);
let result = builder::bare_call(bob.addr)
.data(
AsRef::<[u8]>::as_ref(&DJANGO_ADDR)
@@ -1291,7 +1291,7 @@ fn call_return_code() {
.build_and_unwrap_contract();
// Sending more than the contract has will make the transfer fail.
let value = Pallet::<Test>::convert_native_to_evm(min_balance * 300);
let value = Pezpallet::<Test>::convert_native_to_evm(min_balance * 300);
let result = builder::bare_call(bob.addr)
.data(
AsRef::<[u8]>::as_ref(&django.addr)
@@ -1306,7 +1306,7 @@ fn call_return_code() {
// Contract has enough balance but callee reverts because "1" is passed.
<Test as Config>::Currency::set_balance(&bob.account_id, min_balance + 1000);
let value = Pallet::<Test>::convert_native_to_evm(5u64);
let value = Pezpallet::<Test>::convert_native_to_evm(5u64);
let result = builder::bare_call(bob.addr)
.data(
AsRef::<[u8]>::as_ref(&django.addr)
@@ -2112,7 +2112,7 @@ fn instantiate_with_zero_balance_works() {
phase: Phase::Initialization,
event: RuntimeEvent::Balances(pezpallet_balances::Event::TransferAndHold {
source: ALICE,
dest: Pallet::<Test>::account_id(),
dest: Pezpallet::<Test>::account_id(),
transferred: 777,
reason: <Test as Config>::RuntimeHoldReason::Contracts(
HoldReason::CodeUploadDepositReserve,
@@ -2201,7 +2201,7 @@ fn instantiate_with_below_existential_deposit_works() {
phase: Phase::Initialization,
event: RuntimeEvent::Balances(pezpallet_balances::Event::TransferAndHold {
source: ALICE,
dest: Pallet::<Test>::account_id(),
dest: Pezpallet::<Test>::account_id(),
transferred: 777,
reason: <Test as Config>::RuntimeHoldReason::Contracts(
HoldReason::CodeUploadDepositReserve,
@@ -2373,7 +2373,7 @@ fn storage_deposit_callee_works() {
let callee = get_contract(&addr_callee);
let deposit = DepositPerByte::get() * 100 + DepositPerItem::get() * 1 + 48;
assert_eq!(Pallet::<Test>::evm_balance(&addr_caller), U256::zero());
assert_eq!(Pezpallet::<Test>::evm_balance(&addr_caller), U256::zero());
assert_eq!(callee.total_deposit(), deposit + contract_base_deposit(&addr_callee));
});
}
@@ -3389,7 +3389,7 @@ fn gas_price_api_works() {
assert_eq!(received.flags, ReturnFlags::empty());
assert_eq!(
u64::from_le_bytes(received.data[..].try_into().unwrap()),
u64::try_from(<Pallet<Test>>::evm_base_fee()).unwrap(),
u64::try_from(<Pezpallet<Test>>::evm_base_fee()).unwrap(),
);
});
}
@@ -3410,7 +3410,7 @@ fn base_fee_api_works() {
assert_eq!(received.flags, ReturnFlags::empty());
assert_eq!(
U256::from_little_endian(received.data[..].try_into().unwrap()),
<Pallet<Test>>::evm_base_fee(),
<Pezpallet<Test>>::evm_base_fee(),
);
});
}
@@ -3866,7 +3866,7 @@ fn origin_must_be_mapped() {
);
// after mapping eve is usable as an origin
<Pallet<Test>>::map_account(eve.clone()).unwrap();
<Pezpallet<Test>>::map_account(eve.clone()).unwrap();
assert_ok!(builder::bare_call(addr).origin(eve.clone()).build().result);
assert_ok!(builder::bare_instantiate(Code::Existing(hash)).origin(eve).build().result);
});
@@ -3933,7 +3933,7 @@ fn recovery_works() {
// she now uses the recovery function to move all funds from the fallback
// account to her real account
<Pallet<Test>>::dispatch_as_fallback_account(RuntimeOrigin::signed(EVE), Box::new(call))
<Pezpallet<Test>>::dispatch_as_fallback_account(RuntimeOrigin::signed(EVE), Box::new(call))
.unwrap();
assert_eq!(<Test as Config>::Currency::total_balance(&EVE_FALLBACK), 0);
assert_eq!(<Test as Config>::Currency::total_balance(&EVE), initial_contract_balance + 100);
@@ -3956,7 +3956,7 @@ fn gas_limit_api_works() {
assert_eq!(received.flags, ReturnFlags::empty());
assert_eq!(
u64::from_le_bytes(received.data[..].try_into().unwrap()),
<Pallet<Test>>::evm_block_gas_limit().saturated_into::<u64>(),
<Pezpallet<Test>>::evm_block_gas_limit().saturated_into::<u64>(),
);
});
}
@@ -4552,7 +4552,7 @@ fn pure_precompile_works() {
.build_and_unwrap_result();
assert_eq!(
Pallet::<Test>::evm_balance(&precompile_addr),
Pezpallet::<Test>::evm_balance(&precompile_addr),
U256::from(100),
"{description}: unexpected balance"
);
@@ -4655,7 +4655,7 @@ fn precompiles_work() {
// no account or contract info should be created for a NoInfo pre-compile
assert!(get_contract_checked(&precompile_addr).is_none());
assert!(!System::account_exists(&id));
assert_eq!(Pallet::<Test>::evm_balance(&precompile_addr), U256::zero());
assert_eq!(Pezpallet::<Test>::evm_balance(&precompile_addr), U256::zero());
assert_eq!(result.flags, ReturnFlags::empty());
assert_eq!(u32::from_le_bytes(result.data[..4].try_into().unwrap()), error_code as u32);
@@ -4700,7 +4700,7 @@ fn precompiles_with_info_creates_contract() {
// a pre-compile with contract info should create an account on first call
assert!(get_contract_checked(&precompile_addr).is_some());
assert!(System::account_exists(&id));
assert_eq!(Pallet::<Test>::evm_balance(&precompile_addr), U256::from(0));
assert_eq!(Pezpallet::<Test>::evm_balance(&precompile_addr), U256::from(0));
assert_eq!(result.flags, ReturnFlags::empty());
assert_eq!(u32::from_le_bytes(result.data[..4].try_into().unwrap()), error_code as u32);
@@ -5010,17 +5010,17 @@ fn eip3607_reject_tx_from_contract_or_precompile() {
.build();
assert_err!(result, DispatchError::BadOrigin);
let result = <Pallet<Test>>::upload_code(
let result = <Pezpallet<Test>>::upload_code(
RuntimeOrigin::signed(origin.clone()),
Default::default(),
<BalanceOf<Test>>::MAX,
);
assert_err!(result, DispatchError::BadOrigin);
let result = <Pallet<Test>>::map_account(RuntimeOrigin::signed(origin.clone()));
let result = <Pezpallet<Test>>::map_account(RuntimeOrigin::signed(origin.clone()));
assert_err!(result, DispatchError::BadOrigin);
let result = <Pallet<Test>>::dispatch_as_fallback_account(
let result = <Pezpallet<Test>>::dispatch_as_fallback_account(
RuntimeOrigin::signed(origin.clone()),
call.clone(),
);
@@ -5081,7 +5081,7 @@ fn eip3607_allow_tx_from_contract_or_precompile_if_debug_setting_configured() {
.build();
assert_ok!(result);
let result = <Pallet<Test>>::dispatch_as_fallback_account(
let result = <Pezpallet<Test>>::dispatch_as_fallback_account(
RuntimeOrigin::signed(origin.clone()),
Box::new(RuntimeCall::Balances(pezpallet_balances::Call::transfer_all {
dest: EVE,
@@ -5090,7 +5090,7 @@ fn eip3607_allow_tx_from_contract_or_precompile_if_debug_setting_configured() {
);
assert_ok!(result);
let result = <Pallet<Test>>::upload_code(
let result = <Pezpallet<Test>>::upload_code(
RuntimeOrigin::signed(origin.clone()),
binary.clone(),
<BalanceOf<Test>>::MAX,
@@ -5112,28 +5112,28 @@ fn get_set_storage_key_works() {
let contract_key_to_test = [1; 32];
// Checking non-existing keys gets created.
let storage_value = Pallet::<Test>::get_storage(addr, contract_key_to_test).unwrap();
let storage_value = Pezpallet::<Test>::get_storage(addr, contract_key_to_test).unwrap();
assert_eq!(storage_value, None);
let value_to_write = Some(vec![1, 2, 3]);
let write_result =
Pallet::<Test>::set_storage(addr, contract_key_to_test, value_to_write.clone())
Pezpallet::<Test>::set_storage(addr, contract_key_to_test, value_to_write.clone())
.unwrap();
assert_eq!(write_result, WriteOutcome::New);
let storage_value = Pallet::<Test>::get_storage(addr, contract_key_to_test).unwrap();
let storage_value = Pezpallet::<Test>::get_storage(addr, contract_key_to_test).unwrap();
assert_eq!(storage_value, value_to_write);
// Check existing keys overwrite
let new_value_to_write = Some(vec![5, 1, 2, 3]);
let write_result =
Pallet::<Test>::set_storage(addr, contract_key_to_test, new_value_to_write.clone())
Pezpallet::<Test>::set_storage(addr, contract_key_to_test, new_value_to_write.clone())
.unwrap();
assert_eq!(
write_result,
WriteOutcome::Overwritten(value_to_write.map(|v| v.len()).unwrap_or_default() as u32)
);
let storage_value = Pallet::<Test>::get_storage(addr, contract_key_to_test).unwrap();
let storage_value = Pezpallet::<Test>::get_storage(addr, contract_key_to_test).unwrap();
assert_eq!(storage_value, new_value_to_write);
});
}
@@ -5151,11 +5151,11 @@ fn get_set_storage_var_key_works() {
let contract_key_to_test = vec![1; 85];
// Checking non-existing keys gets created.
let storage_value =
Pallet::<Test>::get_storage_var_key(addr, contract_key_to_test.clone()).unwrap();
Pezpallet::<Test>::get_storage_var_key(addr, contract_key_to_test.clone()).unwrap();
assert_eq!(storage_value, None);
let value_to_write = Some(vec![1, 2, 3]);
let write_result = Pallet::<Test>::set_storage_var_key(
let write_result = Pezpallet::<Test>::set_storage_var_key(
addr,
contract_key_to_test.clone(),
value_to_write.clone(),
@@ -5163,13 +5163,13 @@ fn get_set_storage_var_key_works() {
.unwrap();
assert_eq!(write_result, WriteOutcome::New);
let storage_value =
Pallet::<Test>::get_storage_var_key(addr, contract_key_to_test.clone()).unwrap();
Pezpallet::<Test>::get_storage_var_key(addr, contract_key_to_test.clone()).unwrap();
assert_eq!(storage_value, value_to_write);
// Check existing keys overwrite
let new_value_to_write = Some(vec![5, 1, 2, 3]);
let write_result = Pallet::<Test>::set_storage_var_key(
let write_result = Pezpallet::<Test>::set_storage_var_key(
addr,
contract_key_to_test.clone(),
new_value_to_write.clone(),
@@ -5180,7 +5180,7 @@ fn get_set_storage_var_key_works() {
WriteOutcome::Overwritten(value_to_write.map(|v| v.len()).unwrap_or_default() as u32)
);
let storage_value =
Pallet::<Test>::get_storage_var_key(addr, contract_key_to_test.clone()).unwrap();
Pezpallet::<Test>::get_storage_var_key(addr, contract_key_to_test.clone()).unwrap();
assert_eq!(storage_value, new_value_to_write);
});
}
@@ -5198,13 +5198,13 @@ fn get_set_immutables_works() {
.build_and_unwrap_contract();
// Checking non-existing keys gets created.
let immutable_data = Pallet::<Test>::get_immutables(addr).unwrap();
let immutable_data = Pezpallet::<Test>::get_immutables(addr).unwrap();
assert_eq!(immutable_data, data.to_vec());
let new_data = [0xdeu8; 8].to_vec();
Pallet::<Test>::set_immutables(addr, BoundedVec::truncate_from(new_data.clone())).unwrap();
let immutable_data = Pallet::<Test>::get_immutables(addr).unwrap();
Pezpallet::<Test>::set_immutables(addr, BoundedVec::truncate_from(new_data.clone())).unwrap();
let immutable_data = Pezpallet::<Test>::get_immutables(addr).unwrap();
assert_eq!(immutable_data, new_data);
});
}
@@ -5310,7 +5310,7 @@ fn self_destruct_by_syscall_tracing_works() {
from: addr,
to: DJANGO_ADDR,
call_type: CallType::Selfdestruct,
value: Some(Pallet::<Test>::convert_native_to_evm(100_000u64)),
value: Some(Pezpallet::<Test>::convert_native_to_evm(100_000u64)),
..Default::default()
}],
..Default::default()
@@ -5357,10 +5357,10 @@ fn self_destruct_by_syscall_tracing_works() {
}
}"#;
let alice_balance_pre = Pallet::<Test>::evm_balance(&ALICE_ADDR);
let alice_balance_pre = Pezpallet::<Test>::evm_balance(&ALICE_ADDR);
let alice_balance_post = alice_balance_pre - 50_000_000u64;
let django_balance = Pallet::<Test>::evm_balance(&DJANGO_ADDR);
let contract_balance = Pallet::<Test>::evm_balance(&addr);
let django_balance = Pezpallet::<Test>::evm_balance(&DJANGO_ADDR);
let contract_balance = Pezpallet::<Test>::evm_balance(&addr);
let django_balance_post = contract_balance;
let json = json
@@ -5406,9 +5406,9 @@ fn self_destruct_by_syscall_tracing_works() {
}
}"#;
let alice_balance = Pallet::<Test>::evm_balance(&ALICE_ADDR);
let contract_balance = Pallet::<Test>::evm_balance(&addr);
let django_balance = Pallet::<Test>::evm_balance(&DJANGO_ADDR);
let alice_balance = Pezpallet::<Test>::evm_balance(&ALICE_ADDR);
let contract_balance = Pezpallet::<Test>::evm_balance(&addr);
let django_balance = Pezpallet::<Test>::evm_balance(&DJANGO_ADDR);
let json = json
.replace("{{ALICE_ADDR}}", &format!("{:#x}", ALICE_ADDR))
+14 -14
View File
@@ -27,7 +27,7 @@ use crate::{
AllowEvmBytecode, DebugFlag, ExtBuilder, RuntimeOrigin, Test,
},
tracing::trace,
Code, Config, Error, EthBlockBuilderFirstValues, GenesisConfig, Origin, Pallet, PristineCode,
Code, Config, Error, EthBlockBuilderFirstValues, GenesisConfig, Origin, Pezpallet, PristineCode,
};
use alloy_core::sol_types::{SolCall, SolInterface};
use pezframe_support::{
@@ -220,9 +220,9 @@ fn upload_evm_runtime_code_works() {
ExtBuilder::default().build().execute_with(|| {
let deployer = ALICE;
let deployer_addr = ALICE_ADDR;
let _ = Pallet::<Test>::set_evm_balance(&deployer_addr, 1_000_000_000.into());
let _ = Pezpallet::<Test>::set_evm_balance(&deployer_addr, 1_000_000_000.into());
let (uploaded_blob, _) = Pallet::<Test>::try_upload_code(
let (uploaded_blob, _) = Pezpallet::<Test>::try_upload_code(
deployer,
runtime_code.clone(),
crate::vm::BytecodeType::Evm,
@@ -252,19 +252,19 @@ fn upload_and_remove_code_works_for_evm() {
let (code, code_hash) = compile_module_with_type("Dummy", FixtureType::SolcRuntime).unwrap();
ExtBuilder::default().build().execute_with(|| {
let _ = Pallet::<Test>::set_evm_balance(&ALICE_ADDR, 5_000_000_000u64.into());
let _ = Pezpallet::<Test>::set_evm_balance(&ALICE_ADDR, 5_000_000_000u64.into());
// Ensure the code is not already stored.
assert!(!PristineCode::<Test>::contains_key(&code_hash));
// Upload the code.
assert_ok!(Pallet::<Test>::upload_code(RuntimeOrigin::signed(ALICE), code, 1000u64));
assert_ok!(Pezpallet::<Test>::upload_code(RuntimeOrigin::signed(ALICE), code, 1000u64));
// Ensure the contract was stored.
ensure_stored(code_hash);
// Remove the code.
assert_ok!(Pallet::<Test>::remove_code(RuntimeOrigin::signed(ALICE), code_hash));
assert_ok!(Pezpallet::<Test>::remove_code(RuntimeOrigin::signed(ALICE), code_hash));
// Ensure the code is no longer stored.
assert!(!PristineCode::<Test>::contains_key(&code_hash));
@@ -279,7 +279,7 @@ fn upload_fails_if_evm_bytecode_disabled() {
ExtBuilder::default().build().execute_with(|| {
// Upload should fail since support for EVM bytecode is disabled.
assert_err!(
Pallet::<Test>::upload_code(RuntimeOrigin::signed(ALICE), code, 1000u64),
Pezpallet::<Test>::upload_code(RuntimeOrigin::signed(ALICE), code, 1000u64),
<Error<Test>>::CodeRejected
);
});
@@ -305,7 +305,7 @@ fn dust_work_with_child_calls(fixture_type: FixtureType) {
.evm_value(value)
.build_and_unwrap_result();
assert_eq!(crate::Pallet::<Test>::evm_balance(&addr), value);
assert_eq!(crate::Pezpallet::<Test>::evm_balance(&addr), value);
});
}
@@ -440,12 +440,12 @@ fn prestate_diff_mode_tracing_works() {
let child_addr = crate::address::create1(&contract_addr, 1u64);
// Compute balances
let alice_balance_pre = Pallet::<Test>::convert_native_to_evm(
1_000_000_000_000 - Pallet::<Test>::min_balance(),
let alice_balance_pre = Pezpallet::<Test>::convert_native_to_evm(
1_000_000_000_000 - Pezpallet::<Test>::min_balance(),
);
let replace_placeholders = |json: &str| -> String {
let alice_balance_post = Pallet::<Test>::evm_balance(&ALICE_ADDR);
let alice_balance_post = Pezpallet::<Test>::evm_balance(&ALICE_ADDR);
let mut child_addr_bytes = [0u8; 32];
child_addr_bytes[12..32].copy_from_slice(child_addr.as_bytes());
@@ -523,7 +523,7 @@ fn eth_bizinikiwi_call_dispatches_successfully() {
assert!(EthBlockBuilderFirstValues::<Test>::get().is_none());
assert_ok!(Pallet::<Test>::eth_bizinikiwi_call(
assert_ok!(Pezpallet::<Test>::eth_bizinikiwi_call(
Origin::EthTransaction(ALICE).into(),
Box::new(transfer_call),
vec![]
@@ -544,7 +544,7 @@ fn eth_bizinikiwi_call_requires_eth_origin() {
// Should fail with non-EthTransaction origin
assert_noop!(
Pallet::<Test>::eth_bizinikiwi_call(
Pezpallet::<Test>::eth_bizinikiwi_call(
RuntimeOrigin::signed(ALICE),
Box::new(inner_call.into()),
vec![]
@@ -564,7 +564,7 @@ fn eth_bizinikiwi_call_tracks_weight_correctly() {
let transaction_encoded = vec![];
let transaction_encoded_len = transaction_encoded.len() as u32;
let result = Pallet::<Test>::eth_bizinikiwi_call(
let result = Pezpallet::<Test>::eth_bizinikiwi_call(
Origin::EthTransaction(ALICE).into(),
Box::new(inner_call.clone().into()),
transaction_encoded,
@@ -21,7 +21,7 @@ use crate::{
test_utils::{builder::Contract, ALICE},
tests::{builder, Contracts, ExtBuilder, System, Test, Timestamp},
vm::evm::DIFFICULTY,
Code, Config, DryRunConfig, ExecConfig, Pallet,
Code, Config, DryRunConfig, ExecConfig, Pezpallet,
};
use alloy_core::sol_types::{SolCall, SolInterface};
@@ -179,7 +179,7 @@ fn gaslimit_works(fixture_type: FixtureType) {
.data(BlockInfo::BlockInfoCalls::gaslimit(BlockInfo::gaslimitCall {}).abi_encode())
.build_and_unwrap_result();
let decoded = BlockInfo::gaslimitCall::abi_decode_returns(&result.data).unwrap();
assert_eq!(<Pallet<Test>>::evm_block_gas_limit(), decoded.into());
assert_eq!(<Pezpallet<Test>>::evm_block_gas_limit(), decoded.into());
});
}
@@ -197,7 +197,7 @@ fn base_fee_works(fixture_type: FixtureType) {
.data(BlockInfo::BlockInfoCalls::basefee(BlockInfo::basefeeCall {}).abi_encode())
.build_and_unwrap_result();
let decoded = BlockInfo::basefeeCall::abi_decode_returns(&result.data).unwrap();
assert_eq!(<crate::Pallet<Test>>::evm_base_fee().as_u64(), decoded);
assert_eq!(<crate::Pezpallet<Test>>::evm_base_fee().as_u64(), decoded);
});
}
@@ -522,7 +522,7 @@ fn mock_delegatecall_hook_works(caller_type: FixtureType, callee_type: FixtureTy
DelegateInfo {
callee: callee_addr,
caller: ExecOrigin::<Test>::from_runtime_origin(crate::OriginFor::<Test>::signed(
<Test as crate::pallet::Config>::AddressMapper::to_fallback_account_id(
<Test as crate::pezpallet::Config>::AddressMapper::to_fallback_account_id(
&caller_addr,
),
)).expect("Conversion to ExecOrigin must work"),
@@ -23,7 +23,7 @@ use crate::{
test_utils::{get_balance, get_contract_checked},
Contracts, ExtBuilder, RuntimeOrigin, Test,
},
BalanceOf, Code, Config, Pallet, H160,
BalanceOf, Code, Config, Pezpallet, H160,
};
use alloy_core::sol_types::{SolCall, SolConstructor};
use pezframe_support::traits::fungible::Mutate;
@@ -202,12 +202,12 @@ fn syscall_passes_for_direct_delegate_same_tx(fixture_type: FixtureType) {
if fixture_type == FixtureType::Resolc {
// Need to pre-upload code for PVM
let _ = <Pallet<Test>>::upload_code(
let _ = <Pezpallet<Test>>::upload_code(
RuntimeOrigin::signed(ALICE.clone()),
code.clone(),
<BalanceOf<Test>>::MAX,
);
let _ = <Pallet<Test>>::upload_code(
let _ = <Pezpallet<Test>>::upload_code(
RuntimeOrigin::signed(ALICE.clone()),
delegator_code.clone(),
<BalanceOf<Test>>::MAX,
@@ -402,7 +402,7 @@ fn sent_funds_after_terminate_shall_be_credited_to_beneficiary_base_case(
if fixture_type == FixtureType::Resolc {
// Need to pre-upload code for PVM
let _ = <Pallet<Test>>::upload_code(
let _ = <Pezpallet<Test>>::upload_code(
RuntimeOrigin::signed(ALICE.clone()),
code.clone(),
<BalanceOf<Test>>::MAX,
@@ -615,7 +615,7 @@ fn terminate_twice(fixture_type: FixtureType, method1: u8, method2: u8) {
if fixture_type == FixtureType::Resolc {
// Need to pre-upload code for PVM
let _ = <Pallet<Test>>::upload_code(
let _ = <Pezpallet<Test>>::upload_code(
RuntimeOrigin::signed(ALICE.clone()),
code.clone(),
<BalanceOf<Test>>::MAX,
@@ -669,7 +669,7 @@ fn call_after_terminate_works(fixture_type: FixtureType, method: u8) {
if fixture_type == FixtureType::Resolc {
// Need to pre-upload code for PVM
let _ = <Pallet<Test>>::upload_code(
let _ = <Pezpallet<Test>>::upload_code(
RuntimeOrigin::signed(ALICE.clone()),
code.clone(),
<BalanceOf<Test>>::MAX,
@@ -20,7 +20,7 @@
use crate::{
test_utils::{builder::Contract, ALICE, ALICE_ADDR},
tests::{builder, ExtBuilder, Test},
Code, Config, Pallet,
Code, Config, Pezpallet,
};
use alloy_core::sol_types::{SolCall, SolInterface};
use pezframe_support::traits::fungible::Mutate;
@@ -46,7 +46,7 @@ fn gasprice_works(fixture_type: FixtureType) {
)
.build_and_unwrap_result();
let decoded = TransactionInfo::gaspriceCall::abi_decode_returns(&result.data).unwrap();
assert_eq!(<Pallet<Test>>::evm_base_fee().as_u64(), decoded);
assert_eq!(<Pezpallet<Test>>::evm_base_fee().as_u64(), decoded);
});
}
@@ -85,7 +85,7 @@ pub fn gaslimit<E: Ext>(interpreter: &mut Interpreter<E>) -> ControlFlow<Halt> {
/// EIP-3198: BASEFEE opcode
pub fn basefee<E: Ext>(interpreter: &mut Interpreter<E>) -> ControlFlow<Halt> {
interpreter.ext.charge_or_halt(RuntimeCosts::BaseFee)?;
interpreter.stack.push(crate::Pallet::<E::T>::evm_base_fee())?;
interpreter.stack.push(crate::Pezpallet::<E::T>::evm_base_fee())?;
ControlFlow::Continue(())
}
@@ -23,7 +23,7 @@ use crate::{
evm::{interpreter::Halt, util::as_usize_or_halt, Interpreter},
Ext, RuntimeCosts,
},
Code, DebugSettings, Error, Pallet, Weight, H160, LOG_TARGET, U256,
Code, DebugSettings, Error, Pezpallet, Weight, H160, LOG_TARGET, U256,
};
use alloc::{vec, vec::Vec};
pub use call_helpers::{calc_call_gas, get_memory_in_and_out_ranges};
@@ -48,8 +48,8 @@ pub fn create<const IS_CREATE2: bool, E: Ext>(
interpreter.ext.charge_or_halt(RuntimeCosts::Create {
init_code_len: len as u32,
balance_transfer: Pallet::<E::T>::has_balance(value),
dust_transfer: Pallet::<E::T>::has_dust(value),
balance_transfer: Pezpallet::<E::T>::has_balance(value),
dust_transfer: Pezpallet::<E::T>::has_dust(value),
})?;
let mut code = Vec::new();
@@ -21,7 +21,7 @@ use crate::{
evm::{interpreter::Halt, util::as_usize_or_halt, Interpreter},
Ext,
},
Pallet, RuntimeCosts,
Pezpallet, RuntimeCosts,
};
use core::ops::{ControlFlow, Range};
use revm::interpreter::interpreter_action::CallScheme;
@@ -102,7 +102,7 @@ pub fn calc_call_gas<'a, E: Ext>(
.ext
.gas_meter_mut()
.charge_or_halt(RuntimeCosts::CallTransferSurcharge {
dust_transfer: Pallet::<E::T>::has_dust(value),
dust_transfer: Pezpallet::<E::T>::has_dust(value),
})?;
}
+7 -7
View File
@@ -31,7 +31,7 @@ use crate::{
storage::meter::NestedMeter,
weights::WeightInfo,
AccountIdOf, BalanceOf, CodeInfoOf, CodeRemoved, Config, Error, ExecConfig, ExecError,
HoldReason, Pallet, PristineCode, StorageDeposit, Weight, LOG_TARGET,
HoldReason, Pezpallet, PristineCode, StorageDeposit, Weight, LOG_TARGET,
};
use alloc::vec::Vec;
use codec::{Decode, Encode, MaxEncodedLen};
@@ -165,9 +165,9 @@ impl<T: Config> ContractBlob<T> {
if let Some(code_info) = existing {
ensure!(code_info.refcount == 0, <Error<T>>::CodeInUse);
ensure!(&code_info.owner == origin, BadOrigin);
<Pallet<T>>::refund_deposit(
<Pezpallet<T>>::refund_deposit(
HoldReason::CodeUploadDepositReserve,
&Pallet::<T>::account_id(),
&Pezpallet::<T>::account_id(),
&code_info.owner,
code_info.deposit,
None,
@@ -201,10 +201,10 @@ impl<T: Config> ContractBlob<T> {
None => {
let deposit = self.code_info.deposit;
<Pallet<T>>::charge_deposit(
<Pezpallet<T>>::charge_deposit(
Some(HoldReason::CodeUploadDepositReserve),
&self.code_info.owner,
&Pallet::<T>::account_id(),
&Pezpallet::<T>::account_id(),
deposit,
exec_config,
)
@@ -287,9 +287,9 @@ impl<T: Config> CodeInfo<T> {
let Some(code_info) = existing else { return Err(Error::<T>::CodeNotFound.into()) };
if code_info.refcount == 1 {
<Pallet<T>>::refund_deposit(
<Pezpallet<T>>::refund_deposit(
HoldReason::CodeUploadDepositReserve,
&Pallet::<T>::account_id(),
&Pezpallet::<T>::account_id(),
&code_info.owner,
code_info.deposit,
None,
+4 -4
View File
@@ -28,7 +28,7 @@ use crate::{
limits,
precompiles::{All as AllPrecompiles, Precompiles},
primitives::ExecReturnValue,
Code, Config, Error, Pallet, RuntimeCosts, LOG_TARGET, SENTINEL,
Code, Config, Error, Pezpallet, RuntimeCosts, LOG_TARGET, SENTINEL,
};
use alloc::{vec, vec::Vec};
use codec::Encode;
@@ -683,7 +683,7 @@ impl<'a, E: Ext, M: ?Sized + Memory<E::T>> Runtime<'a, E, M> {
}
self.charge_gas(RuntimeCosts::CallTransferSurcharge {
dust_transfer: Pallet::<E::T>::has_dust(value),
dust_transfer: Pezpallet::<E::T>::has_dust(value),
})?;
}
self.ext.call(
@@ -754,8 +754,8 @@ impl<'a, E: Ext, M: ?Sized + Memory<E::T>> Runtime<'a, E, M> {
Ok(value) => {
self.charge_gas(RuntimeCosts::Instantiate {
input_data_len,
balance_transfer: Pallet::<E::T>::has_balance(value),
dust_transfer: Pallet::<E::T>::has_dust(value),
balance_transfer: Pezpallet::<E::T>::has_balance(value),
dust_transfer: Pezpallet::<E::T>::has_dust(value),
})?;
value
},
+1 -1
View File
@@ -660,7 +660,7 @@ pub mod env {
Ok(self.write_fixed_sandbox_output(
memory,
out_ptr,
&Pallet::<E::T>::evm_base_fee().to_little_endian(),
&Pezpallet::<E::T>::evm_base_fee().to_little_endian(),
false,
already_charged,
)?)
+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_revive
// --pezpallet=pezpallet_revive
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/revive/src/weights.rs
// --wasm-execution=compiled