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

Adding try_state hook for Tips pallet #1871

Merged
merged 17 commits into from
Jan 20, 2024
Merged

Conversation

Doordashcon
Copy link
Contributor

@Doordashcon Doordashcon commented Oct 14, 2023

Part of #239.

Invariant

  1. The number of entries in Tips should be equal to Reasons.
  2. If OpenTip.finders_fee is true, then OpenTip.deposit should be greater than zero.
  3. Reasons exists for each Tip[OpenTip.reason], implying equal length of storage.

polkadot address: 12zsKEDVcHpKEWb99iFt3xrTCQQXZMu477nJQsTBBrof5k2h

@Doordashcon Doordashcon marked this pull request as ready for review October 14, 2023 08:40
@Doordashcon Doordashcon requested review from a team October 14, 2023 08:40
Copy link
Member

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

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

(We should not invest much effort into this pallet since it is Gov1)

Not sure if this is actually correct, since DataDepositPerByte and TipReportDepositBase can be configured to zero.
Maybe also add a check to the integrity_test that TipReportDepositBase is not zero since otherwise it does not take a deposit for the entry into the Reasons and Tips map.

Another invariant would be that the Reason for each Tips exists.

substrate/frame/tips/src/lib.rs Outdated Show resolved Hide resolved
@paritytech-ci paritytech-ci requested a review from a team October 14, 2023 09:10
substrate/frame/tips/src/tests.rs Outdated Show resolved Hide resolved
substrate/frame/tips/src/lib.rs Outdated Show resolved Hide resolved
@paritytech-ci paritytech-ci requested a review from a team October 14, 2023 09:21
@Doordashcon
Copy link
Contributor Author

@ggwpez Thanks for the review

(We should not invest much effort into this pallet since it is Gov1)

Noted

Not sure if this is actually correct, since DataDepositPerByte and TipReportDepositBase can be configured to zero.
Maybe also add a check to the integrity_test that TipReportDepositBase is not zero since otherwise it does not take a deposit for the entry into the Reasons and Tips map.

🤝 will include this.

Another invariant would be that the Reason for each Tips exists.

I previously included this as an Invariant here, seems like it's universal logic in the function calls and also tests for this would always pass.

@Doordashcon Doordashcon changed the title Adding 'try_state` hook for Tips pallet Adding try_state hook for Tips pallet Oct 14, 2023
substrate/frame/tips/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/tips/src/tests.rs Outdated Show resolved Hide resolved
substrate/frame/tips/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/tips/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/tips/src/lib.rs Outdated Show resolved Hide resolved
@juangirini juangirini added the T2-pallets This PR/Issue is related to a particular pallet. label Oct 30, 2023
@paritytech-review-bot paritytech-review-bot bot requested a review from a team November 16, 2023 15:46
Copy link
Contributor

@gpestana gpestana left a comment

Choose a reason for hiding this comment

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

Added a couple of comments, but approving. thanks!

substrate/frame/tips/src/lib.rs Show resolved Hide resolved
substrate/frame/tips/src/tests.rs Show resolved Hide resolved
@paritytech-review-bot paritytech-review-bot bot requested a review from a team January 9, 2024 14:30
prdoc/pr_1871.prdoc Outdated Show resolved Hide resolved
Copy link
Member

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

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

LGTM, lets get it merged soon. Its open since quite a while now 😅

@bkchr bkchr merged commit 3b7a8c7 into paritytech:master Jan 20, 2024
123 of 125 checks passed
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
Part of paritytech#239.

Invariant

1. The number of entries in `Tips` should be equal to `Reasons`.
2. If `OpenTip.finders_fee` is true, then `OpenTip.deposit` should be
greater than zero.
3. Reasons exists for each Tip[`OpenTip.reason`], implying equal length
of storage.

polkadot address: 12zsKEDVcHpKEWb99iFt3xrTCQQXZMu477nJQsTBBrof5k2h

---------

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Mar 26, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Mar 27, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this pull request Apr 10, 2024
bkchr pushed a commit that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants