Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

feat: new deployment super task with env vars names aligned on gateway #455

Merged
merged 1 commit into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/gpu-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ env:
RUST_BACKTRACE: "full"
RUST_MIN_STACK: "8388608"
IS_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
CHECKOUT_TOKEN: ${{ secrets.REPO_CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }}
# Secrets will be available only to zama-ai organization members
SECRETS_AVAILABLE: ${{ secrets.JOB_SECRET != '' }}

Expand Down Expand Up @@ -61,7 +60,6 @@ jobs:
with:
fetch-depth: 0
persist-credentials: 'false'
token: ${{ env.CHECKOUT_TOKEN }}

- name: Check for file changes
id: changed-files
Expand Down Expand Up @@ -136,7 +134,6 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: 'false'
token: ${{ env.CHECKOUT_TOKEN }}
lfs: true

- name: Checkout LFS objects
Expand Down
38 changes: 19 additions & 19 deletions contracts/.env.example
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export MNEMONIC="adapt mosquito move limb mobile illegal tree voyage juice mosquito burger raise father hope layer"
export CHAIN_ID_GATEWAY="654321"
export PRIVATE_KEY_FHEVM_DEPLOYER="0c66d8cde71d2faa29d0cb6e3a567d31279b6eace67b0a9d9ba869c119843a5e"
export PRIVATE_KEY_DECRYPTION_ORACLE_RELAYER="7ec931411ad75a7c201469a385d6f18a325d4923f9f213bd882bbea87e160b67"
export DECRYPTION_MANAGER_ADDRESS="0x5ffdaAB0373E62E2ea2944776209aEf29E631A64"
export ZKPOK_MANAGER_ADDRESS="0x812b06e1CDCE800494b79fFE4f925A504a9A9810"
export NUM_KMS_SIGNERS="1"
export INITIAL_KMS_THRESHOLD="1"
export PRIVATE_KEY_KMS_SIGNER_0="388b7680e4e1afa06efbfd45cdd1fe39f3c6af381df6555a19661f283b97de91"
export PRIVATE_KEY_KMS_SIGNER_1="bbaed91514fa4b7c86aa4f73becbabcf4bce0ae130240f0d6ac3f87e06812440"
export PRIVATE_KEY_KMS_SIGNER_2="1bfa3e2233b0103ad67954a728b246c528916791f7fab4894ff361e3937b47e1"
export PRIVATE_KEY_KMS_SIGNER_3="7a604eed8cf4a43277d192aa0c7894d368577a4021e52bf45420f256e34c7dd7"
export NUM_COPROCESSOR_SIGNERS="1"
export PRIVATE_KEY_COPROCESSOR_ACCOUNT_0="c2454775cca95e6d17d70b68105f48009fc4bf661f025e6a7911a6b4acf2a2f3"
export PRIVATE_KEY_COPROCESSOR_ACCOUNT_1="8cd5feab038d5e3aceaa7ba4825cc046bb6b6144ff6468463c6d2a20428c0a9f"
export PRIVATE_KEY_COPROCESSOR_ACCOUNT_2="bbfec2330ec03c0936ace29ab484560619c549edf745639e1bc7a96ed4a240b0"
export PRIVATE_KEY_COPROCESSOR_ACCOUNT_3="699013f478c4e22e08de83c0cd44d70dbb265eebfd2ae991ca24ceff57e18f31"
export ETHERSCAN_API_KEY="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
export RPC_URL="http://layer1-node:8545"
MNEMONIC="adapt mosquito move limb mobile illegal tree voyage juice mosquito burger raise father hope layer"
CHAIN_ID_GATEWAY="654321"
DEPLOYER_PRIVATE_KEY="7697c90f7863e6057fbe25674464e14b57f2c670b1a8ee0f60fb87eb9b615c4d" # account[5]
DECRYPTION_MANAGER_ADDRESS="0x5ffdaAB0373E62E2ea2944776209aEf29E631A64"
ZKPOK_MANAGER_ADDRESS="0x812b06e1CDCE800494b79fFE4f925A504a9A9810"
NUM_KMS_NODES="1"
KMS_THRESHOLD="1"
KMS_SIGNER_ADDRESS_0="0x9FE8958A2920985AC7ab8d320fDFaB310135a05B" # account[7] (account[6] is the relayer)
KMS_SIGNER_ADDRESS_1="0x466f26442DD182C9A1b018Cd06671F9791DdE8Ef" # account[8]
KMS_SIGNER_ADDRESS_2="0xc45994e4098271c3140117ebD5c74C70dd56D9cd" # account[9]
KMS_SIGNER_ADDRESS_3="0xDb216ECeC4cEd51CdfD9609b6Ce7653aB04f6cAd" # account[10]
NUM_COPROCESSORS="1"
COPROCESSOR_SIGNER_ADDRESS_0="0x6518D50aDc9036Df37119eA465a8159E34417E2E" # account[11]
COPROCESSOR_SIGNER_ADDRESS_1="0xa5eE8292dA52d8234248709F3E217ffEBA5E8312" # account[12]
COPROCESSOR_SIGNER_ADDRESS_2="0xCFbF539CB91c92ace0343c5B0487149Ad0b82078" # account[13]
COPROCESSOR_SIGNER_ADDRESS_3="0xA951F315d5FD35Cac111dFB5250DF231FB8eF905" # account[14]
ETHERSCAN_API_KEY="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
RPC_URL="http://anvil-node:8545"
HARDHAT_NETWORK="staging"
11 changes: 0 additions & 11 deletions contracts/.env.example.deployment

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/addresses/.env.acl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ACL_CONTRACT_ADDRESS=0x339EcE85B9E11a3A3AA557582784a15d7F82AAf2
ACL_CONTRACT_ADDRESS=0x50157CFfD6bBFA2DECe204a89ec419c23ef5755D
2 changes: 1 addition & 1 deletion contracts/addresses/.env.decryptionoracle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DECRYPTION_ORACLE_ADDRESS=0x3d39707abEa4f23229E5109C83c155F27029B7A9
DECRYPTION_ORACLE_ADDRESS=0x233ff88A48c172d29F675403e6A8e302b0F032D9
2 changes: 1 addition & 1 deletion contracts/addresses/.env.exec
Original file line number Diff line number Diff line change
@@ -1 +1 @@
TFHE_EXECUTOR_CONTRACT_ADDRESS=0xB4A8CBDed90998c564dF33679143e7A41c5259fE
TFHE_EXECUTOR_CONTRACT_ADDRESS=0xCD3ab3bd6bcc0c0bf3E27912a92043e817B1cf69
2 changes: 1 addition & 1 deletion contracts/addresses/.env.fhegaslimit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FHE_GASLIMIT_CONTRACT_ADDRESS=0x208De73316E44722e16f6dDFF40881A3e4F86104
FHE_GASLIMIT_CONTRACT_ADDRESS=0x36772142b74871f255CbD7A3e89B401d3e45825f
2 changes: 1 addition & 1 deletion contracts/addresses/.env.inputverifier
Original file line number Diff line number Diff line change
@@ -1 +1 @@
INPUT_VERIFIER_CONTRACT_ADDRESS=0x4862Ca9360e9131AfD04cD1217b94Df15CC1aEEC
INPUT_VERIFIER_CONTRACT_ADDRESS=0x901F8942346f7AB3a01F6D7613119Bca447Bb030
2 changes: 1 addition & 1 deletion contracts/addresses/.env.kmsverifier
Original file line number Diff line number Diff line change
@@ -1 +1 @@
KMS_VERIFIER_CONTRACT_ADDRESS=0x596E6682c72946AF006B27C131793F2b62527A4b
KMS_VERIFIER_CONTRACT_ADDRESS=0xe3a9105a3a932253A70F126eb1E3b589C643dD24
2 changes: 1 addition & 1 deletion contracts/addresses/ACLAddress.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

pragma solidity ^0.8.24;

address constant aclAdd = 0x339EcE85B9E11a3A3AA557582784a15d7F82AAf2;
address constant aclAdd = 0x50157CFfD6bBFA2DECe204a89ec419c23ef5755D;
2 changes: 1 addition & 1 deletion contracts/addresses/DecryptionOracleAddress.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

pragma solidity ^0.8.24;

address constant DECRYPTION_ORACLE_ADDRESS = 0x3d39707abEa4f23229E5109C83c155F27029B7A9;
address constant DECRYPTION_ORACLE_ADDRESS = 0x233ff88A48c172d29F675403e6A8e302b0F032D9;
2 changes: 1 addition & 1 deletion contracts/addresses/FHEGasLimitAddress.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

pragma solidity ^0.8.24;

address constant fheGasLimitAdd = 0x208De73316E44722e16f6dDFF40881A3e4F86104;
address constant fheGasLimitAdd = 0x36772142b74871f255CbD7A3e89B401d3e45825f;
2 changes: 1 addition & 1 deletion contracts/addresses/InputVerifierAddress.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

pragma solidity ^0.8.24;

address constant inputVerifierAdd = 0x4862Ca9360e9131AfD04cD1217b94Df15CC1aEEC;
address constant inputVerifierAdd = 0x901F8942346f7AB3a01F6D7613119Bca447Bb030;
2 changes: 1 addition & 1 deletion contracts/addresses/KMSVerifierAddress.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

