Skip to content
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
13 changes: 3 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ jobs:
- name: "Install the dependencies"
run: "pnpm install"

- name: "Compile the contracts and generate the TypeChain bindings"
run: "pnpm typechain"

- name: Checking code format ciphernode
run: pnpm ciphernode:lint

Expand Down Expand Up @@ -155,9 +152,6 @@ jobs:
echo "## Lint results" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

- name: "Compile the contracts and generate the TypeChain bindings"
run: "pnpm typechain"

- name: "Test the contracts and generate the coverage report"
run: "pnpm coverage"

Expand Down Expand Up @@ -216,8 +210,7 @@ jobs:
run: |
echo "## Lint results" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: "Compile the contracts and generate the TypeChain bindings"
run: "pnpm typechain"

- name: "Run prebuild"
run: "pnpm test:integration prebuild"
- name: "Verify build artifacts exist"
Expand Down Expand Up @@ -355,7 +348,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "22"

- name: Setup pnpm
uses: pnpm/action-setup@v3
Expand Down Expand Up @@ -548,7 +541,7 @@ jobs:
packages/enclave-contracts/dist
packages/enclave-contracts/artifacts
packages/enclave-contracts/cache
packages/enclave-contracts/typechain-types
packages/enclave-contracts/types
crates/wasm/dist
retention-days: 1
if-no-files-found: warn
Expand Down
3 changes: 1 addition & 2 deletions crates/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ COPY ./rust-toolchain.toml .

WORKDIR /build/crates
COPY --from=evm-builder /build/packages/enclave-contracts/artifacts ../packages/enclave-contracts/artifacts
COPY --from=evm-builder /build/packages/enclave-contracts/deployments ../packages/enclave-contracts/deployments

COPY --from=evm-builder /build/packages/enclave-contracts/deployed_contracts.json ../packages/enclave-contracts/deployed_contracts.json

