Skip to content

Commit

Permalink
fix teerdays unlock mismatch (#301)
Browse files Browse the repository at this point in the history
* bump pallets

* replace CurrencyAdapter with FungibleAdapter. bump version
  • Loading branch information
brenzi authored Aug 27, 2024
1 parent 49c2ac9 commit 897c3bf
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 50 deletions.
48 changes: 24 additions & 24 deletions Cargo.lock

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

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.1"
version = "1.13.2"
authors = ["Integritee AG <[email protected]>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/parachain"
Expand Down
2 changes: 1 addition & 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.540"
version = "1.13.550"
authors = ["Integritee AG <[email protected]>"]
homepage = "https://integritee.network/"
repository = "https://github.com/integritee-network/parachain"
Expand Down
26 changes: 18 additions & 8 deletions polkadot-parachains/integritee-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -144,11 +148,16 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}

pub struct DealWithFees;
pub struct DealWithFees<R>(sp_std::marker::PhantomData<R>);

impl OnUnbalanced<pallet_balances::NegativeImbalance<Runtime>> for DealWithFees {
impl<R> OnUnbalanced<Credit<R::AccountId, pallet_balances::Pallet<R>>> for DealWithFees<R>
where
R: pallet_balances::Config + pallet_authorship::Config + pallet_treasury::Config,
<R as frame_system::Config>::AccountId: From<AccountId>,
<R as frame_system::Config>::AccountId: Into<AccountId>,
{
fn on_unbalanceds<B>(
mut fees_then_tips: impl Iterator<Item = pallet_balances::NegativeImbalance<Runtime>>,
mut fees_then_tips: impl Iterator<Item = Credit<R::AccountId, pallet_balances::Pallet<R>>>,
) {
if let Some(fees) = fees_then_tips.next() {
// for fees, 1% to treasury, 99% burned
Expand All @@ -159,7 +168,7 @@ impl OnUnbalanced<pallet_balances::NegativeImbalance<Runtime>> for DealWithFees
if let Some(tips) = fees_then_tips.next() {
tips.merge_into(&mut split.0);
}
Treasury::on_unbalanced(split.0);
ResolveTo::<TreasuryAccountId<R>, pallet_balances::Pallet<R>>::on_unbalanced(split.0);
// burn remainder by not assigning imbalance to someone
}
}
Expand Down Expand Up @@ -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<Balances, DealWithFees>;
type OnChargeTransaction =
pallet_transaction_payment::FungibleAdapter<Balances, DealWithFees<Runtime>>;
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
Expand Down
15 changes: 6 additions & 9 deletions polkadot-parachains/integritee-runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachains/shell-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Balances, ()>;
type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
type WeightToFee = IdentityFee<Balance>;
type FeeMultiplierUpdate = ();
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
Expand Down
9 changes: 3 additions & 6 deletions polkadot-parachains/shell-runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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`.
Expand Down

0 comments on commit 897c3bf

Please sign in to comment.