pragma solidity ^0.8.24;

address constant kmsVerifierAdd = 0x596E6682c72946AF006B27C131793F2b62527A4b;
address constant kmsVerifierAdd = 0xe3a9105a3a932253A70F126eb1E3b589C643dD24;
2 changes: 1 addition & 1 deletion contracts/addresses/TFHEExecutorAddress.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

pragma solidity ^0.8.24;

address constant tfheExecutorAdd = 0xB4A8CBDed90998c564dF33679143e7A41c5259fE;
address constant tfheExecutorAdd = 0xCD3ab3bd6bcc0c0bf3E27912a92043e817B1cf69;
18 changes: 0 additions & 18 deletions contracts/deploy-core-contracts.sh

This file was deleted.

45 changes: 24 additions & 21 deletions contracts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,20 @@ services:
anvil-node:
container_name: anvil-node
image: ghcr.io/foundry-rs/foundry:stable
env_file:
- ./.env.example.deployment
entrypoint:
[
"anvil",
"--block-time",
"0.5",
"--host",
"0.0.0.0",
"--port",
"8545",
"--chain-id",
"12345",
"--accounts",
"15",
"--mnemonic",
"adapt mosquito move limb mobile illegal tree voyage juice mosquito burger raise father hope layer",
]
- anvil
- --block-time
- "0.5"
- --host
- 0.0.0.0
- --port
- "8545"
- --chain-id
- "12345"
- --accounts
- "15"
- --mnemonic
- "adapt mosquito move limb mobile illegal tree voyage juice mosquito burger raise father hope layer"
ports:
- "8545:8545"
volumes:
Expand All @@ -34,8 +30,15 @@ services:
dockerfile: contracts/operations/docker/ci.dockerfile
tags:
- "httpz-smart-contracts:0.7.0-local"
env_file:
- ./.env.example
environment:
- HARDHAT_NETWORK=staging
volumes:
- ./.env.example.deployment:/app/.env
command: ["/app/deploy-core-contracts.sh"]
- HARDHAT_NETWORK=${HARDHAT_NETWORK:-staging}
- CHAIN_ID_GATEWAY=54321
command:
- /bin/bash
- -c
- |
# Uncomment this line to debug
# tail -f /dev/null
cd /app/ && npx hardhat task:deployAllHostContracts
33 changes: 3 additions & 30 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { NetworkUserConfig } from 'hardhat/types';
import { resolve } from 'path';

