Skip to content

Commit

Permalink
addressing review comments #1
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Aug 2, 2020
1 parent 29da06b commit f17fc13
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
28 changes: 21 additions & 7 deletions sigmastate/src/main/scala/sigmastate/interpreter/Hint.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,21 @@ trait Hint
* A hint which is indicating that a secret associated with its public image "image" is already proven.
*/
trait SecretProven extends Hint {
val image: SigmaBoolean
val challenge: Challenge
val uncheckedTree: UncheckedTree

/**
* Public image of a secret which is proven
*/
def image: SigmaBoolean

/**
* Challenge used for a proof
*/
def challenge: Challenge

/**
* Proof in a tree form
*/
def uncheckedTree: UncheckedTree
}

/**
Expand All @@ -43,19 +55,21 @@ case class SimulatedSecretProof(image: SigmaBoolean,
* to randomness ("a" in a sigma protocol).
*/
trait CommitmentHint extends Hint {
val image: SigmaBoolean
val commitment: FirstProverMessage
def image: SigmaBoolean
def commitment: FirstProverMessage
}

/**
* A hint which a commitment to randomness associated with a public image of a secret, as well as randomness itself.
* Please note that this randomness should be kept in secret by the prover.
*
* @param image - image of a secret
* @param randomness - randomness
* @param secretRandomness - randomness
* @param commitment - commitment to randomness used while proving knowledge of the secret
*/
case class OwnCommitment(override val image: SigmaBoolean, randomness: BigInteger, commitment: FirstProverMessage) extends CommitmentHint
case class OwnCommitment(override val image: SigmaBoolean,
secretRandomness: BigInteger,
commitment: FirstProverMessage) extends CommitmentHint

/**
* A hint which contains a commitment to randomness associated with a public image of a secret.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ trait ProverInterpreter extends Interpreter with ProverUtils with AttributionCor
hintsBag.ownCommitments.find(_.image == su.proposition).map { oc =>
DLogInteractiveProver.secondMessage(
privKey.asInstanceOf[DLogProverInput],
oc.randomness,
oc.secretRandomness,
su.challengeOpt.get)
}.getOrElse {
DLogInteractiveProver.secondMessage(
Expand Down Expand Up @@ -473,7 +473,7 @@ trait ProverInterpreter extends Interpreter with ProverUtils with AttributionCor
hintsBag.ownCommitments.find(_.image == dhu.proposition).map { oc =>
DiffieHellmanTupleInteractiveProver.secondMessage(
privKey.asInstanceOf[DiffieHellmanTupleProverInput],
oc.randomness,
oc.secretRandomness,
dhu.challengeOpt.get)
}.getOrElse {
DiffieHellmanTupleInteractiveProver.secondMessage(
Expand Down Expand Up @@ -535,7 +535,8 @@ trait ProverInterpreter extends Interpreter with ProverUtils with AttributionCor
CThresholdUncheckedNode(t.challengeOpt.get, t.children.map(convertToUnchecked), t.k, t.polynomialOpt)
case s: UncheckedSchnorr => s
case d: UncheckedDiffieHellmanTuple => d
case a: Any => ???
case a: Any =>
error(s"Cannot convertToUnproven($a)")
}

}

0 comments on commit f17fc13

Please sign in to comment.