Juvix imports
module arch.node.engines.commitment;
import prelude open;
import arch.node.types.engine open;
import arch.node.engines.commitment_config open public;
import arch.node.engines.commitment_messages open public;
import arch.node.engines.commitment_environment open public;
import arch.node.engines.commitment_behaviour open public;
import arch.node.types.anoma as Anoma open;
open commitment_config_example;
open commitment_environment_example;
Commitment Engine¶
The Commitment engine is responsible for generating commitments (signatures) by a particular identity. Commitment engine instances are generated by the Identity Management Engine when an identity is generated or connected.
Purpose¶
The Commitment Engine maintains signing capabilities for a specific identity and handles commitment (signature) requests for that identity. Only the original caller and anyone to whom they pass the engine instance reference can send messages to the instance and generate commitments by the corresponding identity.
Components¶
- Commitment Messages
- Commitment Config
- Commitment Environment
- Commitment Behaviour
Type¶
CommitmentEngine : Type :=
Engine
CommitmentCfg
CommitmentLocalState
CommitmentMailboxState
CommitmentTimerHandle
CommitmentActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;
Example of a commitment engine¶
exampleCommitmentEngine : CommitmentEngine :=
mkEngine@{
cfg := commitmentCfg;
env := commitmentEnv;
behaviour := commitmentBehaviour;
};
where commitmentCfg
is defined as follows:
commitmentCfg : EngineCfg CommitmentCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "commitment";
cfg :=
mkCommitmentCfg@{
signer :=
mkSigner@{
sign := \{_ x := Ed25519Signature "0xabcd1234"};
};
backend := BackendLocalMemory;
};
};
commitmentEnv
is defined as follows:
axiom dummyExternalIdentity : ExternalIdentity;
axiom dummyIDBackend : Backend;
axiom dummySigningKey : SigningKey;
commitmentEnv : CommitmentEnv :=
mkEngineEnv@{
localState := unit;
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};
and commitmentBehaviour
is defined as follows:
commitmentBehaviour : CommitmentBehaviour :=
mkEngineBehaviour@{
guards := First [commitGuard];
};