Skip to content

Commit

Permalink
integrate teerdays (#299)
Browse files Browse the repository at this point in the history
* bump version

* add teerdays pallet

* benchmark all pallets again

* taploi fmt
  • Loading branch information
brenzi authored Aug 12, 2024
1 parent b2fe75e commit 49c2ac9
Show file tree
Hide file tree
Showing 35 changed files with 1,138 additions and 971 deletions.
77 changes: 58 additions & 19 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pallet-claims = { default-features = false, git = "https://github.com/integritee
pallet-enclave-bridge = { default-features = false, git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v1.13.0" }
pallet-sidechain = { default-features = false, git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v1.13.0" }
pallet-teeracle = { default-features = false, git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v1.13.0" }
pallet-teerdays = { default-features = false, git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v1.13.0" }
pallet-teerex = { default-features = false, git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v1.13.0" }
pallet-xcm-transactor = { default-features = false, git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v1.13.0" }
xcm-primitives = { default-features = false, git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v1.13.0" }
Expand Down Expand Up @@ -178,10 +179,12 @@ substrate-wasm-builder = "23.0.0"
#pallet-enclave-bridge = { path = '../pallets/enclave-bridge' }
#pallet-sidechain = { path = '../pallets/sidechain' }
#pallet-teeracle = { path = '../pallets/teeracle' }
#pallet-teerdays = { path = '../pallets/teerdays' }
#pallet-teerex = { path = '../pallets/teerex' }
#pallet-xcm-transactor = { path = '../pallets/xcm-transactor' }
#sgx-verify = { path = '../pallets/teerex/sgx-verify' }
#teeracle-primitives = { path = '../pallets/primitives/teeracle' }
#teerdays-primitives = { path = '../pallets/primitives/teerdays' }
#teerex-primitives = { path = '../pallets/primitives/teerex' }
#test-utils = { path = '../pallets/test-utils' }
#xcm-primitives = { path = '../pallets/primitives/xcm' }
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "integritee-collator"
description = "The Integritee parachain collator binary"
# align major.minor revision with polkadot SDK. bump patch revision ad lib. make this the github release tag
version = "1.13.0"
version = "1.13.1"
authors = ["Integritee AG <hello@integritee.network>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/parachain"
Expand Down
6 changes: 6 additions & 0 deletions polkadot-parachains/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ mod types {
mod constants {
use super::types::BlockNumber;
use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight};
use polkadot_core_primitives::Moment;
use sp_runtime::Perbill;
/// This determines the average expected block time that we are targeting. Blocks will be
/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by
Expand All @@ -91,6 +92,11 @@ mod constants {
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;

// Time helpers in milliseconds.
pub const MS_PER_MINUTE: Moment = 60_000;
pub const MS_PER_HOUR: Moment = crate::MS_PER_MINUTE * 60;
pub const MS_PER_DAY: Moment = crate::MS_PER_HOUR * 24;

/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is
/// used to limit the maximal weight of a single extrinsic.
pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
Expand Down
6 changes: 5 additions & 1 deletion polkadot-parachains/integritee-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "integritee-runtime"
description = "The Integritee parachain runtime"
# align major.minor revision with polkadot SDK. patch revision must match runtime spec_version
version = "1.13.530"
version = "1.13.540"
authors = ["Integritee AG <hello@integritee.network>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/parachain"
Expand Down Expand Up @@ -61,6 +61,7 @@ pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-sidechain = { workspace = true }
pallet-teeracle = { workspace = true }
pallet-teerdays = { workspace = true }
pallet-teerex = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-transaction-payment = { workspace = true }
Expand Down Expand Up @@ -157,6 +158,7 @@ std = [
"pallet-session/std",
"pallet-sidechain/std",
"pallet-teeracle/std",
"pallet-teerdays/std",
"pallet-teerex/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
Expand Down Expand Up @@ -222,6 +224,7 @@ runtime-benchmarks = [
"pallet-scheduler/runtime-benchmarks",
"pallet-sidechain/runtime-benchmarks",
"pallet-teeracle/runtime-benchmarks",
"pallet-teerdays/runtime-benchmarks",
"pallet-teerex/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
Expand Down Expand Up @@ -269,6 +272,7 @@ try-runtime = [
"pallet-session/try-runtime",
"pallet-sidechain/try-runtime",
"pallet-teeracle/try-runtime",
"pallet-teerdays/try-runtime",
"pallet-teerex/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
Expand Down
19 changes: 16 additions & 3 deletions polkadot-parachains/integritee-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ use frame_system::{
use integritee_parachains_common::{
fee::{SlowAdjustingFeeUpdate, WeightToFee},
AuraId, AVERAGE_ON_INITIALIZE_RATIO, BLOCK_PROCESSING_VELOCITY, DAYS, HOURS,
MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO, RELAY_CHAIN_SLOT_DURATION_MILLIS,
SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY,
MAXIMUM_BLOCK_WEIGHT, MINUTES, MS_PER_DAY, NORMAL_DISPATCH_RATIO,
RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY,
};
pub use integritee_parachains_common::{
AccountId, Address, Balance, BlockNumber, Hash, Header, Nonce, Signature, MILLISECS_PER_BLOCK,
Expand Down Expand Up @@ -119,7 +119,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("integritee-parachain"),
impl_name: create_runtime_str!("integritee-full"),
authoring_version: 2,
spec_version: 530,
spec_version: 540,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 8,
Expand Down Expand Up @@ -551,6 +551,17 @@ impl pallet_sidechain::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_sidechain::WeightInfo<Runtime>;
}
// added by Integritee
parameter_types! {
pub const UnlockPeriod: Moment = 7 * MS_PER_DAY;
}
impl pallet_teerdays::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_teerdays::WeightInfo<Runtime>;
type Currency = Balances;
type CurrencyBalance = Balance;
type UnlockPeriod = UnlockPeriod;
}

parameter_types! {
pub Prefix: &'static [u8] = b"Pay TEERs to the integriTEE account:";
Expand Down Expand Up @@ -1058,6 +1069,7 @@ construct_runtime!(
Teeracle: pallet_teeracle = 52,
Sidechain: pallet_sidechain= 53,
EnclaveBridge: pallet_enclave_bridge = 54,
TeerDays: pallet_teerdays = 55,
}
);

Expand Down Expand Up @@ -1129,6 +1141,7 @@ mod benches {
[pallet_session, SessionBench::<Runtime>]
[pallet_sidechain, Sidechain]
[pallet_teeracle, Teeracle]
[pallet_teerdays, TeerDays]
[pallet_teerex, Teerex]
[pallet_enclave_bridge, EnclaveBridge]
[pallet_timestamp, Timestamp]
Expand Down
Loading

0 comments on commit 49c2ac9

Please sign in to comment.