From ab5500dfda2251994919451198612ac971f9a723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Schie=C3=9Fl?= Date: Sun, 29 Jul 2018 09:57:58 +0200 Subject: [PATCH] attribute assert nesting --- bsip-0040.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsip-0040.md b/bsip-0040.md index fc4cc38..4ef2eb0 100644 --- a/bsip-0040.md +++ b/bsip-0040.md @@ -81,7 +81,7 @@ List of possible asserts are: | `lt, le, gt, ge` | `comparative` | stateless | | `limit` | [`max_cumsum`, `interval_in_sec`] | [`current_cumsum`, `interval_began`] | | `limit_monthly` | [`max_cumsum`, `interval_in_months`] | [`current_cumsum`, `interval_began`] | -| `attribute_assert` | `attribute_to_assert` = [{`attribute_identifier`: `any of above assert_objects`}] | stateless | +| `attribute_assert` | `attribute_to_assert` = [{`attribute_identifier`: `any assert_objects`}] | stateless | There is no implicit type conversion when attempting to assert, incompatible type means assert failure. If required, a field can be added that stores the assumed type of the argument (if conversion fails, assert fails). If an argument has no asset, it is unrestricted and may be given (or not for optional arguments) with any value. @@ -114,7 +114,7 @@ The assert that needs to pass is now `current_cumsum + incoming value <= max_cum Statefull assert, only `int` type arguments. Analogue to `limit`, but `interval_began` is initially set to `month(valid_from)` and set to `month(now)` on update, additionally the time assert is `month(now) >= interval_began + interval_in_months` (include logic for month overflow when year changes). #### `attribute_assert` -Stateless assert, only for dictionary type objects. The `attribute_to_assert` list contains mappings between attributes and asserts that they must fulfill, if present in the dictionary. +Stateless assert, only for dictionary type objects. The `attribute_to_assert` list contains mappings between attributes and asserts that they must fulfill, if present in the dictionary. Allows nesting of `attribute_assert`. Note: - Assume `asset_update_operation`. All attributes of its `options` must be filled on update call. This assert can not be used to realize a "may only change attribute xzy of `options`". This would require that the logic knows which of the arguments are reflected on-chain and it knows how to query it for every operation that contains `options`. If `options` are to be restricted with this assert, all values that should not change would need be fixated by defining a `any` assert for those attributes, while having e.g. a `lt` assert for the one attribute that is allowed to change.