From f708dd78c20eb54870650e63acfa519d7b819672 Mon Sep 17 00:00:00 2001 From: Özgür Kesim Date: Fri, 15 Oct 2021 10:44:53 +0200 Subject: refine extension of table refresh_commitments --- design-documents/024-age-restriction.rst | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/design-documents/024-age-restriction.rst b/design-documents/024-age-restriction.rst index 061921bc..06b34c7e 100644 --- a/design-documents/024-age-restriction.rst +++ b/design-documents/024-age-restriction.rst @@ -168,20 +168,27 @@ The schema for the exchange is changed as follows: BEGIN; -- Check patch versioning is in place. SELECT _v.register_patch('exchange-TBD', NULL, NULL); - -- + + -- Support for age restriction is marked per denomination. ALTER TABLE denominations ADD COLUMN age_restricted BOOLEAN NOT NULL DEFAULT (false); COMMENT ON COLUMN denominations.age_restriced IS 'true if this denomination can be used for age restriction'; - -- + + -- During the melting phase of the refresh, the wallet has to present the + -- hash value of the age commitment (only for denominations with support + -- for age restriction). ALTER TABLE refresh_commitments - ADD COLUMN age_commitment BYTEA ARRAY; - COMMENT ON COLUMN refresh_commitments.age_commitment - IS 'Vector of public keys that represents a commitment to an age. MUST be NULL if in the corresponding denomination .age_restricted equals 'false', MUST NOT be NULL otherwise.` + ADD COLUMN age_commitment_h BYTEA CHECK (LENGTH(age_commitment_h)=64); + COMMENT ON COLUMN refresh_commitments.age_commitment_h + IS 'SHA512 hash of the age commitment of the old coin, iff the corresponding + denomimination has support for age restriction, NULL otherwise.'; COMMIT; -**TODO**: can the contraint (NULL/NOT NULL) on column -``refresh_commitments.age_commitment`` be made explicit in SQL? +Note the constraint on ``refresh_commitments.age_commitment_h``: It can be +NULL, but only iff the corresponding denomination (indirectly referenced via +table ``known_coins``) has ``.age_restricted`` set to true. This constraint +can not be expressed reliably with SQL. Protocol changes ---------------- @@ -189,6 +196,9 @@ Protocol changes Refresh ~~~~~~~ +During the melting phase of the refresh, the wallet has to present the hash +value of the age commitment (for denominations with support for age restriction). + TODO: Extension of the cut'n-choose-protocol. -- cgit v1.2.3