diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2022-10-11 11:44:41 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2022-10-11 11:44:41 +0200 |
commit | fa76fa66624b5b4cd57275aad67f159acf046b70 (patch) | |
tree | 5bc5a895dd126ed8dac5a40f7a541fdb77d51367 | |
parent | 3982c5577b600406bd95516b15cd63d523506525 (diff) | |
download | docs-fa76fa66624b5b4cd57275aad67f159acf046b70.tar.gz docs-fa76fa66624b5b4cd57275aad67f159acf046b70.tar.bz2 docs-fa76fa66624b5b4cd57275aad67f159acf046b70.zip |
simplified DB-schema for policy_details and _fulfilments
-rw-r--r-- | design-documents/028-deposit-policies.rst | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/design-documents/028-deposit-policies.rst b/design-documents/028-deposit-policies.rst index 38423d72..bbf0edc4 100644 --- a/design-documents/028-deposit-policies.rst +++ b/design-documents/028-deposit-policies.rst @@ -79,7 +79,7 @@ TODO: Description label=<<B>deposits</B>> margin=20 deposits [ - label="...|<ref>policy_details_id\l|...|timestamp\l|..." + label="...|<ref>policy_details_id (null)\l|...|timestamp\l|..." ] } @@ -87,7 +87,7 @@ TODO: Description label=<<B>policy_details</B>> margin=20 policy_details [ - label="<id>id\l|<hash>hash_code (unique)\l|deadline\l|commitment (amount)\l|accumulated_total (amount)\l|fee (amount)\l|transferable (amount)\l|fulfillment_state\l" + label="<id>id\l|<hash>hash_code (unique)\l|deadline\l|commitment (amount)\l|accumulated_total (amount)\l|fee (amount)\l|transferable (amount)\l|fulfillment_state\l|<fid>fullfilment_id (null)\l" ] } @@ -101,7 +101,7 @@ TODO: Description } deposits:ref->policy_details:id [ label="n:1"; fontname="monospace" ]; - policy_details:hash->policy_fulfillments:codes [ label="quasi m:1"; fontname="monospace"; dir=back; style=dashed]; + policy_details:fid->policy_fulfillments:id [label="n:1"; fontname="monosapce" ]; } @@ -147,15 +147,20 @@ Invariants The following invariants need to be fulfilled and be checked by the auditor: - The fulfillment state of a policy is **Insufficient** IF AND ONLY IF the - amount in ``commitment`` is larger than the amount in ``accumulated_total``. + amount in ``policy_details.commitment`` is larger than the amount in + ``policy_details.accumulated_total``. -- The sum of amounts in ``fee`` and ``transferable`` must be less or equal to - the amount in ``accumulated_total``. +- The sum of amounts in ``policy_details.fee`` and + ``policy_details.transferable`` must be less or equal to the amount in + ``policy_details.accumulated_total``. -- If the fulfillment state of a policy is **Success**, there MUST exists an - entry in the ``policy_details_fulfillment`` table for the corresponding - ``hash_code``. +- Each hash code encoded in ``policy_fulfillments.policy_hash_codes`` MUST + refer to an existing ``policy_details.hash_code`` AND its ``.fulfillment_id`` + MUST point to the same ``policy_fulfillments.id``. +- Conversely: If a ``policy_details.fulfilment_id`` points to an entry in + ``policy_fulfillment``, the ``policy_details.hash_code`` MUST be present in + that entry's ``.policy_hash_codes``. |