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
@@ -10,7 +10,7 @@ edition.workspace = true
license = "Apache-2.0"
homepage.workspace = true
repository.workspace = true
description = "FRAME oracle pallet for off-chain data"
description = "FRAME oracle pezpallet for off-chain data"
readme = "README.md"
documentation = "https://docs.rs/pezpallet-oracle"
+8 -8
View File
@@ -2,21 +2,21 @@
## Overview
The Oracle pallet provides a decentralized and trustworthy way to bring external, off-chain data onto the
The Oracle pezpallet provides a decentralized and trustworthy way to bring external, off-chain data onto the
blockchain. It allows a configurable set of oracle operators to feed data, such as prices, into the system.
This data can then be used by other pallets.
The pallet is designed to be flexible and can be configured to use different data sources and aggregation
The pezpallet is designed to be flexible and can be configured to use different data sources and aggregation
strategies.
## Key Concepts
- **Oracle Operators**: A set of trusted accounts that are authorized to submit data to the oracle. The pallet
- **Oracle Operators**: A set of trusted accounts that are authorized to submit data to the oracle. The pezpallet
uses the `frame_support::traits::SortedMembers` trait to manage the set of operators. This allows using pallets
like `pezpallet-membership` to manage the oracle members.
- **Data Feeds**: Operators feed data as key-value pairs. The `OracleKey` is used to identify the data being fed
(e.g., a specific currency pair), and the `OracleValue` is the data itself (e.g., the price).
- **Data Aggregation**: The pallet can be configured with a `CombineData` implementation to aggregate the raw
- **Data Aggregation**: The pezpallet can be configured with a `CombineData` implementation to aggregate the raw
values submitted by individual operators into a single, trusted value. A default implementation
`DefaultCombineData` is provided, which takes the median of the values.
- **Timestamped Data**: All data submitted to the oracle is timestamped, allowing consumers of the data to know
@@ -36,22 +36,22 @@ strategies.
### Data Providers
The pallet implements the `DataProvider` and `DataProviderExtended` traits, allowing other pallets to easily
The pezpallet implements the `DataProvider` and `DataProviderExtended` traits, allowing other pallets to easily
consume the oracle data.
## Usage
To use the oracle pallet, you need to:
To use the oracle pezpallet, you need to:
1. **Add it to your runtime's `Cargo.toml`**.
2. **Implement the `Config` trait** for the pallet in your runtime. This includes specifying:
2. **Implement the `Config` trait** for the pezpallet in your runtime. This includes specifying:
- `OnNewData`: A hook to perform actions when new data is received.
- `CombineData`: The data aggregation strategy.
- `Time`: The time provider.
- `OracleKey`, `OracleValue`: The types for the data key and value.
- `RootOperatorAccountId`: An account with sudo-like permissions for the oracle.
- `Members`: The source of oracle operators.
3. **Add the pallet to your runtime's `construct_runtime!` macro**.
3. **Add the pezpallet to your runtime's `construct_runtime!` macro**.
Once configured, authorized operators can call `feed_values` to submit data, and other pallets can use the
`DataProvider` trait to read the aggregated data.
@@ -10,7 +10,7 @@ edition.workspace = true
license = "Apache-2.0"
homepage.workspace = true
repository.workspace = true
description = "Runtime API for the oracle pallet."
description = "Runtime API for the oracle pezpallet."
documentation = "https://docs.rs/pezpallet-oracle-runtime-api"
[dependencies]
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Runtime API definition for the oracle pallet.
//! Runtime API definition for the oracle pezpallet.
//!
//! This crate provides runtime APIs that allow external clients to query oracle data
//! from the blockchain. The APIs are designed to be efficient and provide access to
@@ -16,12 +16,12 @@
// limitations under the License.
use super::*;
use crate::Pallet as Oracle;
use crate::Pezpallet as Oracle;
use pezframe_benchmarking::v2::*;
use pezframe_support::assert_ok;
use pezframe_system::{Pallet as System, RawOrigin};
use pezframe_system::{Pezpallet as System, RawOrigin};
#[instance_benchmarks]
mod benchmarks {
+41 -41
View File
@@ -17,22 +17,22 @@
//! # Oracle
//!
//! A pallet that provides a decentralized and trustworthy way to bring external, off-chain data
//! A pezpallet that provides a decentralized and trustworthy way to bring external, off-chain data
//! onto the blockchain.
//!
//! ## Pallet API
//! ## Pezpallet API
//!
//! See the [`pallet`] module for more information about the interfaces this pallet exposes,
//! See the [`pezpallet`] module for more information about the interfaces this pezpallet exposes,
//! including its configuration trait, dispatchables, storage items, events and errors.
//!
//! ## Overview
//!
//! The Oracle pallet enables blockchain applications to access real-world data through a
//! The Oracle pezpallet enables blockchain applications to access real-world data through a
//! decentralized network of trusted data providers. It's designed to be flexible and can handle
//! various types of external data such as cryptocurrency prices, weather data, sports scores, or
//! any other off-chain information that needs to be brought on-chain.
//!
//! The pallet operates on a permissioned model where only authorized oracle operators can submit
//! The pezpallet operates on a permissioned model where only authorized oracle operators can submit
//! data. This ensures data quality and prevents spam while maintaining decentralization through
//! multiple independent operators. The system aggregates data from multiple sources using
//! configurable algorithms, typically taking the median to resist outliers and manipulation
@@ -61,7 +61,7 @@
//!
//! ### Design
//!
//! The pallet uses a dual-storage approach:
//! The pezpallet uses a dual-storage approach:
//! - [`RawValues`]: Stores individual operator submissions with timestamps
//! - [`Values`]: Stores the final aggregated values after processing
//!
@@ -106,7 +106,7 @@ mod mock;
mod tests;
pub mod weights;
pub use pallet::*;
pub use pezpallet::*;
pub use weights::WeightInfo;
#[cfg(feature = "runtime-benchmarks")]
@@ -127,8 +127,8 @@ impl<OracleKey, OracleValue, L: Get<u32>> BenchmarkHelper<OracleKey, OracleValue
}
}
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use super::*;
pub(crate) type MomentOf<T, I = ()> = <<T as Config<I>>::Time as Time>::Moment;
@@ -158,7 +158,7 @@ pub mod pallet {
pub timestamp: Moment,
}
#[pallet::config]
#[pezpallet::config]
pub trait Config<I: 'static = ()>: pezframe_system::Config {
/// A hook to be called when new data is received.
///
@@ -192,11 +192,11 @@ pub mod pallet {
/// temperatures, scores).
type OracleValue: Parameter + Member + Ord + MaxEncodedLen;
/// The pallet ID.
/// The pezpallet ID.
///
/// Will be used to derive the pallet's account, which is used as the oracle account
/// Will be used to derive the pezpallet's account, which is used as the oracle account
/// when values are fed by root.
#[pallet::constant]
#[pezpallet::constant]
type PalletId: Get<PalletId>;
/// The source of oracle members.
@@ -206,20 +206,20 @@ pub mod pallet {
/// management of oracle operators.
type Members: SortedMembers<Self::AccountId>;
/// Weight information for extrinsics in this pallet.
/// Weight information for extrinsics in this pezpallet.
type WeightInfo: WeightInfo;
/// The maximum number of oracle operators that can feed data in a single block.
#[pallet::constant]
#[pezpallet::constant]
type MaxHasDispatchedSize: Get<u32>;
/// The maximum number of key-value pairs that can be submitted in a single extrinsic.
#[pallet::constant]
#[pezpallet::constant]
type MaxFeedValues: Get<u32>;
/// A helper trait for benchmarking oracle operations.
///
/// Provides sample data for benchmarking the oracle pallet, allowing accurate
/// Provides sample data for benchmarking the oracle pezpallet, allowing accurate
/// weight calculations and performance testing.
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper: BenchmarkHelper<
@@ -229,7 +229,7 @@ pub mod pallet {
>;
}
#[pallet::error]
#[pezpallet::error]
pub enum Error<T, I = ()> {
/// The sender is not a member of the oracle and does not have
/// permission to feed data.
@@ -240,8 +240,8 @@ pub mod pallet {
ExceedsMaxHasDispatchedSize,
}
#[pallet::event]
#[pallet::generate_deposit(pub(crate) fn deposit_event)]
#[pezpallet::event]
#[pezpallet::generate_deposit(pub(crate) fn deposit_event)]
pub enum Event<T: Config<I>, I: 'static = ()> {
/// New data has been fed into the oracle.
NewFeedData {
@@ -263,8 +263,8 @@ pub mod pallet {
/// No storage deposits are required as this data is considered essential for the oracle's
/// operation and data integrity. The storage cost is borne by the blockchain as part of the
/// oracle infrastructure.
#[pallet::storage]
#[pallet::getter(fn raw_values)]
#[pezpallet::storage]
#[pezpallet::getter(fn raw_values)]
pub type RawValues<T: Config<I>, I: 'static = ()> = StorageDoubleMap<
_,
Twox64Concat,
@@ -277,8 +277,8 @@ pub mod pallet {
/// The aggregated values for each oracle key.
///
/// Maps `OracleKey` to `TimestampedValue`.
#[pallet::storage]
#[pallet::getter(fn values)]
#[pezpallet::storage]
#[pezpallet::getter(fn values)]
pub type Values<T: Config<I>, I: 'static = ()> =
StorageMap<_, Twox64Concat, <T as Config<I>>::OracleKey, TimestampedValueOf<T, I>>;
@@ -290,15 +290,15 @@ pub mod pallet {
///
/// The storage is cleared at the end of each block in the `on_finalize` hook, resetting
/// the state for the next block.
#[pallet::storage]
#[pezpallet::storage]
pub(crate) type HasDispatched<T: Config<I>, I: 'static = ()> =
StorageValue<_, BoundedBTreeSet<T::AccountId, T::MaxHasDispatchedSize>, ValueQuery>;
#[pallet::pallet]
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
#[pezpallet::pezpallet]
pub struct Pezpallet<T, I = ()>(PhantomData<(T, I)>);
#[pallet::hooks]
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {
#[pezpallet::hooks]
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pezpallet<T, I> {
/// `on_initialize` to return the weight used in `on_finalize`.
fn on_initialize(_n: BlockNumberFor<T>) -> Weight {
T::WeightInfo::on_finalize()
@@ -310,21 +310,21 @@ pub mod pallet {
}
}
#[pallet::view_functions]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
#[pezpallet::view_functions]
impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
/// Retrieve the aggregated oracle value for a specific key, including its timestamp.
pub fn get_value(key: T::OracleKey) -> Option<TimestampedValueOf<T, I>> {
Self::get(&key)
}
/// Retrieve every aggregated oracle value tracked by the pallet.
/// Retrieve every aggregated oracle value tracked by the pezpallet.
pub fn all_values() -> Vec<(T::OracleKey, TimestampedValueOf<T, I>)> {
<Values<T, I>>::iter().collect()
}
}
#[pallet::call]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
#[pezpallet::call]
impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
/// Feeds external data values into the oracle system.
///
/// ## Dispatch Origin
@@ -354,8 +354,8 @@ pub mod pallet {
/// ## Events
///
/// - [`Event::NewFeedData`]: Emitted when data is successfully fed into the oracle
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::feed_values(values.len() as u32))]
#[pezpallet::call_index(0)]
#[pezpallet::weight(T::WeightInfo::feed_values(values.len() as u32))]
pub fn feed_values(
origin: OriginFor<T>,
values: BoundedVec<(T::OracleKey, T::OracleValue), T::MaxFeedValues>,
@@ -378,7 +378,7 @@ pub mod pallet {
}
}
impl<T: Config<I>, I: 'static> Pallet<T, I> {
impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
fn get_pallet_account() -> T::AccountId {
T::PalletId::get().into_account_truncating()
}
@@ -429,7 +429,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
}
}
impl<T: Config<I>, I: 'static> ChangeMembers<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> ChangeMembers<T::AccountId> for Pezpallet<T, I> {
fn change_members_sorted(
_incoming: &[T::AccountId],
outgoing: &[T::AccountId],
@@ -446,13 +446,13 @@ impl<T: Config<I>, I: 'static> ChangeMembers<T::AccountId> for Pallet<T, I> {
}
}
impl<T: Config<I>, I: 'static> DataProvider<T::OracleKey, T::OracleValue> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> DataProvider<T::OracleKey, T::OracleValue> for Pezpallet<T, I> {
fn get(key: &T::OracleKey) -> Option<T::OracleValue> {
Self::get(key).map(|timestamped_value| timestamped_value.value)
}
}
impl<T: Config<I>, I: 'static> DataProviderExtended<T::OracleKey, TimestampedValueOf<T, I>>
for Pallet<T, I>
for Pezpallet<T, I>
{
fn get_all_values() -> impl Iterator<Item = (T::OracleKey, Option<TimestampedValueOf<T, I>>)> {
<Values<T, I>>::iter().map(|(k, v)| (k, Some(v)))
@@ -460,7 +460,7 @@ impl<T: Config<I>, I: 'static> DataProviderExtended<T::OracleKey, TimestampedVal
}
impl<T: Config<I>, I: 'static> DataFeeder<T::OracleKey, T::OracleValue, T::AccountId>
for Pallet<T, I>
for Pezpallet<T, I>
{
fn feed_value(
who: Option<T::AccountId>,
@@ -27,10 +27,10 @@
// frame-omni-bencher
// v1
// benchmark
// pallet
// pezpallet
// --extrinsic=all
// --runtime=target/production/wbuild/pez-kitchensink-runtime/pez_kitchensink_runtime.wasm
// --pallet=pezpallet_oracle
// --pezpallet=pezpallet_oracle
// --header=bizinikiwi/HEADER-APACHE2
// --output=bizinikiwi/pezframe/honzon/oracle/src/weights.rs
// --wasm-execution=compiled