@@ -5,7 +5,14 @@ import cats.implicits._
55import io .iohk .ethereum .consensus .blocks .BlockGenerator
66import io .iohk .ethereum .domain .{Account , Address , Block , Blockchain , UInt256 }
77import io .iohk .ethereum .jsonrpc .ProofService .StorageValueProof .asRlpSerializedNode
8- import io .iohk .ethereum .jsonrpc .ProofService .{GetProofRequest , GetProofResponse , ProofAccount , StorageProof , StorageProofKey , StorageValueProof }
8+ import io .iohk .ethereum .jsonrpc .ProofService .{
9+ GetProofRequest ,
10+ GetProofResponse ,
11+ ProofAccount ,
12+ StorageProof ,
13+ StorageProofKey ,
14+ StorageValueProof
15+ }
916import io .iohk .ethereum .mpt .{MptNode , MptTraversals }
1017import monix .eval .Task
1118
@@ -30,6 +37,7 @@ object ProofService {
3037 val value : BigInt
3138 val proof : Seq [ByteString ]
3239 }
40+
3341 /**
3442 * Object proving a relationship of a storage value to an account's storageHash
3543 *
@@ -40,13 +48,16 @@ object ProofService {
4048 case class StorageValueProof (
4149 key : StorageProofKey ,
4250 value : BigInt = BigInt (0 ),
43- proof : Seq [ByteString ] = Seq .empty[MptNode ].map(asRlpSerializedNode)) extends StorageProof
51+ proof : Seq [ByteString ] = Seq .empty[MptNode ].map(asRlpSerializedNode)
52+ ) extends StorageProof
4453
4554 object StorageValueProof {
4655 def apply (position : BigInt , value : Option [BigInt ], proof : Option [Vector [MptNode ]]): StorageValueProof =
4756 (value, proof) match {
48- case (Some (value), Some (proof)) => new StorageValueProof (key = StorageProofKey (position), value = value, proof = proof.map(asRlpSerializedNode))
49- case (None , Some (proof)) => new StorageValueProof (key = StorageProofKey (position), proof = proof.map(asRlpSerializedNode))
57+ case (Some (value), Some (proof)) =>
58+ new StorageValueProof (key = StorageProofKey (position), value = value, proof = proof.map(asRlpSerializedNode))
59+ case (None , Some (proof)) =>
60+ new StorageValueProof (key = StorageProofKey (position), proof = proof.map(asRlpSerializedNode))
5061 case (Some (value), None ) => new StorageValueProof (key = StorageProofKey (position), value = value)
5162 case (None , None ) => new StorageValueProof (key = StorageProofKey (position))
5263 }
0 commit comments