Skip to content

Commit

Permalink
fix: use encrypt64 for tests instead 32
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Feb 9, 2024
1 parent dc18f05 commit 249eb0e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/blindAuction/BlindAuction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('BlindAuction', function () {
const [contract] = await Promise.all([contractPromise, transaction.wait()]);

// Transfer 100 tokens to Bob
const encryptedTransferAmount = instance.alice.encrypt32(100);
const encryptedTransferAmount = instance.alice.encrypt64(100);
const tx = await this.erc20['transfer(address,bytes)'](this.signers.bob.address, encryptedTransferAmount);

// Transfer 100 tokens to Carol
Expand All @@ -42,8 +42,8 @@ describe('BlindAuction', function () {
});

it('should check Carol won the bid', async function () {
const bobBidAmount = this.instances.bob.encrypt32(10);
const carolBidAmount = this.instances.carol.encrypt32(20);
const bobBidAmount = this.instances.bob.encrypt64(10);
const carolBidAmount = this.instances.carol.encrypt64(20);

// To be able to bid, we give approbation to
// the blind auction to spend tokens on Bob's and Carol's behalf.
Expand Down
2 changes: 1 addition & 1 deletion test/governor/Comp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Comp', function () {
});

it('should transfer tokens', async function () {
const encryptedAmountToTransfer = this.instances.alice.encrypt32(200000);
const encryptedAmountToTransfer = this.instances.alice.encrypt64(200000);
const transferTransac = await this.comp['transfer(address,bytes)'](
this.signers.bob.address,
encryptedAmountToTransfer,
Expand Down
2 changes: 1 addition & 1 deletion test/governor/GovernorZama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('GovernorZama', function () {
this.comp = await deployCompFixture();

const instances = await createInstances(await this.comp.getAddress(), ethers, this.signers);
const encryptedAmountToTransfer = instances.alice.encrypt32(100000);
const encryptedAmountToTransfer = instances.alice.encrypt64(100000);
const transfer1 = await this.comp['transfer(address,bytes)'](this.signers.bob.address, encryptedAmountToTransfer);
const transfer2 = await this.comp['transfer(address,bytes)'](this.signers.carol.address, encryptedAmountToTransfer);
await Promise.all([transfer1.wait(), transfer2.wait()]);
Expand Down
1 change: 1 addition & 0 deletions test/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const createInstance = async (contractAddress: string, account: Signer, e
instance.encrypt8 = createUintToUint8ArrayFunction(8);
instance.encrypt16 = createUintToUint8ArrayFunction(16);
instance.encrypt32 = createUintToUint8ArrayFunction(32);
instance.encrypt64 = createUintToUint8ArrayFunction(64);
instance.decrypt = (_, hexadecimalString) => Number(BigInt(hexadecimalString));
instance.generatePublicKey = () => ({ eip712: {} as any, publicKey: new Uint8Array() });
} else {
Expand Down

0 comments on commit 249eb0e

Please sign in to comment.