Skip to content

Commit

Permalink
Release v1.2.5 (#33)
Browse files Browse the repository at this point in the history
* sc-executor: Increase maximum instance count (polkadot-sdk#1856)

* remove `pallet::without_storage_info` macros

* Update Cargo.toml, Cargo.lock (#31)

* fix: sort on address modification (#32)

* fix: sort vector on address modification

* chore: increase testnet runtime version

* test: update package.json version

---------

Co-authored-by: alstjd0921 <[email protected]>
  • Loading branch information
dnjscksdn98 and alstjd0921 authored Dec 19, 2023
1 parent aa721d8 commit e646957
Show file tree
Hide file tree
Showing 23 changed files with 964 additions and 1,740 deletions.
2,473 changes: 813 additions & 1,660 deletions Cargo.lock

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[workspace]
resolver = "2"
members = [
"node/core",
"node/common",
"node/dev",
"node/testnet",
"node/mainnet",
"runtime/common",
"runtime/dev",
"runtime/testnet",
"runtime/mainnet",
"pallets/bfc-staking",
"pallets/bfc-utility",
"pallets/bfc-offences",
"pallets/relay-manager",
"precompiles/utils",
"precompiles/utils/macro",
"precompiles/bfc-staking",
"precompiles/bfc-offences",
"precompiles/relay-manager",
"precompiles/governance",
"precompiles/collective",
"precompiles/balance",
"primitives/account",
"primitives/core",
"primitives/bfc-staking",
"node/core",
"node/common",
"node/dev",
"node/testnet",
"node/mainnet",
"runtime/common",
"runtime/dev",
"runtime/testnet",
"runtime/mainnet",
"pallets/bfc-staking",
"pallets/bfc-utility",
"pallets/bfc-offences",
"pallets/relay-manager",
"precompiles/utils",
"precompiles/utils/macro",
"precompiles/bfc-staking",
"precompiles/bfc-offences",
"precompiles/relay-manager",
"precompiles/governance",
"precompiles/collective",
"precompiles/balance",
"primitives/account",
"primitives/core",
"primitives/bfc-staking",
]
[profile.release]
panic = "unwind"
Expand All @@ -40,10 +40,10 @@ repository = "https://github.com/bifrost-platform/bifrost-node"
# General
substrate-fixed = { git = "https://github.com/encointer/substrate-fixed", default-features = false }
parity-scale-codec = { version = "3.2.2", default-features = false, features = [
"derive",
"derive",
] }
scale-info = { version = "2.0", default-features = false, features = [
"derive",
"derive",
] }
evm = { git = "https://github.com/rust-blockchain/evm", rev = "b7b82c7e1fc57b7449d6dfa6826600de37cc1e65", default-features = false }
environmental = { version = "1.1.2", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion node/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bifrost-node"
version = "1.2.4"
version = "1.2.5"
description = "The node specification for Bifrost Node"
authors = { workspace = true }
homepage = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions pallets/bfc-offences/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ pub mod migrations;
mod pallet;
pub mod weights;

pub use pallet::{pallet::*};
pub use pallet::pallet::*;
use weights::WeightInfo;

use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;

use frame_support::traits::Currency;
use frame_support::{pallet_prelude::MaxEncodedLen, traits::Currency};

use bp_staking::{Offence, RoundIndex};
use sp_runtime::{traits::Zero, Perbill, RuntimeDebug};
Expand All @@ -27,7 +27,7 @@ pub type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<
<T as frame_system::Config>::AccountId,
>>::NegativeImbalance;

#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
/// A value that represents the current storage version of this pallet.
///
/// This value is used by the `on_runtime_upgrade` logic to determine whether we run storage
Expand Down
2 changes: 1 addition & 1 deletion pallets/bfc-offences/src/pallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub mod pallet {

/// Pallet for bfc offences
#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);

/// Configuration trait of this pallet
Expand Down Expand Up @@ -77,6 +76,7 @@ pub mod pallet {
pub(crate) type StorageVersion<T: Config> = StorageValue<_, Releases, ValueQuery>;

#[pallet::storage]
#[pallet::unbounded]
#[pallet::getter(fn validator_offences)]
/// The current offence state of a specific validator
pub type ValidatorOffences<T: Config> =
Expand Down
2 changes: 1 addition & 1 deletion pallets/bfc-staking/src/inflation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub fn round_issuance_range<T: Config>(round_inflation: Range<Perbill>) -> Range
}

#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(Eq, PartialEq, Clone, Encode, Decode, Default, RuntimeDebug, TypeInfo)]
#[derive(Eq, PartialEq, Clone, Encode, Decode, Default, RuntimeDebug, TypeInfo, MaxEncodedLen)]
/// The information about the staking inflation for this network
pub struct InflationInfo<Balance> {
/// Staking expectations
Expand Down
72 changes: 58 additions & 14 deletions pallets/bfc-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mod set;
pub mod weights;

pub use inflation::{InflationInfo, Range};
pub use pallet::{pallet::*};
pub use pallet::pallet::*;
pub use set::OrderedSet;
use weights::WeightInfo;

Expand Down Expand Up @@ -79,7 +79,7 @@ macro_rules! log {
};
}

#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
/// A value placed in storage that represents the current version of the Staking storage. This value
/// is used by the `on_runtime_upgrade` logic to determine whether we run storage migration logic.
enum Releases {
Expand All @@ -94,7 +94,9 @@ impl Default for Releases {
}
}

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(
PartialEq, Eq, PartialOrd, Ord, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen,
)]
/// The candidates or the nominators bonded amount to the network
pub struct Bond<AccountId, Balance> {
/// The controller account used to reserve their staked balance
Expand All @@ -116,7 +118,19 @@ impl<A: Decode, B: Default> Default for Bond<A, B> {
}
}

#[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(
Eq,
PartialEq,
Ord,
PartialOrd,
Copy,
Clone,
Encode,
Decode,
RuntimeDebug,
TypeInfo,
MaxEncodedLen,
)]
/// The activity status of the validator
pub enum ValidatorStatus {
/// Committed to be online and producing valid blocks (not equivocating)
Expand Down Expand Up @@ -162,7 +176,7 @@ impl<T: Config> Convert<T::AccountId, Option<ValidatorSnapshot<T::AccountId, Bal
}
}

#[derive(Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
/// Total staked information of the current chain state
pub struct TotalSnapshot<Balance> {
/// The total self-bond of all validator candidates
Expand Down Expand Up @@ -314,7 +328,19 @@ impl<
}

/// Reward destination options.
#[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(
Eq,
PartialEq,
Ord,
PartialOrd,
Copy,
Clone,
Encode,
Decode,
RuntimeDebug,
TypeInfo,
MaxEncodedLen,
)]
pub enum RewardDestination {
/// Pay into the bonded account, increasing the amount at stake accordingly.
Staked,
Expand All @@ -328,7 +354,7 @@ impl Default for RewardDestination {
}
}

