mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
feat(operator): 🏗️ Add Preimage pallet (#23)
Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
This commit is contained in:
parent
35a80814ba
commit
841e8bca9e
6 changed files with 52 additions and 2 deletions
17
operator/Cargo.lock
generated
17
operator/Cargo.lock
generated
|
|
@ -1609,6 +1609,7 @@ dependencies = [
|
|||
"pallet-grandpa",
|
||||
"pallet-mmr",
|
||||
"pallet-multisig",
|
||||
"pallet-preimage",
|
||||
"pallet-session",
|
||||
"pallet-sudo",
|
||||
"pallet-timestamp",
|
||||
|
|
@ -5955,6 +5956,22 @@ dependencies = [
|
|||
"sp-runtime",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pallet-preimage"
|
||||
version = "38.0.0"
|
||||
source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2409#43d7b1e329f50a37cbd67e15aae70c60556cbb59"
|
||||
dependencies = [
|
||||
"frame-benchmarking",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"log",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"sp-core",
|
||||
"sp-io",
|
||||
"sp-runtime",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pallet-session"
|
||||
version = "38.0.0"
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ pallet-babe = { git = "https://github.com/paritytech/polkadot-sdk", branch = "st
|
|||
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false }
|
||||
pallet-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false }
|
||||
pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false }
|
||||
pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false }
|
||||
pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false }
|
||||
pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false }
|
||||
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false }
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ pallet-babe.workspace = true
|
|||
pallet-balances.workspace = true
|
||||
pallet-grandpa.workspace = true
|
||||
pallet-multisig.workspace = true
|
||||
pallet-preimage.workspace = true
|
||||
pallet-session.workspace = true
|
||||
pallet-sudo.workspace = true
|
||||
pallet-timestamp.workspace = true
|
||||
|
|
@ -95,7 +96,7 @@ std = [
|
|||
"pallet-grandpa/std",
|
||||
"pallet-multisig/std",
|
||||
"pallet-mmr/std",
|
||||
"pallet-session/std",
|
||||
"pallet-preimage/std",
|
||||
"pallet-session/std",
|
||||
"pallet-sudo/std",
|
||||
"pallet-timestamp/std",
|
||||
|
|
@ -144,6 +145,7 @@ runtime-benchmarks = [
|
|||
"pallet-balances/runtime-benchmarks",
|
||||
"pallet-grandpa/runtime-benchmarks",
|
||||
"pallet-multisig/runtime-benchmarks",
|
||||
"pallet-preimage/runtime-benchmarks",
|
||||
"pallet-sudo/runtime-benchmarks",
|
||||
"pallet-timestamp/runtime-benchmarks",
|
||||
"pallet-utility/runtime-benchmarks",
|
||||
|
|
@ -166,6 +168,7 @@ try-runtime = [
|
|||
"pallet-balances/try-runtime",
|
||||
"pallet-grandpa/try-runtime",
|
||||
"pallet-multisig/try-runtime",
|
||||
"pallet-preimage/try-runtime",
|
||||
"pallet-session/try-runtime",
|
||||
"pallet-sudo/try-runtime",
|
||||
"pallet-timestamp/try-runtime",
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ frame_benchmarking::define_benchmarks!(
|
|||
[frame_benchmarking, BaselineBench::<Runtime>]
|
||||
[frame_system, SystemBench::<Runtime>]
|
||||
[pallet_balances, Balances]
|
||||
[pallet_preimage, Preimage]
|
||||
[pallet_multisig, Multisig]
|
||||
[pallet_timestamp, Timestamp]
|
||||
[pallet_utility, Utility]
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@
|
|||
use crate::EvmChainId;
|
||||
use crate::OriginCaller;
|
||||
use crate::Timestamp;
|
||||
use crate::STORAGE_BYTE_FEE;
|
||||
use crate::SUPPLY_FACTOR;
|
||||
use crate::UNIT;
|
||||
use crate::{Historical, SessionKeys, ValidatorSet};
|
||||
|
||||
// Local module imports
|
||||
|
|
@ -38,6 +41,8 @@ use super::{
|
|||
use codec::{Decode, Encode};
|
||||
use datahaven_runtime_common::gas::WEIGHT_PER_GAS;
|
||||
use datahaven_runtime_common::time::{EpochDurationInBlocks, MILLISECS_PER_BLOCK, MINUTES};
|
||||
use frame_support::traits::fungible::HoldConsideration;
|
||||
use frame_support::traits::LinearStoragePrice;
|
||||
use frame_support::{
|
||||
derive_impl, parameter_types,
|
||||
traits::{
|
||||
|
|
@ -233,7 +238,27 @@ impl pallet_balances::Config for Runtime {
|
|||
type FreezeIdentifier = RuntimeFreezeReason;
|
||||
type MaxFreezes = VariantCountOf<RuntimeFreezeReason>;
|
||||
type RuntimeHoldReason = RuntimeHoldReason;
|
||||
type RuntimeFreezeReason = RuntimeHoldReason;
|
||||
type RuntimeFreezeReason = RuntimeFreezeReason;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const PreimageBaseDeposit: Balance = 5 * UNIT * SUPPLY_FACTOR ;
|
||||
pub const PreimageByteDeposit: Balance = STORAGE_BYTE_FEE;
|
||||
pub const PreimageHoldReason: RuntimeHoldReason =
|
||||
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
|
||||
}
|
||||
|
||||
impl pallet_preimage::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Currency = Balances;
|
||||
type ManagerOrigin = EnsureRoot<AccountId>;
|
||||
type Consideration = HoldConsideration<
|
||||
AccountId,
|
||||
Balances,
|
||||
PreimageHoldReason,
|
||||
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
|
||||
>;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
|
|
|||
|
|
@ -258,6 +258,9 @@ mod runtime {
|
|||
#[runtime::pallet_index(20)]
|
||||
pub type Utility = pallet_utility;
|
||||
|
||||
#[runtime::pallet_index(22)]
|
||||
pub type Preimage = pallet_preimage;
|
||||
|
||||
#[runtime::pallet_index(24)]
|
||||
pub type Multisig = pallet_multisig;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue