bigchaindb / bigchaindb/cryptoconditions

Where to validate a condition's subtypes?

Open
#60 0 comments 0 reactions 1 assignee Claimed by @sbellem View on GitHub
Dominant language
Python
Stars
73
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Some questions:

* Should the implementation silently ignore extra unsupported subtypes?

If not, then when should the implementation complain about it?

* At parsing time?
* When `.validate()` is explicitly called?

As an example, if we were to validate the subtypes when parsing, we could do so:

```python
class ConditionTypes(BitString):
namedValues = NamedValues(
('preImageSha256', 0),
('prefixSha256', 1),
('thresholdSha256', 2),
('rsaSha256', 3),
('ed25519Sha256', 4),
)
subtypeSpec = ValueSizeConstraint(0, 5)
```

The line `subtypeSpec = ValueSizeConstraint(0, 5)` requires the length of the `BIT STRING` to be no longer than 5.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.