Skip to content

Switch mpc-contract to Promise + callback verification #3269

@pbeza

Description

@pbeza

Background

With dcap-qvl-free wire types now in place (#3235, #3245, #3246), mpc-contract can finally call out to tee-verifier.near over a cross-contract Promise instead of running dcap_qvl::verify::verify itself. This is where the WASM size drop materializes.

User Story

As an MPC contract maintainer, I want submit_participant_info to verify Dstack attestations via cross-contract Promise to tee-verifier.near, so that dcap-qvl and its closure leave the MPC contract's WASM and the contract gains safe headroom under NEP-509's 1,490,000-byte limit.

Acceptance Criteria

  • Attestation::verify splits into extract_dcap_inputs (pre-Promise) + finish_verify (in callback).
  • submit_participant_info's Dstack arm schedules a Promise to tee-verifier.{near,testnet}'s verify_quote and stashes a PendingAttestation keyed by account_id.
  • Mock attestations remain synchronous (no Promise, no pending entry).
  • New on_attestation_verified callback re-reads allowlists fresh from tee_state, runs the post-DCAP body, inserts into stored_attestations, refunds the caller's deposit on failure (or on PromiseError::Failed), and clears the pending entry.
  • State migration initializes the new pending_attestations map empty.
  • cargo tree -p mpc-contract --target wasm32-unknown-unknown -e no-proc-macro -i dcap-qvl returns nothing in normal (non-dev) deps.
  • Reproducible WASM drops at least 200 KB below the 1,490,000-byte NEP-509 limit.
  • Unit tests cover both submit_participant_info arms and the four callback paths (success, promise failed, post-DCAP failed, allowlist re-read).

Resources & Additional Notes

PR: #3247. Depends on #3235, #3237, #3245, #3246. Tracked by #3264.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions