Luxoft / cordentity

This project combines Hyperledger's Indy ledger for decentralized identity with the Corda platform
Apache License 2.0
32 stars 19 forks source link

Getting error when running ReadmeExampleTest #38

Open ADL-work opened 5 years ago

ADL-work commented 5 years ago

Hi team,

I got when trying to run the ReadmeExampleTest by using gradle build

The error is as below:

[ERROR] 01:22:43,650 [Mock network] (VerifyCredentialFlow.kt:177) flow.[4edd6dbb-b59c-4251-86bb-bcdba5e6d895].call - {} java.util.concurrent.ExecutionException: org.hyperledger.indy.sdk.InvalidStructureException: A value being processed is not valid. ... You can buy drinks: false [INFO ] 01:22:43,802 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-1 - Close initiated... {} [INFO ] 01:22:43,809 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-1 - Closed. {} [INFO ] 01:22:43,813 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-2 - Close initiated... {} [INFO ] 01:22:43,817 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-2 - Closed. {} [INFO ] 01:22:43,819 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-3 - Close initiated... {} [INFO ] 01:22:43,824 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-3 - Closed. {} [INFO ] 01:22:43,827 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-4 - Close initiated... {} [INFO ] 01:22:43,833 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-4 - Closed. {} [INFO ] 01:22:43,834 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-5 - Close initiated... {} [INFO ] 01:22:43,844 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-5 - Closed. {} ]]>

Do you know how to fix the issue in order to have

You can buy drinks: true

?

Thank you for your help, AD

seniorjoinu commented 5 years ago

Hey there!

Thank you! We have made a fix. Here is the working version - https://github.com/Luxoft/cordentity/tree/fix/example-test (it is almost the same except ReadmeExampleTest.kt:97).

Unfortunately, we're unable to merge it into master right now, because Cordentity is currently migrating to the HL Labs (https://github.com/hyperledger-labs/cordentity).

ADL-work commented 5 years ago

Hey @seniorjoinu, thanks for the quick updates. I managed to have it and get the result to true. But when I tried with other value of "BORN" to test invalid values, it still shows true (for example changing from 2000 to 2005). Do you have any hint for this?

Much appreciate for the help!

alkopnin commented 5 years ago

Hi @ADL-work Actually it's great that you bring it up. I just have checked the code and let me explain. Currently Indy covers only ">=" mathematical operations. However, they are working on "<" right now.

Let's take a look the example,

In line 89 Indy eventually compares for us 2000 >= 2000 which is true. However, if we change to 2005 we get 2005 >= 2000 which is also true.

Thus, to fix it we will migrate on the latest version as soon as "<" ready and will provide different mathematical operation on predicate building phase.

Sorry for that. And many thanks for your passion, very appreciate.

BTW @seniorjoinu could you, please, check my statement and finally confirm it.

ADL-work commented 5 years ago

Hi @alkopnin,

Many thanks for the explanation, I got it now. When I tried with "1999", it raised an exception and the return value is: false, which is clear now as (1999 >= 2000) is false.

Thanks and have a nice afternoon/evening 👍

lolo8304 commented 5 years ago

i have the same issue and its clear that it fails in the predicate - but ... the predicate is not the issue. try to add an "attribute reference" into it.

org.hyperledger.indy.sdk.InvalidStructureException: A value being processed is not valid

i have validated and compared it to com.luxoft.blockchainlab.hyperledger.indy.AnoncredsDemoTest and here all is working..... it seems that additional entries in the request to indy-sdk

see test attachements AnoncredsDemoTest.json.txt shopping-schema.json.txt

i traced the error and I receive:

cause = {InvalidStructureException@19687} "org.hyperledger.indy.sdk.InvalidStructureException: A value being processed is not valid." stackTrace = {StackTraceElement[10]@19696} 0 = {StackTraceElement@19699} "org.hyperledger.indy.sdk.IndyException.fromSdkError(IndyException.java:72)" 1 = {StackTraceElement@19700} "org.hyperledger.indy.sdk.IndyJava$API.checkResult(IndyJava.java:90)" 2 = {StackTraceElement@19701} "org.hyperledger.indy.sdk.anoncreds.Anoncreds.access$700(Anoncreds.java:26)" 3 = {StackTraceElement@19702} "org.hyperledger.indy.sdk.anoncreds.Anoncreds$4.callback(Anoncreds.java:93)" 4 = {StackTraceElement@19703} "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)" 5 = {StackTraceElement@19704} "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)" 6 = {StackTraceElement@19705} "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)" 7 = {StackTraceElement@19706} "java.lang.reflect.Method.invoke(Method.java:498)" 8 = {StackTraceElement@19707} "com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)" 9 = {StackTraceElement@19708} "com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)"

lolo8304 commented 5 years ago

fixed bug above while removing unneeded "revocation" information. if "revocation" is available there is an SDK issue

patch-cordentity-master.diff.zip

i fixed it on top of master in https://github.com/hyperledger-labs/cordentity

lolo8304 commented 5 years ago

for all: sorry about my message - my mistake. I built "indy master --> 1.8.* but cordenity is only working with 1.7.0 so far (in master and developer branch)

all fine now