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

Approval checking unit tests#3252

Merged
4 commits merged intoparitytech:masterfrom
Lldenaurois:approval_checking_unit_tests
Jun 16, 2021
Merged

Approval checking unit tests#3252
4 commits merged intoparitytech:masterfrom
Lldenaurois:approval_checking_unit_tests

Conversation

@Lldenaurois
Copy link
Contributor

This PR intends to add unit tests for approval checking in the Approval Voting subsystem

@Lldenaurois Lldenaurois force-pushed the approval_checking_unit_tests branch 2 times, most recently from 1babd75 to 4b6f6d3 Compare June 15, 2021 01:40
@Lldenaurois Lldenaurois marked this pull request as draft June 15, 2021 01:41
@Lldenaurois Lldenaurois added A0-please_review Pull request needs code review. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Jun 15, 2021
vec![0, 3], // zero start with gap
vec![2], // non-zero start
vec![2, 4], // non-zero start with gap
];
Copy link
Contributor

Choose a reason for hiding this comment

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

Some test cases with longer gaps and longer sequential runs would be good

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the goal here was to get started with something and see whether it's moving in the right direction. I will continue to expand on this.

In the subsequent commit, we will begin to test this method in
isolation.
Previously, this algorithm would generate duplicate, empty entries for
tranches (1..pre_end). This is caused because the initial value (0) for
gap_end is treated as the end of a prior tranche that wasn't actually
processed. The first pass thus would add (1..tranche) empty entries, in
addition to the (0..pre_end) empty entries chained at the end of the
method.

This is fixed by using the current tranche as the gap_start for the
first iteration, ensuring that the approval_entries_filled only produces
entries in the range (pre_end..post_start).
@Lldenaurois Lldenaurois force-pushed the approval_checking_unit_tests branch from 4b6f6d3 to 8dcdfc9 Compare June 15, 2021 02:20
@rphmeier
Copy link
Contributor

Let's get the bugfix merged in this PR and then you can continue adding tests in a further branch

vec![0, 3], // zero start with gap
vec![2], // non-zero start
vec![2, 4], // non-zero start with gap
];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
];
vec![0, 1, 2], // zero start with run and no gap
vec![2, 3, 4, 8], // non-zero start with run and gap
vec![0, 1, 2, 5, 6, 7], // zero start with runs and gap
];

@Lldenaurois
Copy link
Contributor Author

Should be ready to go.

I've opened a new PR with additional tests. I'll build on top of that one to expand on the testing for this subsystem.

@rphmeier rphmeier marked this pull request as ready for review June 16, 2021 14:48
@rphmeier
Copy link
Contributor

This needs a merge with master and then should be good to go.

@rphmeier
Copy link
Contributor

bot merge

@ghost
Copy link

ghost commented Jun 16, 2021

Waiting for commit status.

@ghost ghost merged commit dd2e858 into paritytech:master Jun 16, 2021
ordian added a commit that referenced this pull request Jun 17, 2021
* master:
  Companion #9019 (max rpc payload override) (#3276)
  Implementers' Guide: Chain Selection (#3262)
  CLI: Add missing feature checking and check if someone passes a file (#3283)
  Export 'TakeRevenue' trait. (#3278)
  Add XCM Decode Limit (#3273)
  Allow Council to Use Scheduler (#3237)
  fix xcm pallet origin (#3272)
  extract determine_new_blocks into a separate utility (#3261)
  Approval checking unit tests (#3252)
  bridges: update finality-grandpa to 0.14.1 (#3266)
  malus - mockable overseer mvp (#3224)
  use safe math (#3249)
  Companion for #8920 (Control Staking) (#3260)
  Companion for #8949 (#3216)
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments