-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: Governance extrinsic to recover Solana Durable Nonces #5130
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5130 +/- ##
=====================================
- Coverage 71% 71% -0%
=====================================
Files 460 460
Lines 81649 81647 -2
Branches 81649 81647 -2
=====================================
- Hits 58169 58102 -67
- Misses 20390 20442 +52
- Partials 3090 3103 +13 ☔ View full report in Codecov by Sentry. |
#[pallet::call_index(7)] | ||
// Todo | ||
#[pallet::weight(Weight::zero())] | ||
pub fn update_sol_nonce( |
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 realised there's no benchmark for this...
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.
Can we please add one, or open an issue to add one (if it doesn't already exist)
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.
.iter() | ||
.position(|(account, _)|*account == nonce_account) | ||
.map(|idx| { | ||
durable_nonces[idx] = (nonce_account, new_hash); | ||
new_hash | ||
}) |
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.
iter_mut
is generally a better idea than using indices do update a map mid-iteration (even though I think it's ok here).
durable_nonces
.iter_mut()
.find(|(account, _)|*account == nonce_account)
.map(|(_account, hash)| {
*hash = new_hash;
new_hash
})
.ok_or::<DispatchError>(Error::<T>::NonceAccountNotBeingUsedOrDoesNotExist.into())
* Added a new Governance Extrinsic that recovers used DurableNonce * Updated extrinsic docs
Pull Request
Closes: PRO-1533
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
Added a new Governance Extrinsic that recovers used DurableNonce.
The given Nonce account must be either Available or Unavailable (i.e. New Nonce accounts are not accepted).