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

feat: add feasibility_check on mined solution #483

Merged
merged 10 commits into from
Mar 31, 2023
Merged

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Mar 8, 2023

Close #480 #498

You don't have to review the staking-miner-playground carefully it simply updates substrate to get the latest EPM changes in the metadata.

@niklasad1 niklasad1 marked this pull request as ready for review March 21, 2023 15:59
@niklasad1 niklasad1 changed the title WIP: feat: add feasibility_check on mined solution feat: add feasibility_check on mined solution Mar 21, 2023
src/epm.rs Outdated Show resolved Hide resolved
pub fn mock_votes(voters: u32, desired_targets: u16) -> Vec<(u32, u16)> {
assert!(voters >= desired_targets as u32);
(0..voters).zip((0..desired_targets).cycle()).collect()
pub fn mock_votes(voters: u32, desired_targets: u16) -> Option<Vec<(u32, u16)>> {
Copy link
Member Author

Choose a reason for hiding this comment

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

refactored to not panic with weird input here

active_voters,
desired_targets.try_into().expect("Desired targets < u16::MAX"),
) else {
return Weight::MAX;
Copy link
Member Author

Choose a reason for hiding this comment

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

refactored not to panic on weird input, Weight::MAX was the best I could come with i.e, just throw away the result

@niklasad1 niklasad1 requested a review from gpestana March 28, 2023 12:57
@niklasad1 niklasad1 merged commit 96e7798 into main Mar 31, 2023
@niklasad1 niklasad1 deleted the na-add-feasibility-check branch March 31, 2023 08:37
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.

add feasiblity check on the solution before submitting
2 participants