Skip to content

feat: accept Intel TDX confidential instances - #1266

Merged
odesenfans merged 2 commits into
mainfrom
od/tdx-message-schema
Sep 2, 2026
Merged

feat: accept Intel TDX confidential instances#1266
odesenfans merged 2 commits into
mainfrom
od/tdx-message-schema

Conversation

@odesenfans

@odesenfans odesenfans commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Bumps aleph-message to the TDX schema tip (aleph-im/aleph-message#161, git-sha pin per the usual V-PROGRAM bump pattern): TeePlatform/mode grow tdx, LaunchMeasurement.registers becomes a union discriminated on platform, and measured instances are credit-only regardless of platform.

No CCN code changes turn out to be needed: TEE validation is fully delegated to aleph-message, and both persistence (handlers/content/vm.py) and pricing (services/cost.py keys on the presence of trusted_execution, not its mode) handle a tdx instance as-is, priced as INSTANCE_CONFIDENTIAL. V-PROGRAM is untouched: the schema keeps its backend sev_snp-only.

The new test processes a mode: tdx instance end to end (credit payment, runtime + declared TDX registers) and pins the two DB-visible facts: environment_trusted_execution_firmware is NULL and the policy column stays at the schema default, since TDX has no host-chosen launch policy.

Update: aleph-message 1.4.0 (carrying #161) is released; the pin now reads aleph-message==1.4.0 and the tests pass against the PyPI package. No merge gate remains.

Noted while here (pre-existing, not touched): environment_trusted_execution_policy is an int4 column, which a real SEV-SNP 64-bit policy can overflow; tdx is unaffected because its policy is forced to the default.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DUWEzYLgSidwttzQGtzB43

Bump aleph-message to the TDX schema tip (aleph-im/aleph-message#161):
TeePlatform/mode grow tdx, LaunchMeasurement.registers becomes a union
discriminated on platform, and measured instances are credit-only
regardless of platform.

No CCN code changes: TEE validation is fully delegated to aleph-message,
and both persistence (handlers/content/vm.py) and pricing
(services/cost.py) key on the presence of trusted_execution, not its
mode, so a tdx instance persists and prices as INSTANCE_CONFIDENTIAL
as-is. The new test processes a mode=tdx instance end to end and pins
the two DB-visible facts: no firmware, and the policy column stays at
the schema default (TDX has no host-chosen launch policy).

Re-pin to the release once one carrying #161 is tagged.
foxpatch-aleph
foxpatch-aleph previously approved these changes Sep 2, 2026

@foxpatch-aleph foxpatch-aleph left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimal, correct change. The dependency bump is verified to contain only the TDX schema additions relative to 1.3.1, and I confirmed by executing the test fixture against the pinned schema that a mode:"tdx" instance parses, defaults policy to 1 with firmware None, and validates as credit payment — exactly what the test asserts and what vm.py persists. No TEE-mode branching exists in pyaleph, so the claim that no CCN code changes are needed checks out, and pricing correctly keys on trusted_execution presence. The test follows the established end-to-end pattern (same credit-balance pattern as other passing tests) and passes lint. Two non-blocking notes below.

pyproject.toml (line 33): Confirmed the git-sha pin style matches the existing aleph-p2p-client pin. As noted in the description, remember to re-pin to a tagged aleph-message release once #161 ships in one (or merge on the sha pin, consistent with prior V-PROGRAM bumps).

tests/message_processing/test_process_confidential.py (line 454): Optional nit: alongside the two TEE facts pinned here, asserting instance.payment_type == "credit" would also lock in the credit-only requirement for measured instances — though that rule is enforced upstream in aleph-message, so this is purely a nice-to-have.

@foxpatch-aleph foxpatch-aleph left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimal, correct change: the aleph-message 1.4.0 pin is the only dependency change and brings exactly the described TDX schema delta (TeePlatform.tdx, TdxRegisters, platform-discriminated registers union, measured-TEE credit-only generalization). I verified the 'no CCN changes needed' claim by running the vm handler mapping with the test's TDX content against the real 1.4.0 package: it produces payment_type=credit, policy=1 (AMDSEVPolicy.NO_DBG) and firmware=None, exactly what the new test asserts, and pricing correctly keys on TEE presence via INSTANCE_CONFIDENTIAL. The test fixture content validates against the 1.4.0 schema, the credit-lot fixture matches established patterns in other passing tests, get_message_status is sync as used, and black/isort/ruff/mypy all pass on the changed files. I could not run the full pipeline test locally (no PostgreSQL/Docker in the sandbox), so the PROCESSED-status path was verified by direct execution of the validation and mapping layers rather than the DB round-trip. Two non-blocking nits: the new fixture duplicates the PendingMessageDb/MessageStatusDb boilerplate from the existing confidential fixture, and the pre-existing int4 policy column (which a real 64-bit SEV-SNP policy can overflow, already documented at vprogram.py:82-84) deserves a follow-up issue.

tests/message_processing/test_process_confidential.py (line 454): Verified: aleph-message 1.4.0 defaults policy to AMDSEVPolicy.NO_DBG (1) and firmware to None for tdx mode, so both this assertion and the is None firmware check below are correct — I ran _map_content_to_db_model with this exact content and got these values. Optional nit: importing and comparing against AMDSEVPolicy.NO_DBG instead of the literal 1 would self-document the 'schema default' claim in the comment, though the existing comment already explains it well.

tests/message_processing/test_process_confidential.py (line 375): The PendingMessageDb + MessageStatusDb setup (~35 lines) duplicates fixture_confidential_vm_message above. A small parameterized helper for the common skeleton would reduce drift risk if the schema of these fixtures changes again. Non-blocking — consistent with the file's existing style.

src/aleph/handlers/content/vm.py (line 125): Pre-existing and correctly called out in the PR description: content.environment.trusted_execution.policy is stored into the int4 environment_trusted_execution_policy column (src/aleph/db/models/vms.py:158), but a real SEV-SNP 64-bit guest policy with high bits set would overflow int4. The 1.4.0 schema now validates sev_snp policies as 64-bit, so a follow-up widening the column (or following the vprogram.py approach of leaving it NULL) would be worthwhile. Out of scope for this PR since tdx policy is pinned to the default.

@odesenfans
odesenfans merged commit 3c1938f into main Sep 2, 2026
4 checks passed
@odesenfans
odesenfans deleted the od/tdx-message-schema branch September 2, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants