From 86b4ff573c3e9a475f9280b97645cc75e2c75b6e Mon Sep 17 00:00:00 2001 From: Garand Tyson Date: Thu, 15 Aug 2024 15:10:54 -0700 Subject: [PATCH] Adjusted proof structs to be rust friendly (#209) --- Stellar-transaction.x | 48 +++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/Stellar-transaction.x b/Stellar-transaction.x index f9b63f6..3a548ab 100644 --- a/Stellar-transaction.x +++ b/Stellar-transaction.x @@ -833,6 +833,29 @@ struct ArchivalProofNode typedef ArchivalProofNode ProofLevel<>; +struct NonexistenceProofBody +{ + ColdArchiveBucketEntry entriesToProve<>; + + // Vector of vectors, where proofLevels[level] + // contains all HashNodes that correspond with that level + ProofLevel proofLevels<>; +}; + +struct ExistenceProofBody +{ + LedgerKey keysToProve<>; + + // Bounds for each key being proved, where bound[n] + // corresponds to keysToProve[n] + ColdArchiveBucketEntry lowBoundEntries<>; + ColdArchiveBucketEntry highBoundEntries<>; + + // Vector of vectors, where proofLevels[level] + // contains all HashNodes that correspond with that level + ProofLevel proofLevels<>; +}; + struct ArchivalProof { uint32 epoch; // AST Subtree for this proof @@ -840,29 +863,10 @@ struct ArchivalProof union switch (ArchivalProofType t) { case EXISTENCE: - struct - { - ColdArchiveBucketEntry entriesToProve<>; - - // Vector of vectors, where proofLevels[level] - // contains all HashNodes that correspond with that level - ProofLevel proofLevels<>; - } existenceProof; + NonexistenceProofBody nonexistenceProof; case NONEXISTENCE: - struct - { - LedgerKey keysToProve<>; - - // Bounds for each key being proved, where bound[n] - // corresponds to keysToProve[n] - ColdArchiveBucketEntry lowBoundEntries<>; - ColdArchiveBucketEntry highBoundEntries<>; - - // Vector of vectors, where proofLevels[level] - // contains all HashNodes that correspond with that level - ProofLevel proofLevels<>; - } nonexistenceProof; - } type; + ExistenceProofBody existenceProof; + } body; }; // Resource limits for a Soroban transaction.