Skip to content

Commit e646957

Browse files
Release v1.2.5 (#33)
* 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 <kwonarseus@gmail.com>
1 parent aa721d8 commit e646957

23 files changed

Lines changed: 964 additions & 1740 deletions

File tree

Cargo.lock

Lines changed: 813 additions & 1660 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
[workspace]
22
resolver = "2"
33
members = [
4-
"node/core",
5-
"node/common",
6-
"node/dev",
7-
"node/testnet",
8-
"node/mainnet",
9-
"runtime/common",
10-
"runtime/dev",
11-
"runtime/testnet",
12-
"runtime/mainnet",
13-
"pallets/bfc-staking",
14-
"pallets/bfc-utility",
15-
"pallets/bfc-offences",
16-
"pallets/relay-manager",
17-
"precompiles/utils",
18-
"precompiles/utils/macro",
19-
"precompiles/bfc-staking",
20-
"precompiles/bfc-offences",
21-
"precompiles/relay-manager",
22-
"precompiles/governance",
23-
"precompiles/collective",
24-
"precompiles/balance",
25-
"primitives/account",
26-
"primitives/core",
27-
"primitives/bfc-staking",
4+
"node/core",
5+
"node/common",
6+
"node/dev",
7+
"node/testnet",
8+
"node/mainnet",
9+
"runtime/common",
10+
"runtime/dev",
11+
"runtime/testnet",
12+
"runtime/mainnet",
13+
"pallets/bfc-staking",
14+
"pallets/bfc-utility",
15+
"pallets/bfc-offences",
16+
"pallets/relay-manager",
17+
"precompiles/utils",
18+
"precompiles/utils/macro",
19+
"precompiles/bfc-staking",
20+
"precompiles/bfc-offences",
21+
"precompiles/relay-manager",
22+
"precompiles/governance",
23+
"precompiles/collective",
24+
"precompiles/balance",
25+
"primitives/account",
26+
"primitives/core",
27+
"primitives/bfc-staking",
2828
]
2929
[profile.release]
3030
panic = "unwind"
@@ -40,10 +40,10 @@ repository = "https://github.com/bifrost-platform/bifrost-node"
4040
# General
4141
substrate-fixed = { git = "https://github.com/encointer/substrate-fixed", default-features = false }
4242
parity-scale-codec = { version = "3.2.2", default-features = false, features = [
43-
"derive",
43+
"derive",
4444
] }
4545
scale-info = { version = "2.0", default-features = false, features = [
46-
"derive",
46+
"derive",
4747
] }
4848
evm = { git = "https://github.com/rust-blockchain/evm", rev = "b7b82c7e1fc57b7449d6dfa6826600de37cc1e65", default-features = false }
4949
environmental = { version = "1.1.2", default-features = false }

node/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bifrost-node"
3-
version = "1.2.4"
3+
version = "1.2.5"
44
description = "The node specification for Bifrost Node"
55
authors = { workspace = true }
66
homepage = { workspace = true }

pallets/bfc-offences/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ pub mod migrations;
44
mod pallet;
55
pub mod weights;
66

7-
pub use pallet::{pallet::*};
7+
pub use pallet::pallet::*;
88
use weights::WeightInfo;
99

1010
use parity_scale_codec::{Decode, Encode};
1111
use scale_info::TypeInfo;
1212

13-
use frame_support::traits::Currency;
13+
use frame_support::{pallet_prelude::MaxEncodedLen, traits::Currency};
1414

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

30-
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)]
30+
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
3131
/// A value that represents the current storage version of this pallet.
3232
///
3333
/// This value is used by the `on_runtime_upgrade` logic to determine whether we run storage

pallets/bfc-offences/src/pallet/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub mod pallet {
1818

1919
/// Pallet for bfc offences
2020
#[pallet::pallet]
21-
#[pallet::without_storage_info]
2221
pub struct Pallet<T>(_);
2322

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

7978
#[pallet::storage]
79+
#[pallet::unbounded]
8080
#[pallet::getter(fn validator_offences)]
8181
/// The current offence state of a specific validator
8282
pub type ValidatorOffences<T: Config> =

pallets/bfc-staking/src/inflation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub fn round_issuance_range<T: Config>(round_inflation: Range<Perbill>) -> Range
9898
}
9999

100100
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
101-
#[derive(Eq, PartialEq, Clone, Encode, Decode, Default, RuntimeDebug, TypeInfo)]
101+
#[derive(Eq, PartialEq, Clone, Encode, Decode, Default, RuntimeDebug, TypeInfo, MaxEncodedLen)]
102102
/// The information about the staking inflation for this network
103103
pub struct InflationInfo<Balance> {
104104
/// Staking expectations

pallets/bfc-staking/src/lib.rs

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mod set;
3939
pub mod weights;
4040

4141
pub use inflation::{InflationInfo, Range};
42-
pub use pallet::{pallet::*};
42+
pub use pallet::pallet::*;
4343
pub use set::OrderedSet;
4444
use weights::WeightInfo;
4545

@@ -79,7 +79,7 @@ macro_rules! log {
7979
};
8080
}
8181

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

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

