summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2022-10-10 20:50:02 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2022-10-10 20:50:02 +0200
commit360dc88d5148cf2f5ab09f3e454f59d478747ad2 (patch)
treec44f582b93a0a11ec9a8939c3f0604917ded2fd3
parentf33088c18b3c5f95198caf584871773b3bd56a07 (diff)
downloaddocs-360dc88d5148cf2f5ab09f3e454f59d478747ad2.tar.gz
docs-360dc88d5148cf2f5ab09f3e454f59d478747ad2.tar.bz2
docs-360dc88d5148cf2f5ab09f3e454f59d478747ad2.zip
database schema changed for policy_details
-rw-r--r--design-documents/028-deposit-policies.rst73
1 files changed, 29 insertions, 44 deletions
diff --git a/design-documents/028-deposit-policies.rst b/design-documents/028-deposit-policies.rst
index 8486ba75..62c45170 100644
--- a/design-documents/028-deposit-policies.rst
+++ b/design-documents/028-deposit-policies.rst
@@ -87,7 +87,7 @@ TODO: Description
label=<<B>policy_details</B>>
margin=20
policy_details [
- label="<id>id\l|<serial>serial_id (unique)\l|deadline\l|timeout_fulfilment_state\l|fulfilment_state\l"
+ label="<id>id\l|<hash>hash_code (unique)\l|deadline\l|total_amount\l|policy_fee\l|refresh_amount\l|state\l"
]
}
@@ -104,12 +104,12 @@ TODO: Description
label=<<B>policy_details_fulfilments</B>>
margin=20
policy_details_fulfilments [
- label="<ref_details>serial_id\l|<ref_fulfilments>fulfilment_id\l|new_amount\l"
+ label="<ref_details>hash_code\l|<ref_fulfilments>fulfilment_id\l"
]
}
deposits:ref->policy_details:id [ label="n:1"; fontname="monospace" ];
- policy_details:serial->policy_details_fulfilments:ref_details [ dir=back; label="1:1"; fontname="monospace" ];
+ policy_details:hash->policy_details_fulfilments:ref_details [ dir=back; label="1:1"; fontname="monospace" ];
policy_details_fulfilments:ref_fulfilments->policy_fulfilments:id [ label="n:1"; fontname="monospace" ];
}
@@ -117,43 +117,31 @@ TODO: Description
Policy Fulfilment States
========================
-The fulfilment of a policy can be in one of the following six states, grouped
-in four classes (Pending, Success, Failure, Timeout):
+The fulfilment of a policy can be in one of the following five states:
-Pending
- Initial state of a policy. The proof of fulfilment is pending.
+Ready
+ The policy is funded and ready. The exchange is waiting for a proof of
+ fulfilment to arrive before the deadline.
-Success-Transfer
- Policy provably fulfilled. The semantics of the policy require that the
- exchange MUST transfer a specific amount to the payto-URI in the
- associated deposit. The final amount might be different from the
- original value during deposit and can be provided by the policy handler.
+Insufficient
+ The policy lacks funding, but has otherwise been accepted. Funding can
+ be continued by calling ``/deposit`` with more coins and the same
+ policy details.
-Success-Refreshable
- Policy provably fulfilled. The semantics of the policy require that
- the coins' value in the associated deposit remains and the owner can
- refresh them.
+Success
+ The policy is provably fulfilled. The amounts for payout, fees and
+ refresh are transfered/can be claimed. Note that a policy fulfilment
+ handler can change the values for the amounts for payout, fees and
+ refresh.
-Failure-Transfer
- Policy provably UNfulfilled. The semantics of the policy require that
- the exchange *MUST* transfer a specific amount to the payto-URI in the
- associated deposit. The final amount might be different from the original
- amount during deposit and can be provided by the policy handler.
+Timeout
+ The policy has timed out. The amount for payout, free and refresh are
+ transfered/can be claimed.
+
+Failure
+ The policy is in an failure state. Payouts, fees and refreshes are
+ blocked, timeouts are ignored.
-Failure-Refreshable
- Policy provably UNfulfilled. The semantics of the policy require that
- the coins' value in the associated deposit remains and the owner can
- refresh them.
-
-Timeout-Transfer
- Policy timed out. The semantics of the policy require that the
- exchange MUST transfer the amount in the associated deposit to the
- payto-URI.
-
-Timeout-Refreshable
- Policy timed out. The semantics of the policy require that the
- coins' value in the associated deposit remains and the owner can
- refresh them.
Invariants
@@ -161,17 +149,14 @@ Invariants
The following invariants need to be fulfilled and be checked by the auditor:
-1. When the fulfilment state of a policy in one of the classes **Pending** or
- **Timeout**, there MUST NOT be an entry in the ``policy_details_fulfilment``
- table for the corresponding ``serial_id``.
+- The total sum of amounts of all deposits that refer the same policy detail
+ MUST NOT be less than the amount in the ``total_amount`` field in the
+ ``policy_details`` table.
-2. Otherwise, fulfilment state of a policy MUST be in one of the classes
- **Success** or **Failure**, IF AND ONLY IF there exists an entry in the
- ``policy_details_fulfilment`` table for the corresponding ``serial_id``.
+- If the fulfilment state of a policy is **Success**, there MUST exists an
+ entry in the ``policy_details_fulfilment`` table for the corresponding
+ ``hash_code``.
-3. If the amount in ``policy_details_fulfilment.new_amount`` is not NULL, it
- MUST be less or equal to the total sum of all amounts defined in the
- corresponding deposit entries, that reference the same ``policy_details``.