-
Notifications
You must be signed in to change notification settings - Fork 509
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
add pallet::call to hotfix sufficients for non-zero nonce accounts #619
add pallet::call to hotfix sufficients for non-zero nonce accounts #619
Conversation
6ca3149
to
fc65741
Compare
frame/evm/src/lib.rs
Outdated
#[pallet::weight( | ||
<T as pallet::Config>::WeightInfo::hotfix_inc_account_sufficients(addresses.len().try_into().unwrap_or(u32::MAX)) | ||
)] | ||
pub fn hotfix_inc_account_sufficients( |
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 you put this under a feature flag?
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.
I tried it out but seems the generated code (pallet::call
procedural macro) still contains references to this code even though the function body is omitted - thereby breaking compilation. Are you aware of a better way to put it behind a feature flag?
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.
Seems it's discouraged to conditional compile pallet calls since that can break an API quite easily. We could conditionally compile and return an unimplemented
error on invocation, but I'm unsure how useful that might be.
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.
Sorry to jump in like this:
But should this not rather be a storage migration instead of an extrinsic?
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.
Yeah if you don't have too many accounts in the state already, a migration will be preferred. Alternatively, I believe you just need this call in one single runtime upgrade (which you manually call all addresses yourself), and then it can be removed. Given that this was a bug in Frontier that probably some other chains will also need it for fixing, we may include that in a Frontier release. We'd need to prepare a changelog and announce it though.
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.
Shall I add a basic version of a CHANGELOG.md
?
Isn't it possible to have the pallet separate from the existing one, so that parachain needing it could include it in their runtime, but it wouldn't mess default pallets ? |
Please change this to either a migration script or to put the hotfix in a standalone pallet. |
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.
Overall lgtm, please check the comment on the dispatchable function body.
frame/hotfix-sufficients/src/lib.rs
Outdated
let refs = frame_system::Pallet::<T>::consumers(&account_id) | ||
+ frame_system::Pallet::<T>::providers(&account_id) | ||
+ frame_system::Pallet::<T>::sufficients(&account_id); |
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 might want to use safe math here
(That amount of references would be absurd, but better safe than sorry :)
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.
Done
…olkadot-evm#619) * add pallet::call to hotfix sufficients for non-zero nonce accounts * make hotfix to fix sufficients payable * cargo fmt * use distinct pallet for hotfix * cleanup traces from pallet evm * add pallet-hotfix-sufficients * fix description * fix benchmarking * update test condition, add docs * use safe add Co-authored-by: tgmichel <telmo@purestake.com>
HotfixSufficients
with callhotfix_inc_account_sufficients
to patch existing accounts with a non-zero nonce but a zerosufficients
value. The value needs to be non-zero to be consistent with our current runtime logic.$ ./scripts/benchmark.sh 1) pallet_evm, runner_execute 2) pallet_evm, hotfix_inc_account_sufficients 3) EXIT #? 2
The signed extrinsic call can be called by any account.