-
Notifications
You must be signed in to change notification settings - Fork 8
TDX DCAP verification precompile #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: reth-v1.0.0-rebase
Are you sure you want to change the base?
Conversation
src/precompiles/tdx_dcap.rs
Outdated
| const INCORRECT_INPUTS: PrecompileError = | ||
| PrecompileError::CustomPrecompileError("incorrect inputs passed in"); | ||
|
|
||
| fn tgx_verify_quote_run(input: &[u8], gas_limit: u64) -> PrecompileResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tgx_verify_quote should be tdx_verify_quote
| interface TDX_DCAP { | ||
| function verifyQuote(bytes memory quote, string memory pckCertPem, string memory pckCrlPem, string memory tcbInfoJson, string memory qeIdentityJson) external returns (uint status); | ||
| /* | ||
| TODO: also add the following |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all of these needed, more detail on which ones we can skip is probably helpful.
src/precompiles/tdx_dcap.rs
Outdated
| // Redefined here to avoid having to import from external services | ||
| pub static TDX_DCAP_ABI: Lazy<BaseContract> = Lazy::new(|| { | ||
| let contract: Contract = | ||
| serde_json::from_str(include_str!("../out/TdxDcap.sol/TDX_DCAP.abi.json")).unwrap(); | ||
| BaseContract::from(contract) | ||
| }); | ||
|
|
||
| pub static VERIFY_QUOTE_ABI: Lazy<Function> = Lazy::new(|| { | ||
| TDX_DCAP_ABI | ||
| .abi() | ||
| .function("verifyQuote") | ||
| .expect("verifyQuote signature not available in TDX DCAP abi") | ||
| .clone() | ||
| }); | ||
|
|
||
| const INPUTS_TOO_BIG: PrecompileError = | ||
| PrecompileError::CustomPrecompileError("inputs passed in are unreasonably big"); | ||
| const INCORRECT_INPUTS: PrecompileError = | ||
| PrecompileError::CustomPrecompileError("incorrect inputs passed in"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit would use alloy for this https://docs.rs/alloy-core/latest/alloy_core/sol_types/macro.sol.html,
src/precompiles/tdx_dcap.rs
Outdated
| pub static TDX_DCAP_ABI: Lazy<BaseContract> = Lazy::new(|| { | ||
| let contract: Contract = | ||
| serde_json::from_str(include_str!("../out/TdxDcap.sol/TDX_DCAP.abi.json")).unwrap(); | ||
| BaseContract::from(contract) | ||
| }); | ||
|
|
||
| pub static VERIFY_QUOTE_ABI: Lazy<Function> = Lazy::new(|| { | ||
| TDX_DCAP_ABI | ||
| .abi() | ||
| .function("verifyQuote") | ||
| .expect("verifyQuote signature not available in TDX DCAP abi") | ||
| .clone() | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit would use alloy for this https://docs.rs/alloy-core/latest/alloy_core/sol_types/macro.sol.html,
more efficient and easier to use API
57a9b9c to
0078bd8
Compare
Adds
verifyTDXDCAPQuoteprecompile and Suave library call that allows offchain verification of TDX DCAP quotes through https://github.com/intel/SGX-TDX-DCAP-QuoteVerificationLibrary.