Skip to content

add trimming tests#538

Merged
niklasad1 merged 31 commits intomainfrom
na-staking-miner-trimming-test
May 18, 2023
Merged

add trimming tests#538
niklasad1 merged 31 commits intomainfrom
na-staking-miner-trimming-test

Conversation

@niklasad1
Copy link
Copy Markdown
Contributor

@niklasad1 niklasad1 commented Apr 26, 2023

Basically it works like this:

  1. Compile the staking-miner-playground (--features test-trimming) that will ensure that both MinerMaxLength and MinerMaxWeight is configured to a smaller value and trimming always occurs.

For instance recall that Kian added some special code where the number of validators, nominators etc can be configured by env variables and we read the same env variables to ensure that MaxLength is less than the number of validators.

  1. Run the staking miner and assert:
    a) Trimming weight and length from the CLI output isn't 0
    b) the solution is accepted by chain (hence feasibility check was successful)

@kianenigma
Copy link
Copy Markdown
Contributor

Looks mostly good, thanks!

@niklasad1 niklasad1 marked this pull request as ready for review May 8, 2023 14:16
@niklasad1 niklasad1 changed the title WIP: trimming tests add trimming tests May 8, 2023
@niklasad1 niklasad1 requested a review from a team as a code owner May 9, 2023 06:36
@niklasad1 niklasad1 requested review from gpestana, jsdw and kianenigma May 11, 2023 14:50
Copy link
Copy Markdown
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 few comments and questions. Also I don't see to be able to build and run the tests for staking-miner-playground locally, the compilation is failing.

assert!(success);
assert!(got_truncate_weight, "Trimming weight logs were not found");
assert!(got_truncate_len, "Trimming length logs were not found");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be possible to assert how much has been truncated in terms of len and weight, or are those values not deterministic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Those are not deterministic right now, I guess it's because how the nominators are generated with some randomness so the number of assignments differ between the runs.

niklasad1 and others added 3 commits May 17, 2023 10:12
@niklasad1
Copy link
Copy Markdown
Contributor Author

merging this now, because I want to run it our daily integration tests.

@niklasad1 niklasad1 merged commit fb9cf09 into main May 18, 2023
@niklasad1 niklasad1 deleted the na-staking-miner-trimming-test branch May 18, 2023 12:24
@niklasad1 niklasad1 mentioned this pull request May 19, 2023
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.

4 participants