Skip to content

Conversation

fraser-iohk
Copy link
Contributor

@fraser-iohk fraser-iohk commented Aug 5, 2025

This PR supercedes #1487

includes the following squashed commit messages:

  • Update to use newest cardano-crypto-class with unsound pure KES implementation

  • Use mlocked KES

  • Add KES agent connectivity

  • Rebase cleanup

  • Handle drop-key messages from KES Agent

  • Provide KESAgentClientTrace to BlockForging

  • Revert change to MockCrypto and require DSIGN only when running the KES agent

  • Bump kes-agent SRP to remove SerDoc dependency

Description

Please include a meaningful description of the PR and link the relevant issues
this PR might resolve.

Also note that:

  • New code should be properly tested (even if it does not add new features).
  • The fix for a regression should include a test that reproduces said regression.

@fraser-iohk fraser-iohk force-pushed the fraser-iohk/kes-agent-rebase-v0.1.0.0 branch 4 times, most recently from 012585e to b38cdd3 Compare August 7, 2025 08:36
@fraser-iohk fraser-iohk self-assigned this Aug 7, 2025
@fraser-iohk fraser-iohk moved this to 🏗 In progress in Consensus Team Backlog Aug 7, 2025
@fraser-iohk fraser-iohk mentioned this pull request Aug 7, 2025
39 tasks
@fraser-iohk fraser-iohk force-pushed the fraser-iohk/kes-agent-rebase-v0.1.0.0 branch from d5634f7 to 8023c8d Compare August 12, 2025 13:27
instance
( CardanoHardForkConstraints StandardCrypto
, IOLike m
, MonadKESAgent m
Copy link
Contributor

Choose a reason for hiding this comment

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

Should MonadKESAgent be part of IOLike?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it could in theory, but MonadKESAgent is currently (in theory) Praos-specific and defined in ouroboros-consensus-diffusion (which is admittedly a bit weird) -- I can try to move it into ouroboros-consensus if that would make more sense

@@ -158,7 +159,7 @@ synthesize genTxs DBSynthesizerConfig{confOptions, confShelleyGenesis, confDbDir
flavargs
$ ChainDB.defaultArgs

forgers <- blockForging
(_, forgers) <- allocate registry (const $ mkForgers nullTracer) (mapM_ BlockForging.finalize)
Copy link
Contributor

Choose a reason for hiding this comment

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

We rely on the registry finalizing these keys. Are we manually finalizing them somewhere? If so, we should call release on the ResourceKey.

( knownSlotWatcher btime $
\currentSlot -> withRegistry (\rr -> withEarlyExit_ $ go rr currentSlot)
)
(finalize blockForging)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we store this blockForging in some registry? Should we instead release it from there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, especially since HotKeys are not supposed to be finalized more than one time

( Just $ \handleKey handleDrop -> do
runKESAgentClient tr path handleKey handleDrop
)
(pure ())
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the finalizer do something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

afaik this should be fine -- we don't need to instruct the KES agent to forget the key since that occurs at the BlockForging level, and the HotKey's finalizer already cancels the async it spawns

lehins and others added 9 commits August 21, 2025 12:39
- Update to use newest cardano-crypto-class with unsound pure KES implementation

- Use mlocked KES

- Add KES agent connectivity

- Rebase cleanup

- Handle drop-key messages from KES Agent

- Provide KESAgentClientTrace to BlockForging

- Revert change to MockCrypto and require DSIGN only when running the KES agent

- Bump kes-agent SRP to remove SerDoc dependency
@fraser-iohk fraser-iohk force-pushed the fraser-iohk/kes-agent-rebase-v0.1.0.0 branch from ccaa4c6 to 7c41ce7 Compare August 21, 2025 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

3 participants