# find crates/* -name "Cargo.toml" -not -path "*/support/*" -printf "COPY %p %p\n" | sed 's|COPY \(.*\) crates/|COPY \1 ./|'
COPY crates/aggregator/Cargo.toml ./aggregator/Cargo.toml
Expand Down
43 changes: 21 additions & 22 deletions crates/entrypoint/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ fn main() -> std::io::Result<()> {
.join("..")
.join("packages")
.join("enclave-contracts")
.join("deployments")
.join("sepolia");
.join("deployed_contracts.json");

// Create output string for contract info
let mut contract_info = String::from(
Expand All @@ -33,26 +32,26 @@ fn main() -> std::io::Result<()> {
"pub static CONTRACT_DEPLOYMENTS: phf::Map<&'static str, ContractInfo> = phf::phf_map! {\n",
);

// Process each JSON file in the deployments directory
for entry in fs::read_dir(deployments_path)? {
let entry = entry?;
let path = entry.path();
// Read the single JSON file
let file = File::open(&deployments_path)?;
let json: Value = from_reader(file)?;

if path.extension().and_then(|s| s.to_str()) == Some("json") {
let contract_name = path.file_stem().and_then(|s| s.to_str()).unwrap();

let file = File::open(&path)?;
let json: Value = from_reader(file)?;

// Extract address and block number
if let (Some(address), Some(deploy_block)) = (
json["address"].as_str(),
json["receipt"]["blockNumber"].as_u64(),
) {
contract_info.push_str(&format!(
" \"{}\" => ContractInfo {{\n address: \"{}\",\n deploy_block: {},\n }},\n",
contract_name, address, deploy_block
));
// Process Sepolia network from the JSON
if let Some(networks) = json.as_object() {
if let Some(sepolia_data) = networks.get("sepolia") {
if let Some(contracts) = sepolia_data.as_object() {
for (contract_name, contract_data) in contracts {
// Extract address and block number from the contract data
if let (Some(address), Some(deploy_block)) = (
contract_data["address"].as_str(),
contract_data["blockNumber"].as_u64(),
) {
contract_info.push_str(&format!(
" \"{}\" => ContractInfo {{\n address: \"{}\",\n deploy_block: {},\n }},\n",
contract_name, address, deploy_block
));
}
Comment thread
ctrlc03 marked this conversation as resolved.
}
}
}
}
Expand All @@ -63,7 +62,7 @@ fn main() -> std::io::Result<()> {
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("contract_deployments.rs");
fs::write(dest_path, contract_info)?;
println!("cargo:rerun-if-changed=../../packages/enclave-contracts/deployments/sepolia");
println!("cargo:rerun-if-changed=../../packages/enclave-contracts/deployed_contracts.json");

Ok(())
}
6 changes: 2 additions & 4 deletions examples/CRISP/client/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
VITE_ENCLAVE_API=http://127.0.0.1:4000
VITE_TWITTER_SERVERLESS_API=
VITE_WALLETCONNECT_PROJECT_ID=
VITE_E3_PROGRAM_ADDRESS=0xc6e7DF5E7b4f2A278906862b61205850344D4e7d # Default E3 program address from anvil
VITE_SEMAPHORE_ADDRESS=0x0B306BF915C4d645ff596e518fAf3F9669b97016


VITE_E3_PROGRAM_ADDRESS=0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1 # Default E3 program address from anvil
VITE_SEMAPHORE_ADDRESS=0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE
4 changes: 2 additions & 2 deletions examples/CRISP/enclave.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ chains:
rpc_url: "ws://localhost:8545"
contracts:
enclave: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
ciphernode_registry: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0"
filter_registry: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
ciphernode_registry: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
filter_registry: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9"

program:
dev: true
Expand Down
85 changes: 37 additions & 48 deletions examples/CRISP/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
// without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.

import "@nomicfoundation/hardhat-foundry";
import "@nomicfoundation/hardhat-toolbox";
import "hardhat-deploy";
import type { HardhatUserConfig } from "hardhat/config";
import { vars } from "hardhat/config";
import type { NetworkUserConfig } from "hardhat/types";
import { configVariable } from "hardhat/config";
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";

// Run 'npx hardhat vars setup' to see the list of variables that need to be set
import { ConfigurationVariable } from "hardhat/types/config";

const mnemonic: string = vars.get("MNEMONIC");
const infuraApiKey: string = vars.get("INFURA_API_KEY");
const mnemonic = configVariable("MNEMONIC");
const privateKey = configVariable("PRIVATE_KEY");
const infuraApiKey = configVariable("INFURA_API_KEY");

const chainIds = {
"arbitrum-mainnet": 42161,
Expand All @@ -30,7 +28,7 @@ const chainIds = {
goerli: 5,
};

function getChainConfig(chain: keyof typeof chainIds): NetworkUserConfig {
function getChainConfig(chain: keyof typeof chainIds, apiUrl: string) {
let jsonRpcUrl: string;
switch (chain) {
case "avalanche":
Expand All @@ -42,64 +40,59 @@ function getChainConfig(chain: keyof typeof chainIds): NetworkUserConfig {
default:
jsonRpcUrl = "https://" + chain + ".infura.io/v3/" + infuraApiKey;
}
return {
accounts: {

let accounts: [ConfigurationVariable] | { count: number, mnemonic: ConfigurationVariable, path: string } ;
if (privateKey) {
accounts = [privateKey];
} else {
accounts = {
count: 10,
mnemonic,
path: "m/44'/60'/0'/0",
},
};
}

return {
accounts,
chainId: chainIds[chain],
url: jsonRpcUrl,
type: 'http' as const,
chainType: "l1" as const,
blockExporers: {
etherscan: {
apiUrl,
},
},
Comment thread
ctrlc03 marked this conversation as resolved.
};
}

const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
namedAccounts: {
deployer: 0,
},
etherscan: {
apiKey: {
arbitrumOne: process.env.ARBISCAN_API_KEY || "",
avalanche: process.env.SNOWTRACE_API_KEY || "",
bsc: process.env.BSCSCAN_API_KEY || "",
mainnet: process.env.ETHERSCAN_API_KEY || "",
optimisticEthereum: process.env.OPTIMISM_API_KEY || "",
polygon: process.env.POLYGONSCAN_API_KEY || "",
polygonMumbai: process.env.POLYGONSCAN_API_KEY || "",
sepolia: process.env.ETHERSCAN_API_KEY || "",
goerli: process.env.ETHERSCAN_API_KEY || "",
},
},
gasReporter: {
currency: "USD",
enabled: process.env.REPORT_GAS ? true : false,
excludeContracts: [],
src: "./contracts",
},
plugins: [hardhatToolboxViemPlugin],
networks: {
hardhat: {
accounts: {
mnemonic,
},
chainId: chainIds.hardhat,
type: "edr-simulated",
},
ganache: {
accounts: {
mnemonic,
},
chainId: chainIds.ganache,
url: "http://localhost:8545",
type: "http",
},
arbitrum: getChainConfig("arbitrum-mainnet"),
avalanche: getChainConfig("avalanche"),
bsc: getChainConfig("bsc"),
mainnet: getChainConfig("mainnet"),
optimism: getChainConfig("optimism-mainnet"),
"polygon-mainnet": getChainConfig("polygon-mainnet"),
"polygon-mumbai": getChainConfig("polygon-mumbai"),
sepolia: getChainConfig("sepolia"),
goerli: getChainConfig("goerli"),
arbitrum: getChainConfig("arbitrum-mainnet", process.env.ARBISCAN_API_KEY || ""),
avalanche: getChainConfig("avalanche", process.env.SNOWTRACE_API_KEY || ""),
bsc: getChainConfig("bsc", process.env.BSCSCAN_API_KEY || ""),
mainnet: getChainConfig("mainnet", process.env.ETHERSCAN_API_KEY || ""),
optimism: getChainConfig("optimism-mainnet", process.env.OPTIMISM_API_KEY || ""),
"polygon-mainnet": getChainConfig("polygon-mainnet", process.env.POLYGONSCAN_API_KEY || ""),
"polygon-mumbai": getChainConfig("polygon-mumbai", process.env.POLYGONSCAN_API_KEY || ""),
sepolia: getChainConfig("sepolia", process.env.ETHERSCAN_API_KEY || ""),
goerli: getChainConfig("goerli", process.env.ETHERSCAN_API_KEY || ""),
},
paths: {
artifacts: "./artifacts",
Expand All @@ -123,10 +116,6 @@ const config: HardhatUserConfig = {
},
},
},
typechain: {
outDir: "types",
target: "ethers-v6",
},
};

export default config;
16 changes: 6 additions & 10 deletions examples/CRISP/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,25 @@
},
"devDependencies": {
"@enclave-e3/config": "^0.0.10-test",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-foundry": "^1.1.2",
"@nomicfoundation/hardhat-ignition": "^0.15.5",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@nomicfoundation/ignition-core": "^0.15.5",
"@nomicfoundation/hardhat-ignition": "^3.0.0",
"@nomicfoundation/hardhat-toolbox-viem": "^5.0.0",
"@types/node": "^22.18.0",
"forge-std": "github:foundry-rs/forge-std#v1.9.4",
"@synthetixio/synpress": "^4.1.0",
"@synthetixio/synpress-cache": "^0.0.12",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"@types/chai": "^4.2.0",
"@types/mocha": ">=9.1.0",
"@types/node": "22.7.5",
"@playwright/test": "1.52.0",
"playwright": "1.52.0",
"concurrently": "^9.1.2",
"dotenv": "^16.4.5",
"ethers": "^6.15.0",
"hardhat": "^2.22.10",
"hardhat-deploy": "^0.12.4",
"concurrently": "^9.1.2",
"hardhat": "^3.0.1",
"hardhat-gas-reporter": "^1.0.8",
"solidity-coverage": "^0.8.1",
"ts-node": "^10.9.2",
Expand Down
6 changes: 3 additions & 3 deletions examples/CRISP/server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ CRON_API_KEY=1234567890

# Based on Default Anvil Deployments (Only for testing)
ENCLAVE_ADDRESS="0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
CIPHERNODE_REGISTRY_ADDRESS="0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0"
NAIVE_REGISTRY_FILTER_ADDRESS="0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
E3_PROGRAM_ADDRESS="0xc6e7DF5E7b4f2A278906862b61205850344D4e7d" # CRISPProgram Contract Address
CIPHERNODE_REGISTRY_ADDRESS="0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
NAIVE_REGISTRY_FILTER_ADDRESS="0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9"
E3_PROGRAM_ADDRESS="0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1" # CRISPProgram Contract Address

# E3 Config
E3_WINDOW_SIZE=40
Expand Down
2 changes: 0 additions & 2 deletions examples/CRISP/tests/CRISPProgram.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.20;

Expand Down
Loading
Loading