119-
#[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
121+
#[derive(
122+
Eq,
123+
PartialEq,
124+
Ord,
125+
PartialOrd,
126+
Copy,
127+
Clone,
128+
Encode,
129+
Decode,
130+
RuntimeDebug,
131+
TypeInfo,
132+
MaxEncodedLen,
133+
)]
120134
/// The activity status of the validator
121135
pub enum ValidatorStatus {
122136
/// Committed to be online and producing valid blocks (not equivocating)
@@ -162,7 +176,7 @@ impl<T: Config> Convert<T::AccountId, Option<ValidatorSnapshot<T::AccountId, Bal
162176
}
163177
}
164178

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

316330
/// Reward destination options.
317-
#[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
331+
#[derive(
332+
Eq,
333+
PartialEq,
334+
Ord,
335+
PartialOrd,
336+
Copy,
337+
Clone,
338+
Encode,
339+
Decode,
340+
RuntimeDebug,
341+
TypeInfo,
342+
MaxEncodedLen,
343+
)]
318344
pub enum RewardDestination {
319345
/// Pay into the bonded account, increasing the amount at stake accordingly.
320346
Staked,
@@ -328,7 +354,7 @@ impl Default for RewardDestination {
328354
}
329355
}
330356

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

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

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

376-
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Encode, Decode, RuntimeDebug, TypeInfo)]
402+
#[derive(
403+
Eq,
404+
PartialEq,
405+
Ord,
406+
PartialOrd,
407+
Clone,
408+
Copy,
409+
Encode,
410+
Decode,
411+
RuntimeDebug,
412+
TypeInfo,
413+
MaxEncodedLen,
414+
)]
377415
/// Request scheduled to change the candidate self-bond
378416
pub struct CandidateBondLessRequest<Balance> {
379417
/// The requested less amount
@@ -504,7 +542,9 @@ impl<
504542
}
505543
}
506544

507-
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
545+
#[derive(
546+
Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen,
547+
)]
508548
/// Capacity status for top or bottom nominations
509549
pub enum CapacityStatus {
510550
/// Reached capacity
@@ -515,7 +555,9 @@ pub enum CapacityStatus {
515555
Partial,
516556
}
517557

518-
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
558+
#[derive(
559+
Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen,
560+
)]
519561
/// Productivity status for active validators
520562
pub enum ProductivityStatus {
521563
/// Successfully produced a block
@@ -526,7 +568,9 @@ pub enum ProductivityStatus {
526568
Ready,
527569
}
528570

529-
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
571+
#[derive(
572+
Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen,
573+
)]
530574
/// All candidate info except the top and bottom nominations
531575
pub struct CandidateMetadata<AccountId, Balance, BlockNumber> {
532576
/// This candidate's stash account (public key)
@@ -2057,7 +2101,7 @@ impl<
20572101
}
20582102
}
20592103

2060-
#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)]
2104+
#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
20612105
/// The current round index and transition information
20622106
pub struct RoundInfo<BlockNumber> {
20632107
/// Current round index

pallets/bfc-staking/src/pallet/impls.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use super::pallet::*;
22

33
use crate::{
44
inflation::Range, weights::WeightInfo, BalanceOf, Bond, DelayedCommissionSet,
5-
DelayedControllerSet, DelayedPayout, ProductivityStatus, RewardDestination, RoundIndex,
6-
TierType, TotalSnapshot, ValidatorSnapshot, ValidatorSnapshotOf,
5+
DelayedControllerSet, DelayedPayout, ProductivityStatus, RewardDestination, RewardPoint,
6+
RoundIndex, TierType, TotalSnapshot, ValidatorSnapshot, ValidatorSnapshotOf,
77
};
88

99
use pallet_session::ShouldEndSession;
@@ -182,20 +182,23 @@ impl<T: Config> Pallet<T> {
182182
selected_candidates
183183
.try_push(candidate.clone())
184184
.expect("SelectedCandidates out of bound");
185+
selected_candidates.sort();
185186
<SelectedCandidates<T>>::put(selected_candidates);
186187
match tier {
187188
TierType::Full => {
188189
let mut selected_full_candidates = <SelectedFullCandidates<T>>::get();
189190
selected_full_candidates
190191
.try_push(candidate.clone())
191192
.expect("SelectedFullCandidates out of bound");
193+
selected_full_candidates.sort();
192194
<SelectedFullCandidates<T>>::put(selected_full_candidates);
193195
},
194196
_ => {
195197
let mut selected_basic_candidates = <SelectedBasicCandidates<T>>::get();
196198
selected_basic_candidates
197199
.try_push(candidate.clone())
198200
.expect("SelectedBasicCandidates out of bound");
201+
selected_basic_candidates.sort();
199202
<SelectedBasicCandidates<T>>::put(selected_basic_candidates);
200203
},
201204
};
@@ -744,7 +747,7 @@ impl<T: Config> Pallet<T> {
744747

745748
let score_plus_5 = <AwardedPts<T>>::get(round_index, &author) + 5;
746749
<AwardedPts<T>>::insert(round_index, author, score_plus_5);
747-
<Points<T>>::mutate(round_index, |x| *x += 5);
750+
<Points<T>>::mutate(round_index, |x: &mut RewardPoint| *x += 5);
748751
}
749752

750753
/// Reset every `per round` related parameters of every candidates

0 commit comments

Comments
 (0)