Skip to content

Commit

Permalink
Merge pull request #51 from zama-ai/prerelease0610
Browse files Browse the repository at this point in the history
chore: use prerelease fhevm0.6.1-0
  • Loading branch information
jatZama authored Dec 11, 2024
2 parents f9505a6 + 7ce8ca0 commit 1fea392
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 43 deletions.
13 changes: 1 addition & 12 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "hardhat-ignore-warnings";
import { HardhatUserConfig, extendProvider } from "hardhat/config";
import { task } from "hardhat/config";
import type { NetworkUserConfig } from "hardhat/types";
import { resolve } from "path";

import CustomProvider from "./CustomProvider";
// Adjust the import path as needed
Expand All @@ -20,17 +19,7 @@ extendProvider(async (provider) => {
return newProvider;
});

task("compile:specific", "Compiles only the specified contract")
.addParam("contract", "The contract's path")
.setAction(async ({ contract }, hre) => {
// Adjust the configuration to include only the specified contract
hre.config.paths.sources = contract;

await hre.run("compile");
});

const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || "./.env";
dotenv.config({ path: resolve(__dirname, dotenvConfigPath) });
dotenv.config();

// Ensure that we have all the environment variables we need.
const mnemonic: string = process.env.MNEMONIC!;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"eslint-config-prettier": "^8.5.0",
"ethers": "^6.8.0",
"extra-bigint": "^1.1.18",
"fhevm": "^0.6.0",
"fhevm": "^0.6.1",
"fhevm-contracts": "^0.2.0",
"fhevm-core-contracts": "^0.6.0",
"fhevmjs": "^0.6.0",
"fhevm-core-contracts": "^0.6.1",
"fhevmjs": "^0.6.1",
"fs-extra": "^10.1.0",
"globals": "^15.9.0",
"hardhat": "^2.22.8",
Expand Down
36 changes: 18 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions test/asyncDecrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const fulfillAllPastRequestsIds = async (mocked: boolean) => {
const handles = event.args[1];
const typesList = handles.map((handle) => parseInt(handle.toString(16).slice(-4, -2), 16));
const msgValue = event.args[4];
const passSignaturesToCaller = event.args[6];

if (!results.includes(requestID)) {
// if request is not already fulfilled
if (mocked) {
Expand Down Expand Up @@ -144,13 +144,9 @@ const fulfillAllPastRequestsIds = async (mocked: boolean) => {
const abiCoder = new ethers.AbiCoder();
let encodedData;
let calldata;
if (!passSignaturesToCaller) {
encodedData = abiCoder.encode(["uint256", ...types], [31, ...valuesFormatted4]); // 31 is just a dummy uint256 requestID to get correct abi encoding for the remaining arguments (i.e everything except the requestID)
calldata = "0x" + encodedData.slice(66); // we just pop the dummy requestID to get the correct value to pass for `decryptedCts`
} else {
encodedData = abiCoder.encode(["uint256", ...types, "bytes[]"], [31, ...valuesFormatted4, []]); // adding also a dummy empty array of bytes for correct abi-encoding when used with signatures
calldata = "0x" + encodedData.slice(66).slice(0, -64); // we also pop the last 32 bytes (empty bytes[])
}

encodedData = abiCoder.encode(["uint256", ...types], [31, ...valuesFormatted4]); // 31 is just a dummy uint256 requestID to get correct abi encoding for the remaining arguments (i.e everything except the requestID)
calldata = "0x" + encodedData.slice(66); // we just pop the dummy requestID to get the correct value to pass for `decryptedCts`

const numSigners = 1; // for the moment mocked mode only uses 1 signer
const decryptResultsEIP712signatures = await computeDecryptSignatures(handles, calldata, numSigners);
Expand Down
4 changes: 2 additions & 2 deletions test/confidentialERC20/ConfidentialERC20.FHEGas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ describe("ConfidentialERC20:FHEGas", function () {
if (network.name === "hardhat") {
// `getFHEGasFromTxReceipt` function only works in mocked mode but gives same exact FHEGas consumed than on the real fhEVM
const FHEGasConsumedTransferFrom = getFHEGasFromTxReceipt(t3);
console.log("FHEGas Consumed during transfer", FHEGasConsumedTransferFrom);
console.log("FHEGas Consumed during transferFrom", FHEGasConsumedTransferFrom);
}
// contrarily to FHEGas, native gas in mocked mode slightly differs from the real gas consumption on fhevm (underestimated by ~20%)
console.log("Native Gas Consumed during transfer", t3.gasUsed);
console.log("Native Gas Consumed during transferFrom", t3.gasUsed);
});
});

0 comments on commit 1fea392

Please sign in to comment.