Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

election-provider-multi-phase: Add extrinsic to challenge signed submissions #11099

Closed
wants to merge 25 commits into from

Conversation

Doordashcon
Copy link
Contributor

@Doordashcon Doordashcon commented Mar 23, 2022

This PR attempts to fix paritytech/polkadot-sdk#281

polkadot address: 12zsKEDVcHpKEWb99iFt3xrTCQQXZMu477nJQsTBBrof5k2h

@kianenigma
Copy link
Contributor

@Doordashcon please ping us once you are ready for review!

@kianenigma kianenigma added A3-in_progress Pull request is in progress. No review needed at this stage. B7-runtimenoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Mar 24, 2022
@Doordashcon Doordashcon marked this pull request as ready for review March 26, 2022 12:12
@Doordashcon
Copy link
Contributor Author

cc @kianenigma @emostov want to check my logic before adding required test and benchmark

@kianenigma kianenigma added A5-grumble and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Mar 26, 2022
@@ -627,6 +627,10 @@ pub mod pallet {
#[pallet::constant]
type SignedRewardBase: Get<BalanceOf<Self>>;

// Base reward for a challenger
#[pallet::constant]
type ChallengeRewardBase: Get<BalanceOf<Self>>;
Copy link
Contributor

@kianenigma kianenigma Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reward of the challenger should be the deposit of the challengee. @emostov wdyt? trying to avoid adding more and more configs.

Copy link
Contributor

@emostov emostov Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reward needs to be less than the deposit so we don't encourage users to spam the system by submitting a bogus solution, then challenging it and claiming back their own solution and claiming back their deposit.

To achieve this we can have a config that is something like ChallengeDepositDiff, e.g. if the deposit is 100 and ChallengeDepositDiff is 5, then reward base would be 95

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point. The reward can just be a Perbill of the deposit then? I think this is slightly more intuitive than a diff.

/// The minimum amount a solution challenger must have to execute
/// `challange_submission`
#[pallet::constant]
type MinimumSlashableAmount: Get<BalanceOf<Self>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, I think the slashable deposit of the challenger should be dynamic and should be simply the same as the amount of the deposit of the solution that you are going after.

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the right track, but needs further work.

ElectionCompute::Signed,
) {
Ok(solution) => {
let _ = T::Currency::slash(&who, T::MinimumSlashableAmount::get());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like Kian mention, T::MinimumSlashableAmount::get() should be replaced with the deposit for the solution

@kianenigma
Copy link
Contributor

@Doordashcon can you give an update on your agenda around this? Just want to make sure you do plan to continue with this PR. Thanks!

@kianenigma
Copy link
Contributor

kianenigma commented May 10, 2022

any updates @Doordashcon?

@Doordashcon
Copy link
Contributor Author

@kianenigma please can you describe a solution that will reduce the number of changes in this PR?

@Doordashcon Doordashcon requested review from kianenigma and removed request for emostov May 19, 2022 11:24
@kianenigma
Copy link
Contributor

What do you mean by reducing the number of changes?

@Doordashcon
Copy link
Contributor Author

My iteration of the optimization requires implementing copy trait on various other types not in the pallet. So maybe this can be a separate issue that I can work on?

@kianenigma
Copy link
Contributor

kianenigma commented Jun 11, 2022

@Doordashcon there is some good work in this PR but honestly at this point I think it is better to leave and re-try this with a fresh start after you have gained a bit more experience in our codebase.

I might try and tackle this myself, or you can retry again later.

I will close this, but since it is linked to the PR, it won't be lost and we can re-open later.

If you provide your DOT/KSM address in the PR description (e.g. polkadot address: 1...), I will open a tip for you as a thank-you for your effort here.

@kianenigma kianenigma closed this Jun 11, 2022
@Doordashcon
Copy link
Contributor Author

Doordashcon commented Jun 11, 2022

@kianenigma I appreciate your guidance on this PR and would like to give it another shot later on. I've added my DOT address in the PR description.

@Doordashcon
Copy link
Contributor Author

cc @kianenigma

@kianenigma
Copy link
Contributor

\tip small

@kianenigma
Copy link
Contributor

/tip small

@substrate-tip-bot
Copy link

Please fix the following problems before calling the tip bot again:

  • Invalid command! Payload should be: "/tip { small / medium / large }".

@kianenigma
Copy link
Contributor

/tip small

@substrate-tip-bot
Copy link

Please fix the following problems before calling the tip bot again:

  • Invalid command! Payload should be: "/tip { small / medium / large }".

@kianenigma
Copy link
Contributor

/tip small

@substrate-tip-bot
Copy link

Please fix the following problems before calling the tip bot again:

  • Invalid command! Payload should be: "/tip { small / medium / large }".

@bkchr
Copy link
Member

bkchr commented Jun 21, 2022

/tip small

1 similar comment
@shawntabrizi
Copy link
Member

/tip small

@substrate-tip-bot
Copy link

A small tip was successfully submitted for Doordashcon (12zsKEDVcHpKEWb99iFt3xrTCQQXZMu477nJQsTBBrof5k2h on polkadot).

https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io#/treasury/tips

@shawntabrizi
Copy link
Member

I have no idea what was causing the error before this... :/

@Doordashcon
Copy link
Contributor Author

Thanks for the tip!

@louismerlin louismerlin removed the D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited label Oct 13, 2022
@Doordashcon
Copy link
Contributor Author

is this feature still needed? I'd like to revisit it

@kianenigma
Copy link
Contributor

kianenigma commented Feb 14, 2023

Yes, happy to mentor you for another try.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C1-low PR touches the given topic and has a low impact on builders.
Projects
Status: 👀 Might Revisit 👀
Development

Successfully merging this pull request may close these issues.

election-provider-multi-phase: Add extrinsic to challenge signed submissions
6 participants