RFC PV-ANCHOR-001 : ProbatioVault Blockchain Anchoring Protocol¶
Statut : Proposition interne Version : 1.2.0 Date : 2026-03-02 Auteur : ProbatioVault Engineering Verification formelle : TLA+ (TLC), Alloy (SAT), Z Notation, Prolog Changelog : v1.2 — ANCHOR-07 algorithme Merkle exact (RFC 9162 §2.1, prefixes 0x00/0x01), ANCHOR-09 modele de confiance blockchain, ANCHOR-18 gouvernance politique de finalite, ANCHOR-19 limites de batch, transition PENDING_FINALITY -> FAILED via timeout, note ecarts spec/code
1. Introduction¶
1.1 Objectif¶
Ce document specifie le protocole PV Anchor, le systeme d'ancrage blockchain de ProbatioVault. L'ancrage garantit l'immutabilite et la tracabilite des evenements d'audit en les ancrant periodiquement dans une blockchain publique via des arbres de Merkle et des preuves d'inclusion compatibles avec la structure definie par RFC 9162.
1.2 Portee¶
Ce protocole couvre :
- Le cycle de vie des batches d'ancrage (PENDING -> BUILDING -> SUBMITTED -> PENDING_FINALITY -> FINALIZED / FAILED)
- L'immutabilite des batches finalises (trigger PostgreSQL)
- L'unicite des evenements dans les batches finalises
- La liberation atomique des evenements en cas d'echec
- La continuite temporelle des fenetres d'ancrage
- La tracabilite complete de chaque transition d'etat
- La construction d'arbres de Merkle (SHA-256, hashes ordonnes)
- Les preuves d'inclusion compatibles avec la structure RFC 9162 (Merkle tree hashing & path computation)
- La verification des artefacts de preuve sans acces privilegie
- La conformite EIP-155 pour les identifiants de chaine
- Le verrouillage pessimiste a la finalisation
- La gestion des reorganisations de chaine (reorg handling)
- La politique de finalite configurable par chaine cible (FINALITY_DEPTH, FINALITY_TIMEOUT)
- La revocation des adresses de signature (SignerStatus lifecycle)
1.3 References normatives¶
| Reference | Titre | Usage |
|---|---|---|
| PV-AUDIT-001 | ProbatioVault Audit Protocol | Format events audit, pipeline probatif |
| PV-PROOF-001 | ProbatioVault ProofEnvelope Protocol | Preuve composite, evidence ancrage |
| RFC 9162 | Certificate Transparency v2 | Inclusion proof structure (Merkle tree hashing & path computation) |
| EIP-155 | Simple Replay Attack Protection | Chain ID validation |
| FIPS 180-4 | Secure Hash Standard (SHA-256) | Hash des arbres de Merkle |
1.4 Terminologie¶
| Terme | Definition |
|---|---|
| AnchorBatch | Ensemble d'evenements regroupes pour ancrage blockchain. Suit un cycle de vie a 5 etats + 2 terminaux. |
| BatchStatus | Etat du batch : PENDING, BUILDING, SUBMITTED, PENDING_FINALITY, FINALIZED, FAILED. |
| MerkleRoot | Racine SHA-256 de l'arbre de Merkle construit a partir des hashes ordonnes des evenements du batch. |
| InclusionProof | Preuve qu'un evenement appartient a un arbre de Merkle, compatible avec la structure RFC 9162. |
| ProofArtifact | Artefact exportable contenant la preuve d'inclusion, verifiable sans acces privilegie. |
| TemporalWindow | Fenetre temporelle [windowStart, windowEnd) definissant la periode de collecte des evenements. |
| Reorg | Reorganisation de la blockchain ou le bloc contenant la transaction est orphelin. |
| Finality | Confirmation definitive d'un bloc par la blockchain (nombre de confirmations suffisant). |
| FinalityDepth | Nombre minimum de confirmations blockchain requises avant de considerer un bloc comme final. Configurable par chaine cible. |
| FinalityTimeout | Delai maximum d'attente de la finality. Depassement declenche FailBatch. Configurable par chaine cible. |
| SignerStatus | Etat d'une adresse de signature : ACTIVE (autorisee a signer) ou REVOKED (revoquee, ne peut plus signer). |
2. Vue d'ensemble du protocole¶
2.1 Machine a etats du batch¶
+------------------+
| PENDING |
+--------+---------+
|
CreateBatch
|
+--------v---------+
| BUILDING |
+--------+---------+
|
SubmitBatch
|
+--------v---------+
| SUBMITTED |
+--------+---------+
|
ConfirmBatch
|
+--------v---------+
| PENDING_FINALITY |
+--------+---------+
/ \
FinalizeBatch HandleReorg
/ \
+-----------v---+ +------v--------+
| FINALIZED | | FAILED |
| (terminal, | | (terminal, |
| immutable) | | events |
+---------------+ | released) |
+------+--------+
|
RetryBatch
|
(new PENDING)
2.2 Flux d'ancrage¶
- CreateBatch : Collecte des evenements eligibles, construction arbre de Merkle, fenetre temporelle
- SubmitBatch : Soumission de la transaction blockchain (merkle root + chain ID + signer address ACTIVE)
- ConfirmBatch : Reception du tx hash et du block number
- FinalizeBatch : Verrouillage pessimiste, validation finality (confirmations >= FINALITY_DEPTH), immutabilite
- FailBatch : Echec (timeout, erreur reseau, reorg, FINALITY_TIMEOUT depasse) avec liberation atomique des evenements
- ExportProofArtifact : Generation d'un artefact de preuve d'inclusion verifiable offline
- VerifyInclusionProof : Verification compatible RFC 9162 d'un evenement dans le Merkle tree
- HandleReorg : Detection de bloc orphelin, transition PENDING_FINALITY -> FAILED
- RetryBatch : Creation d'un nouveau batch PENDING a partir des evenements liberes
- RevokeSigner : Revocation d'une adresse de signature (ACTIVE -> REVOKED, irreversible)
- Tick : Avance de l'horloge logique
2.3 Proprietes de surete¶
EXIGENCE ANCHOR-01 : Les batches suivent strictement la machine a etats : PENDING -> BUILDING -> SUBMITTED -> PENDING_FINALITY -> FINALIZED (ou FAILED). FINALIZED et FAILED sont terminaux.
EXIGENCE ANCHOR-02 : Un batch FINALIZED est immutable. Aucune modification n'est autorisee apres finalisation (enforced par trigger PostgreSQL BEFORE UPDATE OR DELETE).
3. Specifications detaillees¶
3.1 Transitions d'etat¶
EXIGENCE ANCHOR-01 : Les seules transitions valides sont :
| De | Vers | Action | Condition |
|---|---|---|---|
| (none) | PENDING | CreateBatch | Evenements eligibles disponibles |
| PENDING | BUILDING | CreateBatch (phase 2) | Arbre de Merkle construit |
| BUILDING | SUBMITTED | SubmitBatch | Transaction soumise a la blockchain, signer ACTIVE |
| SUBMITTED | PENDING_FINALITY | ConfirmBatch | Tx hash et block number recus |
| PENDING_FINALITY | FINALIZED | FinalizeBatch | Finality confirmee (confirmations >= FINALITY_DEPTH) + lock pessimiste |
| PENDING_FINALITY | FAILED | HandleReorg | Bloc orphelin detecte |
| PENDING_FINALITY | FAILED | FailBatch | FINALITY_TIMEOUT depasse |
| BUILDING | FAILED | FailBatch | Erreur de construction |
| SUBMITTED | FAILED | FailBatch | Timeout ou erreur reseau |
Prouve formellement (TLA+ INV-02 ValidTransitions, Alloy ValidTransitionsOnly).
3.2 Immutabilite des batches finalises¶
EXIGENCE ANCHOR-02 : Un batch a l'etat FINALIZED ne peut plus etre modifie. Enforced par trigger PostgreSQL BEFORE UPDATE OR DELETE sur la table anchor_batches. Prouve formellement (TLA+ INV-03 FinalizedImmutable, Alloy FinalizedBatchImmutable).
3.3 Unicite des evenements¶
EXIGENCE ANCHOR-03 : Chaque evenement appartient a au plus un batch FINALIZED. Un evenement ne peut pas etre ancre deux fois. Prouve formellement (TLA+ INV-04 EventUniqueness, Alloy EventUniqueInFinalizedBatch).
3.4 Liberation atomique des evenements¶
EXIGENCE ANCHOR-04 : Lorsqu'un batch passe a FAILED, tous ses evenements sont liberes atomiquement et redeviennent eligibles pour un nouveau batch. Prouve formellement (TLA+ INV-05 NoEventsLost, Alloy FailedBatchReleasesEvents).
3.5 Continuite temporelle¶
EXIGENCE ANCHOR-05 : Chaque batch a une fenetre temporelle [windowStart, windowEnd) avec windowStart < windowEnd. Les fenetres ne se chevauchent pas entre batches finalises. Prouve formellement (TLA+ INV-06 WindowOrdering, Alloy WindowContinuity).
3.6 Tracabilite des transitions¶
EXIGENCE ANCHOR-06 : Chaque transition d'etat d'un batch DOIT etre enregistree dans l'audit log. L'audit log est append-only. Prouve formellement (TLA+ INV-07 AuditCompleteness, INV-11 AuditAppendOnly, Alloy EveryTransitionAudited).
3.7 Arbre de Merkle¶
EXIGENCE ANCHOR-07 : L'arbre de Merkle est construit selon l'algorithme suivant, compatible avec la structure RFC 9162 §2.1 :
- Hash de feuille :
MTH_leaf(entry) = SHA-256(0x00 || entry_hash)ouentry_hashest le SHA3-256 de l'entree d'audit (32 bytes) - Hash de noeud interne :
MTH_node(left, right) = SHA-256(0x01 || left || right) - Niveau impair : le dernier element sans pair est promu au niveau superieur sans modification (identique a RFC 9162 §2.1)
- Ordre des feuilles : les feuilles sont ordonnees par
leaf_index(entier 0-indexed, attribue dans l'ordre d'insertion dans le batch) - Endianness : les prefixes (0x00, 0x01) sont des octets uniques. Les hashes sont en bytes bruts (pas d'encodage hex)
- Merkle root :
MTH_root = MTH(leaves[0..n-1])pour n feuilles. Si n=1,MTH_root = MTH_leaf(leaves[0])
Chaque batch BUILDING, SUBMITTED, PENDING_FINALITY ou FINALIZED DOIT avoir un merkle root non-vide. Prouve formellement (TLA+ INV-08 MerkleRootPresent, Alloy MerkleRootPresent).
3.8 Preuves d'inclusion compatibles RFC 9162¶
EXIGENCE ANCHOR-08 : Les preuves d'inclusion sont compatibles avec la structure definie par RFC 9162 (Certificate Transparency v2) pour le calcul des Merkle tree hashes et des chemins d'inclusion. Chaque evenement dans un batch finalise peut generer une preuve d'inclusion verifiable. Prouve formellement (Alloy InclusionProofValid).
Note : Ce protocole reutilise la structure de preuves d'inclusion de RFC 9162 (Merkle tree hashing & path computation) mais n'implemente pas un Certificate Transparency log public. L'ancrage est effectue dans des batches prives periodiques.
3.9 Artefact de preuve verifiable offline¶
EXIGENCE ANCHOR-09 : L'artefact de preuve (ProofArtifact) est verifiable sans acces privilegie a ProbatioVault. Il contient : - leaf_hash : SHA3-256 de l'entree d'audit - leaf_index : position dans le batch (0-indexed) - merkle_path : sibling hashes du chemin racine - merkle_root : racine de l'arbre de Merkle - tx_hash : hash de la transaction blockchain - block_number : numero du bloc contenant la transaction - chain_id : identifiant EIP-155 de la chaine
Hypothese de confiance : la verification du maillon blockchain (tx_hash dans un bloc confirme) requiert l'acces a une source blockchain publique (noeud RPC, explorateur de blocs, archive de block headers). Le verificateur DOIT specifier la source utilisee. L'artefact ne contient pas les block headers ni les transaction receipts — ces donnees sont obtenues de la source blockchain au moment de la verification.
Prouve formellement (Alloy ProofArtifactSelfContained).
3.10 Identifiant de chaine EIP-155¶
EXIGENCE ANCHOR-10 : Le chain ID suit la convention EIP-155. Chaque batch soumis a un chain ID explicite. Prouve formellement (TLA+ INV-09 TxIdPresent, Alloy ChainIdEIP155).
3.11 Verrouillage pessimiste¶
EXIGENCE ANCHOR-11 : La finalisation d'un batch utilise un verrouillage pessimiste (SELECT ... FOR UPDATE) pour empecher les modifications concurrentes. Prouve formellement (TLA+ FinalizeBatch precondition).
3.12 Adresse de signature append-only avec revocation¶
EXIGENCE ANCHOR-12 : L'ensemble des adresses de signature (signer addresses) est append-only. Une adresse ajoutee ne peut jamais etre supprimee du registre. Chaque adresse possede un statut (ACTIVE ou REVOKED) gere par ANCHOR-17. Prouve formellement (TLA+ INV-10 SignerAddressAppendOnly, Alloy SignerAddressAppendOnly).
3.13 Champ blockchain dans les preuves d'inclusion¶
EXIGENCE ANCHOR-13 : Chaque preuve d'inclusion contient le champ blockchain (chain ID + block number + tx hash) pour identifier sans ambiguite la chaine d'ancrage. Prouve formellement (Alloy InclusionProofHasBlockchain).
3.14 Gestion des reorganisations (reorg)¶
EXIGENCE ANCHOR-14 : Si un bloc contenant la transaction d'un batch est orphelin (reorganisation de chaine), le batch transite de PENDING_FINALITY a FAILED. Les evenements sont liberes atomiquement. Prouve formellement (TLA+ HandleReorg action, Alloy ReorgHandled).
3.15 Transaction ID obligatoire¶
EXIGENCE ANCHOR-15 : Tout batch a l'etat SUBMITTED ou au-dela DOIT avoir un tx_id (hash de transaction) non-vide et un block_number. Prouve formellement (TLA+ INV-09 TxIdPresent).
3.16 Politique de finalite¶
EXIGENCE ANCHOR-16 : Chaque chaine cible DOIT definir une politique de finalite comprenant :
- FINALITY_DEPTH : nombre minimum de confirmations blockchain (blocs subsequents) requis avant de considerer un bloc comme final. La valeur DOIT etre configurable par chaine.
- FINALITY_TIMEOUT : delai maximum (en secondes) d'attente de la finality apres ConfirmBatch. Le depassement de ce delai declenche FailBatch.
FinalizeBatch exige que le nombre de confirmations du bloc contenant la transaction soit superieur ou egal a FINALITY_DEPTH. Prouve formellement (TLA+ INV-12 FinalityDepthEnforced, Alloy FinalityDepthCheck).
| Chaine | FINALITY_DEPTH (defaut) | FINALITY_TIMEOUT (defaut) |
|---|---|---|
| Ethereum Mainnet | 12 blocs (~2.4 min) | 600s |
| Polygon PoS | 128 blocs (~4.3 min) | 900s |
| Arbitrum One | 1 bloc (L2 finality via L1) | 300s |
Note : Ces valeurs par defaut sont indicatives. L'implementation DOIT permettre de les configurer sans modification de code.
3.17 Revocation des adresses de signature¶
EXIGENCE ANCHOR-17 : Chaque adresse de signature (signer address) possede un statut de cycle de vie :
- ACTIVE : l'adresse est autorisee a signer de nouveaux batches.
- REVOKED : l'adresse est revoquee et ne peut plus signer de nouveaux batches.
Regles :
- Toute nouvelle adresse est ajoutee avec le statut ACTIVE.
- La transition ACTIVE -> REVOKED est irreversible (une fois revoquee, jamais reactivee).
- SubmitBatch DOIT verifier que l'adresse de signature est ACTIVE avant soumission.
- Les batches deja FINALIZED avec un signer ulterieurement revoque restent valides (on ne reecrit pas l'historique).
- La revocation DOIT etre enregistree dans l'audit log.
Prouve formellement (TLA+ INV-13 SignerRevocationValid, Alloy SignerRevocationEnforced).
3.18 Gouvernance de la politique de finalite¶
EXIGENCE ANCHOR-18 : Toute modification de FINALITY_DEPTH ou FINALITY_TIMEOUT pour une chaine supportee DOIT : - Etre documentee avec justification - Etre enregistree dans l'audit log (event FINALITY_POLICY_CHANGE, PROBATIVE) - Respecter les bornes minimales de securite : - FINALITY_DEPTH >= 1 (pour toute chaine) - FINALITY_TIMEOUT >= 60s - Ne s'appliquer qu'aux batches futurs (pas d'effet retroactif)
3.19 Limites de batch¶
EXIGENCE ANCHOR-19 : Chaque batch DOIT contenir entre 1 et MAX_BATCH_SIZE evenements (defaut MAX_BATCH_SIZE = 10000). La frequence de batching est configurable (defaut : toutes les 300 secondes ou lorsque MAX_BATCH_SIZE est atteint, selon la premiere condition). Un batch vide (0 evenements) NE DOIT PAS etre cree.
4. Modele formel¶
4.1 Etats et transitions¶
Le protocole est modelise comme un systeme a etats avec 11 actions :
CreateBatch -----> SubmitBatch -----> ConfirmBatch
|
FinalizeBatch <---+----> HandleReorg
| |
(FINALIZED) (FAILED)
|
RetryBatch
|
(PENDING)
FailBatch : BUILDING/SUBMITTED -> FAILED
ExportProofArtifact : FINALIZED -> artifact
VerifyInclusionProof : FINALIZED -> OK/KO
RevokeSigner : signer ACTIVE -> REVOKED
Tick : clock advances
| Action | Preconditions | Postconditions |
|---|---|---|
| CreateBatch(id) | id n'existe pas, evenements eligibles | batch cree PENDING->BUILDING, merkle root calcule, audit event |
| SubmitBatch(id) | batch BUILDING, signer ACTIVE | batch SUBMITTED, tx soumise, audit event |
| ConfirmBatch(id) | batch SUBMITTED | batch PENDING_FINALITY, tx hash + block number + confirmations, audit event |
| FinalizeBatch(id) | batch PENDING_FINALITY, lock pessimiste, confirmations >= FINALITY_DEPTH | batch FINALIZED, events marques, immutable, audit event |
| FailBatch(id) | batch BUILDING, SUBMITTED ou PENDING_FINALITY (timeout) | batch FAILED, events liberes, audit event |
| HandleReorg(id) | batch PENDING_FINALITY, bloc orphelin | batch FAILED, events liberes, audit event |
| RetryBatch(id) | batch FAILED | nouveau batch PENDING avec events liberes, audit event |
| ExportProofArtifact(id, eventIdx) | batch FINALIZED | artefact de preuve genere |
| VerifyInclusionProof(id, eventIdx) | batch FINALIZED, preuve d'inclusion | verification OK/KO |
| RevokeSigner(sa) | signer address ACTIVE | signer REVOKED, audit event |
| Tick | toujours | clock + 1 |
4.2 Invariants de surete¶
| ID | Invariant | Description | Preuve |
|---|---|---|---|
| INV-01 | TypeInvariant | Types corrects pour toutes les variables (14) | TLC |
| INV-02 | ValidTransitions | Seules les transitions de la machine a etats sont possibles | TLC + Alloy |
| INV-03 | FinalizedImmutable | Batch FINALIZED ne change plus d'etat | TLC + Alloy |
| INV-04 | EventUniqueness | Un evenement dans au plus 1 batch FINALIZED | TLC + Alloy |
| INV-05 | NoEventsLost | Events d'un batch FAILED sont liberes | TLC + Alloy |
| INV-06 | WindowOrdering | windowStart < windowEnd pour chaque batch | TLC + Alloy |
| INV-07 | AuditCompleteness | Chaque transition produit un audit event | TLC + Alloy |
| INV-08 | MerkleRootPresent | Batch post-PENDING a un merkle root | TLC + Alloy |
| INV-09 | TxIdPresent | Batch post-SUBMITTED a un tx hash + block number | TLC |
| INV-10 | SignerAddressAppendOnly | Ensemble des signers ne decroit jamais | TLC + Alloy |
| INV-11 | AuditAppendOnly | Audit log ne perd jamais d'entrees | TLC |
| INV-12 | FinalityDepthEnforced | Batch FINALIZED a confirmations >= FINALITY_DEPTH | TLC + Alloy |
| INV-13 | SignerRevocationValid | Batch SUBMITTED+ a un signer ACTIVE au moment de la soumission | TLC + Alloy |
| INV-14 | FinalityTimeoutEnforced | Batch PENDING_FINALITY > FINALITY_TIMEOUT => FAILED | TLC |
Note sur TLC : Le model checking utilise une configuration bornee (MAX_BATCHES=2, MAX_EVENTS=3, MAX_ITERATIONS=12). Des garanties complementaires proviennent des assertions structurelles Alloy (scope 5) et des schemas Z.
4.3 Theoremes prouves¶
- THM-01 :
Spec => []TypeInvariant - THM-02 :
Spec => []ValidTransitions - THM-03 :
Spec => []FinalizedImmutable - THM-04 :
Spec => []EventUniqueness - THM-05 :
Spec => []NoEventsLost - THM-06 :
Spec => []WindowOrdering - THM-07 :
Spec => []AuditCompleteness - THM-08 :
Spec => []AuditAppendOnly - THM-09 :
Spec => []FinalityDepthEnforced - THM-10 :
Spec => []SignerRevocationValid
4.4 Assertions structurelles (Alloy)¶
| Assertion | Propriete | Resultat |
|---|---|---|
| ValidTransitionsOnly | Seules les transitions valides sont possibles | UNSAT (prouve) |
| FinalizedBatchImmutable | Batch FINALIZED ne change jamais | UNSAT (prouve) |
| EventUniqueInFinalizedBatch | Evenement dans au plus 1 batch FINALIZED | UNSAT (prouve) |
| FailedBatchReleasesEvents | Events liberes atomiquement sur FAILED | UNSAT (prouve) |
| WindowContinuity | windowStart < windowEnd toujours | UNSAT (prouve) |
| EveryTransitionAudited | Chaque transition dans l'audit log | UNSAT (prouve) |
| MerkleRootPresent | Merkle root present apres PENDING | UNSAT (prouve) |
| SignerAddressAppendOnly | Ensemble signers ne decroit pas | UNSAT (prouve) |
| InclusionProofValid | Preuve d'inclusion compatible RFC 9162 | UNSAT (prouve) |
| ProofArtifactSelfContained | Artefact verifiable sans acces privilegie | UNSAT (prouve) |
| FinalityDepthCheck | Batch FINALIZED a confirmations >= 1 | UNSAT (prouve) |
| SignerRevocationEnforced | Batch SUBMITTED+ a un signer ACTIVE | UNSAT (prouve) |
5. Considerations de securite¶
5.1 Reorganisations de chaine (reorg)¶
| Menace | Mitigation | Verification |
|---|---|---|
| Bloc orphelin post-soumission | HandleReorg : PENDING_FINALITY -> FAILED | ANCHOR-14, INV-05 |
| Double ancrage apres reorg | Events liberes + re-collectes dans nouveau batch | ANCHOR-03, INV-04 |
| Finality insuffisante | Attente confirmations >= FINALITY_DEPTH avant FINALIZED | ANCHOR-16, INV-12 |
5.2 Finality et confirmation¶
| Menace | Mitigation | Verification |
|---|---|---|
| Finalisation prematuree | Lock pessimiste + confirmations >= FINALITY_DEPTH | ANCHOR-11, ANCHOR-16, INV-12 |
| Transaction non-confirmee | ConfirmBatch exige tx hash + block number | ANCHOR-15, INV-09 |
| Timeout de confirmation | FINALITY_TIMEOUT + FailBatch + liberation atomique | ANCHOR-04, ANCHOR-16, INV-05 |
| Profondeur de finalite insuffisante | FINALITY_DEPTH configurable par chaine, valeurs par defaut securisees | ANCHOR-16 |
5.3 Multi-chain et EIP-155¶
| Menace | Mitigation | Verification |
|---|---|---|
| Replay attack cross-chain | Chain ID EIP-155 par batch | ANCHOR-10 |
| Confusion de chaine dans les preuves | Champ blockchain dans inclusion proofs | ANCHOR-13 |
| Signer address compromise | Revocation immediate (ACTIVE -> REVOKED), batches futurs refuses | ANCHOR-12, ANCHOR-17, INV-10, INV-13 |
| Signer revoque signe un batch | SubmitBatch refuse si signer REVOKED | ANCHOR-17, INV-13 |
5.4 Integrite des donnees¶
| Menace | Mitigation | Verification |
|---|---|---|
| Modification post-finalization | Trigger PostgreSQL BEFORE UPDATE OR DELETE | ANCHOR-02, INV-03 |
| Perte d'evenements | Liberation atomique + NoEventsLost invariant | ANCHOR-04, INV-05 |
| Merkle root falsifie | SHA-256 de hashes ordonnes, verifiable offline | ANCHOR-07, ANCHOR-08 |
| Audit trail incomplete | Append-only, chaque transition logguee | ANCHOR-06, INV-07, INV-11 |
5.5 Limitations connues¶
- La verification d'inclusion necessite la connaissance du merkle root et du merkle path. Si l'arbre est perdu, la preuve est non-reconstructible a partir du seul artefact.
- Le protocole ne garantit pas la disponibilite de la blockchain. Un noeud blockchain indisponible peut bloquer SubmitBatch et ConfirmBatch indefiniment (mitigation : timeout + FailBatch).
- Les valeurs par defaut de FINALITY_DEPTH et FINALITY_TIMEOUT sont indicatives et doivent etre ajustees en fonction de la blockchain cible et de l'appetence au risque.
6. Ancrage au code reel¶
| Systeme | Mecanisme d'ancrage | Verification |
|---|---|---|
| TLA+ | ASSUME verifiant les transitions du code | Echec TLC si divergence |
| Alloy | one sig Real_* + fact some Real_* | Echec SAT si artefact manquant |
| Z | Schemas valides contre entities TypeORM | Lint FAIL si non matche |
| Prolog | Facts extraits du code vs 32 regles de conformite | Checks code reel |
6.1 Etat d'implementation¶
Note implementation : Les composants marques "Non implemente" representent des ecarts spec/code bloquants. Le protocole n'est pas considere comme verrouille operationnellement tant que ces composants ne sont pas implementes et que les checks Prolog ne passent pas a PASS.
| Composant | Statut | Checks Prolog |
|---|---|---|
| AnchorBatchService.createBatch() | Implemente | 2/2 PASS |
| AnchorBatchService.finalizeBatch() | Implemente | 1/1 PASS |
| AnchorBatchService.failBatch() | Implemente | 1/1 PASS |
| AnchorBatchService.exportProofArtifact() | Implemente | 1/1 PASS |
| anchor_batch entity | Implemente | 7/7 PASS |
| MerkleTreeService | Implemente | 2/2 PASS |
| InclusionProofService | Implemente | 2/2 PASS |
| ProofEventService.collectEligibleEvents() | Implemente | 1/1 PASS |
| Trigger immutabilite | Implemente | 1/1 PASS |
| HSM FIPS cluster | Implemente | 1/1 PASS |
| Finality depth (confirmation_count) | Non implemente | 0/2 FAIL |
| Signer revocation (signer_status) | Non implemente | 0/3 FAIL |
7. Annexes¶
7.1 Specifications formelles associees¶
| Fichier | Systeme | Contenu |
|---|---|---|
PV_Anchor.tla | TLA+ | Modele temporel (11 actions, 13 invariants, 10 theoremes) |
PV_Anchor.cfg | TLA+ | Configuration TLC (MAX_BATCHES=2, MAX_EVENTS=3) |
PV_Anchor.als | Alloy | Modele structurel (9 signatures, 12 assertions) |
PV_Anchor.zed | Z | Specification ensembliste (17 invariants, 9 operations) |
pv_anchor_compliance.pl | Prolog | 32 regles de conformite code |
7.2 Matrice de tracabilite¶
| Exigence | TLA+ | Alloy | Z | Prolog |
|---|---|---|---|---|
| ANCHOR-01 (transitions) | INV-02 | ValidTransitionsOnly | INV-02 | check_batch_status_enum |
| ANCHOR-02 (immutable) | INV-03 | FinalizedBatchImmutable | INV-03 | check_batch_immutable_trigger |
| ANCHOR-03 (unicite events) | INV-04 | EventUniqueInFinalizedBatch | INV-04 | check_batch_event_entity |
| ANCHOR-04 (events liberes) | INV-05 | FailedBatchReleasesEvents | INV-05 | check_fail_batch_method |
| ANCHOR-05 (window ordering) | INV-06 | WindowContinuity | INV-06 | check_batch_window_cols |
| ANCHOR-06 (audit log) | INV-07, INV-11 | EveryTransitionAudited | INV-07 | check_audit_log_entity |
| ANCHOR-07 (merkle root) | INV-08 | MerkleRootPresent | INV-08 | check_merkle_root_col, check_merkle_tree_service |
| ANCHOR-08 (inclusion proof) | VerifyInclusionProof | InclusionProofValid | INV-09 | check_inclusion_proof_service |
| ANCHOR-09 (proof artifact) | ExportProofArtifact | ProofArtifactSelfContained | INV-10 | check_export_proof_artifact_method |
| ANCHOR-10 (chain ID) | INV-09 | ChainIdEIP155 | INV-11 | check_chain_id_col |
| ANCHOR-11 (lock pessimiste) | FinalizeBatch | — | INV-14 | check_finalize_batch_method |
| ANCHOR-12 (signer append-only) | INV-10 | SignerAddressAppendOnly | INV-15 | check_signer_address_col |
| ANCHOR-13 (blockchain in proof) | — | InclusionProofHasBlockchain | INV-16 | check_inclusion_proof_blockchain |
| ANCHOR-14 (reorg handling) | HandleReorg | ReorgHandled | INV-17 | check_handle_reorg |
| ANCHOR-15 (tx_id obligatoire) | INV-09 | — | INV-09 | check_tx_id_col, check_block_number_col |
| ANCHOR-16 (finality depth) | INV-12 | FinalityDepthCheck | INV-12 | check_confirmation_count_col, check_finalize_confirmations_guard |
| ANCHOR-17 (signer revocation) | INV-13 | SignerRevocationEnforced | INV-13 | check_signer_status_mechanism, check_signer_revoke_method, check_submit_active_signer_guard |
| ANCHOR-18 (finality governance) | - | - | - | - |
| ANCHOR-19 (batch size limits) | - | - | - | check_batch_size_limits |
7.3 Vecteurs de test¶
| Test | Entree | Sortie attendue |
|---|---|---|
| Batch complet | Events -> FINALIZED | FinalizeBatch OK |
| Transition invalide | PENDING -> FINALIZED | ERREUR |
| Batch immutable | UPDATE apres FINALIZED | ERREUR (trigger DB) |
| Double ancrage | Event deja FINALIZED | CreateBatch ERREUR |
| Events liberes | Batch FAILED | Events eligibles de nouveau |
| Fenetre invalide | windowStart >= windowEnd | CreateBatch ERREUR |
| Reorg detecte | Bloc orphelin | PENDING_FINALITY -> FAILED |
| Inclusion proof valide | Event dans batch FINALIZED | VerifyInclusionProof OK |
| Inclusion proof invalide | Hash mismatch | VerifyInclusionProof KO |
| Proof artifact offline | Artefact exporte + pas d'acces PV | Verification OK |
| Chain ID present | Batch SUBMITTED | chain_id non-vide |
| Signer non-supprimable | Tentative suppression signer | ERREUR |
| Finality insuffisante | confirmations < FINALITY_DEPTH | FinalizeBatch ERREUR |
| Finality timeout | Delai > FINALITY_TIMEOUT | FailBatch declenche |
| Signer revoque | SubmitBatch avec signer REVOKED | ERREUR |
| Revocation irreversible | Tentative reactivation signer | ERREUR |
| Batch valide apres revocation | Batch FINALIZED + signer revoque apres | Batch reste valide |
| Merkle leaf prefix | MTH_leaf(entry) | SHA-256(0x00 ‖ entry_hash) |
| Merkle node prefix | MTH_node(L, R) | SHA-256(0x01 ‖ L ‖ R) |
| Merkle single leaf | n=1 | MTH_root = MTH_leaf(leaves[0]) |
| Merkle impair | n=3 | 3eme feuille promue sans modification |
| Finality policy change | modifier FINALITY_DEPTH | Audit event FINALITY_POLICY_CHANGE emis (ANCHOR-18) |
| Finality depth min | FINALITY_DEPTH = 0 | ERREUR (ANCHOR-18, >= 1 requis) |
| Finality timeout min | FINALITY_TIMEOUT = 30s | ERREUR (ANCHOR-18, >= 60s requis) |
| Batch size max | 10001 evenements | ERREUR (ANCHOR-19, > MAX_BATCH_SIZE) |
| Batch vide | 0 evenements | CreateBatch ERREUR (ANCHOR-19) |
| Pending finality timeout | PENDING_FINALITY + FINALITY_TIMEOUT depasse | FailBatch (INV-14) |
7.4 Historique des revisions¶
| Version | Date | Description |
|---|---|---|
| 1.0.0 | 2026-02-26 | Version initiale, generee depuis modeles formels |
| 1.1.0 | 2026-02-27 | Ajout ANCHOR-16 (finality depth), ANCHOR-17 (signer revocation), reformulation RFC 9162 |
| 1.2.0 | 2026-03-02 | ANCHOR-07 algorithme Merkle exact (RFC 9162 §2.1, prefixes 0x00/0x01, promotion impair), ANCHOR-09 modele de confiance blockchain (hypothese verificateur), ANCHOR-18 gouvernance politique de finalite (bornes min, audit obligatoire), ANCHOR-19 limites de batch (MAX_BATCH_SIZE, frequence), transition PENDING_FINALITY -> FAILED via timeout, INV-14 FinalityTimeoutEnforced, note ecarts spec/code bloquants |