summaryrefslogtreecommitdiff
path: root/source/Test
diff options
context:
space:
mode:
authoradelon <22380201+adelon@users.noreply.github.com>2026-08-01 02:27:40 +0200
committeradelon <22380201+adelon@users.noreply.github.com>2026-08-01 02:27:40 +0200
commit0c60f12e7ecc4f211d9a9953af399b685bc52a24 (patch)
tree101f13b2bf6b6c793b1a6eeb42c88a53bb4e910a /source/Test
parent2cddaa039707a78b60e8127cdb2699ce0746ebf7 (diff)
Add cached declaration authorization
Diffstat (limited to 'source/Test')
-rw-r--r--source/Test/Unit/Declaration.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/Test/Unit/Declaration.hs b/source/Test/Unit/Declaration.hs
index 0b3e67b..28f277d 100644
--- a/source/Test/Unit/Declaration.hs
+++ b/source/Test/Unit/Declaration.hs
@@ -341,6 +341,38 @@ aggregatesExactVampireObligations =
("unexpected proof validation count: "
<> show (length records))
+ cachedRecord <-
+ case Declaration.committedBatchProofValidations batch of
+ [record] -> pure record
+ records ->
+ assertFailure
+ ("unexpected cached proof records: "
+ <> show (length records))
+ >> fail "unreachable"
+ cached <- runSuccessful fixture do
+ (_value, committed) <- Declaration.commitProofDeclaration
+ (Semantic.proofSyntaxId "two-vampire-obligations") do
+ candidate <- Declaration.reserveCandidate
+ (factSpec fixture "two-vampire-obligations")
+ Declaration.authorizeCachedVampireCandidate
+ (Semantic.proofSyntaxId "two-vampire-obligations")
+ cachedRecord
+ candidate do
+ Declaration.acceptCachedVampireObligation first
+ Declaration.acceptCachedVampireObligation second
+ pure committed
+ assertEqual
+ "cached authorization preserves the exact direct proof"
+ (Authority.CheckedSourceProof expectedRequests)
+ (case Declaration.committedBatchProofValidations cached of
+ [record] ->
+ Authority.validationDirectAuthorization
+ (Semantic.proofValidationRecordCertificate record)
+ records ->
+ error
+ ("unexpected cached validation records: "
+ <> show (length records)))
+
emptyProof <- runDriver fixture do
Declaration.commitProofDeclaration
(Semantic.proofSyntaxId "empty-vampire-proof") do