From 1168b05c393dff11c6a0678355fea91fcd0b2791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20B=C4=99za?= Date: Wed, 11 Dec 2024 15:37:52 +0100 Subject: [PATCH] feat: remove unnecessary sp1 risc0 dependencies --- .github/workflows/build.yml | 3 - .gitmodules | 6 - README.md | 22 --- contracts/AttestationEntrypointBase.sol | 95 ------------- contracts/AutomataDcapAttestationFee.sol | 13 -- contracts/interfaces/IQuoteVerifier.sol | 5 - contracts/verifiers/V3QuoteVerifier.sol | 15 -- contracts/verifiers/V4QuoteVerifier.sol | 21 --- env/.arbitrum-one.env.example | 24 ---- env/.arbitrum-sepolia.env.example | 25 ---- env/.base-mainnet.env.example | 24 ---- env/.base-sepolia.env.example | 24 ---- env/.ethereum-mainnet.env.example | 5 - env/.holesky.env.example | 5 - env/.mainnet.env.example | 5 - env/.optimism-mainnet.env.example | 24 ---- env/.optimism-sepolia.env.example | 25 ---- env/.sepolia.env.example | 5 - env/.testnet.env.example | 8 -- env/.worldchain-mainnet.env.example | 24 ---- env/.worldchain-sepolia.env.example | 25 ---- forge-script/AttestationScript.s.sol | 10 -- .../AutomataDcapAttestationFeeTest.t.sol | 6 +- forge-test/AutomataDcapAttestationTest.t.sol | 132 +----------------- forge-test/utils/RiscZeroSetup.sol | 16 --- forge-test/utils/succinct/Groth16Setup.sol | 11 -- forge-test/utils/succinct/PlonkSetup.sol | 11 -- foundry.toml | 17 +-- lib/risc0-ethereum | 1 - lib/sp1-contracts | 1 - 30 files changed, 5 insertions(+), 603 deletions(-) delete mode 100644 env/.arbitrum-one.env.example delete mode 100644 env/.arbitrum-sepolia.env.example delete mode 100644 env/.base-mainnet.env.example delete mode 100644 env/.base-sepolia.env.example delete mode 100644 env/.optimism-mainnet.env.example delete mode 100644 env/.optimism-sepolia.env.example delete mode 100644 env/.worldchain-mainnet.env.example delete mode 100644 env/.worldchain-sepolia.env.example delete mode 100644 forge-test/utils/RiscZeroSetup.sol delete mode 100644 forge-test/utils/succinct/Groth16Setup.sol delete mode 100644 forge-test/utils/succinct/PlonkSetup.sol delete mode 160000 lib/risc0-ethereum delete mode 160000 lib/sp1-contracts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b764f97..3c9a9cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,9 +8,6 @@ on: workflow_dispatch: -env: - DCAP_RISCZERO_IMAGE_ID: "0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f" - jobs: check: strategy: diff --git a/.gitmodules b/.gitmodules index 58592c6..38ce3e4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,6 @@ [submodule "lib/forge-std"] path = lib/forge-std url = https://github.com/foundry-rs/forge-std -[submodule "lib/sp1-contracts"] - path = lib/sp1-contracts - url = https://github.com/succinctlabs/sp1-contracts -[submodule "lib/risc0-ethereum"] - path = lib/risc0-ethereum - url = https://github.com/risc0/risc0-ethereum [submodule "lib/automata-on-chain-pccs"] path = lib/automata-on-chain-pccs url = https://github.com/automata-network/automata-on-chain-pccs diff --git a/README.md b/README.md index a7624db..0601fa6 100644 --- a/README.md +++ b/README.md @@ -70,28 +70,6 @@ contract ExampleDcapContract { } } - // SNARK Attestation example - // ZkCoProcessorType can either be RiscZero or Succinct - function attestWithSnark( - bytes calldata output, - ZkCoProcessorType zkvm, - bytes calldata proofBytes - ) public - { - (bool success, bytes memory output) = attest.verifyAndAttestWithZKProof( - output, - zkvm, - proofBytes - ); - - if (success) { - // ... implementation to handle successful attestations - } else { - string memory errorMessage = string(output); - // ... implementation to handle failed attestations - } - } - } ``` diff --git a/contracts/AttestationEntrypointBase.sol b/contracts/AttestationEntrypointBase.sol index a89c295..1cd879e 100644 --- a/contracts/AttestationEntrypointBase.sol +++ b/contracts/AttestationEntrypointBase.sol @@ -8,38 +8,11 @@ import "./types/Constants.sol"; import {Header} from "./types/CommonStruct.sol"; import {Ownable} from "solady/auth/Ownable.sol"; -// ZK-Coprocessor imports: -import {IRiscZeroVerifier} from "risc0/IRiscZeroVerifier.sol"; -import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol"; - -enum ZkCoProcessorType { - Unknown, - RiscZero, - Succinct -} - -/** - * @title ZK Co-Processor Configuration Object - * @param dcapProgramIdentifier - This is the identifier of the ZK Program, required for - * verification - * @param zkVerifier - Points to the address of the ZK Verifier contract. Ideally - * this should be pointing to a universal verifier, that may support multiple proof types and/or versions. - */ -struct ZkCoProcessorConfig { - bytes32 dcapProgramIdentifier; - address zkVerifier; -} - /** * @title DCAP Attestation Entrypoint Base contract * @notice Provides full implementation of both on-chain and ZK DCAP Verification */ abstract contract AttestationEntrypointBase is Ownable { - // 51abd95c - error Unknown_Zk_Coprocessor(); - - mapping(ZkCoProcessorType => ZkCoProcessorConfig) _zkConfig; - mapping(uint16 quoteVersion => IQuoteVerifier verifier) public quoteVerifiers; constructor() { @@ -55,32 +28,6 @@ abstract contract AttestationEntrypointBase is Ownable { quoteVerifiers[quoteVerifier.quoteVersion()] = quoteVerifier; } - /** - * @notice Sets the ZK Configuration for the given ZK Co-Processor - */ - function setZkConfiguration(ZkCoProcessorType zkCoProcessor, ZkCoProcessorConfig memory config) - external - onlyOwner - { - _zkConfig[zkCoProcessor] = config; - } - - /** - * @param zkCoProcessorType 1 - RiscZero, 2 - Succinct... etc. - * @return this is either the IMAGE_ID for RiscZero Guest Program or - * Succiinct Program Verifying Key - */ - function programIdentifier(uint8 zkCoProcessorType) external view returns (bytes32) { - return _zkConfig[ZkCoProcessorType(zkCoProcessorType)].dcapProgramIdentifier; - } - - /** - * @notice get the contract verifier for the provided ZK Co-processor - */ - function zkVerifier(uint8 zkCoProcessorType) external view returns (address) { - return _zkConfig[ZkCoProcessorType(zkCoProcessorType)].zkVerifier; - } - /** * @notice full on-chain verification for an attestation * @param rawQuote - Intel DCAP Quote serialized in raw bytes @@ -107,48 +54,6 @@ abstract contract AttestationEntrypointBase is Ownable { (success, output) = quoteVerifier.verifyQuote(header, rawQuote); } - /** - * @notice verifies an attestation using SNARK proofs - * - * @param output - The output of the Guest program, this includes: - * - VerifiedOutput struct - * - RootCA hash - * - TCB Signing CA hash - * - Root CRL hash - * - Platform or Processor CRL hash - * @param zkCoprocessor - Specify ZK Co-Processor - * @param proofBytes - The encoded cryptographic proof (i.e. SNARK)). - */ - function _verifyAndAttestWithZKProof( - bytes calldata output, - ZkCoProcessorType zkCoprocessor, - bytes calldata proofBytes - ) - internal - view - returns (bool success, bytes memory verifiedOutput) - { - ZkCoProcessorConfig memory zkConfig = _zkConfig[zkCoprocessor]; - - if (zkCoprocessor == ZkCoProcessorType.RiscZero) { - IRiscZeroVerifier(zkConfig.zkVerifier).verify( - proofBytes, zkConfig.dcapProgramIdentifier, sha256(output) - ); - } else if (zkCoprocessor == ZkCoProcessorType.Succinct) { - ISP1Verifier(zkConfig.zkVerifier).verifyProof(zkConfig.dcapProgramIdentifier, output, proofBytes); - } else { - revert Unknown_Zk_Coprocessor(); - } - - // verifies the output - uint16 version = uint16(bytes2(output[2:4])); - IQuoteVerifier quoteVerifier = quoteVerifiers[version]; - if (address(quoteVerifier) == address(0)) { - return (false, bytes("Unsupported quote version")); - } - (success, verifiedOutput) = quoteVerifier.verifyZkOutput(output); - } - /** * @notice Parses the header to get basic information about the quote, such as the version, TEE types etc. */ diff --git a/contracts/AutomataDcapAttestationFee.sol b/contracts/AutomataDcapAttestationFee.sol index eeca3ce..a8b8f9a 100644 --- a/contracts/AutomataDcapAttestationFee.sol +++ b/contracts/AutomataDcapAttestationFee.sol @@ -26,17 +26,4 @@ contract AutomataDcapAttestationFee is FeeManagerBase, AttestationEntrypointBase { (success, output) = _verifyAndAttestOnChain(rawQuote); } - - function verifyAndAttestWithZKProof( - bytes calldata output, - ZkCoProcessorType zkCoprocessor, - bytes calldata proofBytes - ) - external - payable - collectFee - returns (bool success, bytes memory verifiedOutput) - { - (success, verifiedOutput) = _verifyAndAttestWithZKProof(output, zkCoprocessor, proofBytes); - } } diff --git a/contracts/interfaces/IQuoteVerifier.sol b/contracts/interfaces/IQuoteVerifier.sol index 03be5d9..57b049f 100644 --- a/contracts/interfaces/IQuoteVerifier.sol +++ b/contracts/interfaces/IQuoteVerifier.sol @@ -21,9 +21,4 @@ interface IQuoteVerifier { function quoteVersion() external view returns (uint16); function verifyQuote(Header calldata, bytes calldata) external view returns (bool, bytes memory); - - /** - * @notice additional check on the public output obtained from the ZK Program execution - */ - function verifyZkOutput(bytes calldata) external view returns (bool, bytes memory); } diff --git a/contracts/verifiers/V3QuoteVerifier.sol b/contracts/verifiers/V3QuoteVerifier.sol index befe341..9e05362 100644 --- a/contracts/verifiers/V3QuoteVerifier.sol +++ b/contracts/verifiers/V3QuoteVerifier.sol @@ -12,21 +12,6 @@ import "../bases/tcb/TCBInfoV2Base.sol"; contract V3QuoteVerifier is QuoteVerifierBase, TCBInfoV2Base { constructor(address _ecdsaVerifier, address _router) QuoteVerifierBase(_router, 3) P256Verifier(_ecdsaVerifier) {} - function verifyZkOutput(bytes calldata outputBytes) - external - view - override - returns (bool success, bytes memory output) - { - uint256 offset = 2 + uint16(bytes2(outputBytes[0:2])); - success = checkCollateralHashes(offset + 72, outputBytes); - if (success) { - output = outputBytes[2:offset]; - } else { - output = bytes("Found one or more collaterals mismatch"); - } - } - function verifyQuote(Header calldata header, bytes calldata rawQuote) external view diff --git a/contracts/verifiers/V4QuoteVerifier.sol b/contracts/verifiers/V4QuoteVerifier.sol index c3b77df..872fec5 100644 --- a/contracts/verifiers/V4QuoteVerifier.sol +++ b/contracts/verifiers/V4QuoteVerifier.sol @@ -27,27 +27,6 @@ contract V4QuoteVerifier is QuoteVerifierBase, TCBInfoV3Base, TDXModuleBase { constructor(address _ecdsaVerifier, address _router) QuoteVerifierBase(_router, 4) P256Verifier(_ecdsaVerifier) {} - function verifyZkOutput(bytes calldata outputBytes) - external - view - override - returns (bool success, bytes memory output) - { - bytes4 teeType = bytes4(outputBytes[4:8]); - if (teeType != SGX_TEE && teeType != TDX_TEE) { - return (false, bytes("Unknown TEE type")); - } - - uint256 offset = 2 + uint16(bytes2(outputBytes[0:2])); - - success = checkCollateralHashes(offset + 72, outputBytes); - if (success) { - output = outputBytes[2:offset]; - } else { - output = bytes("Found one or more collaterals mismatch"); - } - } - function verifyQuote(Header calldata header, bytes calldata rawQuote) external view diff --git a/env/.arbitrum-one.env.example b/env/.arbitrum-one.env.example deleted file mode 100644 index cf5862c..0000000 --- a/env/.arbitrum-one.env.example +++ /dev/null @@ -1,24 +0,0 @@ -RPC_URL="https://arb1.arbitrum.io/rpc" -ETHERSCAN_API_KEY_ARBITRUM= -PRIVATE_KEY=0x -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca - -ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 -FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 -X509_HELPER=0x4Aca9C0EB063401C9F5c2Fc4487DBC5ccF1C9E2B -X509_CRL_HELPER=0x6e204fEAe40F668a06E78a83b66185FFC8892DDA - -PCCS_STORAGE=0x2bBc0Ccc218E63Ad4D2bbb7bdE1375B092FD38a2 -ENCLAVE_ID_DAO=0x45f91C0d9Cf651785d93fcF7e9E97dE952CdB910 -FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 -PCK_DAO=0x31F18aA7B4cbAD7A726BCBF5AB3e286fC0b02A82 -PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 - -RISC0_VERIFIER=0x0b144e07a0826182b6b59788c34b32bfa86fb711 -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - -PCCS_ROUTER=0x729E3e7542E8A6630818E9a14A67e0Cb7008a5E5 -DCAP_ATTESTATION=0xaEd8bF5907fC8690b1cb70DFD459Ca5Ed1529246 -V3_VERIFIER=0x4613038C93aF8963dc9E5e46c9fb3cbc68724df1 -V4_VERIFIER=0xdE13b52a02Bd0a48AcF4FCaefccb094b41135Ee2 \ No newline at end of file diff --git a/env/.arbitrum-sepolia.env.example b/env/.arbitrum-sepolia.env.example deleted file mode 100644 index 7c79341..0000000 --- a/env/.arbitrum-sepolia.env.example +++ /dev/null @@ -1,25 +0,0 @@ -RPC_URL="https://sepolia-rollup.arbitrum.io/rpc" -PRIVATE_KEY=0x -ETHERSCAN_API_KEY_ARBITRUM="" - -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca - -ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 -FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 -X509_HELPER=0x4Aca9C0EB063401C9F5c2Fc4487DBC5ccF1C9E2B -X509_CRL_HELPER=0x6e204fEAe40F668a06E78a83b66185FFC8892DDA - -PCCS_STORAGE=0x2bBc0Ccc218E63Ad4D2bbb7bdE1375B092FD38a2 -ENCLAVE_ID_DAO=0x45f91C0d9Cf651785d93fcF7e9E97dE952CdB910 -FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 -PCK_DAO=0x31F18aA7B4cbAD7A726BCBF5AB3e286fC0b02A82 -PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 - -RISC0_VERIFIER=0x0b144E07A0826182B6b59788c34b32Bfa86Fb711 -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - -PCCS_ROUTER=0x729E3e7542E8A6630818E9a14A67e0Cb7008a5E5 -DCAP_ATTESTATION=0xaEd8bF5907fC8690b1cb70DFD459Ca5Ed1529246 -V3_VERIFIER=0x4613038C93aF8963dc9E5e46c9fb3cbc68724df1 -V4_VERIFIER=0xdE13b52a02Bd0a48AcF4FCaefccb094b41135Ee2 \ No newline at end of file diff --git a/env/.base-mainnet.env.example b/env/.base-mainnet.env.example deleted file mode 100644 index 588f5a8..0000000 --- a/env/.base-mainnet.env.example +++ /dev/null @@ -1,24 +0,0 @@ -RPC_URL="https://mainnet.base.org" -PRIVATE_KEY=0x -ETHERSCAN_API_KEY_BASE="" -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca - -ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 -FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 -X509_HELPER=0x4Aca9C0EB063401C9F5c2Fc4487DBC5ccF1C9E2B -X509_CRL_HELPER=0x6e204fEAe40F668a06E78a83b66185FFC8892DDA - -PCCS_STORAGE=0x2bBc0Ccc218E63Ad4D2bbb7bdE1375B092FD38a2 -ENCLAVE_ID_DAO=0x45f91C0d9Cf651785d93fcF7e9E97dE952CdB910 -FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 -PCK_DAO=0x31F18aA7B4cbAD7A726BCBF5AB3e286fC0b02A82 -PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 - -RISC0_VERIFIER=0x0b144e07a0826182b6b59788c34b32bfa86fb711 -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - -PCCS_ROUTER=0x729E3e7542E8A6630818E9a14A67e0Cb7008a5E5 -DCAP_ATTESTATION=0xaEd8bF5907fC8690b1cb70DFD459Ca5Ed1529246 -V3_VERIFIER=0x4613038C93aF8963dc9E5e46c9fb3cbc68724df1 -V4_VERIFIER=0xdE13b52a02Bd0a48AcF4FCaefccb094b41135Ee2 \ No newline at end of file diff --git a/env/.base-sepolia.env.example b/env/.base-sepolia.env.example deleted file mode 100644 index bd07809..0000000 --- a/env/.base-sepolia.env.example +++ /dev/null @@ -1,24 +0,0 @@ -RPC_URL="https://sepolia.base.org" -PRIVATE_KEY=0x -ETHERSCAN_API_KEY_BASE="" -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca - -ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 -FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 -X509_HELPER=0x4Aca9C0EB063401C9F5c2Fc4487DBC5ccF1C9E2B -X509_CRL_HELPER=0x6e204fEAe40F668a06E78a83b66185FFC8892DDA - -PCCS_STORAGE=0x2bBc0Ccc218E63Ad4D2bbb7bdE1375B092FD38a2 -ENCLAVE_ID_DAO=0x45f91C0d9Cf651785d93fcF7e9E97dE952CdB910 -FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 -PCK_DAO=0x31F18aA7B4cbAD7A726BCBF5AB3e286fC0b02A82 -PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 - -RISC0_VERIFIER=0x0b144E07A0826182B6b59788c34b32Bfa86Fb711 -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - -PCCS_ROUTER=0x729E3e7542E8A6630818E9a14A67e0Cb7008a5E5 -DCAP_ATTESTATION=0xaEd8bF5907fC8690b1cb70DFD459Ca5Ed1529246 -V3_VERIFIER=0x4613038C93aF8963dc9E5e46c9fb3cbc68724df1 -V4_VERIFIER=0xdE13b52a02Bd0a48AcF4FCaefccb094b41135Ee2 \ No newline at end of file diff --git a/env/.ethereum-mainnet.env.example b/env/.ethereum-mainnet.env.example index 4ef059c..57d277b 100644 --- a/env/.ethereum-mainnet.env.example +++ b/env/.ethereum-mainnet.env.example @@ -1,8 +1,6 @@ RPC_URL="https://1rpc.io/eth" PRIVATE_KEY=0x ETHERSCAN_OG_API_KEY="" -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca ENCLAVE_IDENTITY_HELPER=0x13BECaa512713Ac7C2d7a04ba221aD5E02D43DFE FMSPC_TCB_HELPER=0xc99bF04C31bF3d026B5B47b2574FC19C1459B732 @@ -15,9 +13,6 @@ FMSPC_TCB_DAO=0x868c18869f68E0E0b0b7B2B4439f7fDDd0421e6b PCK_DAO=0xeCc198936FcA3Ca1fDc97B8612B32185908917B0 PCS_DAO=0x86f8865BCe8BE62CB8096b5B94fA3fB3a6ED330c -RISC0_VERIFIER=0x8EaB2D97Dfce405A1692a21b3ff3A172d593D319 -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - PCCS_ROUTER=0x09bBC921be046726bb5b694A49888e4e2e7AA9C3 DCAP_ATTESTATION=0xE26E11B257856B0bEBc4C759aaBDdea72B64351F V3_VERIFIER=0xF38a49322cAA0Ead71D4B1cF2afBb6d02BE5FC96 diff --git a/env/.holesky.env.example b/env/.holesky.env.example index 5b856bb..3cf32ed 100644 --- a/env/.holesky.env.example +++ b/env/.holesky.env.example @@ -1,8 +1,6 @@ RPC_URL="https://1rpc.io/holesky" PRIVATE_KEY=0x ETHERSCAN_OG_API_KEY="" -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 @@ -15,9 +13,6 @@ FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 PCK_DAO=0x31F18aA7B4cbAD7A726BCBF5AB3e286fC0b02A82 PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 -RISC0_VERIFIER=0xf70aBAb028Eb6F4100A24B203E113D94E87DE93C -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - PCCS_ROUTER=0x729E3e7542E8A6630818E9a14A67e0Cb7008a5E5 DCAP_ATTESTATION=0xaEd8bF5907fC8690b1cb70DFD459Ca5Ed1529246 V3_VERIFIER=0x4613038C93aF8963dc9E5e46c9fb3cbc68724df1 diff --git a/env/.mainnet.env.example b/env/.mainnet.env.example index 2232db0..bd1f50b 100644 --- a/env/.mainnet.env.example +++ b/env/.mainnet.env.example @@ -1,7 +1,5 @@ RPC_URL="https://rpc.ata.network" PRIVATE_KEY=0x -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 @@ -14,9 +12,6 @@ FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 PCK_DAO=0x31F18aA7B4cbAD7A726BCBF5AB3e286fC0b02A82 PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 -RISC0_VERIFIER=0xC71619Cf2671432f671Fedd85A9ae449c69c6DA4 -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - PCCS_ROUTER=0x722525B96b62e182F8A095af0a79d4EA2037795C DCAP_ATTESTATION=0xaEd8bF5907fC8690b1cb70DFD459Ca5Ed1529246 V3_VERIFIER=0x4613038C93aF8963dc9E5e46c9fb3cbc68724df1 diff --git a/env/.optimism-mainnet.env.example b/env/.optimism-mainnet.env.example deleted file mode 100644 index 8aae72d..0000000 --- a/env/.optimism-mainnet.env.example +++ /dev/null @@ -1,24 +0,0 @@ -RPC_URL="https://mainnet.optimism.io" -PRIVATE_KEY=0x -ETHERSCAN_API_KEY_OPTIMISM="" -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca - -ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 -FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 -X509_HELPER=0x4Aca9C0EB063401C9F5c2Fc4487DBC5ccF1C9E2B -X509_CRL_HELPER=0x6e204fEAe40F668a06E78a83b66185FFC8892DDA - -PCCS_STORAGE=0x2bBc0Ccc218E63Ad4D2bbb7bdE1375B092FD38a2 -ENCLAVE_ID_DAO=0x45f91C0d9Cf651785d93fcF7e9E97dE952CdB910 -FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 -PCK_DAO=0x31F18aA7B4cbAD7A726BCBF5AB3e286fC0b02A82 -PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 - -RISC0_VERIFIER=0x0b144e07a0826182b6b59788c34b32bfa86fb711 -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - -PCCS_ROUTER=0x729E3e7542E8A6630818E9a14A67e0Cb7008a5E5 -DCAP_ATTESTATION=0xaEd8bF5907fC8690b1cb70DFD459Ca5Ed1529246 -V3_VERIFIER=0x4613038C93aF8963dc9E5e46c9fb3cbc68724df1 -V4_VERIFIER=0xdE13b52a02Bd0a48AcF4FCaefccb094b41135Ee2 \ No newline at end of file diff --git a/env/.optimism-sepolia.env.example b/env/.optimism-sepolia.env.example deleted file mode 100644 index 216c776..0000000 --- a/env/.optimism-sepolia.env.example +++ /dev/null @@ -1,25 +0,0 @@ -RPC_URL="https://sepolia.optimism.io" -PRIVATE_KEY=0x -ETHERSCAN_API_KEY_OPTIMISM="" - -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca - -ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 -FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 -X509_HELPER=0x4Aca9C0EB063401C9F5c2Fc4487DBC5ccF1C9E2B -X509_CRL_HELPER=0x6e204fEAe40F668a06E78a83b66185FFC8892DDA - -PCCS_STORAGE=0x2bBc0Ccc218E63Ad4D2bbb7bdE1375B092FD38a2 -ENCLAVE_ID_DAO=0x45f91C0d9Cf651785d93fcF7e9E97dE952CdB910 -FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 -PCK_DAO=0x31F18aA7B4cbAD7A726BCBF5AB3e286fC0b02A82 -PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 - -RISC0_VERIFIER=0x0b144E07A0826182B6b59788c34b32Bfa86Fb711 -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - -PCCS_ROUTER=0x729E3e7542E8A6630818E9a14A67e0Cb7008a5E5 -DCAP_ATTESTATION=0xaEd8bF5907fC8690b1cb70DFD459Ca5Ed1529246 -V3_VERIFIER=0x4613038C93aF8963dc9E5e46c9fb3cbc68724df1 -V4_VERIFIER=0xdE13b52a02Bd0a48AcF4FCaefccb094b41135Ee2 \ No newline at end of file diff --git a/env/.sepolia.env.example b/env/.sepolia.env.example index d370c37..4575e54 100644 --- a/env/.sepolia.env.example +++ b/env/.sepolia.env.example @@ -1,8 +1,6 @@ RPC_URL="https://1rpc.io/sepolia" PRIVATE_KEY=0x ETHERSCAN_OG_API_KEY="" -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca ENCLAVE_IDENTITY_HELPER=0x2247B6dfE1bD9c376ECb58A68fa29603015a54a6 FMSPC_TCB_HELPER=0x4907280122325DbCeba657210Df2E3EE0e853cD0 @@ -15,9 +13,6 @@ FMSPC_TCB_DAO=0xB87a493684Bb643258Ae4887B444c6cB244db935 PCK_DAO=0xcCfb6b78B2C30666F41c012627a74768DAACf4ab PCS_DAO=0x980AEAdb3fa7c2c58A81091D93A819a24A103E6C -RISC0_VERIFIER=0x925d8331ddc0a1F0d96E68CF073DFE1d92b69187 -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - PCCS_ROUTER=0xfFC62c8851F54723206235E24af1bf10b9ea1d47 DCAP_ATTESTATION=0xE28ea4E574871CA6A4331d6692bd3DD602Fb4f76 V3_VERIFIER=0x6E64769A13617f528a2135692484B681Ee1a7169 diff --git a/env/.testnet.env.example b/env/.testnet.env.example index 80e8bb4..55b2450 100644 --- a/env/.testnet.env.example +++ b/env/.testnet.env.example @@ -1,10 +1,7 @@ # Environment Configuration PRIVATE_KEY=0x RPC_URL="https://1rpc.io/ata/testnet" -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca -# On-Chain PCCS Configurations ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 X509_HELPER=0x4Aca9C0EB063401C9F5c2Fc4487DBC5ccF1C9E2B @@ -15,11 +12,6 @@ FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 PCK_DAO=0x722525B96b62e182F8A095af0a79d4EA2037795C PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 -# ZK Verifiers -RISC0_VERIFIER=0xaE7F7EC735b6A90366e55f87780b36e7e6Ec3c65 -SP1_VERIFIER_GATEWAY=0x7291752B7c1e0E69adF9801865b25435b0bE4Fc6 - -# DCAP PCCS_ROUTER=0x3095741175094128ae9F451fa3693B2d23719940 DCAP_ATTESTATION=0x6D67Ae70d99A4CcE500De44628BCB4DaCfc1A145 V3_VERIFIER=0x03F3082cC6521179b30Bccf92561ea0576931Ffc diff --git a/env/.worldchain-mainnet.env.example b/env/.worldchain-mainnet.env.example deleted file mode 100644 index cade6fe..0000000 --- a/env/.worldchain-mainnet.env.example +++ /dev/null @@ -1,24 +0,0 @@ -RPC_URL="https://worldchain-mainnet.g.alchemy.com/public" -PRIVATE_KEY=0x -ETHERSCAN_API_KEY_WORLDCHAIN="" -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca - -ENCLAVE_IDENTITY_HELPER=0x13BECaa512713Ac7C2d7a04ba221aD5E02D43DFE -FMSPC_TCB_HELPER=0xc99bF04C31bF3d026B5B47b2574FC19C1459B732 -X509_HELPER=0x3e2fe733E444313A93Fa3f9AEd3bB203048dDE70 -X509_CRL_HELPER=0x2567245dE6E349C8B7AA82fD6FF854b844A0aEF9 - -PCCS_STORAGE=0xE2636fdbd053da8E798D959304e20fADa934E8c0 -ENCLAVE_ID_DAO=0x28111536292b34f37120861A46B39BF39187d73a -FMSPC_TCB_DAO=0x868c18869f68E0E0b0b7B2B4439f7fDDd0421e6b -PCK_DAO=0xeCc198936FcA3Ca1fDc97B8612B32185908917B0 -PCS_DAO=0x86f8865BCe8BE62CB8096b5B94fA3fB3a6ED330c - -RISC0_VERIFIER=0xF8f76f22044c57181aa0170f85347dF84298422d -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - -PCCS_ROUTER=0x09bBC921be046726bb5b694A49888e4e2e7AA9C3 -DCAP_ATTESTATION=0xE26E11B257856B0bEBc4C759aaBDdea72B64351F -V3_VERIFIER=0xF38a49322cAA0Ead71D4B1cF2afBb6d02BE5FC96 -V4_VERIFIER=0xC86EE37Ee5030B9fF737F3E71f7611Abf5dfD9B7 \ No newline at end of file diff --git a/env/.worldchain-sepolia.env.example b/env/.worldchain-sepolia.env.example deleted file mode 100644 index 72f812c..0000000 --- a/env/.worldchain-sepolia.env.example +++ /dev/null @@ -1,25 +0,0 @@ -RPC_URL="https://worldchain-sepolia.g.alchemy.com/public" -PRIVATE_KEY=0x -ETHERSCAN_API_KEY_WORLDCHAIN="" - -DCAP_RISCZERO_IMAGE_ID=0x83613a8beec226d1f29714530f1df791fa16c2c4dfcf22c50ab7edac59ca637f -DCAP_SUCCINCT_VKEY=0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca - -ENCLAVE_IDENTITY_HELPER=0xae27D762EED6958bc34b358bd7C78c7211fe77F8 -FMSPC_TCB_HELPER=0x71056B540b4E60D0E8eFb55FAd487C486B09FFF5 -X509_HELPER=0x4Aca9C0EB063401C9F5c2Fc4487DBC5ccF1C9E2B -X509_CRL_HELPER=0x6e204fEAe40F668a06E78a83b66185FFC8892DDA - -PCCS_STORAGE=0x2bBc0Ccc218E63Ad4D2bbb7bdE1375B092FD38a2 -ENCLAVE_ID_DAO=0x45f91C0d9Cf651785d93fcF7e9E97dE952CdB910 -FMSPC_TCB_DAO=0x9c54C72867b07caF2e6255CE32983c28aFE40F26 -PCK_DAO=0x31F18aA7B4cbAD7A726BCBF5AB3e286fC0b02A82 -PCS_DAO=0xcf171ACd6c0a776f9d3E1F6Cac8067c982Ac6Ce1 - -RISC0_VERIFIER=0xF8f76f22044c57181aa0170f85347dF84298422d -SP1_VERIFIER_GATEWAY=0xD3dc607EfDfB758c0dcB47CA7BD6f22a1257606d - -PCCS_ROUTER=0x729E3e7542E8A6630818E9a14A67e0Cb7008a5E5 -DCAP_ATTESTATION=0xaEd8bF5907fC8690b1cb70DFD459Ca5Ed1529246 -V3_VERIFIER=0x4613038C93aF8963dc9E5e46c9fb3cbc68724df1 -V4_VERIFIER=0xdE13b52a02Bd0a48AcF4FCaefccb094b41135Ee2 \ No newline at end of file diff --git a/forge-script/AttestationScript.s.sol b/forge-script/AttestationScript.s.sol index 3ff14c0..08c34ff 100644 --- a/forge-script/AttestationScript.s.sol +++ b/forge-script/AttestationScript.s.sol @@ -24,14 +24,4 @@ contract AttestationScript is Script { vm.broadcast(deployerKey); AutomataDcapAttestationFee(attestationAddr).setQuoteVerifier(verifier); } - - function configureZk(uint8 zk, address verifierGateway, bytes32 programId) public { - address attestationAddr = vm.envAddress("DCAP_ATTESTATION"); - - ZkCoProcessorConfig memory config = - ZkCoProcessorConfig({dcapProgramIdentifier: programId, zkVerifier: verifierGateway}); - - vm.broadcast(deployerKey); - AutomataDcapAttestationFee(attestationAddr).setZkConfiguration(ZkCoProcessorType(zk), config); - } } diff --git a/forge-test/AutomataDcapAttestationFeeTest.t.sol b/forge-test/AutomataDcapAttestationFeeTest.t.sol index 37aeef8..e68e7a1 100644 --- a/forge-test/AutomataDcapAttestationFeeTest.t.sol +++ b/forge-test/AutomataDcapAttestationFeeTest.t.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.13; import "./utils/PCCSSetupBase.sol"; -import "./utils/RiscZeroSetup.sol"; import {AutomataDcapAttestationFee} from "../contracts/AutomataDcapAttestationFee.sol"; import {V3QuoteVerifier} from "../contracts/verifiers/V3QuoteVerifier.sol"; @@ -10,7 +9,7 @@ import {V4QuoteVerifier} from "../contracts/verifiers/V4QuoteVerifier.sol"; import {BytesUtils} from "../contracts/utils/BytesUtils.sol"; -contract AutomataDcapAttestationFeeTest is PCCSSetupBase, RiscZeroSetup { +contract AutomataDcapAttestationFeeTest is PCCSSetupBase { using BytesUtils for bytes; uint256 constant EXPECTED_GAS = 5_000_000; @@ -21,7 +20,6 @@ contract AutomataDcapAttestationFeeTest is PCCSSetupBase, RiscZeroSetup { AutomataDcapAttestationFee attestation; PCCSRouter pccsRouter; - bytes32 imageId = vm.envBytes32("DCAP_RISCZERO_IMAGE_ID"); address user = address(69); function setUp() public override { @@ -36,8 +34,6 @@ contract AutomataDcapAttestationFeeTest is PCCSSetupBase, RiscZeroSetup { pccsRouter = setupPccsRouter(); pcsDaoUpserts(); - setUpRiscZero(); - // DCAP Contract Deployment attestation = new AutomataDcapAttestationFee(); diff --git a/forge-test/AutomataDcapAttestationTest.t.sol b/forge-test/AutomataDcapAttestationTest.t.sol index d19c2e2..f4fdf63 100644 --- a/forge-test/AutomataDcapAttestationTest.t.sol +++ b/forge-test/AutomataDcapAttestationTest.t.sol @@ -2,25 +2,16 @@ pragma solidity ^0.8.13; import "./utils/PCCSSetupBase.sol"; -import "./utils/RiscZeroSetup.sol"; -import {PlonkSetup} from "./utils/succinct/PlonkSetup.sol"; -import {Groth16Setup} from "./utils/succinct/Groth16Setup.sol"; import { - AutomataDcapAttestationFee, ZkCoProcessorConfig, ZkCoProcessorType + AutomataDcapAttestationFee } from "../contracts/AutomataDcapAttestationFee.sol"; import {V3QuoteVerifier} from "../contracts/verifiers/V3QuoteVerifier.sol"; import {V4QuoteVerifier} from "../contracts/verifiers/V4QuoteVerifier.sol"; -import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol"; - -contract AutomataDcapAttestationFeeTest is PCCSSetupBase, RiscZeroSetup { +contract AutomataDcapAttestationFeeTest is PCCSSetupBase { AutomataDcapAttestationFee attestation; PCCSRouter pccsRouter; - - // Contracts used for testing only - PlonkSetup succinctPlonkSetup; - Groth16Setup succinctGroth16Setup; function setUp() public override { super.setUp(); @@ -99,123 +90,4 @@ contract AutomataDcapAttestationFeeTest is PCCSSetupBase, RiscZeroSetup { } assertTrue(success); } - - function testRiscZeroProofAttestation() public { - bytes32 imageId = vm.envBytes32("DCAP_RISCZERO_IMAGE_ID"); - setUpRiscZero(); - ZkCoProcessorConfig memory riscZeroConfig = - ZkCoProcessorConfig({dcapProgramIdentifier: imageId, zkVerifier: address(riscZeroVerifier)}); - vm.prank(admin); - attestation.setZkConfiguration(ZkCoProcessorType.RiscZero, riscZeroConfig); - - // pinned May 19th, 2024, Midnight GMT - vm.warp(1731974400); - - vm.startPrank(admin); - bytes memory pckCrlUpdate = - hex"30820a6330820a08020101300a06082a8648ce3d04030230703122302006035504030c19496e74656c205347582050434b20506c6174666f726d204341311a3018060355040a0c11496e74656c20436f72706f726174696f6e3114301206035504070c0b53616e746120436c617261310b300906035504080c024341310b3009060355040613025553170d3234313131383134303035345a170d3234313231383134303035345a30820934303302146fc34e5023e728923435d61aa4b83c618166ad35170d3234313131383134303035345a300c300a0603551d1504030a01013034021500efae6e9715fca13b87e333e8261ed6d990a926ad170d3234313131383134303035345a300c300a0603551d1504030a01013034021500fd608648629cba73078b4d492f4b3ea741ad08cd170d3234313131383134303035345a300c300a0603551d1504030a010130340215008af924184e1d5afddd73c3d63a12f5e8b5737e56170d3234313131383134303035345a300c300a0603551d1504030a01013034021500b1257978cfa9ccdd0759abf8c5ca72fae3a78a9b170d3234313131383134303035345a300c300a0603551d1504030a01013033021474fea614a972be0e2843f2059835811ed872f9b3170d3234313131383134303035345a300c300a0603551d1504030a01013034021500f9c4ef56b3ab48d577e108baedf4bf88014214b9170d3234313131383134303035345a300c300a0603551d1504030a010130330214071de0778f9e5fc4f2878f30d6b07c9a30e6b30b170d3234313131383134303035345a300c300a0603551d1504030a01013034021500cde2424f972cea94ff239937f4d80c25029dd60b170d3234313131383134303035345a300c300a0603551d1504030a0101303302146c3319e5109b64507d3cf1132ce00349ef527319170d3234313131383134303035345a300c300a0603551d1504030a01013034021500df08d756b66a7497f43b5bb58ada04d3f4f7a937170d3234313131383134303035345a300c300a0603551d1504030a01013033021428af485b6cf67e409a39d5cb5aee4598f7a8fa7b170d3234313131383134303035345a300c300a0603551d1504030a01013034021500fb8b2daec092cada8aa9bc4ff2f1c20d0346668c170d3234313131383134303035345a300c300a0603551d1504030a01013034021500cd4850ac52bdcc69a6a6f058c8bc57bbd0b5f864170d3234313131383134303035345a300c300a0603551d1504030a01013034021500994dd3666f5275fb805f95dd02bd50cb2679d8ad170d3234313131383134303035345a300c300a0603551d1504030a0101303302140702136900252274d9035eedf5457462fad0ef4c170d3234313131383134303035345a300c300a0603551d1504030a01013033021461f2bf73e39b4e04aa27d801bd73d24319b5bf80170d3234313131383134303035345a300c300a0603551d1504030a0101303302143992be851b96902eff38959e6c2eff1b0651a4b5170d3234313131383134303035345a300c300a0603551d1504030a010130330214639f139a5040fdcff191e8a4fb1bf086ed603971170d3234313131383134303035345a300c300a0603551d1504030a01013034021500959d533f9249dc1e513544cdc830bf19b7f1f301170d3234313131383134303035345a300c300a0603551d1504030a0101303302140fda43a00b68ea79b7c2deaeac0b498bdfb2af90170d3234313131383134303035345a300c300a0603551d1504030a010130340215009d67753b81e47090aea763fbec4c4549bcdb9933170d3234313131383134303035345a300c300a0603551d1504030a01013033021434bfbb7a1d9c568147e118b614f7b76ed3ef68df170d3234313131383134303035345a300c300a0603551d1504030a0101303402150085d3c9381b77a7e04d119c9e5ad6749ff3ffab87170d3234313131383134303035345a300c300a0603551d1504030a0101303402150093887ca4411e7a923bd1fed2819b2949f201b5b4170d3234313131383134303035345a300c300a0603551d1504030a0101303302142498dc6283930996fd8bf23a37acbe26a3bed457170d3234313131383134303035345a300c300a0603551d1504030a010130340215008a66f1a749488667689cc3903ac54c662b712e73170d3234313131383134303035345a300c300a0603551d1504030a01013034021500afc13610bdd36cb7985d106481a880d3a01fda07170d3234313131383134303035345a300c300a0603551d1504030a01013034021500efe04b2c33d036aac96ca673bf1e9a47b64d5cbb170d3234313131383134303035345a300c300a0603551d1504030a0101303402150083d9ac8d8bb509d1c6c809ad712e8430559ed7f3170d3234313131383134303035345a300c300a0603551d1504030a0101303302147931fd50b5071c1bbfc5b7b6ded8b45b9d8b8529170d3234313131383134303035345a300c300a0603551d1504030a0101303302141fa20e2970bde5d57f7b8ddf8339484e1f1d0823170d3234313131383134303035345a300c300a0603551d1504030a0101303302141e87b2c3b32d8d23e411cef34197b95af0c8adf5170d3234313131383134303035345a300c300a0603551d1504030a010130340215009afd2ee90a473550a167d996911437c7502d1f09170d3234313131383134303035345a300c300a0603551d1504030a0101303302144481b0f11728a13b696d3ea9c770a0b15ec58dda170d3234313131383134303035345a300c300a0603551d1504030a01013034021500a7859f57982ef0e67d37bc8ef2ef5ac835ff1aa9170d3234313131383134303035345a300c300a0603551d1504030a0101303302147ae37748a9f912f4c63ba7ab07c593ce1d1d1181170d3234313131383134303035345a300c300a0603551d1504030a01013033021413884b33269938c195aa170fca75da177538df0b170d3234313131383134303035345a300c300a0603551d1504030a0101303302142c3cc6fe9279db1516d5ce39f2a898cda5a175e1170d3234313131383134303035345a300c300a0603551d1504030a010130330214717948687509234be979e4b7dce6f31bef64b68c170d3234313131383134303035345a300c300a0603551d1504030a010130340215009d76ef2c39c136e8658b6e7396b1d7445a27631f170d3234313131383134303035345a300c300a0603551d1504030a01013034021500c3e025fca995f36f59b48467939e3e34e6361a6f170d3234313131383134303035345a300c300a0603551d1504030a010130340215008c5f6b3257da05b17429e2e61ba965d67330606a170d3234313131383134303035345a300c300a0603551d1504030a01013034021500a17c51722ec1e0c3278fe8bdf052059cbec4e648170d3234313131383134303035345a300c300a0603551d1504030a0101a02f302d300a0603551d140403020101301f0603551d23041830168014956f5dcdbd1be1e94049c9d4f433ce01570bde54300a06082a8648ce3d04030203490030460221009d1e3cd0a09165302618555741c96c9ca04ddbea4009edf613f490360da54f16022100e08a94f9924efe124fecd862f5be8c4b6f12aa8d8756767cbba21a91d405bed0"; - pcsDao.upsertPckCrl(CA.PLATFORM, pckCrlUpdate); - V4QuoteVerifier quoteVerifier = new V4QuoteVerifier(P256_VERIFIER, address(pccsRouter)); - attestation.setQuoteVerifier(address(quoteVerifier)); - pccsRouter.setAuthorized(address(quoteVerifier), true); - assertEq(address(attestation.quoteVerifiers(4)), address(quoteVerifier)); - vm.stopPrank(); - - bytes memory journal = - hex"02550004000000810790c06f000000040102000000000000000000000000009790d89a10210ec6968a773cee2ca05b5aa97309f36727a968527be4606fc19e6f73acce350946c9d46a9bf7a63f843000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000080e702060000000000f2dd2696f69b950645832bdc095ffd11247eeff687eeacdb57a58d2ddb9a9f94fea40c961e19460c00ffa31420ecbc180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000998204508d58dcbfebe5e11c48669f7a921ac2da744dfb7d014ecdff2acdff1c9f665fdad52aadacf296a1df9909eb2383d100224f1716aeb431f7cb3cf028197dbd872487f27b0f6329ab17647dc9953c7014109818634f879e6550bc60f93eecfc42ff4d49278bfdbb0c77e570f4490cff10a2ee1ac11fbd2c2b49fa6cfa3cf1a1cb755c72522dd8a689e9d47906a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000278e753482976c8a7351fe2113609c7350d491cdae3d449eefc202fa41b2ad6840239cc2ba084c2d594b4e6dabeae0fcbf71c96daf0d0c9ecf0e9810c045790000000000673c303af1b429770139634fec8934a32e99c62365a2137e0ed7c2d675dd4acf0d1c830893efc8f3b20fd410af389046098c9e19304635a834aaabdf01ec7ad1f47d5ec70fa74a3f32c80b978c8ad671395dabf24283eef9091bc3919fd39b9915a87f1adf3061c165c0191e2658256a2855cac9267f179aafb1990c9e918d6452816adf9953f245d005b9d7d8e36a842a60b51e5cf85b2c2072ae397c178535c9985b7798b20813efc643bdfea60602a3c5cbef0f806d75c8c2622b0ed454f9d524ccbf"; - bytes memory seal = - hex"50bd17690d7dc73d9d89c6ee3e1b1b6bd9843d5ef2553c76770276578cf890d286cbf4470e27c981cf6d2ce36e2ab7ece52d9e83c72886f02e93e3556a5cd19a2fa458a60a2c0281f5c7f0191a48246bd6118a2b41e2e262f500c2e7866b7eac2c2e534f06520a77f983b74dfd89488361492de67658594c8e7133589917d94e0edb93c7122bc4a811c8729d51b23fac9f878f10063dc0e27d20450bc5eba34f5e52489f1c2f34bd6cbc7f1046e5df615d20121db97e77379a0fe82ac07c80434368572921ab7d07ca2fb0c06e343fdf5300f93a1024595e50b28140e210dfb9536168d22dc1f13636e1aeda96973acd0c0b318e74cecf5b5179349b081325f174f08457"; - - ZkCoProcessorType zkCoProcessorType = ZkCoProcessorType.RiscZero; - (bool success, bytes memory output) = attestation.verifyAndAttestWithZKProof(journal, zkCoProcessorType, seal); - - if (!success) { - console.log(string(output)); - } - assertTrue(success); - } - - function testSuccintGroth16ProofAttestation() public { - succinctGroth16Setup = new Groth16Setup(); - - bytes32 vk = 0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca; - ISP1Verifier sp1Verifier = ISP1Verifier(succinctGroth16Setup.setup()); - ZkCoProcessorConfig memory succinctConfig = - ZkCoProcessorConfig({dcapProgramIdentifier: vk, zkVerifier: address(sp1Verifier)}); - vm.prank(admin); - attestation.setZkConfiguration(ZkCoProcessorType.Succinct, succinctConfig); - - // pinned May 10th, 2024, Midnight GMT - vm.warp(1715342400); - - vm.startPrank(admin); - bytes memory pckCrlUpdate = - hex"30820a6230820a08020101300a06082a8648ce3d04030230703122302006035504030c19496e74656c205347582050434b20506c6174666f726d204341311a3018060355040a0c11496e74656c20436f72706f726174696f6e3114301206035504070c0b53616e746120436c617261310b300906035504080c024341310b3009060355040613025553170d3234303530393132333735335a170d3234303630383132333735335a30820934303302146fc34e5023e728923435d61aa4b83c618166ad35170d3234303530393132333735335a300c300a0603551d1504030a01013034021500efae6e9715fca13b87e333e8261ed6d990a926ad170d3234303530393132333735335a300c300a0603551d1504030a01013034021500fd608648629cba73078b4d492f4b3ea741ad08cd170d3234303530393132333735335a300c300a0603551d1504030a010130340215008af924184e1d5afddd73c3d63a12f5e8b5737e56170d3234303530393132333735335a300c300a0603551d1504030a01013034021500b1257978cfa9ccdd0759abf8c5ca72fae3a78a9b170d3234303530393132333735335a300c300a0603551d1504030a01013033021474fea614a972be0e2843f2059835811ed872f9b3170d3234303530393132333735335a300c300a0603551d1504030a01013034021500f9c4ef56b3ab48d577e108baedf4bf88014214b9170d3234303530393132333735335a300c300a0603551d1504030a010130330214071de0778f9e5fc4f2878f30d6b07c9a30e6b30b170d3234303530393132333735335a300c300a0603551d1504030a01013034021500cde2424f972cea94ff239937f4d80c25029dd60b170d3234303530393132333735335a300c300a0603551d1504030a0101303302146c3319e5109b64507d3cf1132ce00349ef527319170d3234303530393132333735335a300c300a0603551d1504030a01013034021500df08d756b66a7497f43b5bb58ada04d3f4f7a937170d3234303530393132333735335a300c300a0603551d1504030a01013033021428af485b6cf67e409a39d5cb5aee4598f7a8fa7b170d3234303530393132333735335a300c300a0603551d1504030a01013034021500fb8b2daec092cada8aa9bc4ff2f1c20d0346668c170d3234303530393132333735335a300c300a0603551d1504030a01013034021500cd4850ac52bdcc69a6a6f058c8bc57bbd0b5f864170d3234303530393132333735335a300c300a0603551d1504030a01013034021500994dd3666f5275fb805f95dd02bd50cb2679d8ad170d3234303530393132333735335a300c300a0603551d1504030a0101303302140702136900252274d9035eedf5457462fad0ef4c170d3234303530393132333735335a300c300a0603551d1504030a01013033021461f2bf73e39b4e04aa27d801bd73d24319b5bf80170d3234303530393132333735335a300c300a0603551d1504030a0101303302143992be851b96902eff38959e6c2eff1b0651a4b5170d3234303530393132333735335a300c300a0603551d1504030a010130330214639f139a5040fdcff191e8a4fb1bf086ed603971170d3234303530393132333735335a300c300a0603551d1504030a01013034021500959d533f9249dc1e513544cdc830bf19b7f1f301170d3234303530393132333735335a300c300a0603551d1504030a0101303302140fda43a00b68ea79b7c2deaeac0b498bdfb2af90170d3234303530393132333735335a300c300a0603551d1504030a010130340215009d67753b81e47090aea763fbec4c4549bcdb9933170d3234303530393132333735335a300c300a0603551d1504030a01013033021434bfbb7a1d9c568147e118b614f7b76ed3ef68df170d3234303530393132333735335a300c300a0603551d1504030a0101303402150085d3c9381b77a7e04d119c9e5ad6749ff3ffab87170d3234303530393132333735335a300c300a0603551d1504030a0101303402150093887ca4411e7a923bd1fed2819b2949f201b5b4170d3234303530393132333735335a300c300a0603551d1504030a0101303302142498dc6283930996fd8bf23a37acbe26a3bed457170d3234303530393132333735335a300c300a0603551d1504030a010130340215008a66f1a749488667689cc3903ac54c662b712e73170d3234303530393132333735335a300c300a0603551d1504030a01013034021500afc13610bdd36cb7985d106481a880d3a01fda07170d3234303530393132333735335a300c300a0603551d1504030a01013034021500efe04b2c33d036aac96ca673bf1e9a47b64d5cbb170d3234303530393132333735335a300c300a0603551d1504030a0101303402150083d9ac8d8bb509d1c6c809ad712e8430559ed7f3170d3234303530393132333735335a300c300a0603551d1504030a0101303302147931fd50b5071c1bbfc5b7b6ded8b45b9d8b8529170d3234303530393132333735335a300c300a0603551d1504030a0101303302141fa20e2970bde5d57f7b8ddf8339484e1f1d0823170d3234303530393132333735335a300c300a0603551d1504030a0101303302141e87b2c3b32d8d23e411cef34197b95af0c8adf5170d3234303530393132333735335a300c300a0603551d1504030a010130340215009afd2ee90a473550a167d996911437c7502d1f09170d3234303530393132333735335a300c300a0603551d1504030a0101303302144481b0f11728a13b696d3ea9c770a0b15ec58dda170d3234303530393132333735335a300c300a0603551d1504030a01013034021500a7859f57982ef0e67d37bc8ef2ef5ac835ff1aa9170d3234303530393132333735335a300c300a0603551d1504030a0101303302147ae37748a9f912f4c63ba7ab07c593ce1d1d1181170d3234303530393132333735335a300c300a0603551d1504030a01013033021413884b33269938c195aa170fca75da177538df0b170d3234303530393132333735335a300c300a0603551d1504030a0101303302142c3cc6fe9279db1516d5ce39f2a898cda5a175e1170d3234303530393132333735335a300c300a0603551d1504030a010130330214717948687509234be979e4b7dce6f31bef64b68c170d3234303530393132333735335a300c300a0603551d1504030a010130340215009d76ef2c39c136e8658b6e7396b1d7445a27631f170d3234303530393132333735335a300c300a0603551d1504030a01013034021500c3e025fca995f36f59b48467939e3e34e6361a6f170d3234303530393132333735335a300c300a0603551d1504030a010130340215008c5f6b3257da05b17429e2e61ba965d67330606a170d3234303530393132333735335a300c300a0603551d1504030a01013034021500a17c51722ec1e0c3278fe8bdf052059cbec4e648170d3234303530393132333735335a300c300a0603551d1504030a0101a02f302d300a0603551d140403020101301f0603551d23041830168014956f5dcdbd1be1e94049c9d4f433ce01570bde54300a06082a8648ce3d04030203480030450220556cff7546df52c6c39dae93fd6c0c2c5375fffe28c9b06e702fd8fed06eb4ad022100dfcfc43950839421833147eac23990a3017b9ea2f6cd49a1060363b83246ba2b"; - pcsDao.upsertPckCrl(CA.PLATFORM, pckCrlUpdate); - V4QuoteVerifier quoteVerifier = new V4QuoteVerifier(P256_VERIFIER, address(pccsRouter)); - attestation.setQuoteVerifier(address(quoteVerifier)); - pccsRouter.setAuthorized(address(quoteVerifier), true); - assertEq(address(attestation.quoteVerifiers(4)), address(quoteVerifier)); - vm.stopPrank(); - - bytes memory output = - hex"02550004000000810790c06f000000040102000000000000000000000000009790d89a10210ec6968a773cee2ca05b5aa97309f36727a968527be4606fc19e6f73acce350946c9d46a9bf7a63f843000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000080e702060000000000f2dd2696f69b950645832bdc095ffd11247eeff687eeacdb57a58d2ddb9a9f94fea40c961e19460c00ffa31420ecbc180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000998204508d58dcbfebe5e11c48669f7a921ac2da744dfb7d014ecdff2acdff1c9f665fdad52aadacf296a1df9909eb2383d100224f1716aeb431f7cb3cf028197dbd872487f27b0f6329ab17647dc9953c7014109818634f879e6550bc60f93eecfc42ff4d49278bfdbb0c77e570f4490cff10a2ee1ac11fbd2c2b49fa6cfa3cf1a1cb755c72522dd8a689e9d47906a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000278e753482976c8a7351fe2113609c7350d491cdae3d449eefc202fa41b2ad6840239cc2ba084c2d594b4e6dabeae0fcbf71c96daf0d0c9ecf0e9810c0457900000000006711a5009d15153a84fbc62bcf79a13967729408838fc92c0c97eb85d628db3566af265467eebe27bf6dc0aa227bc8ad11c55c22370f4f7e7246c6c65bef5205342142090fa74a3f32c80b978c8ad671395dabf24283eef9091bc3919fd39b9915a87f1adf3061c165c0191e2658256a2855cac9267f179aafb1990c9e918d6452816adf9953f245d005b9d7d8e36a842a60b51e5cf85b2c2072ae397c178535c9985b77607c9c42db9df0b9b1a68b4172b8f2303edbf0a41308850a850bcbfb713318b0"; - bytes memory proofBytes = - hex"090690902e3b7d041ca4d5f9f3b26f78687c0b6713374e64ecf3dedea472ba9c8520da991f0eab3733f2d32ea127447cea9698981866ba2eb5f945107f5476e5f44fa78b0beff7bc8f171768ce1c2b1e7ca2a9de2cf041bc93d603d0d1dc6fd69eb57f0c2fa84dee5d83f0345efa4d7ec3fff021118fbc7924d1374cc04b5ac4b5d70f8c15939e4c434318ee15e65f5a1ff612571ba93734dc57fc2de4c6a17a6fd28fd60007f59f01c31558a0b7f3e4152a8975b0a39497531d08e0b603ddd24445b2f30e167bfa7be1524e3eb552e031250a76d78aa6f634ada635c82dce0ae667a7af29345d5a84e2f4bcb22c1e06258ab163458cfd0aaeb9577e1d430788d94aadb6"; - - ZkCoProcessorType zkCoProcessorType = ZkCoProcessorType.Succinct; - (bool success, bytes memory ret) = attestation.verifyAndAttestWithZKProof( - output, - zkCoProcessorType, - proofBytes - ); - - if (!success) { - console.log(string(ret)); - } - assertTrue(success); - } - - function testSuccintPlonkProofAttestation() public { - succinctPlonkSetup = new PlonkSetup(); - - bytes32 vk = 0x0043e4e0c286cf4a2c03472ca2384f35a008558bc5de4e0f39d1d1bc989badca; - ISP1Verifier sp1Verifier = ISP1Verifier(succinctPlonkSetup.setup()); - ZkCoProcessorConfig memory succinctConfig = ZkCoProcessorConfig({ - dcapProgramIdentifier: vk, - zkVerifier: address(sp1Verifier) - }); - vm.prank(admin); - attestation.setZkConfiguration( - ZkCoProcessorType.Succinct, - succinctConfig - ); - - // pinned May 10th, 2024, Midnight GMT - vm.warp(1715342400); - - vm.startPrank(admin); - bytes memory pckCrlUpdate = hex"30820a6230820a08020101300a06082a8648ce3d04030230703122302006035504030c19496e74656c205347582050434b20506c6174666f726d204341311a3018060355040a0c11496e74656c20436f72706f726174696f6e3114301206035504070c0b53616e746120436c617261310b300906035504080c024341310b3009060355040613025553170d3234303530393132333735335a170d3234303630383132333735335a30820934303302146fc34e5023e728923435d61aa4b83c618166ad35170d3234303530393132333735335a300c300a0603551d1504030a01013034021500efae6e9715fca13b87e333e8261ed6d990a926ad170d3234303530393132333735335a300c300a0603551d1504030a01013034021500fd608648629cba73078b4d492f4b3ea741ad08cd170d3234303530393132333735335a300c300a0603551d1504030a010130340215008af924184e1d5afddd73c3d63a12f5e8b5737e56170d3234303530393132333735335a300c300a0603551d1504030a01013034021500b1257978cfa9ccdd0759abf8c5ca72fae3a78a9b170d3234303530393132333735335a300c300a0603551d1504030a01013033021474fea614a972be0e2843f2059835811ed872f9b3170d3234303530393132333735335a300c300a0603551d1504030a01013034021500f9c4ef56b3ab48d577e108baedf4bf88014214b9170d3234303530393132333735335a300c300a0603551d1504030a010130330214071de0778f9e5fc4f2878f30d6b07c9a30e6b30b170d3234303530393132333735335a300c300a0603551d1504030a01013034021500cde2424f972cea94ff239937f4d80c25029dd60b170d3234303530393132333735335a300c300a0603551d1504030a0101303302146c3319e5109b64507d3cf1132ce00349ef527319170d3234303530393132333735335a300c300a0603551d1504030a01013034021500df08d756b66a7497f43b5bb58ada04d3f4f7a937170d3234303530393132333735335a300c300a0603551d1504030a01013033021428af485b6cf67e409a39d5cb5aee4598f7a8fa7b170d3234303530393132333735335a300c300a0603551d1504030a01013034021500fb8b2daec092cada8aa9bc4ff2f1c20d0346668c170d3234303530393132333735335a300c300a0603551d1504030a01013034021500cd4850ac52bdcc69a6a6f058c8bc57bbd0b5f864170d3234303530393132333735335a300c300a0603551d1504030a01013034021500994dd3666f5275fb805f95dd02bd50cb2679d8ad170d3234303530393132333735335a300c300a0603551d1504030a0101303302140702136900252274d9035eedf5457462fad0ef4c170d3234303530393132333735335a300c300a0603551d1504030a01013033021461f2bf73e39b4e04aa27d801bd73d24319b5bf80170d3234303530393132333735335a300c300a0603551d1504030a0101303302143992be851b96902eff38959e6c2eff1b0651a4b5170d3234303530393132333735335a300c300a0603551d1504030a010130330214639f139a5040fdcff191e8a4fb1bf086ed603971170d3234303530393132333735335a300c300a0603551d1504030a01013034021500959d533f9249dc1e513544cdc830bf19b7f1f301170d3234303530393132333735335a300c300a0603551d1504030a0101303302140fda43a00b68ea79b7c2deaeac0b498bdfb2af90170d3234303530393132333735335a300c300a0603551d1504030a010130340215009d67753b81e47090aea763fbec4c4549bcdb9933170d3234303530393132333735335a300c300a0603551d1504030a01013033021434bfbb7a1d9c568147e118b614f7b76ed3ef68df170d3234303530393132333735335a300c300a0603551d1504030a0101303402150085d3c9381b77a7e04d119c9e5ad6749ff3ffab87170d3234303530393132333735335a300c300a0603551d1504030a0101303402150093887ca4411e7a923bd1fed2819b2949f201b5b4170d3234303530393132333735335a300c300a0603551d1504030a0101303302142498dc6283930996fd8bf23a37acbe26a3bed457170d3234303530393132333735335a300c300a0603551d1504030a010130340215008a66f1a749488667689cc3903ac54c662b712e73170d3234303530393132333735335a300c300a0603551d1504030a01013034021500afc13610bdd36cb7985d106481a880d3a01fda07170d3234303530393132333735335a300c300a0603551d1504030a01013034021500efe04b2c33d036aac96ca673bf1e9a47b64d5cbb170d3234303530393132333735335a300c300a0603551d1504030a0101303402150083d9ac8d8bb509d1c6c809ad712e8430559ed7f3170d3234303530393132333735335a300c300a0603551d1504030a0101303302147931fd50b5071c1bbfc5b7b6ded8b45b9d8b8529170d3234303530393132333735335a300c300a0603551d1504030a0101303302141fa20e2970bde5d57f7b8ddf8339484e1f1d0823170d3234303530393132333735335a300c300a0603551d1504030a0101303302141e87b2c3b32d8d23e411cef34197b95af0c8adf5170d3234303530393132333735335a300c300a0603551d1504030a010130340215009afd2ee90a473550a167d996911437c7502d1f09170d3234303530393132333735335a300c300a0603551d1504030a0101303302144481b0f11728a13b696d3ea9c770a0b15ec58dda170d3234303530393132333735335a300c300a0603551d1504030a01013034021500a7859f57982ef0e67d37bc8ef2ef5ac835ff1aa9170d3234303530393132333735335a300c300a0603551d1504030a0101303302147ae37748a9f912f4c63ba7ab07c593ce1d1d1181170d3234303530393132333735335a300c300a0603551d1504030a01013033021413884b33269938c195aa170fca75da177538df0b170d3234303530393132333735335a300c300a0603551d1504030a0101303302142c3cc6fe9279db1516d5ce39f2a898cda5a175e1170d3234303530393132333735335a300c300a0603551d1504030a010130330214717948687509234be979e4b7dce6f31bef64b68c170d3234303530393132333735335a300c300a0603551d1504030a010130340215009d76ef2c39c136e8658b6e7396b1d7445a27631f170d3234303530393132333735335a300c300a0603551d1504030a01013034021500c3e025fca995f36f59b48467939e3e34e6361a6f170d3234303530393132333735335a300c300a0603551d1504030a010130340215008c5f6b3257da05b17429e2e61ba965d67330606a170d3234303530393132333735335a300c300a0603551d1504030a01013034021500a17c51722ec1e0c3278fe8bdf052059cbec4e648170d3234303530393132333735335a300c300a0603551d1504030a0101a02f302d300a0603551d140403020101301f0603551d23041830168014956f5dcdbd1be1e94049c9d4f433ce01570bde54300a06082a8648ce3d04030203480030450220556cff7546df52c6c39dae93fd6c0c2c5375fffe28c9b06e702fd8fed06eb4ad022100dfcfc43950839421833147eac23990a3017b9ea2f6cd49a1060363b83246ba2b"; - pcsDao.upsertPckCrl(CA.PLATFORM, pckCrlUpdate); - V4QuoteVerifier quoteVerifier = new V4QuoteVerifier(P256_VERIFIER, address(pccsRouter)); - attestation.setQuoteVerifier(address(quoteVerifier)); - pccsRouter.setAuthorized(address(quoteVerifier), true); - assertEq(address(attestation.quoteVerifiers(4)), address(quoteVerifier)); - vm.stopPrank(); - - bytes memory output = hex"02550004000000810790c06f000000040102000000000000000000000000009790d89a10210ec6968a773cee2ca05b5aa97309f36727a968527be4606fc19e6f73acce350946c9d46a9bf7a63f843000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000080e702060000000000f2dd2696f69b950645832bdc095ffd11247eeff687eeacdb57a58d2ddb9a9f94fea40c961e19460c00ffa31420ecbc180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000998204508d58dcbfebe5e11c48669f7a921ac2da744dfb7d014ecdff2acdff1c9f665fdad52aadacf296a1df9909eb2383d100224f1716aeb431f7cb3cf028197dbd872487f27b0f6329ab17647dc9953c7014109818634f879e6550bc60f93eecfc42ff4d49278bfdbb0c77e570f4490cff10a2ee1ac11fbd2c2b49fa6cfa3cf1a1cb755c72522dd8a689e9d47906a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000278e753482976c8a7351fe2113609c7350d491cdae3d449eefc202fa41b2ad6840239cc2ba084c2d594b4e6dabeae0fcbf71c96daf0d0c9ecf0e9810c0457900000000006711a5009d15153a84fbc62bcf79a13967729408838fc92c0c97eb85d628db3566af265467eebe27bf6dc0aa227bc8ad11c55c22370f4f7e7246c6c65bef5205342142090fa74a3f32c80b978c8ad671395dabf24283eef9091bc3919fd39b9915a87f1adf3061c165c0191e2658256a2855cac9267f179aafb1990c9e918d6452816adf9953f245d005b9d7d8e36a842a60b51e5cf85b2c2072ae397c178535c9985b77607c9c42db9df0b9b1a68b4172b8f2303edbf0a41308850a850bcbfb713318b0"; - bytes memory proofBytes = hex"54bdcae30257b2a6b364ef0ad5d08c1789c5bd33bdae2f6a077108a4287b6c119bfa95e01c52f57b719acfece7405d405a3af1800400e03dabbc12a416aac723de796c550d20db00d614561667a91e5131d399e6ab7187f2ee74ccf892736206462f704226cda97a534276d92dca4332fce7578a97906e74b451e3eca007707db34df26f293ce4413d61a21da49c685b4a4619e0c98ab29a9eec217c9466cc1fdf05b8f30d2987b8d93976805123ffa978c5b830c9abea8921b0c0d7901b0f558a3cd9fc2f31f0568cbfb8df1ce63058992d1f3e921ae4d6a54caba77394429e36f40e6916eaad98e391db1af39829bd4f2b6a16bbf71d9f714ac412042e1febe663927e1fd67bd115e78a370cccca6d53851ecdf6762c705d3bbb63f35d00373eef20561ad93d9e046335a11fa48469850181e80c5944cbfce75447f72ed296f304b4160acdf1ef3858974fbc379aa75efa7eb3aa8e20ad5565045b9288f592a6e17b141f86b4d4c4c5fdec21b113d6e423212f5db56b8a546885b12cc9e379abad7513247d03ebc3964c7b04fe00eaf3adebbb1a59af03de4e21faa0380f50f269925822285195a606c06f4e0d34f7773b1576454e33affeea4b4424175a573a4b21f813432bd4f4081ad49a5e11d3c5bda4db6eeba477e7e1560caccc2d8a120b7646304fef4b3a2d058419a2af9e39e52944c819576db4d77382563e5358c2db02fd09c7e153e9a5d9dd3e29a155ae8841049d1ed0ec88dbf07c051b9b3b69ee9dd41aade969bdc2ee2ee639fa1178e2ea50dbb415d72ea273da05579434a0d2fbf528a61bfd3ed97fdcb13ac1b79206ca950c59328e74a4961c070179455ae0be9d1f22d8414937f676ddecfc28d0af8c8d203cd12c2607cf261f7e5d842622fbbd2f953cf2a3ae123569cea71b1d8d1e3ff5307dfbfba7524d4cf063497acadfd62cae8f0e2292f0c9034401685afedc3b4060fc4a3c984da6e3adf0888bc00fda2d658d77046a032c5c80e2c61f3167d0c0740ea286987e14278aeb109d5a9a230ed0932e114ddc4ba556334322e49ef973532d4bb1fe014fbf5da9b545af71362beb8ce20aa2a34b2f83600ab74de1d5ed7283c294c7cb7a144c90e7d33f8bf3043f7299964fe67fce64ece1665566b6c669025d1008267551563f3d8ed3e42b277efe0627ec0a327c7551258e11410c7f4f3e12ab3536ba7966d954d25891bf"; - - ZkCoProcessorType zkCoProcessorType = ZkCoProcessorType.Succinct; - (bool success, bytes memory ret)= attestation.verifyAndAttestWithZKProof( - output, - zkCoProcessorType, - proofBytes - ); - - if (!success) { - console.log(string(ret)); - } - assertTrue(success); - } } diff --git a/forge-test/utils/RiscZeroSetup.sol b/forge-test/utils/RiscZeroSetup.sol deleted file mode 100644 index 049ba89..0000000 --- a/forge-test/utils/RiscZeroSetup.sol +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {RiscZeroGroth16Verifier} from "risc0/groth16/RiscZeroGroth16Verifier.sol"; - -abstract contract RiscZeroSetup { - bytes32 public constant CONTROL_ROOT = hex"8b6dcf11d463ac455361b41fb3ed053febb817491bdea00fdb340e45013b852e"; - // NOTE: This has opposite byte order to the value in the risc0 repository. - bytes32 public constant BN254_CONTROL_ID = hex"05a022e1db38457fb510bc347b30eb8f8cf3eda95587653d0eac19e1f10d164e"; - - RiscZeroGroth16Verifier riscZeroVerifier; - - function setUpRiscZero() internal { - riscZeroVerifier = new RiscZeroGroth16Verifier(CONTROL_ROOT, BN254_CONTROL_ID); - } -} diff --git a/forge-test/utils/succinct/Groth16Setup.sol b/forge-test/utils/succinct/Groth16Setup.sol deleted file mode 100644 index bb80722..0000000 --- a/forge-test/utils/succinct/Groth16Setup.sol +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {SP1Verifier} from "@sp1-contracts/v3.0.0/SP1VerifierGroth16.sol"; - -contract Groth16Setup { - function setup() public returns (address verifier) { - SP1Verifier groth16Verifier = new SP1Verifier(); - verifier = address(groth16Verifier); - } -} diff --git a/forge-test/utils/succinct/PlonkSetup.sol b/forge-test/utils/succinct/PlonkSetup.sol deleted file mode 100644 index d754647..0000000 --- a/forge-test/utils/succinct/PlonkSetup.sol +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {SP1Verifier} from "@sp1-contracts/v3.0.0/SP1VerifierPlonk.sol"; - -contract PlonkSetup { - function setup() public returns (address verifier) { - SP1Verifier plonkVerifier = new SP1Verifier(); - verifier = address(plonkVerifier); - } -} diff --git a/foundry.toml b/foundry.toml index 40f3eb9..536b6bf 100644 --- a/foundry.toml +++ b/foundry.toml @@ -4,16 +4,12 @@ out = 'out' libs = ['lib'] script = 'forge-script' test = 'forge-test' -cache_path = 'cache_forge' -fs_permissions = [{ access = "read", path = "./"}] +cache_path = 'cache_forge' +fs_permissions = [{ access = "read", path = "./" }] remappings = [ "solady/=lib/automata-on-chain-pccs/lib/solady/src/", "p256-verifier/=lib/automata-on-chain-pccs/lib/p256-verifier/src/", "@automata-network/on-chain-pccs/=lib/automata-on-chain-pccs/src/", - "risc0/=lib/risc0-ethereum/contracts/src/", - # foundry is not able to detect this particular remapping for some reason... - "openzeppelin/=lib/risc0-ethereum/lib/openzeppelin-contracts/", - "@sp1-contracts/=lib/sp1-contracts/contracts/src/" ] solc = "0.8.27" optimizer = true @@ -26,15 +22,6 @@ evm_version = "paris" ffi = true [etherscan] -base_sepolia = { key = "${ETHERSCAN_API_KEY_BASE}", url = "https://api-sepolia.basescan.org/api" } holesky = { key = "${ETHERSCAN_OG_API_KEY}", url = "https://api-holesky.etherscan.io/api" } sepolia = { key = "${ETHERSCAN_OG_API_KEY}", url = "https://api-sepolia.etherscan.io/api" } -optimism_sepolia = { key = "${ETHERSCAN_API_KEY_OPTIMISM}", url = "https://api-sepolia-optimistic.etherscan.io/api" } -arbitrum_sepolia = { key = "${ETHERSCAN_API_KEY_ARBITRUM}", url = "https://api-sepolia.arbiscan.io/api" } -world_sepolia = { key = "${ETHERSCAN_API_KEY_WORLDCHAIN}", url = "https://api-sepolia.worldscan.org/api" } mainnet = { key = "${ETHERSCAN_OG_API_KEY}", url = "https://api.etherscan.io/api" } -ata_mainnet = { key = "verifyContract", url = "https://api.routescan.io/v2/network/mainnet/evm/65536_2/etherscan/api?", chain = 65536 } -base = { key = "${ETHERSCAN_API_KEY_BASE}", url = "https://api.basescan.org/api" } -optimism = { key = "${ETHERSCAN_API_KEY_OPTIMISM}", url = "https://api-optimistic.etherscan.io/api" } -arbitrum = { key = "${ETHERSCAN_API_KEY_ARBITRUM}", url = "https://api.arbiscan.io/api" } -world = { key = "${ETHERSCAN_API_KEY_WORLDCHAIN}", url = "https://api.worldscan.org/api" } \ No newline at end of file diff --git a/lib/risc0-ethereum b/lib/risc0-ethereum deleted file mode 160000 index 35a6e27..0000000 --- a/lib/risc0-ethereum +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 35a6e27a39fc8408ee1c7d2c7da4c762c2fb0f25 diff --git a/lib/sp1-contracts b/lib/sp1-contracts deleted file mode 160000 index 275691a..0000000 --- a/lib/sp1-contracts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 275691af9bfaf67158f6df1f4c3c1646eb03eed0