-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add indy-vdr-proxy profile #837
Conversation
@@ -39,6 +40,7 @@ lazy_static = "1.4.0" | |||
derive_builder = "0.12.0" | |||
uuid = { version = "1.3.0", default-features = false, features = ["v4"] } | |||
tokio = { version = "1.20" } | |||
indy-vdr-proxy-client = { git = "https://github.com/mirgee/indy-vdr.git", rev = "fab0535", optional = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool 👍 but I've noticed you perhaps by mistake created PR against your own repo, rather against hyperledger origin mirgee/indy-vdr#1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is on purpose, I first want to make the maintainers are actually interested in the client before making a PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you let them know somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end decided to open a PR against the Hyperledger repo. But IMO merging it should not be in any way a precondition for merging this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but it would be good to make a comment above this dependency; stating the changes you made and also that it is future TODO to monitor your indy-vdr PR and revert to using the main branch if/when your indy-vdr PR is merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume forked dependencies are implicitly suspicious and to be avoided and that the changes made are easily traceable; but added the comment for clarity.
Codecov Report
@@ Coverage Diff @@
## main #837 +/- ##
==========================================
- Coverage 49.01% 8.70% -40.31%
==========================================
Files 414 408 -6
Lines 33704 32870 -834
Branches 7458 7199 -259
==========================================
- Hits 16519 2862 -13657
- Misses 12064 29197 +17133
+ Partials 5121 811 -4310
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
||
use super::error::{AriesVcxCoreError, AriesVcxCoreErrorKind}; | ||
|
||
impl From<VdrProxyClientError> for AriesVcxCoreError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we have 3 different ledger errors in aries-vcx-core
#[error("Connection to Pool Ledger.")]
PoolLedgerConnect,
#[error("Ledger rejected submitted request.")]
InvalidLedgerResponse,
#[error("Ledger item not found.")]
LedgerItemNotFound,
when using VdrProxy
ledger trait implementation, all errors are squashed into AriesVcxCoreErrorKind::InvalidLedgerResponse,
- that's fine with the first two, but remapping LedgerItemNotFound
into InvalidLedgerResponse
can cause some troubles. For example function _try_get_cred_def_from_ledger
is handling LedgerItemNotFound
in very particular way.
It would be good if we could on level of indy-vdr-proxy-client
distinquish and return "item not not found on ledger" vs "other issue with ledger response" errors, and that would enable us propagate more granular handling on aries-vcx level as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized this is actually a problem of wider scope - vdr_ledger
submitter, eg previously indy_vdr_ledger.rs
also behaves differently
let send_req_result: VdrSendRequestResult = recv
.await
.map_err(|e| AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::InvalidState, e))?;
let (result, _) = send_req_result?;
It actually returns even different error.
I think you can still line up the error handling as suggested in previous comment, but I think what needs to happen in the end is:
- take out the ledger trait as separate crate
- the trait needs to return custom error types - for example
ErrorPoolLedgerConnect
,ErrorInvalidLedgerResponse
,ErrorLedgerItemNotFound
- Add some documentation to traits specifying what error needs to be returned in what case, ideally covered with some tests against the trait interface which any implementor of the trait could reuse (not sure how this would be practically done)
This should solve the deviations in error handling of the trait implementation, which now returns AriesVcxCoreError
- way too much freedom for trait implementors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some comments
55af02f
to
74e1e56
Compare
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
7c0f9b5
to
74c94a5
Compare
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
7cce657
to
0a17360
Compare
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per our discussion, I'll conclude things we discussed privately, for transparency and other reviewers
- there's lots of manual parsing going on here, because the
indy-vdr
doesn't contain model of ledger responses - the assumption is thatindy-vdr
has been typically used via FFI so far, so there wasn't value for implementors to maintained detailed types for ledger responses - there are indy ledger responses in vdrtools under
libvdrtools/src/domain/ledger/*.rs
- we could reuse that, either pull it out from vdrtool as a small crate withinaries-vcx
repo, or even better make contribution toindy-vdr
where we would map the ledger responses to those types.
But that would be scope for another PR(s)
Would be ideal if |
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good, splitting the logic into a request_submitter was a good move.
Just noticed a couple of things:
vdr_reader.rs
indid_resolver_sov
may need to be updated to use the new request_submitter. It currently fails to build withcargo build --features modular_libs --no-default-features
.- The
vdr_proxy_profile
technically depends on thevdrtools
dependency/feature-flag. I think this is ok, but I wonder if thevdr_proxy_profile
would therefore need to be to hidden behind thevdrtools
flag as well? e.g.aries_vcx
currently fails to build withcargo build --features vdr_proxy_ledger --no-default-features
. But maybe it's that's ok and you can ignore this comment, but something to think about. I've been using thecheck-aries-vcx-feature-variants
CI job to check that features can survive/compile on their own, if you think it's appropriate, you could add the vdr_proxy_ledger in there.
Also had that other comment about commenting on your usage of indy-vdr fork.
Feel free to merge after you've addressed/considered my review! thnx
@@ -39,6 +40,7 @@ lazy_static = "1.4.0" | |||
derive_builder = "0.12.0" | |||
uuid = { version = "1.3.0", default-features = false, features = ["v4"] } | |||
tokio = { version = "1.20" } | |||
indy-vdr-proxy-client = { git = "https://github.com/mirgee/indy-vdr.git", rev = "fab0535", optional = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but it would be good to make a comment above this dependency; stating the changes you made and also that it is future TODO to monitor your indy-vdr PR and revert to using the main branch if/when your indy-vdr PR is merged
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa> # Conflicts: # .github/workflows/main.yml
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
@gmulhearn-anonyome Good catch. Updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming CI still good
Adds a new profile
VdrProxyProfile
which uses a running instance of indy-vdr-proxy (through indy-vdr-proxy-client) to read and write transactions instead of communicating with the ledger directly.This may be useful in situations where
The
VdrProxyProfile
profile reuses existingIndyVdrLedger
implementation of theBaseLedger
trait and request submitting is injected through an implementation of theRequestSubmitter
trait.