KES agent state.
Modulekes-agent-1.3.0.0Haskell2010
Cardano.KESAgent.Processes.Agent
The main Agent program. The KES Agent opens two sockets:
A "control" socket, to which a control server can connect in order to push new keys into the agent.
A "service" socket, to which a Node can connect in order to receive the current KES key and future key updates.
The KES Agent has two slots, each of which can hold up to one KES key:
- The "staged key" slot can hold just a raw KES signing key; this key is
not shared with service clients, and there is no operational certificate
linked to it. This slot is used to hold a key while an operational
certificate for it is generated. Staged keys are not shared with other
agents, and are always lost when the KES agent restarts. Staged keys do
not have any validity attached to them; they become valid when an
operational certificate is attached and they are moved to the active slot.
Because of this, staged keys will never be evolved by the KES agent, and
when a staged key is installed into the active slot, it will always be at
evolution 0.
- The "active" or "current" slot may hold a TaggedBundle. A tagged
bundle is always tagged with a timestamp for synchronization purposes, and
may hold a Bundle. A Bundle, then, consists of a signing key and a
matching operational certificate. The active key is sent out to service
clients in two situations:
- When a service client first connects, the current key bundle is sent
- When a new key bundle is installed into the active slot, it is sent out
to all connected clients.
The KES Agent also takes care of evolving active keys to the current KES period, based on genesis parameters (EvolutionConfig) passed at agent creation and the host's RTC. While active keys are evolved inside the agent, these evolved keys will *not* be sent out to connected clients, because those clients will already have an earlier evolution of the key, and must evolve those themselves. The evolved key will, however, be served once to any service client connecting at a later time.
- 5 types
- 2 classes
- 6 values
- Packagekes-agent-1.3.0.0
- Exports13
- LanguageHaskell2010
- LicenceApache-2.0
- SourceAgent.hs
Configuration options for creating a new KES agent process.
Constructors
AgentOptionsagentTracer :: Tracer m AgentTraceagentControlAddr :: Maybe addrSocket on which the agent will be listening for control messages, i.e., KES keys being pushed from a control server. For "relay" agents that don't need to receive any control connections, this can be Nothing.
agentServiceAddr :: addrSocket on which the agent will send KES keys to any connected nodes.
agentBootstrapAddr :: [addr]Sockets that the agent will use for bootstrapping from other agents.
agentEvolutionConfig :: EvolutionConfigEvolution configuration: genesis, slot duration, slots per KES period
agentGetCurrentTime :: m UTCTimeReturn the current time. Should normally be set to
getPOSIXTime, but overriding this may be desirable for testing purposes.agentColdVerKey :: VerKeyDSIGN (DSIGN c)Cold verification key, used for verifying operational certificates. The KES agent will only accept operational certificates signed using the corresponding cold signing key.
agentGenSeed :: m (MLockedSeed (SeedSizeKES (KES c)))Seed generator for generating KES signing keys. This is configurable for testing purposes. *It is vitally important for the security of generated keys that a cryptographically sound seed generator is used here. Production code should always use mlockedSeedNewRandom from
cardano-crypto-classhere.*
Evolution parameters used to determine which evolution of a given key is current, and when a key should evolve. Fields are named after the matching fields of the genesis JSON file.
Constructors
Instances5Eq, Ord, Show, FromJSON, ToJSON
Eq EvolutionConfigDefined in kes-agent-crypto-1.2.0.0 · Cardano.KESAgent.KES.EvolutionOrd EvolutionConfigDefined in kes-agent-crypto-1.2.0.0 · Cardano.KESAgent.KES.EvolutionShow EvolutionConfigDefined in kes-agent-crypto-1.2.0.0 · Cardano.KESAgent.KES.EvolutionFromJSON EvolutionConfigDefined in kes-agent-crypto-1.2.0.0 · Cardano.KESAgent.KES.EvolutionToJSON EvolutionConfigDefined in kes-agent-crypto-1.2.0.0 · Cardano.KESAgent.KES.Evolution
Crypto types for which control drivers are available.
Methods
availableControlDrivers :: AgentContext m c => [(VersionIdentifier, ControlDriverRun m c fd addr)]The control drivers available for this
Crypto.
Instances3ControlCrypto
ControlCrypto MockCryptoDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.Agent.ControlDriversControlCrypto SingleCryptoDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.Agent.ControlDriversControlCrypto StandardCryptoDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.Agent.ControlDrivers
Crypto types for which service drivers are available.
Methods
availableServiceDrivers :: AgentContext m c => [ServiceDriver m c]The service drivers available for this
Crypto.
Instances3ServiceCrypto
ServiceCrypto MockCryptoDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.Agent.ServiceDriversServiceCrypto SingleCryptoDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.Agent.ServiceDriversServiceCrypto StandardCryptoDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.Agent.ServiceDrivers
Default evolution parameters, based on the parameters used on the real-world production ledger at the time of writing.
Trace messages emitted from a KES agent process.
Constructors
AgentVersionHandshakeDriverTrace VersionHandshakeDriverTraceAgentBootstrapTrace String ServiceClientTraceAgentCheckEvolution KESPeriodAgentControlClientConnected String StringAgentControlClientDisconnected StringAgentControlDriverTrace String ControlDriverTraceAgentControlSocketClosed StringAgentControlSocketDisabledAgentControlSocketError StringAgentControlVersionHandshakeFailedAgentCRefEvent CRefEventAgentDroppingKey TaggedBundleTraceAgentInstallingKeyDropAgentInstallingNewKey TaggedBundleTraceAgentKeyEvolved KESPeriod KESPeriodAgentKeyExpired KESPeriod KESPeriodAgentKeyNotEvolved KESPeriod KESPeriodAgentListeningOnControlSocket StringAgentListeningOnServiceSocket StringAgentLockAcquired StringAgentLockReleased StringAgentLockRequest StringAgentNoKeyToEvolveAgentRejectingKey StringAgentReplacingPreviousKey TaggedBundleTrace TaggedBundleTraceAgentServiceClientConnected String StringAgentServiceClientDisconnected StringAgentServiceDriverTrace String ServiceDriverTraceAgentServiceSocketClosed StringAgentServiceSocketError StringAgentServiceVersionHandshakeFailedAgentSkippingOldKey String StringAgentRequestingKeyUpdate TaggedBundleTraceAgentPushingKeyUpdate TaggedBundleTrace StringAgentHandlingKeyUpdateAgentUpdateKESPeriod KESPeriod KESPeriodAgentGeneratedStagedKey StringAgentCouldNotGenerateStagedKeyAgentDroppedStagedKey StringAgentNoStagedKeyToDropAgentDebugTrace StringAgentConfigurationError String
Instances2Show, Pretty
Show AgentTraceDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.Agent.TypePretty AgentTraceDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.Agent.Type
Trace logging messages a service client can generate.
Constructors
ServiceClientVersionHandshakeTrace !VersionHandshakeDriverTraceServiceClientVersionHandshakeFailedServiceClientDriverTrace !ServiceDriverTraceServiceClientSocketClosedServiceClientConnected !StringServiceClientAttemptReconnect !Int !Int !String !StringServiceClientReceivedKey !TaggedBundleTraceServiceClientDeclinedKey !TaggedBundleTraceServiceClientDroppedKeyServiceClientOpCertNumberCheck !Word64 !Word64ServiceClientAbnormalTermination !StringServiceClientStopped
Instances2Show, Pretty
Show ServiceClientTraceDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.ServiceClientPretty ServiceClientTraceDefined in kes-agent-1.3.0.0 · Cardano.KESAgent.Processes.ServiceClient
Initialize agent options with reasonable defaults. The following fields must be overridden before use, otherwise they will error: - agentServiceAddr (a KES agent that doesn't serve any keys is useless) - agentColdVerKey (a cold verification key is required to verify opcerts) - agentGenSeed (seed generator is required to generate keys)
Initialize a new Agent. This will not spawn the actual agent process, just set up everything it needs.
Initialize a new Agent. This will not spawn the actual agent process, just set up everything it needs.
Run an agent. This will spawn the following threads: - An evolution thread, which regularly checks whether the active key should be evolved, and if so, evolves it. - A service listener, listening on the configured service socket, spawning a service handler for each accepted service connection - A control listener, listening on the configured control socket, spawning a control handler for each accepted control connection - One bootstrap client thread for each configured bootstrapping address. Each bootstrap client acts as a service client to another agent, taking care of receiving incoming key updates, comparing them against the current active key, and installing them if they are valid and newer.
Clean up after an Agent.