diff --git a/nucypher/blockchain/eth/sol/source/contracts/lib/ReEncryptionValidator.sol b/nucypher/blockchain/eth/sol/source/contracts/lib/ReEncryptionValidator.sol index c184cb94f..9cb024bbc 100644 --- a/nucypher/blockchain/eth/sol/source/contracts/lib/ReEncryptionValidator.sol +++ b/nucypher/blockchain/eth/sol/source/contracts/lib/ReEncryptionValidator.sol @@ -63,7 +63,7 @@ library ReEncryptionValidator { require(alicesAddress == _precomputed.alicesKeyAsAddress, "Bad KFrag signature"); // Compute proof's challenge scalar h, used in all ZKP verification equations - uint256 h = computeProofChallengeScalar(_capsuleBytes, _cFragBytes); + uint256 h = computeProofChallengeScalar(_capsule, _cFrag); ////// // Verifying 1st equation: z*E == h*E_1 + E_2 @@ -257,14 +257,10 @@ library ReEncryptionValidator { } function computeProofChallengeScalar( - bytes memory _capsuleBytes, - bytes memory _cFragBytes + UmbralDeserializer.Capsule memory _capsule, + UmbralDeserializer.CapsuleFrag memory _cFrag ) internal pure returns (uint256) { - // TODO: Optimize this since they have already been parsed by the caller - UmbralDeserializer.Capsule memory _capsule = _capsuleBytes.toCapsule(); - UmbralDeserializer.CapsuleFrag memory _cFrag = _cFragBytes.toCapsuleFrag(); - // Compute h = hash_to_bignum(e, e1, e2, v, v1, v2, u, u1, u2, metadata) bytes memory hashInput = abi.encodePacked( // Point E diff --git a/tests/blockchain/eth/contracts/contracts/LibTestSet.sol b/tests/blockchain/eth/contracts/contracts/LibTestSet.sol index b853a83c9..3639cdc09 100644 --- a/tests/blockchain/eth/contracts/contracts/LibTestSet.sol +++ b/tests/blockchain/eth/contracts/contracts/LibTestSet.sol @@ -185,7 +185,9 @@ contract ReEncryptionValidatorMock { ) public pure returns (uint256) { - return ReEncryptionValidator.computeProofChallengeScalar(_capsuleBytes, _cFragBytes); + UmbralDeserializer.Capsule memory _capsule = _capsuleBytes.toCapsule(); + UmbralDeserializer.CapsuleFrag memory _cFrag = _cFragBytes.toCapsuleFrag(); + return ReEncryptionValidator.computeProofChallengeScalar(_capsule, _cFrag); } function aliceAddress(