chainflip-io / chainflip-backend

The Chainflip backend repo, including the Chainflip Node and CFE.
52 stars 15 forks source link

chore: improve ES Check type inference #5448

Closed kylezs closed 5 days ago

kylezs commented 6 days ago

Pull Request

Checklist

Please conduct a thorough self-review before opening the PR.

Summary

I hit an issue when writing a check like so on my PR:

number_of_open_elections_is(_pre, post, n: ElectionCount) {
    assert_eq!(post.unsynchronised_state.open_elections, n, "Number of open elections should be {}", n);
},

and it was because without explicitly comparing the whole post-state as is currently done on some Checks, it can't infer the rest of the state. Fixing this by explicitly providing the type in the closure, writing checks should remain just as clean.

codecov[bot] commented 6 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 72%. Comparing base (277b152) to head (f3eee8d). Report is 7 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #5448 +/- ## ====================================== - Coverage 72% 72% -0% ====================================== Files 490 490 Lines 87053 86929 -124 Branches 87053 86929 -124 ====================================== - Hits 62423 62242 -181 - Misses 21675 21729 +54 - Partials 2955 2958 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.