DuniterPy issueshttps://git.duniter.org/clients/python/duniterpy/-/issues2021-04-25T14:46:34+02:00https://git.duniter.org/clients/python/duniterpy/-/issues/157Create identity attribute on the Revocation and Certification classes2021-04-25T14:46:34+02:00matograineCreate identity attribute on the Revocation and Certification classes> Coming from the [implementation of the `revoke` command implementation on Silkaj](https://git.duniter.org/clients/python/silkaj/-/merge_requests/170#note_26655).
The `Revocation` has `extract_self_cert()` method that needs a signed ra...> Coming from the [implementation of the `revoke` command implementation on Silkaj](https://git.duniter.org/clients/python/silkaj/-/merge_requests/170#note_26655).
The `Revocation` has `extract_self_cert()` method that needs a signed raw document.
However, a `Revocation` object could have an `identity` attribute. Same for `Certification`.
Or a dedicated method, like `Revocation.extract_identity()`.
### Todo
- [ ] `Revocation.identity()`
- [ ] `Certification.identity()`Backloghttps://git.duniter.org/clients/python/duniterpy/-/issues/172Document.version field should be optional with default=[last_document_version]2021-06-29T14:31:52+02:00Vincent TexierDocument.version field should be optional with default=[last_document_version]**Break backward compatibility.**
`Document` class set the protocol version as the first mandatory constructor field.
It is not easy for a new user to find the last version of the protocol.
To ease the creation of a document, this fie...**Break backward compatibility.**
`Document` class set the protocol version as the first mandatory constructor field.
It is not easy for a new user to find the last version of the protocol.
To ease the creation of a document, this field should be set by default to the last protocol version.
So we need to set the field in last position, with the last protocol version of Duniter (12 at the time of writing) as default value.
Before:
```python
def __init__(self, version: int, currency: str) -> None:
...
```
After:
```python
def __init__(self, currency: str, version: int = 12) -> None:
...
```1.0.0Vincent TexierVincent Texierhttps://git.duniter.org/clients/python/duniterpy/-/issues/114Fix bma.blockhain.revoked calling /blockchain/with/excluded2020-04-26T14:55:17+02:00MoulFix bma.blockhain.revoked calling /blockchain/with/excluded7d822aee introduced a new method [`bma.blockchain.revoked` which is exactly the same as `bma.blockchain.excluded`](https://git.duniter.org/clients/python/duniterpy/blob/88107ff04c24c2c6a9c7ab2b1c7526be92dd5149/duniterpy/api/bma/blockchai...7d822aee introduced a new method [`bma.blockchain.revoked` which is exactly the same as `bma.blockchain.excluded`](https://git.duniter.org/clients/python/duniterpy/blob/88107ff04c24c2c6a9c7ab2b1c7526be92dd5149/duniterpy/api/bma/blockchain.py#L394-411) based on `/blockchain/with/excluded`.
Its a bug, cause the blockchain/with/revoked should be called.0.57.0Vincent TexierVincent Texierhttps://git.duniter.org/clients/python/duniterpy/-/issues/187Implement __eq__() methods on Revocation, Identity, Membership, and Certifica...2021-11-12T22:23:31+01:00MoulImplement __eq__() methods on Revocation, Identity, Membership, and Certification classes- [x] Implement `__eq__` in `Document`
- [x] Call `super().__eq__()` in `Transaction`’s `__eq__()` method
- Implement `__eq__()` and `__hash__()` methods in:
- [x] `Identity`:
- [x] `Revocation`
- [x] `Certification`
- [x] `Membershi...- [x] Implement `__eq__` in `Document`
- [x] Call `super().__eq__()` in `Transaction`’s `__eq__()` method
- Implement `__eq__()` and `__hash__()` methods in:
- [x] `Identity`:
- [x] `Revocation`
- [x] `Certification`
- [x] `Membership`
Useful to write tests.
`__eq__()` is already implemented on `Transation`, `Block`, and `BlockUID` classes.1.1.0MoulMoulhttps://git.duniter.org/clients/python/duniterpy/-/issues/95Remove `signatures` argument from all `__init__()`’s documents subclasses2021-06-29T19:00:14+02:00Vincent TexierRemove `signatures` argument from all `__init__()`’s documents subclassesWhen we instantiate a `Document` instance, or a `Document` subclass instance, we do not have the signatures of the document as it is not created yet.
**So we can remove the `signatures` argument in the `__init__()` of `Document` and all...When we instantiate a `Document` instance, or a `Document` subclass instance, we do not have the signatures of the document as it is not created yet.
**So we can remove the `signatures` argument in the `__init__()` of `Document` and all his subclass.**
It will be a big backward compatibility break. But the code will be more logic and simple.
### Deprecation first
Deprecation need to be done in a previous release (say %"0.60.0" for example).
It will be Deprecated gracefully with warnings, thanks to python deprecation system.
http://www.jaggedverge.com/2016/09/deprecation-warnings-in-python/
To ease the migration, perhaps start by set the argument as Optional with deprecationWarning.
Then remove it in a future version...
### Previous thoughts
All documents classes inherit of the `Document` class.
The `Document` class has a required `signatures` parameter which type is `List[str]`.
But most of the subclass does not have any signature when creating an instance.
So, when `None` is passed, the subclass handle it differently.
See `Identity` subclass handling (and the fact that you must provide a `None` parameter):
```python
def __init__(
self,
version: int,
currency: str,
pubkey: str,
uid: str,
ts: BlockUID,
signature: Optional[str],
) -> None:
...
if signature:
super().__init__(version, currency, [signature])
else:
super().__init__(version, currency, [])
```
See `Membership` subclass, consider it to be the best way to do it:
```python
def __init__(
self,
version: int,
currency: str,
issuer: str,
membership_ts: BlockUID,
membership_type: str,
uid: str,
identity_ts: BlockUID,
signature: Optional[str] = None,
) -> None:
...
super().__init__(version, currency, [signature] if signature else [])
```
Here, the `signature` parameter is not required, and we prepare a `signatures` parameter for the parent `Document` class.
We should do it for all subclass of `Document`, being careful as some are multi-signature.1.0.0Vincent TexierVincent Texierhttps://git.duniter.org/clients/python/duniterpy/-/issues/21Revocation document change2019-07-31T17:05:22+02:00Cédric MoreauRevocation document changeOriginal change in https://github.com/ucoin-io/ucoin/issues/196
---
Protocol rule: https://github.com/ucoin-io/ucoin/blob/master/doc/Protocol.md#revocation
The Revocation document has changed, and also has an impact on Block document ...Original change in https://github.com/ucoin-io/ucoin/issues/196
---
Protocol rule: https://github.com/ucoin-io/ucoin/blob/master/doc/Protocol.md#revocation
The Revocation document has changed, and also has an impact on Block document which now has a `Revoked` field with inline revocations in it:
```
PUBLIC_KEY:SIGNATURE
```
UCPv0.2https://git.duniter.org/clients/python/duniterpy/-/issues/163Revocation.from_signed_raw() do not stores timestamps into a BlockUID object2021-05-22T12:50:59+02:00MoulRevocation.from_signed_raw() do not stores timestamps into a BlockUID object> From https://git.duniter.org/clients/python/silkaj/-/merge_requests/170#note_26657 & https://git.duniter.org/clients/python/silkaj/-/merge_requests/170#note_26658
`from_signed_raw()` methods from `Membership`, `Identity`, and `Certifi...> From https://git.duniter.org/clients/python/silkaj/-/merge_requests/170#note_26657 & https://git.duniter.org/clients/python/silkaj/-/merge_requests/170#note_26658
`from_signed_raw()` methods from `Membership`, `Identity`, and `Certification` classes store timestamps into a `BlockUID` object. This is not the case of `Revocation.from_signed_raw()`. Let's make it consistent and more convenient to use.1.0.0MoulMoul