-
Notifications
You must be signed in to change notification settings - Fork 71
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
Update polkadot-v0.9.43 #456
Conversation
d7a23f6
to
29f3c97
Compare
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.
The code is able to compile and unit tests are passing now.
Subsequently, we will need to run
- upgrade test script
- make sure tasks still run before and after upgrade
- make sure staking can work in dev environment.
@@ -2160,7 +2160,7 @@ fn trigger_tasks_limits_missed_slots() { | |||
AutomationTime::get_last_slot() | |||
{ | |||
assert_eq!(updated_last_time_slot, SCHEDULED_TIME); | |||
assert_eq!(updated_last_missed_slot, SCHEDULED_TIME - SLOT_SIZE_SECONDS * 3); | |||
assert_eq!(updated_last_missed_slot, SCHEDULED_TIME - SLOT_SIZE_SECONDS * 2); |
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.
Add a comment here.
This line ensures when given a total weight of 9_769_423 + 200_000, missing_task_id5, missing_task_id4, missing_task_id3 and missing_task_id2 will be discarded from the missed_queue in the current version of code.
// TODO: we should examine the tasks in missed_queue instead of examing the timestamp of missing_task_id2
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.
code change from 3 to 2? could be some regression ?
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.
Because scheduled_call.get_dispatch_info().weight have changed with polkadot-v.9.43, We need to change the test code.
|
90649c7
to
736f7df
Compare
@@ -343,8 +343,7 @@ fn testnet_genesis( | |||
general_councils: Vec<AccountId>, | |||
technical_memberships: Vec<AccountId>, | |||
) -> oak_runtime::GenesisConfig { | |||
let candidate_stake = | |||
std::cmp::max(oak_runtime::MinCollatorStk::get(), oak_runtime::MinCandidateStk::get()); | |||
let candidate_stake = oak_runtime::MinCandidateStk::get(); |
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.
this logic is changed. is this internally done this way?
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.
Yes.
The new version of the parachain-staking pallet has removed the MinCollatorStk
setting and instead uses MinCandidateStk
to limit the threshold of candidate.
A new set of collators is chosen from the candidates.
moonbeam-foundation/moonbeam@25d02f3
![image](https://private-user-images.githubusercontent.com/16951509/277849318-7f08c3a5-6967-4592-b015-9f9d9844129f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNTIzMTcsIm5iZiI6MTczOTE1MjAxNywicGF0aCI6Ii8xNjk1MTUwOS8yNzc4NDkzMTgtN2YwOGMzYTUtNjk2Ny00NTkyLWIwMTUtOWY5ZDk4NDQxMjlmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDAxNDY1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRkMTVmNjkxMWQ0MWUwODlmZGI3ZGRkNTlmMGE1MTBiOGMyNjhlZDEwMTA2NzBkZjZlYTQ1ZGMyYWRlYzhlZWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Il0Lq2-mDnZea5qijfVpkBdYEM12vtjJY9rNgj0w2rI)
In fact, in the implementation of the join_candidates function, it uses the MinCandidateStk value to restrict the entry threshold. It requires bond >= T::MinCandidateStk::get()
and locks these bonded assets.
Join candidates function:
https://github.com/moonbeam-foundation/moonbeam/blob/25d02f3c952c9827bb6d938da5c6a60ed5ccf420/pallets/parachain-staking/src/lib.rs#L936C1-L936C1
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.
Good call! @v9n
I sync’ed with Charles. The value of MinCandidateStk
was updated from 400K to 1M 5 months ago but MinCollatorStk
wasn’t, so we haven’t been using MinCollatorStk
for a while. Therefore, since MinCollatorStk's value has been already out-of-date I think it’s safe to delete its logic now. As Charles said, the MinCandidateStk
alone can safe guard the candidacy entrance.
turing_runtime::MinCollatorStk::get(), | ||
turing_runtime::MinCandidateStk::get(), | ||
); | ||
let candidate_stake = turing_runtime::MinCandidateStk::get(); |
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.
same as above
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] | ||
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] | ||
#[cfg_attr(feature = "std", serde(deny_unknown_fields))] | ||
pub struct AutostakingResult { | ||
pub period: i32, | ||
pub apy: f64, | ||
pub apy: String, |
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.
this change from a number to a string? is that right?
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.
Yes, AutostakingResult
must implement TypeInfo
trait in polkadot-v0.9.43.
But f64
does not implement TypeInfo
.
So I change it to String
instead.
// Measured: `0` | ||
// Estimated: `0` | ||
// Minimum execution time: 2_972_000 picoseconds. | ||
Weight::from_parts(3_082_000, 0) |
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.
should this number be pull froma benchmark ?
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.
Yes, we should run a benchmark on a standard machine to generate this value.
However, this weight value isn't very critical at the moment because it is typically only called by AdminOrigin
.
In kusama, the weight is 3_078_000.
/// We opted to not check exactly what on-chain versions each pallet is at, since it would be | ||
/// an involved effort, this is testnet, and no one has complained | ||
/// (https://github.com/paritytech/polkadot/issues/6657#issuecomment-1552956439). | ||
pub struct SetStorageVersions; |
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.
love the comment and background.
log::info!("The pallet_xcm is migrating to version 1"); | ||
let mut weight = T::DbWeight::get().reads(1); | ||
|
||
let translate = |pre: (u64, Weight, u32)| -> Option<(u64, Weight, u32)> { |
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.
we should explain on why we do (u64, Weight, u32)
-> (u64, Weight, u32)
to restore the proof size
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.
Fixed
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 good to me so far. i had some general comment but want to point out so we can understand that it is. but don't think there is any blocker.
9fd56e6
to
0769fcd
Compare
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 great. let merge 🥳
No description provided.