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

Fix active_epoch_no of PoolUpdates #611

Merged
merged 1 commit into from
May 28, 2021
Merged

Conversation

kderme
Copy link
Contributor

@kderme kderme commented May 12, 2021

No description provided.

@kderme kderme requested a review from erikd as a code owner May 12, 2021 21:04
@kderme kderme force-pushed the kderme/fix-active_epoch_no branch 2 times, most recently from 16d113b to df719d0 Compare May 12, 2021 21:39
@kderme kderme added the do not merge Test or debug only label May 13, 2021
@kderme kderme force-pushed the kderme/fix-active_epoch_no branch 2 times, most recently from 10dac50 to 915b253 Compare May 13, 2021 23:54
@kderme kderme removed the do not merge Test or debug only label May 14, 2021
@@ -296,14 +297,23 @@ insertPoolRegister tracer network (EpochNo epoch) txId idx params = do
]

poolHashId <- insertPoolHash (Shelley._poolId params)

let wasPoolRegistered = Set.member (Shelley._poolId params) $ getPoolParams $ lssOldState lStateSnap
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is big enough to be pulled out into a separate function, even if its in a where clause.

@@ -86,6 +88,7 @@ import Ouroboros.Network.Block (HeaderHash, Point (..))
import qualified Ouroboros.Network.Point as Point

import qualified Shelley.Spec.Ledger.BaseTypes as Shelley
import Shelley.Spec.Ledger.Keys
Copy link
Contributor

Choose a reason for hiding this comment

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

All imports from outside this repo should be qualified or explicit.

This makes it easier to figure out where a symbol comes from

@kderme kderme force-pushed the kderme/fix-active_epoch_no branch from 915b253 to e2d1afa Compare May 26, 2021 20:12
@erikd erikd force-pushed the kderme/fix-active_epoch_no branch 4 times, most recently from 62c0731 to 2b8026d Compare May 28, 2021 01:12
Previously, the value inserted in the activeEpochNo field did not match
the actual behaviour of the ledger rules.

The epoch where the update becomes active is the current epoch plus two
or three.

* If the pool is found in `_pParams` field of `PState` before the current
  block its `+3` (retirements in the current block are irrelevant).
* If it's not found, but there is already another `PoolReg` in the current
  block it's `+3` (we can check this from the db).
* Otherwize its `+2`.

Closes: #610
@erikd erikd force-pushed the kderme/fix-active_epoch_no branch from 2b8026d to c226c4b Compare May 28, 2021 01:32
@erikd erikd merged commit d37c3a6 into master May 28, 2021
@iohk-bors iohk-bors bot deleted the kderme/fix-active_epoch_no branch May 28, 2021 01:44
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.

2 participants