Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
9599fcf
add Commission to BondedPoolInner
Oct 14, 2022
79a0b9d
add set_commission call
Oct 14, 2022
b8d041a
add CommissionConfig + commission.config
Oct 14, 2022
5fbc8d0
default commission on create
Oct 14, 2022
ff9825e
separate set_commission & set_max_commission
Oct 14, 2022
6514d50
rename CommissionConfig to CommissionThrottle
Oct 14, 2022
b438a80
add throttling in set_commission
Oct 14, 2022
4bded45
abstract CommissionThrottle::can_update
Oct 14, 2022
ad41ef2
mv Default Commission impl
Oct 14, 2022
fd96a70
add set_commission_throttle
Oct 14, 2022
655ef75
change can_update to throttling
Oct 14, 2022
d2fe74a
rm unused Error
Oct 14, 2022
561d393
Merge branch 'master' into rb-nomination-pool-commission
Oct 14, 2022
3adbaa5
deduct & transfer commission to depositor
Oct 15, 2022
2a2ebf5
use try_mutate
Oct 15, 2022
f33f92b
mv setters to BondedPool
Oct 15, 2022
dcccc5d
calls work tests + fixes
Oct 17, 2022
da2e32e
add commission tests + fixes
Oct 17, 2022
ddea6ba
fmt
Oct 17, 2022
55ac7cd
Merge branch 'master' into rb-nomination-pool-commission
Oct 17, 2022
4e3ff0d
add commission.receiver
Oct 17, 2022
e29c5cc
fixes
Oct 17, 2022
90fefd0
receive -> payee
Oct 23, 2022
72c16b0
tests use payee
Oct 23, 2022
b15a086
use CommissionThrottlePrefs
Oct 23, 2022
42a0ce4
fmt
Oct 23, 2022
1c0a180
make commission.current Option
Oct 23, 2022
de05cec
set None if 0% commission
Oct 23, 2022
3562d63
make commission Option
Oct 23, 2022
185a0a9
combine commission + payee
Oct 23, 2022
316c448
make payee optional after set
Oct 23, 2022
5ef7d0c
combinators for set_commission_throttle
Oct 23, 2022
51073aa
CommissionThrottle::default/ use take()
Oct 23, 2022
e1fcfb7
refactor bonded_pool.commission()
Oct 24, 2022
5bdb153
fix commission() & rm Default
Oct 24, 2022
80906cb
amend comments
Oct 24, 2022
48965e5
use commission
Oct 24, 2022
e6084f1
rm deprecated event
Oct 24, 2022
b3ba869
refactor throttle()
Oct 24, 2022
5550651
commission_payee revise
Oct 24, 2022
359cce0
commission_payee returns Option<&T::AccountId>
Oct 25, 2022
bd49e96
refactor set_commission_current
Oct 25, 2022
a0507f2
refactor set_commission_current
Oct 27, 2022
088df1e
some mapping
Oct 27, 2022
f492894
clearer ensures, mv throttling()
Oct 27, 2022
4feab19
refactor percentage() into Commission
Oct 27, 2022
4ee687c
throttling uses self.percentage()
Oct 27, 2022
c836bfb
don't return self
Oct 27, 2022
983278a
make closure + 1 payout test
Oct 27, 2022
62e617e
includ payee
Oct 28, 2022
25ec735
add commission to `PaidOut`, use withdraw
Oct 28, 2022
e397698
fmt
Oct 28, 2022
4f9eaee
mv comment, rn closure
Oct 28, 2022
49619e5
percentage() -> as_percent()
Oct 29, 2022
254a3dd
Merge branch 'master' into rb-nomination-pool-commission
Nov 6, 2022
dd977b2
simplifying expressions
Nov 7, 2022
d395db0
Option<Commission> -> Commission
Nov 7, 2022
7637e46
add maybe_update_max
Nov 7, 2022
3096729
Err
Nov 7, 2022
b4c35f3
tests pass
Nov 7, 2022
36612b5
add update_current
Nov 7, 2022
e5b8651
mv payee()
Nov 7, 2022
c5fe182
add arbitrary points values
Nov 8, 2022
37485b3
migration: add commission to BondedPoolInner
Nov 8, 2022
882f167
add commission to BondedPoolInner
Nov 8, 2022
f813564
add commision benchmarks
Nov 8, 2022
f646331
set_max_commission -> set_commission_max
Nov 8, 2022
2a55aba
benchmarks build
Nov 8, 2022
1ea87c6
maybe_update_current
Nov 8, 2022
6bca9cc
maybe_update_throttle
Nov 8, 2022
1e65a80
fmt
Nov 8, 2022
2c21126
add throttle.restricted()
Nov 8, 2022
d821d6d
mv get_commission_and_payee to Commission
Nov 8, 2022
757e112
rm dereference
Nov 8, 2022
32cc16f
commission_set() + comments
Nov 8, 2022
0d0c781
fix pool id
Nov 8, 2022
a40f555
throttle after commission set
Nov 8, 2022
4716965
amend set_commission_handles_errors
Nov 8, 2022
5060cb6
benchmarks work
Nov 8, 2022
da6ab34
run benchmarks + add weights to commission calls
Nov 8, 2022
9ab85df
Merge branch 'master' into rb-nomination-pool-commission
Nov 9, 2022
86bef40
merge master
Nov 9, 2022
c801b8e
+ test: do_not_throttle_initial_commission_set
Nov 9, 2022
d02c671
bring comments up to date
Nov 9, 2022
8fe6af1
simplify get_commission_and_payee
Nov 9, 2022
00ec90e
use transfer()
Nov 9, 2022
de7b57a
tidy up
Nov 9, 2022
610d294
rm payee()
Nov 9, 2022
2de0693
fixes
Nov 9, 2022
635d23c
migration fixes
Nov 9, 2022
285f0d5
Merge branch 'master' into rb-nomination-pool-commission
Nov 10, 2022
4d412d7
fixes + refactor get_commission_and_payee
Nov 10, 2022
4c89cf1
revert Cargo.lock
Nov 10, 2022
dba9edd
add licence
Nov 10, 2022
7954f76
add comment
Nov 10, 2022
1937108
bump STORAGE_VERSION
Nov 10, 2022
9d0ea15
remove comment formatting
Nov 10, 2022
1a0fd00
create_pool_account supports commission
Nov 14, 2022
c892dd0
derive DefaultNoBound
Nov 14, 2022
1a90b84
format comments better
Nov 14, 2022
8286109
fixes
Nov 14, 2022
a358c1d
DefaultNoBound
Nov 14, 2022
be29603
migration note
Nov 14, 2022
bc91daf
feedback fixes
Nov 14, 2022
cae84ce
Merge branch 'master' into rb-nomination-pool-commission
Dec 7, 2022
37caa03
Update frame/nomination-pools/src/lib.rs
Dec 7, 2022
ba0a757
+ PoolCommissionThrottleUpdated event
Dec 7, 2022
a007d67
Merge branch 'rb-nomination-pool-commission' of https://github.com/pa…
Dec 7, 2022
d9e01ae
amend comment
Dec 7, 2022
1f1e627
rm leaky abstraction
Dec 7, 2022
91be827
allow update payee only
Dec 7, 2022
4e69827
change fn scope
Dec 7, 2022
e820eea
fix set max commission logic
Dec 8, 2022
5752dd9
+ max_commission_after_current_commission_works
Dec 8, 2022
b651cd4
rm do_not_throttle_initial_commission_set
Dec 9, 2022
5f50791
fix benchmark
Dec 9, 2022
be10a8d
Merge branch 'master' into rb-nomination-pool-commission
Dec 18, 2022
aa60ebc
add note
Dec 22, 2022
abfd007
Merge branch 'master' into rb-nomination-pool-commission
Dec 22, 2022
73c1eaa
Merge branch 'master' into rb-nomination-pool-commission
Dec 22, 2022
2793501
+ call_index macro to calls
Dec 23, 2022
6ad97d3
CommissionThrottlePrefs -> CommissionChangeRate
Dec 23, 2022
f4d25fe
consider min_delay durations in throttle
Dec 23, 2022
eb3f627
add struct to mock
Dec 23, 2022
03ef1c7
clippy fix
Dec 23, 2022
111677b
use saturated_into
Dec 23, 2022
9a05061
fmt
Dec 23, 2022
6134ef5
Merge remote-tracking branch 'origin/master' into rb-nomination-pool-…
Dec 23, 2022
0f250aa
+ GlobalMaxCommission storage
Dec 24, 2022
9ba4347
+ global_max_commission
Dec 24, 2022
b25f845
Merge branch 'master' into rb-nomination-pool-commission
Dec 24, 2022
b9f5b1a
fmt
Dec 24, 2022
e029514
fix
Dec 24, 2022
e30b2de
+ global_max_commission
Dec 24, 2022
b3d84ff
use Perbill
Dec 24, 2022
6fa4671
some re-wording
Dec 24, 2022
df2d07d
enforce global max commission + tests
Dec 24, 2022
b142637
re-run benchmarks
Dec 24, 2022
c6a5e95
initial global commission of 0%
Dec 25, 2022
0eb3d2d
feedback amendments
Dec 25, 2022
4c008af
fmt
Dec 25, 2022
301a3d5
+ comment
Dec 25, 2022
5dfa94c
Update frame/nomination-pools/src/lib.rs
Dec 25, 2022
9ccc4f1
fmt
Dec 25, 2022
67810ea
simplify set_commission + allow rm current
Dec 26, 2022
d4db02e
+ mod commission to tests
Dec 26, 2022
61e0b12
fix benchmarks
Dec 26, 2022
474265e
simplify last_updated & change_rate
Dec 26, 2022
fc79f93
clippy fix
Dec 26, 2022
1106d26
fmt
Dec 26, 2022
ba4f4da
+ commission
Dec 26, 2022
8d04143
bound comm. to GlobalMax on payout
Dec 27, 2022
181ff0f
rm commission_or_zero, use inline
Dec 27, 2022
58ee938
fix tests
Dec 27, 2022
92b2c9c
only use global max on payout
Dec 27, 2022
4307da0
correct migration reads + writes
Dec 27, 2022
c8ac28d
set last_updated on set initial change_rate
Dec 27, 2022
3edb47e
last_updated -> throttle_from
Dec 27, 2022
3a6150d
throttling() tidy up
Dec 27, 2022
ac853fa
set `None` current on 0% + tests
Dec 27, 2022
1532c02
tidy up Commission impl
Dec 27, 2022
48f0ca6
comments + tidy up
Dec 27, 2022
a0a1a56
fmt
Dec 27, 2022
992ab1f
fix min_delay of zero scenario
Dec 27, 2022
1a9f2c6
zero change rate tests + fixes
Dec 27, 2022
460b9ec
+ 0% max commission test
Dec 27, 2022
fbe0890
fix migration
Dec 27, 2022
dfa3d13
fmt
Dec 27, 2022
ac8a16a
do not transfer reward on 100% commission + test
Dec 27, 2022
9593b55
+ global max prevents 100% commission test
Dec 27, 2022
0620b83
fmt
Dec 27, 2022
99e9935
use less_restrictive (allows same change rates)
Dec 27, 2022
49220c7
commissions not above 100% tests
Dec 27, 2022
52bb0b9
fmt
Dec 27, 2022
4ba4c09
use KeepAlive
Dec 27, 2022
06811c7
Update frame/nomination-pools/src/lib.rs
Dec 28, 2022
02bdc43
fmt
Dec 28, 2022
d78909d
update docs
Dec 28, 2022
4c68558
some renaming
Dec 28, 2022
f9b2cfb
+ change rate decreasing commissions test
Dec 28, 2022
10968e1
change test name
Dec 28, 2022
2363716
test fixes + commission decrease test
Dec 28, 2022
1452bdb
test name
Dec 28, 2022
860da81
feedback nitpicks amendments
Dec 28, 2022
22b6356
+ doc
Dec 28, 2022
c1fa307
fmt
Dec 28, 2022
c78b99c
test
Dec 28, 2022
4072074
test
Dec 28, 2022
55fd2ef
test
Dec 28, 2022
c0b798c
test
Dec 28, 2022
8f2b9fd
test
Dec 28, 2022
69d55ea
test
Dec 28, 2022
8b51bb9
test
Dec 28, 2022
13857d5
test
Dec 28, 2022
7059ec4
test
Dec 28, 2022
f17e714
test
Dec 28, 2022
f0db505
test
Dec 28, 2022
6959bbb
one more test
Dec 28, 2022
3abc71b
test
Dec 28, 2022
1013634
Revert "test"
Dec 28, 2022
de0edd3
Revert "one more test"
Dec 28, 2022
180744d
Revert "test"
Dec 28, 2022
36d77df
Revert "test"
Dec 28, 2022
49e0aeb
Revert "test"
Dec 28, 2022
a10f6e2
Revert "test"
Dec 28, 2022
c3db72e
Revert "test"
Dec 28, 2022
4a437aa
Revert "test"
Dec 28, 2022
7dec077
Revert "test"
Dec 28, 2022
73d9bf8
Revert "test"
Dec 28, 2022
f5005d6
Revert "test"
Dec 28, 2022
0bf345c
Revert "test"
Dec 28, 2022
3c4c61c
Allow StakingAdmin to set `min_commission` (#13018)
Ank4n Dec 26, 2022
ff816f2
Make CLI state pruning optional again (#13017)
bkchr Dec 26, 2022
15b18ae
Runtime diagnostics for leaked messages in unbounded channels (part 2…
dmitry-markin Dec 27, 2022
f653eac
[contracts] Make debug buffer work like a FIFO pipe (#12953)
agryaznov Dec 27, 2022
7b7482c
Improve inactive fund tracking (#13009)
gavofyork Dec 27, 2022
811e9d7
Print "stalled" task on shutdown (#13022)
bkchr Dec 28, 2022
dbdc2ce
Merge remote-tracking branch 'origin/master' into rb-nomination-pool-…
Dec 28, 2022
d4a666f
Merge remote-tracking branch 'origin/master' into rb-nomination-pool-…
Jan 2, 2023
d08a412
Update frame/nomination-pools/src/lib.rs
Jan 5, 2023
4350c70
Merge remote-tracking branch 'origin/master' into rb-nomination-pool-…
Jan 9, 2023
b8408bb
add note on usage of twox hash (#13089)
Ank4n Jan 9, 2023
34febb3
Remove unused code in state-db (#13103)
skunert Jan 9, 2023
ae9005c
EPM and staking events improvement (#13035)
gpestana Jan 9, 2023
f61fc7e
CI: configure `cargo-nextest`'s reporter options explicitly (#13104)
rcny Jan 9, 2023
2dd6e73
Add ensure_pow method (#13042)
lemunozm Jan 9, 2023
db7a1c2
Add solution hint to error message (#13111)
Jan 10, 2023
1a29e81
Avoid unintentionally canceling the scheduled crate publishing job (#…
joao-paulo-parity Jan 10, 2023
fc43b5f
introduce log-target constant to more frame pallets (#13116)
tonyalaribe Jan 10, 2023
874e3e2
Update tests for 1.66 and switch CI to stable Rust 1.66 (#13118)
rcny Jan 10, 2023
f39c290
remove update-node-template (#13100)
joao-paulo-parity Jan 11, 2023
6f9d9b1
simplify throttling to 1 increment per interval
Jan 11, 2023
f4f39d5
fmt
Jan 11, 2023
fb9766f
use map_pr_else w. defensive!
Jan 11, 2023
7ba0e2b
reformat try_update_current
Jan 11, 2023
d4be203
amend comment
Jan 11, 2023
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
46 changes: 42 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,39 @@ variables:
CARGO_INCREMENTAL: 0
DOCKER_OS: "debian:stretch"
ARCH: "x86_64"
CI_IMAGE: "paritytech/ci-linux:production"
CI_IMAGE: "paritytech/ci-linux@sha256:9140bc3c843a8b12a3bcf6f5886346536092795bbadfd7f1836362cb28dfcc71"
BUILDAH_IMAGE: "quay.io/buildah/stable:v1.27"
RUSTY_CACHIER_SINGLE_BRANCH: master
RUSTY_CACHIER_DONT_OPERATE_ON_MAIN_BRANCH: "true"
RUSTY_CACHIER_COMPRESSION_METHOD: zstd
NEXTEST_FAILURE_OUTPUT: immediate-final
NEXTEST_SUCCESS_OUTPUT: final
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.22"

default:
.shared-default: &shared-default
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
interruptible: true
cache: {}

.default-pipeline-definitions:
default:
<<: *shared-default
interruptible: true

.crate-publishing-pipeline-definitions:
default:
<<: *shared-default
# The crate-publishing pipeline defaults to `interruptible: false` so that we'll be able to
# reach and run the publishing jobs despite the "Auto-cancel redundant pipelines" CI setting.
# The setting is relevant because the crate-publishing pipeline runs on `master`, thus future
# pipelines on `master` (e.g. created for new commits or other schedules) might unintendedly
# cancel the publishing jobs or its dependencies before we get to actually publish the crates.
interruptible: false

.collect-artifacts:
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
Expand Down Expand Up @@ -213,9 +229,15 @@ default:
# this job runs only on nightly pipeline with the mentioned variable, against `master` branch
- if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "nightly"

.crate-publishing-pipeline:
rules:
- if: $CI_COMMIT_REF_NAME != "master"
when: never

.scheduled-crate-publishing-pipeline:
rules:
- if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "automatic-crate-publishing"
- !reference [.crate-publishing-pipeline, rules]
- if: $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "automatic-crate-publishing"

.crates-publishing-template:
stage: test
Expand Down Expand Up @@ -263,6 +285,22 @@ include:
- scripts/ci/gitlab/pipeline/publish.yml
# zombienet jobs
- scripts/ci/gitlab/pipeline/zombienet.yml
# The crate-publishing pipeline requires a customized `interruptible` configuration. Unfortunately
# `interruptible` can't currently be dynamically set based on variables as per:
# - https://gitlab.com/gitlab-org/gitlab/-/issues/38349
# - https://gitlab.com/gitlab-org/gitlab/-/issues/194023
# Thus we work around that limitation by using conditional includes.
# For crate-publishing pipelines: run it with defaults + `interruptible: false`. The WHOLE
# pipeline is made uninterruptible to ensure that test jobs also get a chance to run to
# completion, because the publishing jobs depends on them AS INTENDED: crates should not be
# published before their source code is checked.
- local: scripts/ci/gitlab/crate-publishing-pipeline.yml
rules:
- if: $PIPELINE == "automatic-crate-publishing"
# For normal pipelines: run it with defaults + `interruptible: true`
- local: scripts/ci/gitlab/default-pipeline.yml
rules:
- if: $PIPELINE != "automatic-crate-publishing"

#### stage: deploy

Expand Down
21 changes: 2 additions & 19 deletions client/state-db/src/noncanonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
&self,
level_index: usize,
discarded_journals: &mut Vec<Vec<u8>>,
discarded_blocks: &mut Vec<BlockHash>,
hash: &BlockHash,
) {
if let Some(level) = self.levels.get(level_index) {
Expand All @@ -335,13 +334,7 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
.clone();
if parent == *hash {
discarded_journals.push(overlay.journal_key.clone());
discarded_blocks.push(overlay.hash.clone());
self.discard_journals(
level_index + 1,
discarded_journals,
discarded_blocks,
&overlay.hash,
);
self.discard_journals(level_index + 1, discarded_journals, &overlay.hash);
}
});
}
Expand Down Expand Up @@ -393,7 +386,6 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
self.pinned_canonincalized.push(hash.clone());

let mut discarded_journals = Vec::new();
let mut discarded_blocks = Vec::new();
for (i, overlay) in level.blocks.into_iter().enumerate() {
let mut pinned_children = 0;
// That's the one we need to canonicalize
Expand All @@ -411,12 +403,7 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
commit.data.deleted.extend(overlay.deleted.clone());
} else {
// Discard this overlay
self.discard_journals(
0,
&mut discarded_journals,
&mut discarded_blocks,
&overlay.hash,
);
self.discard_journals(0, &mut discarded_journals, &overlay.hash);
pinned_children = discard_descendants(
&mut self.levels.as_mut_slices(),
&mut self.values,
Expand All @@ -437,7 +424,6 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
discard_values(&mut self.values, overlay.inserted);
}
discarded_journals.push(overlay.journal_key.clone());
discarded_blocks.push(overlay.hash.clone());
}
commit.meta.deleted.append(&mut discarded_journals);

Expand Down Expand Up @@ -548,9 +534,6 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
trace!(target: "state-db-pin", "Discarding unpinned non-canon block: {:?}", hash);
discard_values(&mut self.values, inserted);
self.parents.remove(&hash);
true
} else {
false
}
},
Entry::Vacant(_) => break,
Expand Down
1 change: 1 addition & 0 deletions frame/assets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ pub use pallet::*;
pub use weights::WeightInfo;

type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
const LOG_TARGET: &str = "runtime::assets";

/// Trait with callbacks that are executed after successfull asset creation or destruction.
pub trait AssetsCallback<AssetId, AccountId> {
Expand Down
12 changes: 10 additions & 2 deletions frame/assets/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,18 @@ pub mod v1 {
Some(old_value.migrate_to_v1())
});
current_version.put::<Pallet<T>>();
log::info!(target: "runtime::assets", "Upgraded {} pools, storage to version {:?}", translated, current_version);
log::info!(
target: LOG_TARGET,
"Upgraded {} pools, storage to version {:?}",
translated,
current_version
);
T::DbWeight::get().reads_writes(translated + 1, translated + 1)
} else {
log::info!(target: "runtime::assets", "Migration did not execute. This probably should be removed");
log::info!(
target: LOG_TARGET,
"Migration did not execute. This probably should be removed"
);
T::DbWeight::get().reads(1)
}
}
Expand Down
6 changes: 4 additions & 2 deletions frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ pub use weights::WeightInfo;

pub use pallet::*;

const LOG_TARGET: &str = "runtime::balances";

type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;

#[frame_support::pallet]
Expand Down Expand Up @@ -950,7 +952,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {

if locks.len() as u32 > T::MaxLocks::get() {
log::warn!(
target: "runtime::balances",
target: LOG_TARGET,
"Warning: A user has more currency locks than expected. \
A runtime configuration adjustment may be needed."
);
Expand Down Expand Up @@ -985,7 +987,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
// since the funds that are under the lock will themselves be stored in the
// account and therefore will need a reference.
log::warn!(
target: "runtime::balances",
target: LOG_TARGET,
"Warning: Attempt to introduce lock consumer reference, yet no providers. \
This is unexpected but should be safe."
);
Expand Down
14 changes: 10 additions & 4 deletions frame/balances/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ fn migrate_v0_to_v1<T: Config<I>, I: 'static>(accounts: &[T::AccountId]) -> Weig
// Set storage version to `1`.
StorageVersion::new(1).put::<Pallet<T, I>>();

log::info!(target: "runtime::balances", "Storage to version 1");
log::info!(target: LOG_TARGET, "Storage to version 1");
T::DbWeight::get().reads_writes(2 + accounts.len() as u64, 3)
} else {
log::info!(target: "runtime::balances", "Migration did not execute. This probably should be removed");
log::info!(
target: LOG_TARGET,
"Migration did not execute. This probably should be removed"
);
T::DbWeight::get().reads(1)
}
}
Expand Down Expand Up @@ -87,10 +90,13 @@ impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for ResetInactive<T, I> {
// Set storage version to `0`.
StorageVersion::new(0).put::<Pallet<T, I>>();

log::info!(target: "runtime::balances", "Storage to version 0");
log::info!(target: LOG_TARGET, "Storage to version 0");
T::DbWeight::get().reads_writes(1, 2)
} else {
log::info!(target: "runtime::balances", "Migration did not execute. This probably should be removed");
log::info!(
target: LOG_TARGET,
"Migration did not execute. This probably should be removed"
);
T::DbWeight::get().reads(1)
}
}
Expand Down
8 changes: 5 additions & 3 deletions frame/collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ pub mod weights;
pub use pallet::*;
pub use weights::WeightInfo;

const LOG_TARGET: &str = "runtime::collective";

/// Simple index type for proposal counting.
pub type ProposalIndex = u32;

Expand Down Expand Up @@ -390,7 +392,7 @@ pub mod pallet {
ensure_root(origin)?;
if new_members.len() > T::MaxMembers::get() as usize {
log::error!(
target: "runtime::collective",
target: LOG_TARGET,
"New members count ({}) exceeds maximum amount of members expected ({}).",
new_members.len(),
T::MaxMembers::get(),
Expand All @@ -400,7 +402,7 @@ pub mod pallet {
let old = Members::<T, I>::get();
if old.len() > old_count as usize {
log::warn!(
target: "runtime::collective",
target: LOG_TARGET,
"Wrong count used to estimate set_members weight. expected ({}) vs actual ({})",
old_count,
old.len(),
Expand Down Expand Up @@ -1040,7 +1042,7 @@ impl<T: Config<I>, I: 'static> ChangeMembers<T::AccountId> for Pallet<T, I> {
) {
if new.len() > T::MaxMembers::get() as usize {
log::error!(
target: "runtime::collective",
target: LOG_TARGET,
"New members count ({}) exceeds maximum amount of members expected ({}).",
new.len(),
T::MaxMembers::get(),
Expand Down
9 changes: 5 additions & 4 deletions frame/collective/src/migrations/v4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use sp_io::hashing::twox_128;

use super::super::LOG_TARGET;
use frame_support::{
traits::{
Get, GetStorageVersion, PalletInfoAccess, StorageVersion,
Expand All @@ -42,15 +43,15 @@ pub fn migrate<T: frame_system::Config, P: GetStorageVersion + PalletInfoAccess,

if new_pallet_name == old_pallet_name {
log::info!(
target: "runtime::collective",
target: LOG_TARGET,
"New pallet name is equal to the old pallet name. No migration needs to be done.",
);
return Weight::zero()
}

let on_chain_storage_version = <P as GetStorageVersion>::on_chain_storage_version();
log::info!(
target: "runtime::collective",
target: LOG_TARGET,
"Running migration to v4 for collective with storage version {:?}",
on_chain_storage_version,
);
Expand All @@ -66,7 +67,7 @@ pub fn migrate<T: frame_system::Config, P: GetStorageVersion + PalletInfoAccess,
<T as frame_system::Config>::BlockWeights::get().max_block
} else {
log::warn!(
target: "runtime::collective",
target: LOG_TARGET,
"Attempted to apply migration to v4 but failed because storage version is {:?}",
on_chain_storage_version,
);
Expand Down Expand Up @@ -138,7 +139,7 @@ pub fn post_migrate<P: GetStorageVersion + PalletInfoAccess, N: AsRef<str>>(old_

fn log_migration(stage: &str, old_pallet_name: &str, new_pallet_name: &str) {
log::info!(
target: "runtime::collective",
target: LOG_TARGET,
"{}, prefix: '{}' ==> '{}'",
stage,
old_pallet_name,
Expand Down
7 changes: 4 additions & 3 deletions frame/election-provider-multi-phase/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ frame_benchmarking::benchmarks! {
assert!(<MultiPhase<T>>::snapshot().is_none());
assert!(<MultiPhase<T>>::current_phase().is_off());
}: {
<MultiPhase<T>>::on_initialize_open_signed();
<MultiPhase<T>>::phase_transition(Phase::Signed);
} verify {
assert!(<MultiPhase<T>>::snapshot().is_none());
assert!(<MultiPhase<T>>::current_phase().is_signed());
Expand All @@ -210,7 +210,8 @@ frame_benchmarking::benchmarks! {
assert!(<MultiPhase<T>>::snapshot().is_none());
assert!(<MultiPhase<T>>::current_phase().is_off());
}: {
<MultiPhase<T>>::on_initialize_open_unsigned(true, 1u32.into())
let now = frame_system::Pallet::<T>::block_number();
<MultiPhase<T>>::phase_transition(Phase::Unsigned((true, now)));
} verify {
assert!(<MultiPhase<T>>::snapshot().is_none());
assert!(<MultiPhase<T>>::current_phase().is_unsigned());
Expand Down Expand Up @@ -318,7 +319,7 @@ frame_benchmarking::benchmarks! {
submit {
// the queue is full and the solution is only better than the worse.
<MultiPhase<T>>::create_snapshot().map_err(<&str>::from)?;
MultiPhase::<T>::on_initialize_open_signed();
<MultiPhase<T>>::phase_transition(Phase::Signed);
<Round<T>>::put(1);

let mut signed_submissions = SignedSubmissions::<T>::get();
Expand Down
Loading