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

Add a treasury growth test #5639

Merged
merged 1 commit into from
Mar 6, 2024
Merged

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Jan 16, 2024

Description

Tests that testnet genesis creates treasury which is growing in time.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • roundtrip tests
    • integration tests
      See Runnings tests for more details
  • Any changes are noted in the CHANGELOG.md for affected package
  • The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
    • Code is linted with hlint. See .github/workflows/check-hlint.yml to get the hlint version
    • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml to get the stylish-haskell version
    • Code builds on Linux, MacOS and Windows for ghc-8.10.7 and ghc-9.2.7
  • Self-reviewed the diff

Note on CI

If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.

@carbolymer carbolymer force-pushed the mgalazyn/test/treasury-growth branch 4 times, most recently from e035f0a to 103c1e3 Compare January 26, 2024 10:23
@carbolymer carbolymer force-pushed the mgalazyn/test/treasury-growth branch 6 times, most recently from 37ef1f0 to 03c4e8a Compare February 1, 2024 08:57
@carbolymer carbolymer force-pushed the mgalazyn/test/treasury-growth branch 7 times, most recently from 8161251 to 1373341 Compare March 5, 2024 06:32
@carbolymer carbolymer marked this pull request as ready for review March 5, 2024 06:33
@carbolymer carbolymer requested a review from a team as a code owner March 5, 2024 06:33
@carbolymer carbolymer force-pushed the mgalazyn/test/treasury-growth branch from 1373341 to 1df7a53 Compare March 5, 2024 08:09
[] -> False
xn:_ -> xn > x1

checkNonDecreasing :: (Ord a) => [a] -> Bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not have this check in the handler? You would only need to check two consecutive epochs and you can do this by taking the length of the state Map EpochNo Integer and comparing the values.

Copy link
Contributor Author

@carbolymer carbolymer Mar 5, 2024

Choose a reason for hiding this comment

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

This seems to be more clear than combining the epoch treasury values aggregation and check in the same place.

It also checks that nothing weird is not going on - that treasury is suddenly not decreasing after temporary growth.

Moreover, that's a useful debug information to have how the treasury value was changing in the test period if the test fails.

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the case [_] -> True be false since we want to check consecutive epochs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, technically a single element set is non-decreasing. A single element set is ruled out by checkHasIncreased, which returns False for [_].

@carbolymer carbolymer force-pushed the mgalazyn/test/treasury-growth branch from 6fa902f to c18580c Compare March 6, 2024 07:06
@carbolymer carbolymer disabled auto-merge March 6, 2024 10:35
@carbolymer carbolymer merged commit e9600ef into master Mar 6, 2024
16 of 22 checks passed
@carbolymer carbolymer deleted the mgalazyn/test/treasury-growth branch March 6, 2024 10:35
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.

3 participants