Skip to content

Commit

Permalink
allow offchain collection of partial evals
Browse files Browse the repository at this point in the history
  • Loading branch information
kitounliu committed Jul 10, 2024
1 parent 2d10095 commit 29e4c58
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
1 change: 0 additions & 1 deletion contracts/zkdvrf.sol
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ contract zkdvrf is Ownable {
// submit the final pseudorandom value which is computed by combining t partial evaluations offchain
function submitRandom(IPseudoRand.PseudoRandom memory pseudo) public onlyOwner {
require(roundToRandom[currentRoundNum].value == bytes32(0), "Answer for round already exists");
require(roundSubmissionCount[currentRoundNum] >= threshold, "Partial evaluation threshold not reached");
require(IPseudoRand(pseudoRand).verifyPseudoRand(bytes(roundInput[currentRoundNum]), pseudo.proof, gpkVal), "Incorrect random submitted");
bytes32 value = keccak256(abi.encodePacked(pseudo.proof.x, pseudo.proof.y));
require(pseudo.value == value, "Incorrect pseudorandom value");
Expand Down
4 changes: 0 additions & 4 deletions test/zkdvrf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,6 @@ describe('ZKDVRF on-chain tests', async () => {
await expect(Zkdvrf.submitPartialEval(pEvals[0])).to.be.revertedWith('Already submitted for round')
})

it('should not be able to generate random below threshold', async () => {
await expect(Zkdvrf.submitRandom(pseudoRandom)).to.be.revertedWith('Partial evaluation threshold not reached')
})

it('all nodes should be able to submit partial eval', async () => {
await Zkdvrf.connect(account2).submitPartialEval(pEvals[1])
await Zkdvrf.connect(account3).submitPartialEval(pEvals[2])
Expand Down

0 comments on commit 29e4c58

Please sign in to comment.