#[derive(Default, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(Default, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
/// Info needed to make delayed controller sets after round end
pub struct DelayedControllerSet<AccountId> {
/// The bonded stash account
Expand All @@ -345,7 +371,7 @@ impl<AccountId: PartialEq + Clone> DelayedControllerSet<AccountId> {
}
}

#[derive(Default, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(Default, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
/// Info needed to maked delayed commission sets after round end
pub struct DelayedCommissionSet<AccountId> {
/// The bonded controller account
Expand All @@ -362,7 +388,7 @@ impl<AccountId: PartialEq + Clone> DelayedCommissionSet<AccountId> {
}
}

#[derive(Default, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(Default, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
/// Info needed to make delayed payments to stakers after round end
pub struct DelayedPayout<Balance> {
/// Total round reward (result of compute_issuance() at round end)
Expand All @@ -373,7 +399,19 @@ pub struct DelayedPayout<Balance> {
pub validator_commission: Perbill,
}

#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(
Eq,
PartialEq,
Ord,
PartialOrd,
Clone,
Copy,
Encode,
Decode,
RuntimeDebug,
TypeInfo,
MaxEncodedLen,
)]
/// Request scheduled to change the candidate self-bond
pub struct CandidateBondLessRequest<Balance> {
/// The requested less amount
Expand Down Expand Up @@ -504,7 +542,9 @@ impl<
}
}

#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(
Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen,
)]
/// Capacity status for top or bottom nominations
pub enum CapacityStatus {
/// Reached capacity
Expand All @@ -515,7 +555,9 @@ pub enum CapacityStatus {
Partial,
}

#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(
Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen,
)]
/// Productivity status for active validators
pub enum ProductivityStatus {
/// Successfully produced a block
Expand All @@ -526,7 +568,9 @@ pub enum ProductivityStatus {
Ready,
}

#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(
Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen,
)]
/// All candidate info except the top and bottom nominations
pub struct CandidateMetadata<AccountId, Balance, BlockNumber> {
/// This candidate's stash account (public key)
Expand Down Expand Up @@ -2057,7 +2101,7 @@ impl<
}
}

#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
/// The current round index and transition information
pub struct RoundInfo<BlockNumber> {
/// Current round index
Expand Down
9 changes: 6 additions & 3 deletions pallets/bfc-staking/src/pallet/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use super::pallet::*;

use crate::{
inflation::Range, weights::WeightInfo, BalanceOf, Bond, DelayedCommissionSet,
DelayedControllerSet, DelayedPayout, ProductivityStatus, RewardDestination, RoundIndex,
TierType, TotalSnapshot, ValidatorSnapshot, ValidatorSnapshotOf,
DelayedControllerSet, DelayedPayout, ProductivityStatus, RewardDestination, RewardPoint,
RoundIndex, TierType, TotalSnapshot, ValidatorSnapshot, ValidatorSnapshotOf,
};

use pallet_session::ShouldEndSession;
Expand Down Expand Up @@ -182,20 +182,23 @@ impl<T: Config> Pallet<T> {
selected_candidates
.try_push(candidate.clone())
.expect("SelectedCandidates out of bound");
selected_candidates.sort();
<SelectedCandidates<T>>::put(selected_candidates);
match tier {
TierType::Full => {
let mut selected_full_candidates = <SelectedFullCandidates<T>>::get();
selected_full_candidates
.try_push(candidate.clone())
.expect("SelectedFullCandidates out of bound");
selected_full_candidates.sort();
<SelectedFullCandidates<T>>::put(selected_full_candidates);
},
_ => {
let mut selected_basic_candidates = <SelectedBasicCandidates<T>>::get();
selected_basic_candidates
.try_push(candidate.clone())
.expect("SelectedBasicCandidates out of bound");
selected_basic_candidates.sort();
<SelectedBasicCandidates<T>>::put(selected_basic_candidates);
},
};
Expand Down Expand Up @@ -744,7 +747,7 @@ impl<T: Config> Pallet<T> {

let score_plus_5 = <AwardedPts<T>>::get(round_index, &author) + 5;
<AwardedPts<T>>::insert(round_index, author, score_plus_5);
<Points<T>>::mutate(round_index, |x| *x += 5);
<Points<T>>::mutate(round_index, |x: &mut RewardPoint| *x += 5);
}

/// Reset every `per round` related parameters of every candidates
Expand Down
Loading

0 comments on commit e646957

Please sign in to comment.