Repository navigation
feat(rs-sdk): fetch document, identity, data contract and list documents - #1451
Conversation
commit 9a0c9fa Author: Lukasz Klimek <[email protected]> Date: Thu Aug 24 14:19:25 2023 +0200 refactor: FromProof - use type instead of generic for Response commit 9b35c88 Author: Lukasz Klimek <[email protected]> Date: Thu Aug 24 13:55:26 2023 +0200 chore: remove FromProof for identities_* commit e1d978f Author: Lukasz Klimek <[email protected]> Date: Thu Aug 24 13:49:30 2023 +0200 test: proof of identity balance and revision commit 1ca28ca Author: Lukasz Klimek <[email protected]> Date: Thu Aug 24 12:44:57 2023 +0200 fix: FromProof for GetIdentityKeysRequest commit 947d5b4 Author: Quantum Explorer <[email protected]> Date: Wed Aug 23 16:03:36 2023 +0200 more fixes commit 8de2aea Merge: dccbad8 61fbb27 Author: Quantum Explorer <[email protected]> Date: Wed Aug 23 14:21:18 2023 +0200 Merge branch 'fix/verifyFixes' of github.com:dashpay/platform into fix/verifyFixes commit dccbad8 Author: Quantum Explorer <[email protected]> Date: Wed Aug 23 14:20:35 2023 +0200 fix commit 61fbb27 Author: Lukasz Klimek <[email protected]> Date: Tue Aug 22 17:41:04 2023 +0200 test: proof identity_ok commit 6b3bed1 Author: Lukasz Klimek <[email protected]> Date: Tue Aug 22 17:18:49 2023 +0200 chore: fix error handling after merge commit 262604b Merge: 8829b65 8d648e9 Author: Lukasz Klimek <[email protected]> Date: Tue Aug 22 17:15:26 2023 +0200 Merge branch 'proof-identity-keys' into fix/verifyFixes commit 8829b65 Merge: e6707bb 76e8365 Author: Lukasz Klimek <[email protected]> Date: Tue Aug 22 17:15:13 2023 +0200 Merge remote-tracking branch 'origin/feat/rs-drive-light-client' into fix/verifyFixes commit 8d648e9 Author: Lukasz Klimek <[email protected]> Date: Tue Aug 22 17:00:09 2023 +0200 test: identity keys commit 811177b Author: Lukasz Klimek <[email protected]> Date: Tue Aug 22 16:34:14 2023 +0200 fix: from_proof for identity_keys commit 577a15e Author: Lukasz Klimek <[email protected]> Date: Tue Aug 22 16:33:53 2023 +0200 test: identity commit e6707bb Author: Lukasz Klimek <[email protected]> Date: Mon Aug 21 16:52:08 2023 +0200 chore: fix from_proof for IdentityBalanceAndRevision commit 57b3fa4 Author: Quantum Explorer <[email protected]> Date: Fri Aug 18 15:09:51 2023 +0200 pushed out error commit e15bb97 Author: Quantum Explorer <[email protected]> Date: Fri Aug 18 14:35:00 2023 +0200 more fixes
…es-merge-versioning
…es-merge-versioning
This reverts commit ab6372f.
This reverts commit 20654fe.
This reverts commit e7d2ff4.
| impl Query<GetIdentityRequest> for dpp::prelude::Identifier { | ||
| fn query(self) -> Result<GetIdentityRequest, Error> { | ||
| let id = self.to_vec(); | ||
| Ok(GetIdentityRequest { id, prove: true }) |
There was a problem hiding this comment.
I'm a little confused because of the prove: true. It might be because I'm not aware about the original task.
Why did we start with querying proofs and not actual platform types? (Identity, Document, and etc)
There was a problem hiding this comment.
We query proofs because I believe this is the correct way to do this.
Our implementation:
- retrieves the proof using dapi
- verifies grovedb proof
- verifies tenderdash-generated proof (eg. quorum signatures, etc)
- extracts the object (like Identity) from the proof and returns it to the user
This way the sdk user receives correct, proved object, without any chance to modify it.
If we were receiving only the objects (that is, prove: false), there is a risk that data can be modified by attacker during transit or on the dapi server. Here, the user can be certain that received info is correct.
Having that said, in future, we might implement "non-proved" version of requests. I'll modify the query trait to support that.
There was a problem hiding this comment.
Updated the trait to add support in future in 6d08229a6c898d24bea834e604181aa9b5445d3e .
QuantumExplorer
left a comment
There was a problem hiding this comment.
Very nice work, I do think you might have made your life a little more complicated than it needed to be, but this should work very nicely, and might be the right solution. I think time will tell once we start using it if it flows properly and people like it.
| /// queryset limit | ||
| pub limit: u32, | ||
| /// first object to start with | ||
| pub start: Option<Start>, |
There was a problem hiding this comment.
I think you need a start_included bool.
| let request = query.query(sdk.prove())?; | ||
|
|
||
| let response = request | ||
| .clone() |
There was a problem hiding this comment.
who do we need to clone the request?
There was a problem hiding this comment.
(not saying that this is a problem, just curious)
There was a problem hiding this comment.
execute() consumes the request, so we need to clone it here in order to log it later and pass to sdk.parse_proof.
|
|
||
| /// Trait implemented by objects that can be listed or searched. | ||
| #[async_trait::async_trait] | ||
| pub trait List |
There was a problem hiding this comment.
Rename to FetchList or FetchMany (I think FetchMany is better but would be okay with FetchList)
There was a problem hiding this comment.
Renamed to FetchMany
… rs-sdk/test-fetch-and-list
Issue being fixed or feature implemented
rs-sdkis a high-level crate that provides external developers with easy API interface to access the Dash Platform.Identity, Data Contract and Document objects are base elements of rs-sdk. In this PR, we create initial version of rs-sdk.
What was done?
Notes for reviewer:
How Has This Been Tested?
Breaking Changes
None
Checklist:
For repository code-owners and collaborators only