Skip to content
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

Bump substrate v0.9.28 and add a MeetupResult in the IssuedRewards storage. #274

Merged
merged 11 commits into from
Nov 9, 2022

Conversation

echevrier
Copy link
Collaborator

@echevrier echevrier commented Oct 25, 2022

Upgrade to polkadot-v0.9.28 :

  • substrate dependencies to substrate's branch = "polkadot-v0.9.28"
  • polkadot dependencies to polkadot's branch = "release-v0.9.28"
  • jsonrpsee to version = 0.15.1

Reasoning for adding the MeetupResult:

Failing calls do no longer change the storage, see #275. So we had to change the dispatch result to be OK, but in turn we store the MeetupResult in IssuedRewards instead of just a plain (). This is anyhow helpful information for client applications. Further, an event is emitted when a failing meetup is evaluated.

@echevrier echevrier marked this pull request as draft October 25, 2022 16:32
echevrier added 2 commits October 26, 2022 16:28
- Add a claim_reward feedback in the IssuedRewards Storage
- claim_reward returns OK if a MeetupValidationError occurs in the Registration phase
@echevrier echevrier marked this pull request as ready for review October 27, 2022 12:51
@echevrier echevrier marked this pull request as draft October 27, 2022 13:00
@echevrier echevrier requested a review from clangenb October 27, 2022 13:21
@echevrier echevrier marked this pull request as ready for review October 31, 2022 12:54
@echevrier echevrier linked an issue Oct 31, 2022 that may be closed by this pull request
Copy link
Member

@clangenb clangenb left a comment

Choose a reason for hiding this comment

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

Some minor comments. Otherwise, it looks good.

@pifragile you might also want to have a look at this.

Further, I am considering of changing the paradigm, such that we also have branch = polkadot-v9.x.x on master. Do you have any objections here @pifragile?

primitives/src/ceremonies.rs Outdated Show resolved Hide resolved
primitives/src/ceremonies.rs Outdated Show resolved Hide resolved
info!(target: LOG, "marking issuance as completed for failed meetup.");

<IssuedRewards<T>>::insert((cid, cindex), meetup_index, meetup_result);
return Ok(Pays::No.into())
Copy link
Member

Choose a reason for hiding this comment

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

We should also return the error here. Otherwise, the user expects some rewards.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we return an error, the storage (IssuedRewards) will not be updated. We did these changes to fix it: #275
The "error" feedback is in the MeetupResult:
MeetupResult::VotesNotDependable or MeetupResult::MeetupValidationIndexOutOfBounds. Perhaps we can improve the name: MeetupResult::VotesNotDependableError, MeetupResult::MeetupValidationIndexOutOfBoundsError ?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, sorry, I completely forgot that this was the cause of this PR. In that case, we should additionally add an event:

MeetupEvaluated(MeetupResult)

@echevrier echevrier requested a review from clangenb November 8, 2022 14:45
Copy link
Member

@clangenb clangenb left a comment

Choose a reason for hiding this comment

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

One tiny remark, which will lead you to revert some stuff here. :)

Comment on lines 1171 to 1172
Option<MeetupResult>,
ValueQuery,
Copy link
Member

Choose a reason for hiding this comment

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

Instead of making this an Option<MeetupResult>, you should change ValueQuery to OptionQuery.

@echevrier echevrier requested a review from clangenb November 8, 2022 15:18
Copy link
Member

@clangenb clangenb left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me now!

Comment on lines +1043 to +1048
let meetup_result = IssuedRewards::<TestRuntime>::get((cid, cindex), 1);
assert_eq!(meetup_result, Some(MeetupResult::VotesNotDependable));

assert!(event_deposited::<TestRuntime>(
Event::MeetupEvaluated(cid, 1, MeetupResult::VotesNotDependable).into()
));
Copy link
Member

Choose a reason for hiding this comment

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

👍

@clangenb clangenb changed the title claim_rewards_error_results_in_meetup_marked_as_completed fails Bump substrate v0.9.28 and add a MeetupResult in the IssuedRewards storage. Nov 9, 2022
@clangenb clangenb merged commit 7273267 into master Nov 9, 2022
@pifragile
Copy link
Contributor

sorry i completely missed this @clangenb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can no longer mark a failed meetup as completed
3 participants