diff --git a/.env.example b/.env.example index 2477ead..641b779 100644 --- a/.env.example +++ b/.env.example @@ -1,20 +1,20 @@ # Environment Configuration PRIVATE_KEY=0x RPC_URL="" -DCAP_IMAGE_ID= +DCAP_IMAGE_ID=0x4052beb38db7869b15596d53c2d5c02c9307faffca9215e69b0f0d0e1812a6c2 # On-Chain PCCS Configurations -ENCLAVE_IDENTITY_HELPER= -FMSPC_TCB_HELPER= -X509_CRL_HELPER= -X509_HELPER= -ENCLAVE_ID_DAO= -FMSPC_TCB_DAO= -PCK_DAO= -PCS_DAO= +ENCLAVE_IDENTITY_HELPER=0xfd4a34b578B352FE1896CDafaEb0f45f993352Bf +FMSPC_TCB_HELPER=0xC2A662e08A35513596E22D0aC236Ce72e59125EE +X509_CRL_HELPER=0x12C1E13Aa2a238EAb15c2e2b6AC670266bc3C814 +X509_HELPER=0x5213c0e3Ab478dbc83E8afFF8909717332E4f8E1 +ENCLAVE_ID_DAO=0x413272890ab9F155a47A5F90a404Fb51aa259087 +FMSPC_TCB_DAO=0x7c04B466DebA13D48116b1339C62b35B9805E5A0 +PCK_DAO=0x6D4cA6AE5315EBBcb4331c82531db0ad8853Eb31 +PCS_DAO=0xD0335cbC73CA2f8EDd98a2BE3909f55642F414D7 -RISC0_VERIFIER= -DCAP_ATTESTATION= +RISC0_VERIFIER=0x4967e2fB48E2037eC466a8b60722A94bBce48Eb7 +DCAP_ATTESTATION=0xefE368b17D137E86298eec8EbC5502fb56d27832 -V3_VERIFIER= -V4_VERIFIER= \ No newline at end of file +V3_VERIFIER=0x67042d171b8b7da1a4a98df787bdce79190dac3c +V4_VERIFIER=0x921b8f6ec83e405b715111ec1ae8b54a3ea063eb \ No newline at end of file diff --git a/README.md b/README.md index 7dac993..7ac153f 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,21 @@ -# AutomataDcapV3Attestation +# Automata DCAP Attestation -## Getting Started +## Summary -Clone this repo, by running the following command: +Automata DCAP Attestation consists of three parts: -```bash -git clone git@github.com:automata-network/automata-dcap-v3-attestation.git --recurse-submodules -``` +- PCCS Router: A central contract to read collaterals from [`automata-on-chain-pccs`](https://github.com/automata-network/automata-on-chain-pccs) -This repo includes both Hardhat and Foundry frameworks. Therefore, you can absolutely provide additional scripts and test cases written in both Solidity and TypeScript. +- Automata DCAP Attestation: This is the entrypoint contract for users to submit a quote to be verified. This contract parses the Quote header to identify the version, which then forwards the quote to the respective QuoteVerifier contract. -If you are building with Hardhat, make sure to run the command below to install the necessary NPM packages. +- Quote Verifier(s): This contract provides the full implementation on verifying a given quote specific to its version. This contract is intended to be called only from the Automata DCAP Attestation contract. + +## Getting Started + +Clone this repo, by running the following command: ```bash -npm install +git clone git@github.com:automata-network/automata-dcap-attestation.git --recurse-submodules ``` Before you begin, make sure to create a copy of the `.env` file with the example provided. Then, please provide any remaining variables that are missing. @@ -21,59 +23,53 @@ Before you begin, make sure to create a copy of the `.env` file with the example ```bash cp .env.example .env ``` + --- ## Building With Foundry -Compile the contract: +Compile the contracts: ```bash forge build ``` -Testing the contract: +Testing the contracts: ```bash forge test ``` +To view gas report, pass the `--gas-report` flag. + To provide additional test cases, please include those in the `/forge-test` directory. To provide additional scripts, please include those in the `/forge-script` directory. ### Deployment Scripts -- `AutomataDcapV3Attestation` deployment +Deploy the PCCS Router: ```bash -forge script DeployDCAPScript --broadcast --rpc-url $RPC_URL +forge script DeployRouter --rpc-url $RPC_URL --broadcast -vvvv ``` ---- - - - - -## Projects using AutomataDcapV3Attestation - -* [Flashbots](https://writings.flashbots.net/suave-tee-coprocessor) -* [Taiko]( -https://github.com/taikoxyz/taiko-mono/tree/main/packages/protocol/contracts/automata-attestation) +```bash +forge script AttestationScript --rpc-url $RPC_URL --broadcast -vvvv --sig "configVerifier(address)" +``` \ No newline at end of file diff --git a/forge-script/setup.sh b/forge-script/setup.sh deleted file mode 100755 index 10c0e81..0000000 --- a/forge-script/setup.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -source .env - -DEPLOY_SCRIPT="DeployDCAPScript" -FORGE_COMMAND_SUFFIX="--broadcast --rpc-url $RPC_URL" - -echo "[LOG] Deploying AutomataDcapV3Attestation..." -DCAP_ATTESTATION_OUTPUT=$(forge script $DEPLOY_SCRIPT --sig "deployAttestation()" $FORGE_COMMAND_SUFFIX | grep LOG) -export DCAP_ATTESTATION_ADDRESS=$(echo $DCAP_ATTESTATION_OUTPUT | grep -oE '0x[0-9A-Fa-f]+') -# echo "DCAP_ATTESTATION_ADDRESS=$DCAP_ATTESTATION_ADDRESS" >> .env -echo $DCAP_ATTESTATION_OUTPUT \ No newline at end of file