Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate teerdays #299

Merged
merged 4 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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 @@
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 @@ -255,7 +255,7 @@

impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;

Check warning on line 258 in polkadot-parachains/integritee-runtime/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

use of deprecated struct `pallet_transaction_payment::CurrencyAdapter`: Please use the fungible trait and FungibleAdapter. This struct will be removed some time after March 2024.

warning: use of deprecated struct `pallet_transaction_payment::CurrencyAdapter`: Please use the fungible trait and FungibleAdapter. This struct will be removed some time after March 2024. --> polkadot-parachains/integritee-runtime/src/lib.rs:258:57 | 258 | type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>; | ^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
Expand Down Expand Up @@ -551,6 +551,17 @@
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 @@ -587,7 +598,7 @@
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const DataDepositPerByte: Balance = 100 * MILLITEER;
pub const MaxApprovals: u32 = 100;
pub const MaxBalance: Balance = Balance::max_value();

Check warning on line 601 in polkadot-parachains/integritee-runtime/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

usage of a legacy numeric method

warning: usage of a legacy numeric method --> polkadot-parachains/integritee-runtime/src/lib.rs:601:43 | 601 | pub const MaxBalance: Balance = Balance::max_value(); | ^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants = note: `#[warn(clippy::legacy_numeric_constants)]` on by default help: use the associated constant instead | 601 | pub const MaxBalance: Balance = Balance::MAX; | ~~~
pub TreasuryAccount: AccountId = Treasury::account_id();
}

Expand Down Expand Up @@ -1058,6 +1069,7 @@
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 @@
[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
Loading