-
Notifications
You must be signed in to change notification settings - Fork 20
Subsidize adding an Ethereum compatible control key #2403
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
base: main
Are you sure you want to change the base?
Conversation
@@ -46,5 +46,8 @@ | |||
"tsx": "^4.19.3", | |||
"typescript": "^5.8.3", | |||
"typescript-eslint": "^8.30.1" | |||
}, | |||
"optionalDependencies": { |
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.
Needed for running e2e tests locally on Ubuntu
Codecov ReportAll modified and coverable lines are covered by tests ✅
🚀 New features to boost your workflow:
|
ca3b553
to
844f53e
Compare
|
||
/// Filters calls that match Msa::add_public_key_to_msa | ||
pub trait GetAddKeyData<RuntimeCall, AccountId, MessageSourceId> { | ||
/// If the xall matches Msa::add_public_key_to_msa, return the owner account id and msa 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.
/// If the xall matches Msa::add_public_key_to_msa, return the owner account id and msa id | |
/// If the call matches Msa::add_public_key_to_msa, return the owner account id and msa id |
if eligible_call_weight.is_zero() { | ||
0u32.into() | ||
} else { | ||
let reduction: Permill = Permill::from_percent(70u32); |
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.
See e2e test for how much this reduces cost.
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.
nit: I think it might be helpful to have a comment about the weight reductions or percentages and such in here.
Overall is it fair to say that this reduces the fee to around 0.3 or a bit more for subsidized?
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, that's about right
signPayloadSr25519, | ||
stakeToProvider, | ||
} from '../scaffolding/helpers'; | ||
import { getUnifiedAddress, getUnifiedPublicKey } from '../scaffolding/ethereum'; |
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.
nit: Unfortunately my pr merge caused a conflict here and you should use @frequency-chain/ethereum-utils
for these functions
let withdraw_fee = ChargeFrqTransactionPayment::<Test>::from(0u64) | ||
.withdraw_fee(&owner_id, &pay_with_capacity_add_public_key_call, &dispatch_info, 10) | ||
.unwrap(); | ||
assert!(withdraw_fee.0.lt(&106_000_000u64)); |
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.
nit: Might worth comparing the non-ethereum vs ethereum weights for the same call instead of using a magic number which might change in feature.
pallets/msa/src/weights.rs
Outdated
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.
if no additional functions are added or removed then maybe this should not get committed!?
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.
oversight, thanks
if eligible_call_weight.is_zero() { | ||
0u32.into() | ||
} else { | ||
let reduction: Permill = Permill::from_percent(70u32); |
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.
nit: I think it might be helpful to have a comment about the weight reductions or percentages and such in here.
Overall is it fair to say that this reduces the fee to around 0.3 or a bit more for subsidized?
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.
- Read through changes.
🚢 it!
bug fixed, tests passing
Update e2e/scaffolding/helpers.ts remove backticks Co-authored-by: Joe Caputo <[email protected]>
…gibility * Pay for 2nd key w/ capacity if ethereum is a low cost transaction. * e2e tests for same.
* Rename eligibility function * extract rust tests to own file
2d60894
to
0ff2ee2
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.
Nice work, approved.
Goal
The goal of this PR is to allow adding a second key to be a
freesubsidized capacity transaction under specific circumstances. This change reduces the capacity fee by about 70% when there is one key, and the new key is Ethereum-compatible.Most of #2286
Discussion
Note on something easy to miss: the expiration block will default to 0, which means this feature is off by default, until the value is set to a block in the future. There is no on-chain monitoring of the usage of this feature.
Checklist
freesubsidized key addition period.not applicable
- [ ] Design doc(s) updated?