uport-project / kotlin-did-jwt

Create and verify uPort and DID compliant JWTs in Kotlin
https://developer.uport.me
Apache License 2.0
8 stars 6 forks source link

[bugfix] crash in ethr-did-resolver for nodes that don't reply with logs #21

Closed mirceanis closed 5 years ago

mirceanis commented 5 years ago

In case the RPC node can't provide logs, the ethr-did-resolver would crash. This PR fixes the crash by skipping the blocks without logs, returning the default DID document (with eventual owner change).

This situation comes up when working against a local node with ganache (I was using 2.1.0)

A test has been added to simulate the blank logs situation.

codecov[bot] commented 5 years ago

Codecov Report

Merging #21 into develop will increase coverage by 0.85%. The diff coverage is 75%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop      #21      +/-   ##
=============================================
+ Coverage      70.37%   71.22%   +0.85%     
- Complexity       160      163       +3     
=============================================
  Files             22       22              
  Lines            783      782       -1     
  Branches         132      133       +1     
=============================================
+ Hits             551      557       +6     
+ Misses           154      149       -5     
+ Partials          78       76       -2
Impacted Files Coverage Δ Complexity Δ
...src/main/java/me/uport/sdk/jwt/model/JwtPayload.kt 11.11% <50%> (ø) 8 <1> (ø) :arrow_down:
.../main/java/me/uport/sdk/ethrdid/EthrDIDResolver.kt 80% <83.33%> (+4.65%) 17 <0> (+3) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4d22d26...2266c20. Read the comment docs.