From bd2af374af1b8679426f68d2471e1b40793570f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Schie=C3=9Fl?= Date: Fri, 10 Aug 2018 07:15:18 +0200 Subject: [PATCH] If beneficial for performance or complexity sections --- bsip-0040.md | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/bsip-0040.md b/bsip-0040.md index ccd10d2..17793a6 100644 --- a/bsip-0040.md +++ b/bsip-0040.md @@ -103,7 +103,7 @@ List of possible restrictions are: | `any` | [`list`, `of`, `allowed`, `values`] | stateless | | `none` | [`none`, `of`, `these`, `values`] | stateless | | `lt, le, gt, ge, eq, neq` | `comparative` | stateless | -| `contains, not_contains` | [`list`, `of`, `values`] | stateless | +| `contains_all, contains_none` | [`list`, `of`, `values`] | stateless | | `limit` | [`max_cumsum`, `interval_in_sec`] | [`current_cumsum`, `interval_began`] | | `limit_monthly` | [`max_cumsum`, `interval_in_months`] | [`current_cumsum`, `interval_began`] | | `attribute_assert` | list of restrictions | stateless | @@ -117,15 +117,22 @@ Following cases must hold for a restriction: Note: - If required a field can be added that stores the assumed type of the argument +- This list of restrictions may be redefined to improve clarity, performance or to reduce complexity of implementation while maintaining the intended functionality In the following we list possible `restriction`s. Mentioning `argument value` in the text below refers to the value of the argument of the operation specified by `argument` of a restriction. #### `any` -Stateless assert, all argument types. `Argument value` must be equal to one of values in the data list +Stateless assert, all argument types. `Argument value` must be equal to one of values in the data list. + +Note +- If beneficial for performance or complexity an additional operator `equal` can be implemented that only compares to one. #### `none` -Stateless assert, all argument types. `Argument value` must NOT be equal to any of the values in the list. +Stateless assert, all argument types. `Argument value` must NOT be equal to any of the values in the list. + +Note +- If beneficial for performance or complexity an additional operator `not_equal` can be implemented that only compares to one. #### `lt, le, gt, ge, eq, neq` Stateless assert. Allows explicit type conversion: @@ -140,12 +147,16 @@ The different asserts read as: - `gt`: `Argument value` must be greater than `comparative` - `ge`: `Argument value` must be greater than or equal to `comparative` - `eq`: `Argument value` must equal to `comparative` -- `eq`: `Argument value` must NOT be equal to `comparative` +- `neq`: `Argument value` must NOT be equal to `comparative` -#### `contains, not_contains` +Note +- `eq` and `neq` are implicit number comparators and not to be mistaken by a strict left must equal right operator, just like `lt, le, gt, ge` (for example, comparing `1 > list object` would have no sense) +- If beneficial for performance or complexity the implicit type conversions can be removed and distinct operators introduced that do not have implicit type conversions + +#### `contains_all, contains_none` Stateless assert, for `list` type arguments. -- `contains`: The `argument value` must contain all items specified by `data`, but can contain more -- `not_contains`: The `argument value` must NOT contain any of the items specified by `data`, but can contain others +- `contains_all`: The `argument value` must contain all items specified by `data`, but can contain more +- `contains_none`: The `argument value` must NOT contain any of the items specified by `data`, but can contain others #### `limit` Stateful assert, only `int` type arguments. When the authority is created, `interval_began` is set to `valid_from` from its custom active authority and `max_cumsum` to `0`. Incoming operations are first tried to match all stateless asserts, @@ -375,7 +386,7 @@ the transaction is executed. We propose do split the implmentation into two milestones. Each milestone will be voted on as a separate BSIP: -1. Implementation of basic functionaliy to allow custom active permissions and authorities, including `any`, `none` and `lt, le, gt, ge, eq, neq`, `contains, not_contains` and `attribute_assert` `asserts`. If deemed necessary by developpers, reduce to only allow one key or one account for every `custom active authority` +1. Implementation of basic functionaliy to allow custom active permissions and authorities, including `any`, `none` and `lt, le, gt, ge, eq, neq`, `contains_all, contains_none` and `attribute_assert` `asserts`. If deemed necessary by developpers, reduce to only allow one key or one account for every `custom active authority` 2. Implement stateful asserts `limit` and `limit_monthly` 3. Implement `logical_or`