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

Trace hard fork transition events #1520

Merged
merged 4 commits into from
Jul 22, 2020
Merged

Conversation

mrBliss
Copy link
Contributor

@mrBliss mrBliss commented Jul 22, 2020

This will trace events like:

  • HardForkUpdateTransitionConfirmed
  • HardForkUpdateTransitionDone
  • HardForkUpdateTransitionRolledBack
  • ...

cabal.project Outdated Show resolved Hide resolved
@mrBliss mrBliss force-pushed the mrBliss/trace-transition-events branch 2 times, most recently from 1c2ddee to f8500e9 Compare July 22, 2020 13:39
@mrBliss
Copy link
Contributor Author

mrBliss commented Jul 22, 2020

This is what the structured output looks like on mainnet_candidate:

{"at":"2020-07-22T17:13:12.99Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"5e8ac3@194","events":[{"protocolUpdates":[{"protocolUpdateVersion":{"pvMajor":1,"pvMinor":0,"pvAlt":0},"protocolUpdateState":{"kind":"UpdateRegistered","slot":194}}],"kind":"ByronUpdatedProtocolUpdates"}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}
{"at":"2020-07-22T17:13:12.99Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"ddcf74@195","events":[{"protocolUpdates":[{"protocolUpdateVersion":{"pvMajor":1,"pvMinor":0,"pvAlt":0},"protocolUpdateState":{"kind":"UpdateConfirmed","slot":195}}],"kind":"ByronUpdatedProtocolUpdates"}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}
{"at":"2020-07-22T17:13:13.27Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"79c8b0@411","events":[{"protocolUpdates":[{"protocolUpdateVersion":{"pvMajor":1,"pvMinor":0,"pvAlt":0},"protocolUpdateState":{"kind":"UpdateCandidate","slot":411}}],"kind":"ByronUpdatedProtocolUpdates"}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}
{"at":"2020-07-22T17:13:13.65Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"d04085@627","events":[{"protocolUpdates":[{"protocolUpdateVersion":{"pvMajor":1,"pvMinor":0,"pvAlt":0},"protocolUpdateState":{"kind":"UpdateStableCandidate","transitionEpoch":1}}],"kind":"ByronUpdatedProtocolUpdates"}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}
{"at":"2020-07-22T17:13:14.57Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"375e8c@1080","events":[{"protocolUpdates":[],"kind":"ByronUpdatedProtocolUpdates"}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}

{"at":"2020-07-22T17:14:06.35Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"8ff654@17466","events":[{"protocolUpdates":[{"protocolUpdateVersion":{"pvMajor":2,"pvMinor":0,"pvAlt":0},"protocolUpdateState":{"kind":"UpdateRegistered","slot":17466}}],"kind":"ByronUpdatedProtocolUpdates"}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}
{"at":"2020-07-22T17:14:06.36Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"ea9ea5@17467","events":[{"protocolUpdates":[{"protocolUpdateVersion":{"pvMajor":2,"pvMinor":0,"pvAlt":0},"protocolUpdateState":{"kind":"UpdateConfirmed","slot":17467}}],"kind":"ByronUpdatedProtocolUpdates"}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}
{"at":"2020-07-22T17:14:09.97Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"34061f@17683","events":[{"protocolUpdates":[{"protocolUpdateVersion":{"pvMajor":2,"pvMinor":0,"pvAlt":0},"protocolUpdateState":{"kind":"UpdateCandidate","slot":17683}}],"kind":"ByronUpdatedProtocolUpdates"}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}
{"at":"2020-07-22T17:14:12.74Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"a53783@17899","events":[{"protocolUpdates":[{"protocolUpdateVersion":{"pvMajor":2,"pvMinor":0,"pvAlt":0},"protocolUpdateState":{"kind":"UpdateStableCandidate","transitionEpoch":17}}],"kind":"ByronUpdatedProtocolUpdates"},{"kind":"HardForkUpdateTransitionConfirmed","toEra":"Shelley","fromEra":"Byron","transitionEpoch":17}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}

{"at":"2020-07-22T17:14:29.25Z","env":"1.16.0:ab846","ns":["cardano.node.ChainDB"],"data":{"kind":"TraceAddBlockEvent.AddedToCurrentChain","newtip":"\"fe59c3@19860","events":[{"kind":"HardForkUpdateTransitionDone","toEra":"Shelley","fromEra":"Byron","transitionEpoch":17}]},"app":[],"msg":"","pid":"1295156","loc":null,"host":"desktop","sev":"Notice","thread":"33"}

@mrBliss mrBliss force-pushed the mrBliss/trace-transition-events branch from f8500e9 to 8e46b94 Compare July 22, 2020 17:15
@mrBliss mrBliss marked this pull request as ready for review July 22, 2020 17:15
@mrBliss mrBliss requested a review from disassembler July 22, 2020 17:15
Comment on lines 76 to 82
instance ToObject ProtocolUpdate where
toObject verb (ProtocolUpdate updateVersion updateState) =
mkObject $
[ "protocolUpdateVersion" .= updateVersion
, "protocolUpdateState" .= toObject verb updateState
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we purposefully not providing a kind field here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably not. I suggest add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, not purposefully, will fix it. BTW, if a kind field is mandatory, maybe mkObject should take it as an argument?

<> showT (unSlotNo slotNo)
<> ", but we cannot lead because: "
<> showT reason
TraceNoLedgerState slotNo _blk -> const $
"No ledger state at slot " <> showT (unSlotNo slotNo)
"No ledger state for slot " <> showT (unSlotNo slotNo)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it really matters much, but should we stay consistent with your changes and say "in slot"?

Suggested change
"No ledger state for slot " <> showT (unSlotNo slotNo)
"No ledger state in slot " <> showT (unSlotNo slotNo)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This made me realise that it's still not right, I now changed it to:

    TraceNoLedgerState slotNo pt -> const $
      "Could not obtain ledger state for point "
        <> pack (showPoint MaximalVerbosity immutableTipPoint)
        <> ", current slot: "
        <> showT (unSlotNo slotNo)

Because we're asking a ledger state for a point, not the current slot.

I also intentionally use "for slot" for TraceNoLedgerView, because we're asking for a forecast of the LedgerView for a particular slot using forecastFor.

Copy link
Contributor

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

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

LGTM, modulo the couple copy'n'paste fixes below.

@mrBliss mrBliss force-pushed the mrBliss/trace-transition-events branch from 8e46b94 to 290de71 Compare July 22, 2020 18:33
@mrBliss
Copy link
Contributor Author

mrBliss commented Jul 22, 2020

bors merge

iohk-bors bot added a commit that referenced this pull request Jul 22, 2020
1520: Trace hard fork transition events r=mrBliss a=mrBliss

This will trace events like:

* `HardForkUpdateTransitionConfirmed`
* `HardForkUpdateTransitionDone`
* `HardForkUpdateTransitionRolledBack`
* ...

Co-authored-by: Thomas Winant <[email protected]>
Comment on lines 293 to 295
TraceNoLedgerState slotNo pt -> const $
"Could not obtain ledger state for point "
<> pack (showPoint MaximalVerbosity immutableTipPoint)
Copy link
Contributor

Choose a reason for hiding this comment

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

immutableTipPoint is apparently not in scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right after fixing a few copy'n'pastos, I make another one 🤦. I would blame ghcide for being unreliable in showing type errors (all green), but I should have run cabal build all to check.

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 22, 2020

Build failed

For example `TraceBlockFromFuture`, was incorrect.
@mrBliss mrBliss force-pushed the mrBliss/trace-transition-events branch from 290de71 to 35309ff Compare July 22, 2020 20:11
@mrBliss
Copy link
Contributor Author

mrBliss commented Jul 22, 2020

bors merge

iohk-bors bot added a commit that referenced this pull request Jul 22, 2020
1520: Trace hard fork transition events r=mrBliss a=mrBliss

This will trace events like:

* `HardForkUpdateTransitionConfirmed`
* `HardForkUpdateTransitionDone`
* `HardForkUpdateTransitionRolledBack`
* ...

Co-authored-by: Thomas Winant <[email protected]>
@mrBliss
Copy link
Contributor Author

mrBliss commented Jul 22, 2020

Bors crashed, this PR is cursed.

@mrBliss
Copy link
Contributor Author

mrBliss commented Jul 22, 2020

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 22, 2020

@iohk-bors iohk-bors bot merged commit 95d4122 into master Jul 22, 2020
@iohk-bors iohk-bors bot deleted the mrBliss/trace-transition-events branch July 22, 2020 21:03
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