bigchaindb / bigchaindb/cryptoconditions
Where to validate a condition's subtypes?
- 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
Assessment
This issue has not been assessed yet.