feat(ProxyType): add support for claiming rewards#2628
Conversation
Added the ability to submit a Proxy.proxy extrinsic that calls RuntimeCall::Capacity(pallet_capacity::Call::claim_staking_reward). Previously, only pallet_capacity::Call::stake could be called using the ProxyType::Staking. Currently only staking
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
aramikm
left a comment
There was a problem hiding this comment.
Looks good! Do we need to test with a multisig account also since that was also one of the things they were doing.
|
@aramikm the multisig account is used to build the proxy address, which performs another proxy call. At the end it just comes in as a proxy call, so it should be fine. |
|
@aramikm your question made me feel paranoid so I wrote a multisig proxy test :) |
| }); | ||
|
|
||
| it('can boost, claim, and unstake via proxy account', async function () { | ||
| const boostAmount = 2n * DOLLARS; |
There was a problem hiding this comment.
this test was not passing for the reasons I thought. It is now fixed and I added some checks.
| ); | ||
|
|
||
| // assert that bob got the claimed rewards. | ||
| const bobNewBalance = await getFreeBalance(bob); |
There was a problem hiding this comment.
the proxy should not get the claimed rewards; bob, the "real" i.e. staker, should.
|
|
||
| it('multisig call as a proxy works for capacity staking ops', async function () { | ||
| // Input the addresses that will make up the multisig account. | ||
| const alice = await createAndFundKeypair(fundingSource, 2000n * DOLLARS, 'alice'); |
There was a problem hiding this comment.
this could be cleaned up a little, but I wanted to ensure that it worked
| ); | ||
|
|
||
| // Helpers | ||
| // the weight for this is pretty high |
There was a problem hiding this comment.
I pulled the weights from the Frequency txn that failed and bumped them up a bit
shannonwells
left a comment
There was a problem hiding this comment.
Approving since the tests I wrote validate @enddynayn 's fix.
JoeCap08055
left a comment
There was a problem hiding this comment.
Love the additional tests!
👍🏻
Purpose
We have account holders that need to be able to use proxies for Capacity staking.
Previously, only pallet_capacity::Call::stake could be called using the ProxyType::Staking.
Change summary
RuntimeCall::Capacity(pallet_capacity::Call::claim_staking_reward).