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

Update registration ownership info in monitorStakePools #1154

Merged
merged 11 commits into from
Dec 11, 2019

Conversation

rvl
Copy link
Contributor

@rvl rvl commented Dec 10, 2019

Relates to #1092.

Overview

This modifies the stake pool network follower loop so that pool registrations are tracked in the database.

Tested with a unit test that mocks the network layer.

@rvl rvl self-assigned this Dec 10, 2019
iohk-bors bot added a commit that referenced this pull request Dec 10, 2019
1131: Include registration certificates in Cardano.Pool.Metrics.Block r=rvl a=rvl

# Issue Number

Relates to #1090.

# Overview

- Adds registration certificates to `Cardano.Pool.Metrics.Block`.

# Comments

- Testing will be done in #1154.


Co-authored-by: Rodney Lorrimar <[email protected]>
@KtorZ KtorZ force-pushed the rvl/1092/pool-registrations-db branch from 2354a1f to 4691945 Compare December 10, 2019 16:03
@KtorZ KtorZ marked this pull request as ready for review December 10, 2019 16:03
@KtorZ KtorZ changed the base branch from rvl/1090/apply-block-pool-registrations to master December 10, 2019 16:05
Copy link
Member

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

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

@rvl I've completed the unit test but will leave the review to you.
In the end, I am not sure it's buying us much more than what the db properties already buy us in terms of testing..

Still, I carried on because this test setup could open some nice possibilities to also test other stuff like the metrics.

@KtorZ
Copy link
Member

KtorZ commented Dec 10, 2019

bors try

iohk-bors bot added a commit that referenced this pull request Dec 10, 2019
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 10, 2019

try

Build succeeded

@rvl rvl force-pushed the rvl/1092/pool-registrations-db branch from 4d61438 to 9851083 Compare December 11, 2019 00:58
@rvl
Copy link
Contributor Author

rvl commented Dec 11, 2019

Thanks @KtorZ.

In the end, I am not sure it's buying us much more than what the db properties already buy us in terms of testing..

I thought the same thing. There is only a small amount of logic in monitorStakePools that is not covered by unit tests. But it needs to be unit tested somehow.

I have added an extra assertion for to the test case that stake pool registration certificates are logged.

<> pretty registrations
liftIO $ forM_ registrations $ \registration ->
logInfo tr $ "Discovered stake pool registration: "
<> pretty registration
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@jonathanknowles jonathanknowles left a comment

Choose a reason for hiding this comment

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

I reviewed the following changes:

LGTM!

Though it'd be great to have a named constant for the magic number 42. (See: 9851083#diff-baca5dbe242634249ae8122255a26866R317)

@@ -288,6 +312,9 @@ prop_trackRegistrations test = monadicIO $ do
pure (0, mempty)
, networkTip =
pure header0
, staticBlockchainParameters =
(block0, mockBlockchainParameters
{ getEpochStability = Quantity 42 })
Copy link
Member

Choose a reason for hiding this comment

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

Question: where does the number 42 come from, and does it have a special meaning?

Even if it's just an arbitrary number, perhaps adding a named constant will help future readers to know that it's just an arbitrary number? (For example, arbitraryEpochStability or mockEpochStability.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK fixed.

@rvl rvl force-pushed the rvl/1092/pool-registrations-db branch from 9851083 to b941225 Compare December 11, 2019 04:16
@rvl
Copy link
Contributor Author

rvl commented Dec 11, 2019

bors merge

@rvl
Copy link
Contributor Author

rvl commented Dec 11, 2019

bors r+

iohk-bors bot added a commit that referenced this pull request Dec 11, 2019
1154: Update registration ownership info in monitorStakePools r=rvl a=rvl

Relates to #1092.

# Overview

This modifies the stake pool network follower loop so that pool registrations are tracked in the database.

Tested with a unit test that mocks the network layer.


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: KtorZ <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 11, 2019

Build succeeded

@iohk-bors iohk-bors bot merged commit b941225 into master Dec 11, 2019
@KtorZ KtorZ deleted the rvl/1092/pool-registrations-db branch December 11, 2019 09:26
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