Skip to content
Juvix imports

module arch.node.engines.verification;

import prelude open;
import arch.node.types.engine open;
import arch.node.engines.verification_config open public;
import arch.node.engines.verification_messages open public;
import arch.node.engines.verification_environment open public;
import arch.node.engines.verification_behaviour open public;
import arch.node.types.anoma as Anoma open;

open verification_config_example;
open verification_environment_example;

Verification Engine

The Verification Engine is responsible for verifying commitments (signatures) made by external identities. It automatically uses "signs_for" relationship information from the Signs For Engine along with caller preference information to determine how to verify a commitment.

Purpose

The Verification Engine verifies commitments (signatures) made by external identities. It can use "signs_for" relationship information and caller preferences to determine how to verify a commitment. This engine is designed to be stateless, allowing for efficient implementation by the runtime.

Components

Type

VerificationEngine : Type :=
Engine
VerificationCfg
VerificationLocalState
VerificationMailboxState
VerificationTimerHandle
VerificationActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Example of a verification engine

exampleVerificationEngine : VerificationEngine :=
mkEngine@{
cfg := verificationCfg;
env := verificationEnv;
behaviour := verificationBehaviour;
};

where verificationCfg is defined as follows:

verificationCfg : EngineCfg VerificationCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "verification";
cfg :=
mkVerificationCfg@{
verifier :=
\{_ _ :=
mkVerifier@{
verify := \{_ _ _ := true};
verifierHash :=
mkHASH@{
ordKey :=
mkOrdkey@{
compare := Ord.cmp;
};
hash := \{x := "0x1234abcd"};
};
}};
backend := BackendLocalMemory;
signsForEngineAddress := mkPair none "Blah";
};
};

verificationEnv is defined as follows:

verificationEnv : VerificationEnv :=
mkEngineEnv@{
localState :=
mkVerificationLocalState@{
pendingRequests := Map.empty;
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};

and verificationBehaviour is defined as follows:

verificationBehaviour : VerificationBehaviour :=
mkEngineBehaviour@{
guards := First [verifyGuard; signsForResponseGuard];
};