import CustomProvider from './CustomProvider';
// Adjust the import path as needed
import './tasks/accounts';
import './tasks/etherscanVerify';
import './tasks/taskDeploy';
import './tasks/taskUtils';
Expand Down Expand Up @@ -50,34 +50,7 @@ task('coverage').setAction(async (taskArgs, hre, runSuper) => {
task('test', async (taskArgs, hre, runSuper) => {
// Run modified test task
if (hre.network.name === 'hardhat') {
const privKeyFhevmDeployer = process.env.PRIVATE_KEY_FHEVM_DEPLOYER;
const privKeyFhevmRelayer = process.env.PRIVATE_KEY_DECRYPTION_ORACLE_RELAYER;
const decryptionManagerAddress = process.env.DECRYPTION_MANAGER_ADDRESS;
const zkpokManagerAddress = process.env.ZKPOK_MANAGER_ADDRESS;
await hre.run('task:faucetToPrivate', { privateKey: privKeyFhevmDeployer });
await hre.run('task:faucetToPrivate', { privateKey: privKeyFhevmRelayer });

await hre.run('compile:specific', { contract: 'contracts/emptyProxy' });
await hre.run('task:deployEmptyUUPSProxies', { privateKey: privKeyFhevmDeployer, useCoprocessorAddress: false });

await hre.run('compile:specific', { contract: 'contracts' });
await hre.run('compile:specific', { contract: 'lib' });
await hre.run('compile:specific', { contract: 'decryptionOracle' });

await hre.run('task:deployACL', { privateKey: privKeyFhevmDeployer });
await hre.run('task:deployTFHEExecutor', { privateKey: privKeyFhevmDeployer });
await hre.run('task:deployKMSVerifier', {
privateKey: privKeyFhevmDeployer,
decryptionManagerAddress: decryptionManagerAddress,
useAddress: false,
});
await hre.run('task:deployInputVerifier', {
privateKey: privKeyFhevmDeployer,
zkpokManagerAddress: zkpokManagerAddress,
useAddress: false,
});
await hre.run('task:deployFHEGasLimit', { privateKey: privKeyFhevmDeployer });
await hre.run('task:deployDecryptionOracle', { privateKey: privKeyFhevmDeployer });
await hre.run('task:deployAllHostContracts');
}
await hre.run('compile:specific', { contract: 'examples' });
await runSuper();
Expand Down Expand Up @@ -125,7 +98,7 @@ const config: HardhatUserConfig = {
networks: {
hardhat: {
accounts: {
count: 10,
count: 20,
mnemonic,
path: "m/44'/60'/0'/0",
},
Expand Down
31 changes: 0 additions & 31 deletions contracts/launch-fhevm-sepolia.sh

This file was deleted.

2 changes: 0 additions & 2 deletions contracts/operations/docker/ci.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ COPY contracts/contracts ./contracts/
COPY contracts/lib ./lib/
COPY contracts/tasks ./tasks/
COPY contracts/decryptionOracle ./decryptionOracle/

RUN chmod +x ./*.sh
16 changes: 2 additions & 14 deletions contracts/operations/docker/dev.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN npm install && \
npm cache clean --force

# Copy the application files
COPY contracts/.env.example.deployment contracts/*.sh contracts/*.ts contracts/tsconfig.json ./
COPY contracts/.env.example contracts/*.sh contracts/*.ts contracts/tsconfig.json ./
COPY contracts/addresses ./addresses/
COPY contracts/contracts ./contracts/
COPY contracts/lib ./lib/
Expand All @@ -22,16 +22,4 @@ COPY contracts/decryptionOracle ./decryptionOracle/
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Set executable permissions and prepare the environment
RUN chmod +x ./*.sh && \
cp .env.example.deployment .env

# Set up environment variables and compile contracts
# RUN PRIVATE_KEY_FHEVM_DEPLOYER="$(grep PRIVATE_KEY_FHEVM_DEPLOYER .env | cut -d '"' -f 2)" && \
# export PRIVATE_KEY_FHEVM_DEPLOYER && \
# NUM_KMS_SIGNERS="$(grep NUM_KMS_SIGNERS .env | cut -d '"' -f 2)" && \
# export NUM_KMS_SIGNERS && \
# npx hardhat clean && \
# npx hardhat compile:specific --contract addresses && \
# npx hardhat compile:specific --contract contracts && \
# npx hardhat compile:specific --contract lib && \
# npx hardhat compile:specific --contract decryptionOracle
RUN cp .env.example .env
42 changes: 42 additions & 0 deletions contracts/tasks/accounts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { task, types } from 'hardhat/config';
import { HardhatNetworkHDAccountsConfig } from 'hardhat/types';

// Use this task to get the list of accounts (addresses, private keys, public keys)
task('get-accounts', 'Prints the list of accounts')
.addParam('numAccounts', 'Number of accounts to return (1-20)', 20, types.int)
.setAction(async ({ numAccounts }, hre) => {
// Validate input
if (numAccounts < 1 || numAccounts > 20) {
throw new Error('Number of accounts must be between 1 and 20');
}

// Get signers from hardhat
const signers = await hre.ethers.getSigners();
const accounts = [];
const { mnemonic } = hre.network.config.accounts as HardhatNetworkHDAccountsConfig;

// Get details for specified number of accounts
for (let i = 0; i < numAccounts && i < signers.length; i++) {
const signer = signers[i];
const address = await signer.getAddress();
const phrase = hre.ethers.Mnemonic.fromPhrase(mnemonic);
const pathDeployer = "m/44'/60'/0'/0/" + i;
const privateKey = hre.ethers.HDNodeWallet.fromMnemonic(phrase, pathDeployer).privateKey;
const publicKey = hre.ethers.HDNodeWallet.fromMnemonic(phrase, pathDeployer).publicKey;

accounts.push({
index: i,
privateKey: privateKey,
publicKey: publicKey,
address: address,
});
}
console.info('\nAccount Details:');
console.info('================');
accounts.forEach(({ index, privateKey, address, publicKey }) => {
console.info(`\nAccount ${index}:`);
console.info(`Address: ${address}`);
console.info(`Private Key: ${privateKey}`);
console.info(`Public Key: ${publicKey}`);
});
});
Loading
Loading