-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks overall very good to me.
…fences-benchmarks' into shawntabrizi-fix-offences-benchmarks
frame/balances/src/lib.rs
Outdated
@@ -458,7 +458,7 @@ decl_module! { | |||
/// - Contains a limited number of reads and writes. | |||
/// # </weight> | |||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 100_000_000] | |||
fn set_balance( | |||
pub fn set_balance( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just started reviewing, but you shouldn't need to make this pub. You can instead call make_free_balance_be
which is part of the currency trait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix the balance/event stuff
@@ -18,7 +18,7 @@ | |||
//! from VRF outputs and manages epoch transitions. | |||
|
|||
#![cfg_attr(not(feature = "std"), no_std)] | |||
#![forbid(unused_must_use, unsafe_code, unused_variables, unused_must_use)] | |||
#![warn(unused_must_use, unsafe_code, unused_variables, unused_must_use)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this intentional (or a result of debugging)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentional. Using forbid
may cause issues with:
- Quick development cycle
- Build randomly breaking on rustc upgrades
We did try that in the past, but it was doing more harm than good.
bot merge |
let raw_amount = bond_amount::<T>(); | ||
// add twice as much balance to prevent the account from being killed. | ||
let free_amount = raw_amount.saturating_mul(2.into()); | ||
T::Currency::make_free_balance_be(&stash, free_amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a note for whoever might read this in the future and want to work on benchmarks: we use this function quite a lot, and it does not change T::Currency::issuance
. And we use total issuance in staking's phragmen, and it can cause some very hard to track bugs... so keep that in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had another brief look and looks okay to me!
An attempt to benchmark
offences
with the same kind of reports that are most likely going to be used in the final runtime (likeim-online
,grandpa
andbabe
).Even though we don't report
babe
(see #5752) norgrandpa
(see #3868) yet, the final report is not likely to change that much (or at all).