-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tee): introduce get_tee_proofs RPC method for TEE proofs (#2474)
## What ❔ Add `get_tee_proofs` RPC method to expose TEE attestations and proofs for a given batch number and TEE type. Currently, there can be only one proof instance per batch number per TEE type. In the future, we may allow multiple instances since attestations can be revoked if the machine that produced them is compromised. ## Why ❔ We want to enable anyone to download TEE attestations and proofs for any transaction, allowing them to verify it on their own machines using the `verify-attestation` standalone binary (available at https://github.com/matter-labs/teepot/tree/main/bin/verify-attestation). This is just an intermediate step; the ultimate goal is to have TEE proofs and attestations verification implemented on-chain. ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [x] Code has been formatted via `zk fmt` and `zk lint`.
- Loading branch information
Showing
23 changed files
with
367 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...lib/dal/.sqlx/query-286f27e32a152c293d07e7c22e893c6f5a43386d4183745a4668507cf672b3f6.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
...lib/dal/.sqlx/query-640d37aa1d6dc722b1651c74b7ea2fca14965083b0589c3b3efad02e37d55f0c.json
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
...lib/dal/.sqlx/query-9533a672ae82db344ae1070ae11b608d21dc70397b64ce500881a8b55953c59c.json
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
...f8d103f12e51252c46a210a007e5e600d711.json → ...213a0b02b3ff96398920bc0250397bb2a95f.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...lib/dal/.sqlx/query-d8bc4af72e3d94df53967c83d577a1e1abf3d268b16498cc65758af66781cbb6.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...lib/dal/.sqlx/query-e048951ded9e4a4a28238334bc4dc118360ab83bae3196ec941216901be629da.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
...lib/dal/.sqlx/query-e2ff392b3aa7a22fc39d150d08b148b0f1c7e512dd43434062341eb263fe434f.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# TeeProofGenerationDal | ||
|
||
## Table Name | ||
|
||
`tee_proofs` | ||
|
||
## `status` Diagram | ||
|
||
```mermaid | ||
--- | ||
title: Status Diagram | ||
--- | ||
stateDiagram-v2 | ||
[*] --> ready_to_be_proven : insert_tee_proof_generation_job | ||
ready_to_be_proven --> picked_by_prover : get_next_batch_to_be_proven | ||
picked_by_prover --> generated : save_proof_artifacts_metadata | ||
generated --> [*] | ||
``` |
5 changes: 5 additions & 0 deletions
5
core/lib/dal/migrations/20240805144000_tee_proofs_reorg.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ALTER TABLE tee_verifier_input_producer_jobs ADD COLUMN picked_by TEXT; | ||
|
||
ALTER TABLE tee_proof_generation_details DROP CONSTRAINT tee_proof_generation_details_pkey; | ||
ALTER TABLE tee_proof_generation_details ALTER COLUMN tee_type DROP NOT NULL; | ||
ALTER TABLE tee_proof_generation_details ADD PRIMARY KEY (l1_batch_number); |
7 changes: 7 additions & 0 deletions
7
core/lib/dal/migrations/20240805144000_tee_proofs_reorg.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ALTER TABLE tee_verifier_input_producer_jobs DROP COLUMN picked_by; | ||
|
||
ALTER TABLE tee_proof_generation_details DROP CONSTRAINT tee_proof_generation_details_pkey; | ||
UPDATE tee_proof_generation_details SET tee_type = 'sgx' WHERE tee_type IS NULL; | ||
ALTER TABLE tee_proof_generation_details ALTER COLUMN tee_type SET NOT NULL; | ||
ALTER TABLE tee_proof_generation_details ALTER COLUMN l1_batch_number SET NOT NULL; | ||
ALTER TABLE tee_proof_generation_details ADD PRIMARY KEY (l1_batch_number, tee_type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use chrono::NaiveDateTime; | ||
|
||
#[derive(Debug, Clone, sqlx::FromRow)] | ||
pub struct StorageTeeProof { | ||
pub pubkey: Option<Vec<u8>>, | ||
pub signature: Option<Vec<u8>>, | ||
pub proof: Option<Vec<u8>>, | ||
pub updated_at: NaiveDateTime, | ||
pub attestation: Option<Vec<u8>>, | ||
} |
Oops, something went wrong.