cardano-testnet | Remove redundant watchEpochStateUpdate#6535
cardano-testnet | Remove redundant watchEpochStateUpdate#6535carbolymer merged 1 commit intomasterfrom
watchEpochStateUpdate#6535Conversation
c076427 to
6bd49c2
Compare
palas
left a comment
There was a problem hiding this comment.
Very nice simplification 👍
There is a lot of small nuance in some changes, and probably most of it doesn't really make a difference in practice, so I think we can ignore it.
I pointed out a couple of small things that may be worth changing or double-checking
|
|
||
| -- | Core retry loop. Repeats the action every 300ms until it returns 'Right' | ||
| -- or the timeout is reached, in which case the last 'Left' is returned. | ||
| retryByTimeout |
There was a problem hiding this comment.
I think the name is misleading. To me, retryByTimeout suggests that it will retry once when the timeout hits. Maybe retryUntilTimeout instead?
retryUntil is better but there is already retryUntilM and they are both monadic... If what we want is making them easier to differentiate, I would focus on naming the difference, maybe simpleRetryUntilM or eitherRetryUntilM or something like that.
There was a problem hiding this comment.
I think I'll go with retryUntilRightM
| -> m (Either e a) | ||
| retryByTimeout esv timeout act = withFrozenCallStack $ do | ||
| startingValue <- getCurrentValue | ||
| go $ startingValue + timeoutW64 |
There was a problem hiding this comment.
Nice, I was thinking about this recalculation before but I didn't want to mention it
| retryUntilM epochStateView (WaitForBlocks numberOfBlocks) | ||
| (getBlockNumber epochStateView) | ||
| (\(BlockNo bn) -> bn >= startingBlockNumber + numberOfBlocks) |
There was a problem hiding this comment.
I think it is not very nice to have both the timeout and the action counting blocks, they may get out of sync too. I think it would be better to use retryByTimeout and rely on the timeout only, making the action always Left =<< getBlockNumber epochStateView, or Left () and then getting the block number afterwards.
Same as in waitForEpochs
| mGovernanceActionTxIx H.=== Nothing | ||
| void $ retryUntilM epochStateView (WaitForEpochs $ EpochInterval 2) | ||
| (maybeExtractGovernanceActionIndex governanceActionTxId <$> getEpochState epochStateView) | ||
| isNothing |
There was a problem hiding this comment.
Apparently, this is weakening the test, because it was originally testing that:
- The action is not available at the beginning of the call to
watchEpochStateUpdate - The action remained unavailable during two epochs
But I am not sure the later was intentional.
On the other hand, line 136 was clearly waiting for the proposal to expire. And the new usage of retryUntilM is allowing for that to happen 2 epochs later potentially, so that is not good.
We could either merge this with the line 136 and reduce the timeout to adjust it to the original expectation. Or if we think that verifying that "the action does not reappear for two extra epochs" is important, we would need to invert this retrying and make the timeout the success
There was a problem hiding this comment.
Good catch.
it was originally testing that (...) The action remained unavailable during two epochs
Looks like a double-check to me to deal with rollbacks. I don't expect rollbacks in one SPO testnets, but we can add a one epoch wait for a good measure, in case rollback happens on epoch boundary.
82f0f20 to
75aece7
Compare
palas
left a comment
There was a problem hiding this comment.
Just one comment for clarification and one thing that I think is weird in the test gov action test. Otherwise, looking good 👍
| | ti1 == L.extractHash ti2 = Just gai | ||
| compareWithTxId _ x _ _ = x | ||
|
|
||
| -- | Look up the @gasExpiresAfter@ epoch for the governance action submitted |
There was a problem hiding this comment.
I was super confused until I found out that gas meant GovActionState. Maybe it would be good to say that, for example say "look up the expiration epoch in the governance action state, through the gasExpiresAfter lens", or something like that
There was a problem hiding this comment.
I've renamed the function parameter
75aece7 to
47aa730
Compare
Jimbo4350
left a comment
There was a problem hiding this comment.
Approved based on the work in: github.com//pull/6538
47aa730 to
344c313
Compare
Checklist
See Running tests for more details
CHANGELOG.mdfor affected package.cabalfiles are updatedhlint. See.github/workflows/check-hlint.ymlto get thehlintversionstylish-haskell. See.github/workflows/stylish-haskell.ymlto get thestylish-haskellversionghc-9.6andghc-9.12Note 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.