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

fix teerdays unlock mismatch #301

Merged
merged 2 commits into from
Aug 27, 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
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 <hello@integritee.network>"]
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 <hello@integritee.network>"]
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 @@
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_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 @@
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 @@
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 @@
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_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 Expand Up @@ -598,7 +608,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 611 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:611:43 | 611 | 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 | 611 | pub const MaxBalance: Balance = Balance::MAX; | ~~~
pub TreasuryAccount: AccountId = Treasury::account_id();
}

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
Loading