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

tests(app): βŒ› shorten epoch length in staking test #4048

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

cratelyn
Copy link
Contributor

🚠 overview

in #4001 we added a test for the staking component (see also #3995, and #3588).

this shortens the epoch length, so that this test runs in less time, and importantly, so that debugging test failures does not entail sifting through many log lines.

βž• changes

  • manually construct an AppState so that we use a shorter epoch. this test involves waiting for multiple epochs to pass, which takes many seconds with the default length of 719, see:

  • TestNode<C>::fast_forward now accepts a u64, mirroring the type used in the sct parameters.

πŸƒ runtime

on main...

    Starting 1 test across 1 binary
        PASS [  12.646s] penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
------------
     Summary [  12.647s] 1 test run: 1 passed, 0 skipped

after these changes...

    Starting 1 test across 1 binary
        PASS [   0.420s] penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
------------
     Summary [   0.420s] 1 test run: 1 passed, 0 skipped

πŸ₯™ log volume

on main...

; RUST_LOG='info' cargo nextest run -p penumbra-app --test mock_consensus_staking --no-capture | wc -l
    Finished test [unoptimized + debuginfo] target(s) in 0.16s
    Starting 1 test across 1 binary
       START             penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
        PASS [  12.185s] penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
------------
     Summary [  12.185s] 1 test run: 1 passed, 0 skipped
46082
; RUST_LOG='info' cargo nextest run -p penumbra-app --test mock_consensus_staking --no-capture | wc -l
    Finished test [unoptimized + debuginfo] target(s) in 0.15s
    Starting 1 test across 1 binary
       START             penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
        PASS [   0.416s] penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
------------
     Summary [   0.416s] 1 test run: 1 passed, 0 skipped
450

 ### 🚠 overview

in #4001 we added a test for the staking component (_see also #3995,
and #3588_).

this shortens the epoch length, so that this test runs in less time, and
importantly, so that debugging test failures does not entail sifting
through many log lines.

 ### βž• changes

* manually construct an `AppState` so that we use a shorter epoch. this
  test involves waiting for multiple epochs to pass, which takes
  many seconds with the default length of 719, see:
  <https://github.com/penumbra-zone/penumbra/blob/8be8e8266b312c2a9eb1b1522a937e8df12f3a4f/crates/core/component/sct/src/params.rs#L41>

* `TestNode<C>::fast_forward` now accepts a u64, mirroring the type used
  in the sct parameters.

 ### πŸƒ runtime

on `main`...

```
    Starting 1 test across 1 binary
        PASS [  12.646s] penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
------------
     Summary [  12.647s] 1 test run: 1 passed, 0 skipped
```

after these changes...

```
    Starting 1 test across 1 binary
        PASS [   0.420s] penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
------------
     Summary [   0.420s] 1 test run: 1 passed, 0 skipped
```

 ### πŸ₯™ log volume

on `main`...

```
; RUST_LOG='info' cargo nextest run -p penumbra-app --test mock_consensus_staking --no-capture | wc -l
    Finished test [unoptimized + debuginfo] target(s) in 0.16s
    Starting 1 test across 1 binary
       START             penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
        PASS [  12.185s] penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
------------
     Summary [  12.185s] 1 test run: 1 passed, 0 skipped
46082
```

```
; RUST_LOG='info' cargo nextest run -p penumbra-app --test mock_consensus_staking --no-capture | wc -l
    Finished test [unoptimized + debuginfo] target(s) in 0.15s
    Starting 1 test across 1 binary
       START             penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
        PASS [   0.416s] penumbra-app::mock_consensus_staking mock_consensus_can_define_and_delegate_to_a_validator
------------
     Summary [   0.416s] 1 test run: 1 passed, 0 skipped
450
```
@cratelyn cratelyn added the A-mock-consensus Area: Relates to the mock consensus engine label Mar 19, 2024
@cratelyn cratelyn added this to the Sprint 2 milestone Mar 19, 2024
@cratelyn cratelyn self-assigned this Mar 19, 2024
@cratelyn cratelyn marked this pull request as ready for review March 19, 2024 15:00
@cratelyn cratelyn changed the title tests(app): shorten epoch length in staking test tests(app): βŒ› shorten epoch length in staking test Mar 19, 2024
@cratelyn cratelyn merged commit 1ec7aba into main Mar 19, 2024
6 checks passed
@cratelyn cratelyn deleted the kate/shorter-epoch-in-test branch March 19, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mock-consensus Area: Relates to the mock consensus engine
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant