From 29e4c58f673e7dc3034ee6ee40cbccf2fbc18303 Mon Sep 17 00:00:00 2001 From: Jia Liu Date: Wed, 10 Jul 2024 15:44:16 +0100 Subject: [PATCH] allow offchain collection of partial evals --- contracts/zkdvrf.sol | 1 - test/zkdvrf.spec.ts | 4 ---- 2 files changed, 5 deletions(-) diff --git a/contracts/zkdvrf.sol b/contracts/zkdvrf.sol index 5e7541b..dafc1b7 100644 --- a/contracts/zkdvrf.sol +++ b/contracts/zkdvrf.sol @@ -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"); diff --git a/test/zkdvrf.spec.ts b/test/zkdvrf.spec.ts index 8142b6b..21e5c6e 100644 --- a/test/zkdvrf.spec.ts +++ b/test/zkdvrf.spec.ts @@ -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])