From 897c3bf9a32389ff925f113f64f0933e686065c0 Mon Sep 17 00:00:00 2001 From: brenzi Date: Tue, 27 Aug 2024 15:45:24 +0200 Subject: [PATCH] fix teerdays unlock mismatch (#301) * bump pallets * replace CurrencyAdapter with FungibleAdapter. bump version --- Cargo.lock | 48 +++++++++---------- polkadot-parachains/Cargo.toml | 2 +- .../integritee-runtime/Cargo.toml | 2 +- .../integritee-runtime/src/lib.rs | 26 ++++++---- .../integritee-runtime/src/xcm_config.rs | 15 +++--- polkadot-parachains/shell-runtime/src/lib.rs | 2 +- .../shell-runtime/src/xcm_config.rs | 9 ++-- 7 files changed, 54 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1784479..6343a4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1193,7 +1193,7 @@ dependencies = [ [[package]] name = "claims-primitives" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "parity-scale-codec", "rustc-hex", @@ -1335,7 +1335,7 @@ checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" [[package]] name = "common-primitives" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "derive_more", "parity-scale-codec", @@ -2841,7 +2841,7 @@ dependencies = [ [[package]] name = "enclave-bridge-primitives" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "common-primitives", "log", @@ -4288,7 +4288,7 @@ dependencies = [ [[package]] name = "integritee-collator" -version = "1.13.1" +version = "1.13.2" dependencies = [ "assert_cmd", "async-trait", @@ -4395,7 +4395,7 @@ dependencies = [ [[package]] name = "integritee-runtime" -version = "1.13.540" +version = "1.13.550" dependencies = [ "assets-common", "cumulus-pallet-aura-ext", @@ -6552,7 +6552,7 @@ dependencies = [ [[package]] name = "pallet-asset-registry" version = "0.0.1" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6827,7 +6827,7 @@ dependencies = [ [[package]] name = "pallet-claims" version = "0.9.12" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "claims-primitives", "frame-benchmarking", @@ -6997,7 +6997,7 @@ dependencies = [ [[package]] name = "pallet-enclave-bridge" version = "0.12.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "enclave-bridge-primitives", "frame-benchmarking", @@ -7497,7 +7497,7 @@ dependencies = [ [[package]] name = "pallet-sidechain" version = "0.11.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "enclave-bridge-primitives", "frame-benchmarking", @@ -7635,7 +7635,7 @@ dependencies = [ [[package]] name = "pallet-teeracle" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "frame-benchmarking", "frame-support", @@ -7661,7 +7661,7 @@ dependencies = [ [[package]] name = "pallet-teerdays" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "frame-benchmarking", "frame-support", @@ -7683,7 +7683,7 @@ dependencies = [ [[package]] name = "pallet-teerex" version = "0.10.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "frame-benchmarking", "frame-support", @@ -7913,7 +7913,7 @@ dependencies = [ [[package]] name = "pallet-xcm-transactor" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -7969,8 +7969,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e69bf016dc406eff7d53a7d3f7cf1c2e72c82b9088aac1118591e36dd2cd3e9" dependencies = [ "bitcoin_hashes 0.13.0", - "rand 0.8.5", - "rand_core 0.6.4", + "rand 0.7.3", + "rand_core 0.5.1", "serde", "unicode-normalization", ] @@ -12310,7 +12310,7 @@ dependencies = [ [[package]] name = "sgx-verify" version = "0.1.4" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "base64 0.13.1", "chrono", @@ -12489,7 +12489,7 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "sidechain-primitives" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "parity-scale-codec", "scale-info", @@ -14031,7 +14031,7 @@ checksum = "1d2faeef5759ab89935255b1a4cd98e0baf99d1085e37d36599c625dac49ae8e" [[package]] name = "teeracle-primitives" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "common-primitives", "sp-std", @@ -14041,7 +14041,7 @@ dependencies = [ [[package]] name = "teerdays-primitives" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "parity-scale-codec", "scale-info", @@ -14053,7 +14053,7 @@ dependencies = [ [[package]] name = "teerex-primitives" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "common-primitives", "derive_more", @@ -14107,7 +14107,7 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "test-utils" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "log", "sgx-verify", @@ -14760,7 +14760,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", "digest 0.10.7", - "rand 0.8.5", + "rand 0.7.3", "static_assertions", ] @@ -15952,7 +15952,7 @@ dependencies = [ [[package]] name = "xcm-primitives" version = "0.0.1" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "frame-support", "sp-runtime", @@ -15976,7 +15976,7 @@ dependencies = [ [[package]] name = "xcm-transactor-primitives" version = "0.1.0" -source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#d9223be14a86bb35ed4fb5d47de293f79bce5575" +source = "git+https://github.com/integritee-network/pallets.git?branch=polkadot-v1.13.0#4ff695cb82a8406fdb4f10c6ea023225ea5e778a" dependencies = [ "common-primitives", "cumulus-primitives-core", diff --git a/polkadot-parachains/Cargo.toml b/polkadot-parachains/Cargo.toml index 83d6722..0cd9f27 100644 --- a/polkadot-parachains/Cargo.toml +++ b/polkadot-parachains/Cargo.toml @@ -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.1" +version = "1.13.2" authors = ["Integritee AG "] homepage = "https://integritee.network/" repository = "https://github.com/integritee-network/parachain" diff --git a/polkadot-parachains/integritee-runtime/Cargo.toml b/polkadot-parachains/integritee-runtime/Cargo.toml index 0b1f5eb..a501b4b 100644 --- a/polkadot-parachains/integritee-runtime/Cargo.toml +++ b/polkadot-parachains/integritee-runtime/Cargo.toml @@ -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.540" +version = "1.13.550" authors = ["Integritee AG "] homepage = "https://integritee.network/" repository = "https://github.com/integritee-network/parachain" diff --git a/polkadot-parachains/integritee-runtime/src/lib.rs b/polkadot-parachains/integritee-runtime/src/lib.rs index 990ff0f..f5ae81c 100644 --- a/polkadot-parachains/integritee-runtime/src/lib.rs +++ b/polkadot-parachains/integritee-runtime/src/lib.rs @@ -44,8 +44,11 @@ pub use frame_support::{ use frame_support::{ derive_impl, ord_parameter_types, traits::{ - fungible::{HoldConsideration, NativeFromLeft, NativeOrWithId, UnionOf}, - tokens::{imbalance::ResolveAssetTo, ConversionFromAssetBalance, PayFromAccount}, + fungible::{Credit, HoldConsideration, NativeFromLeft, NativeOrWithId, UnionOf}, + tokens::{ + imbalance::{ResolveAssetTo, ResolveTo}, + ConversionFromAssetBalance, PayFromAccount, + }, AsEnsureOriginWithArg, ConstBool, EnsureOriginWithArg, EqualPrivilegeOnly, Imbalance, InstanceFilter, LinearStoragePrice, OnUnbalanced, }, @@ -73,6 +76,7 @@ pub use pallet_sidechain; pub use pallet_teeracle; pub use pallet_teerex::Call as TeerexCall; pub use pallet_timestamp::Call as TimestampCall; +use pallet_treasury::TreasuryAccountId; use parachains_common::{message_queue::NarrowOriginToSibling, AssetIdForTrustBackedAssets}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; @@ -119,7 +123,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: 540, + spec_version: 550, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 8, @@ -144,11 +148,16 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } -pub struct DealWithFees; +pub struct DealWithFees(sp_std::marker::PhantomData); -impl OnUnbalanced> for DealWithFees { +impl OnUnbalanced>> for DealWithFees +where + R: pallet_balances::Config + pallet_authorship::Config + pallet_treasury::Config, + ::AccountId: From, + ::AccountId: Into, +{ fn on_unbalanceds( - mut fees_then_tips: impl Iterator>, + mut fees_then_tips: impl Iterator>>, ) { if let Some(fees) = fees_then_tips.next() { // for fees, 1% to treasury, 99% burned @@ -159,7 +168,7 @@ impl OnUnbalanced> for DealWithFees if let Some(tips) = fees_then_tips.next() { tips.merge_into(&mut split.0); } - Treasury::on_unbalanced(split.0); + ResolveTo::, pallet_balances::Pallet>::on_unbalanced(split.0); // burn remainder by not assigning imbalance to someone } } @@ -255,7 +264,8 @@ impl pallet_balances::Config for Runtime { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = + pallet_transaction_payment::FungibleAdapter>; type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; diff --git a/polkadot-parachains/integritee-runtime/src/xcm_config.rs b/polkadot-parachains/integritee-runtime/src/xcm_config.rs index 1ebbb94..e0dcc8c 100644 --- a/polkadot-parachains/integritee-runtime/src/xcm_config.rs +++ b/polkadot-parachains/integritee-runtime/src/xcm_config.rs @@ -51,17 +51,15 @@ use sp_std::{ prelude::*, }; use staging_xcm::latest::prelude::*; -#[allow(deprecated)] -use staging_xcm_builder::CurrencyAdapter; use staging_xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FixedRateOfFungible, - FixedWeightBounds, FrameTransactionalProcessor, FungiblesAdapter, HashedDescription, - NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, - WithComputedOrigin, + FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, + HashedDescription, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, + RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + TrailingSetTopicAsId, WithComputedOrigin, }; use staging_xcm_executor::{traits::JustTry, XcmExecutor}; use xcm_primitives::{AsAssetLocation, ConvertedRegisteredAssetId}; @@ -141,8 +139,7 @@ pub type LocationToAccountId = ( ); /// Means for transacting TEER only. -#[allow(deprecated)] -pub type LocalNativeTransactor = CurrencyAdapter< +pub type LocalNativeTransactor = FungibleAdapter< // Use this currency: Balances, // Matcher: matches concrete fungible assets whose `id` could be converted into `CurrencyId`. diff --git a/polkadot-parachains/shell-runtime/src/lib.rs b/polkadot-parachains/shell-runtime/src/lib.rs index 914254e..1735e41 100644 --- a/polkadot-parachains/shell-runtime/src/lib.rs +++ b/polkadot-parachains/shell-runtime/src/lib.rs @@ -216,7 +216,7 @@ impl pallet_balances::Config for Runtime { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter; type WeightToFee = IdentityFee; type FeeMultiplierUpdate = (); type LengthToFee = ConstantMultiplier; diff --git a/polkadot-parachains/shell-runtime/src/xcm_config.rs b/polkadot-parachains/shell-runtime/src/xcm_config.rs index 4087dbe..e997a5c 100644 --- a/polkadot-parachains/shell-runtime/src/xcm_config.rs +++ b/polkadot-parachains/shell-runtime/src/xcm_config.rs @@ -47,13 +47,11 @@ use sp_std::{ prelude::*, }; use staging_xcm::latest::prelude::*; -#[allow(deprecated)] -use staging_xcm_builder::CurrencyAdapter; use staging_xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, - FixedWeightBounds, FrameTransactionalProcessor, ParentAsSuperuser, ParentIsPreset, - RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, ParentAsSuperuser, + ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, }; @@ -160,8 +158,7 @@ pub type LocationToAccountId = ( ); /// Means for transacting assets on this chain. -#[allow(deprecated)] -pub type LocalAssetTransactor = CurrencyAdapter< +pub type LocalAssetTransactor = FungibleAdapter< // Use this currency: Balances, // Matcher: matches concrete fungible assets whose `id` could be converted into `CurrencyId`.