Skip to content

Make dcap-qvl optional in the attestation crates (prerequisite for dropping it from the contract WASM) #3621

Description

@pbeza

Background

Make dcap-qvl (Intel TDX quote verification) an optional dependency of the attestation / mpc-attestation crates, so it is no longer in their default build. dcap-qvl is ~310 KB / ~21% of the mpc-contract WASM, pushing it toward NEAR's 1.5 MiB deployment cap (NEP-509).

This is a prerequisite refactor: it does not move DCAP off-chain or shrink the WASM yet. The end goal is to stop compiling dcap-qvl into the contract, which requires the contract to verify an attestation without linking it — running only the post-DCAP policy checks (measurement allowlist, report-data binding, RTMR replay) and delegating the cryptographic DCAP step to the standalone tee-verifier contract over a cross-contract call. That was impossible before, because DCAP and the policy checks were welded into a single Attestation::verify that always called dcap_qvl::verify::verify, and dcap-qvl was non-optional.

This PR adds that dcap-qvl-free verification path and makes the dependency optional, so the follow-ups become mechanical:

  1. Move DCAP off the contract. Instead of running DCAP in-WASM, the contract asks the tee-verifier contract to do it and returns a verified report; the contract then runs only the policy checks via the verify_with_report entry point added in this PR (which needs no dcap-qvl).
  2. Drop dcap-qvl from the contract. With DCAP gone from the contract, it stops opting into the new local-verify feature — and dcap-qvl falls out of the build and the WASM.

The follow-up PRs do not exist yet; this is the first slice of a larger integration effort (#3540) being landed as smaller, self-contained PRs.

Acceptance Criteria

  • Attestation::verify is split into:
    • verify_with_report(report, …) — post-DCAP policy checks against an already-verified VerifiedReport; does not use dcap-qvl.
    • verify_locally(…) — full DCAP + post-DCAP in one call, behind a new local-verify feature.
  • dcap-qvl is optional, gated behind local-verify, so it is absent from the default build of attestation and mpc-attestation (verifiable via cargo tree).
  • The dcap_qvltee-verifier-interface conversions live in a shared tee-verifier-conversions crate, with the byte-layout pin tests in one place.
  • No behavior change: mpc-contract still enables local-verify and verifies locally exactly as before.

Resources & Additional Notes

See the design doc for the full plan.

Metadata

Metadata

Assignees

Labels

contractrefactorImprovements to code structure, readability, or performance that don't add new features or fix bugs.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions