Skip to content

Add commit hash to policy #22

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Melvillian
Copy link
Collaborator

We want to add the commit hash to the Policy because Flashtestations
needs a way to associate a TEE's workloadId with the source code used
to build the TEE image represented by that workloadId. There is no way
to do this that does not involve some sort of onchain permissioned action,
because to do it without permissioned action would require building TEE
images onchain, which is prohibitively expensive. Instead, we settle for
a multisig signer that is permissioned to associate workloadIds with commit hashes.

Offchain verifiers can then use this commit hash to locate the TEE image build source code,
build the TEE image, derive the workloadId, and then compare that locally-built
workloadId with the workloadId in the policy that is associated with the commit hash.
In this way, anyone can reliably prove that a given block is built using source code
that orders transactions in a fair and verifiable manner which is the purpose of flashtestations).

@Melvillian Melvillian requested a review from Ruteri July 22, 2025 19:05
@Melvillian
Copy link
Collaborator Author

This PR is in a bad state because it's trying to build off of this PR in Ruteri's repo: #21

once that merges to flashtestations master this PR will be much cleaner

@Melvillian Melvillian force-pushed the add-commit-hash-to-policy branch from 798b9c7 to a7e083a Compare July 25, 2025 16:33
@Melvillian Melvillian changed the base branch from minimal-example-of-working-onchain-verification-on-ethereum-sepolia to main July 25, 2025 16:34
…o a policy

Completes UNI-835

We want to add the commit hash to the Policy because Flashtestations
needs a way to associate a TEE's workloadId with the source code used
to build the TEE image represented by that workloadId. There is no way
to do this that does not involve some sort of onchain permissioned action,
because to do it without permissioned action would require building TEE
images onchain, which is prohibitively expensive. Instead, we settle for
a multisig signer that is permissioned to associate workloadIds with commit hashes.

The recordLocators part of the metadata makes it easier for verifiers to find the URL from
which to fetch the source code. We provide multiple locators so there is higher availability.

Offchain verifiers can then use this commit hash to locate the TEE image build source code,
build the TEE image, derive the workloadId, and then compare that locally-built
workloadId with the workloadId in the policy that is associated with the commit hash.
In this way, anyone can reliably prove that a given block is built using source code
that orders transactions in a fair and verifiable manner which is the purpose of flashtestations).

fix broken tests

fixed tests
@Melvillian Melvillian force-pushed the add-commit-hash-to-policy branch from a7e083a to 8d99a49 Compare July 25, 2025 16:59
bytes32 workloadKey = WorkloadId.unwrap(workloadId);

// Check if workload already exists
require(bytes(approvedWorkloads[workloadKey].commitHash).length == 0, WorkloadAlreadyInPolicy());
Copy link
Contributor

Choose a reason for hiding this comment

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

We can consider allowing updates to the commit hash — it's not necessarily wrong. If the commit changes only say the readme or release notes it'd still have the same associated image and workloadId but be more informative. The owner can always remove the old workload and then add a new one.
That being said it's of course more secure to not allow the update — we could in that case have an explicit comment about it.

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