Skip to content

Commit

Permalink
test: adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
PacificYield committed Dec 31, 2024
1 parent 9c3f173 commit db4f9e4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions contracts/test/kmsVerifier/kmsVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,16 @@ describe('KMSVerifier', function () {
// different format of inputProof for native
const cheatInputProof = encryptedAmount2.inputProof + encryptedAmount2.inputProof.slice(-130); // trying to cheat by repeating the first kms signer signature
const cheat = cheatInputProof.slice(0, 5) + '2' + cheatInputProof.slice(6);
await expect(contract2.requestMixedBytes256(encryptedAmount2.handles[0], cheat)).to.revertedWith(
'Not enough unique KMS input signatures',
); // this should fail because in this case the InputVerifier received only one KMS signature (instead of at least 2)

// It should be reverted by InputVerifier with custom error 'SignerIsNotCoprocessor'.
// It should fail because in this case the InputVerifier received only one KMS signature (instead of at least 2).

const orig = dotenv.parse(fs.readFileSync('addresses/.env.inputverifier')).INPUT_VERIFIER_CONTRACT_ADDRESS;
const inputVerifier = (await ethers.getContractFactory('contracts/InputVerifier.coprocessor.sol:InputVerifier')).attach(orig);
await expect(contract2.requestMixedBytes256(encryptedAmount2.handles[0], cheat)).to.revertedWithCustomError(
inputVerifier,
'KMSNumberSignaturesInsufficient',
);
}
process.env.NUM_KMS_SIGNERS = '4';
const encryptedAmount = await inputAlice.encrypt();
Expand Down

0 comments on commit db4f9e4

Please sign in to comment.