Commit graph

319 commits

Author SHA1 Message Date
Harald Hoyer
4a0a4f6e5e
fix(proof-validation): handle optional proof status
Ensure proof status is treated as optional, preventing crashes when status is absent.
- Modify status field to `Option<String>` in `Proof` struct.
- Update validation logic to handle `None` values safely.
- Adjust main logic to check for "permanently_ignored" safely.
2024-11-28 15:48:23 +01:00
Harald Hoyer
5b7f7482e6
Merge pull request #221 from matter-labs/tee/pab/error-handling-get-tee-proofs-api
feat(verifier): don't retry verifying permanently ignored batches
2024-11-27 11:09:21 +01:00
Harald Hoyer
35db54779e
Merge branch 'main' into tee/pab/error-handling-get-tee-proofs-api 2024-11-27 10:48:35 +01:00
Patrick
73ce227070
Merge pull request #222 from matter-labs/license
chore: update lint workflow actions
2024-11-27 10:33:30 +01:00
Harald Hoyer
2c6a62a471
chore: update lint workflow actions
- Changed spdx action to reference a stable commit instead of master.
- Changed license list to conform to new action parameter format
2024-11-27 08:50:42 +01:00
Patryk Bęza
e63d0901fa
feat(verifier): don't retry verifying permanently ignored batches
Currently, the [TEE verifier][1] – the tool for continuous SGX
attestation and batch signature verification – is [stuck][2] on batches
that failed to be proven and are marked as `permanently_ignored`. The
tool should be able to distinguish between batches that are permanently
ignored (and should be skipped) and batches that have failed but will be
retried. This PR enables that distinction.

This commit goes hand in hand with the following PR:
https://github.com/matter-labs/zksync-era/pull/3321

[1]: https://github.com/matter-labs/teepot/blob/main/bin/verify-era-proof-attestation/src/main.rs
[2]: https://grafana.matterlabs.dev/goto/unFqf57Hg?orgId=1
2024-11-26 17:19:55 +01:00
Harald Hoyer
1a8a9f17fa
Merge pull request #212 from matter-labs/logging
feat(logging): centralize logging setup in teepot crate
2024-09-18 16:38:39 +02:00
Harald Hoyer
af3ab51320
feat(logging): centralize logging setup in teepot crate
- Added a new logging module in `teepot` crate.
- Removed redundant logging setup code from individual projects.
- Updated dependencies and references for logging setup.

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-18 16:08:13 +02:00
Harald Hoyer
2ff3b1168d
Merge pull request #210 from matter-labs/crane
fix(flake.nix): remove redundant crane input follow
2024-09-18 15:46:41 +02:00
Harald Hoyer
b7f4828a6d
Merge branch 'main' into crane 2024-09-18 15:36:26 +02:00
Harald Hoyer
7c61f81137
Merge pull request #211 from matter-labs/magix_nix_cache
ci: remove magic nix cache
2024-09-18 15:36:15 +02:00
Harald Hoyer
69ae1d39e3
Merge branch 'main' into magix_nix_cache 2024-09-18 15:24:08 +02:00
Harald Hoyer
538782e1f9
Merge pull request #209 from matter-labs/feat/hex-serialization
feat(tee): use hex deserialization for RPC requests
2024-09-18 15:22:43 +02:00
Harald Hoyer
9bce6edfaa
ci: remove magic nix cache
Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-18 14:56:04 +02:00
Harald Hoyer
21a9ecdee1
fix(flake.nix): remove redundant crane input follow
- Removed the unnecessary crane input follow from flake.nix.

```
warning: input 'crane' has an override for a non-existent input 'nixpkgs'
```
2024-09-18 14:46:33 +02:00
Patryk Bęza
9bf40c9cb9
feat(tee): use hex deserialization for RPC requests
Following Anton's suggestion, we have switched to hex serialization for
API/RPC requests and responses. Previously, we used default JSON
serialization for Vec<u8>, which resulted in a lengthy comma-separated
list of integers.

This change standardizes serialization, making it more efficient and
reducing the size of the responses. The previous format, with a series
of comma-separated integers for pubkey-like fields, looked odd.

Then:
```
curl -X POST\
     -H "Content-Type: application/json" \
     --data '{"jsonrpc": "2.0", "id": 1, "method": "unstable_getTeeProofs", "params": [491882, "Sgx"] }' \
        https://mainnet.era.zksync.io
{"jsonrpc":"2.0","result":[{"attestation":[3,0,2,0,0,0,0,0,10,<dozens of comma-separated integers here>
```

Now:
```
$ curl -X POST \
       -H "Content-Type: application/json" \
       --data '{"jsonrpc": "2.0", "id": 1, "method": "unstable_getTeeProofs", "params": [1, "sgx"] }' \
          http://localhost:3050
{"jsonrpc":"2.0","result":[{"l1BatchNumber":1,"teeType":"sgx","pubkey":"0506070809","signature":"0001020304","proof":"0a0b0c0d0e","provedAt":"2024-09-16T11:53:38.253033Z","attestation":"0403020100"}],"id":1}
```

This change needs to be deployed in lockstep with:
https://github.com/matter-labs/zksync-era/pull/2887.
2024-09-18 14:10:21 +02:00
Harald Hoyer
2c326f83bd
Merge pull request #207 from matter-labs/container-tag
chore: tag container with git tag
2024-09-17 15:09:02 +02:00
Harald Hoyer
e7b743b213
chore: tag container with git tag
Allow all tags and tag the matterlabsrobot container with it.

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-17 14:48:49 +02:00
Harald Hoyer
3b7041b459
Merge pull request #206 from matter-labs/cargo-release
chore: Release
2024-09-16 17:38:14 +02:00
Harald Hoyer
77818cffef
chore: Release 2024-09-16 17:01:14 +02:00
Harald Hoyer
2b6e68e269
Merge pull request #205 from matter-labs/cargo-release
chore: prepare release tags
2024-09-16 16:39:51 +02:00
Harald Hoyer
7743c1321a
chore: prepare release tags
* set `publish = false` for multiple Cargo.toml files
* cargo update
* fix taplo.toml
* sort `workspace.dependencies`
* add `cargo-release` to nix shell

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-16 16:14:26 +02:00
Harald Hoyer
108ef8cc07
Merge pull request #198 from matter-labs/patrick/attestation-acceptance-params
feat(verify-era-proof-attestation): added continuous mode with attestation policies
2024-09-16 12:04:42 +02:00
Patryk Bęza
4fcaaa7398
feat(verify-era-proof-attestation): continuous mode with attestation policies
This PR introduces TEE Prover continuous mode with attestation policies.

Attestation policies are a set of criteria that determine whether an SGX
attestation should be considered valid or invalid. In practice, this
means checking against a specified set of mrsigners, mrenclaves, and TCB
levels. If the attestation’s mrenclave/mrsigner/TCB levels matches those
in the provided --sgx-mrenclaves/--sgx-mrsigners/--sgx-allowed-tcb-levels,
we treat the attestation as successfully verified. Otherwise, the
attestation is considered invalid.

The --continuous mode for the TEE Prover allows it to run continuously,
verifying new batches exposed by the node's RPC API in real-time.

To try it out, run the following commands:

    $ nix build -L .#container-verify-era-proof-attestation-sgx
    $ export IMAGE_TAG=$(docker load -i result | grep -Po 'Loaded image.*: \K.*')
    $ docker run  -i --init --rm $IMAGE_TAG --continuous 11505 --rpc https://sepolia.era.zksync.dev --sgx-allowed-tcb-levels Ok,SwHardeningNeeded --log-level debug
    $ docker run  -i --init --rm $IMAGE_TAG --batch 11509 --rpc https://sepolia.era.zksync.dev --sgx-allowed-tcb-levels Ok,SwHardeningNeeded --log-level debug
2024-09-13 19:34:37 +02:00
Harald Hoyer
dd2a0304be
Merge pull request #199 from matter-labs/devshell_env
chore(nix): set shell environment for openssl
2024-09-11 15:31:50 +02:00
Harald Hoyer
d37d8c4845
chore(nix): set shell environment for openssl
The shellHook statement has been added to export OPENSSL_NO_VENDOR as 1.
This should prevent building the vendored version of openssl.
2024-09-11 10:35:32 +02:00
Harald Hoyer
e13bf353e0
Merge pull request #197 from matter-labs/extracmd
chore: add extra startup information to unseal and admin enclaves
2024-09-04 10:00:07 +02:00
Harald Hoyer
488dcfcdca
chore: add extra startup information to unseal and admin enclaves
This eases testing and debugging.

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-04 09:47:20 +02:00
Harald Hoyer
537521f0ee
Merge pull request #184 from matter-labs/renovate/trufflesecurity-trufflehog-3.x
chore(deps): update trufflesecurity/trufflehog action to v3.81.10
2024-09-03 15:24:37 +02:00
renovate[bot]
5162acd666
chore(deps): update trufflesecurity/trufflehog action to v3.81.10 2024-09-03 13:17:07 +00:00
Harald Hoyer
3b9735499c
Merge pull request #195 from matter-labs/cargo-update
chore: cargo and flake update
2024-09-03 15:15:46 +02:00
Harald Hoyer
301f91d269
Merge branch 'main' into cargo-update 2024-09-03 14:51:51 +02:00
Patrick
0e6eb2b74e
feat(verify-era-proof-attestation): add support for verifying a range of batches (#194)
Co-authored-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-03 12:48:04 +00:00
Harald Hoyer
d88f79d239
chore: rename nixsgxLib.mkSGXContainer to pkgs.lib.tee.sgxGramineContainer
Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-03 13:24:20 +02:00
Harald Hoyer
15109610d8
chore: update flake.lock
Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-03 13:24:19 +02:00
Harald Hoyer
b0ac83b78e
chore: update Cargo.lock
Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-03 13:24:18 +02:00
Harald Hoyer
2c21d0161e
Merge pull request #196 from matter-labs/env-preexec
feat(tee-key-preexec): add cmdline arg for env prefix
2024-09-03 11:06:33 +02:00
Harald Hoyer
c94912d832
feat(tee-key-preexec): add cmdline arg for env prefix
- Introduced `clap` for command-line argument parsing.
- Replaced manual argument handling with `clap`'s derived `Args` struct.
- Updated environmental variables to use dynamic prefixes.

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-09-03 10:42:42 +02:00
Harald Hoyer
6b0b0b69ca
Merge pull request #189 from matter-labs/patrick/sgx-rpc-attestation-verifier
feat(verify-attestation): RPC attestation and batch signature verification binary
2024-08-30 12:37:01 +02:00
Patryk Bęza
5e4b8901b0
feat(verify-attestation): RPC attestation and batch signature verification binary
This is another variant of the binary tool for verifying attestation and
the signature of a given batch. Unlike the existing tool, this variant
does not require you to provide two separate files—one for the
attestation and one for the signature. Instead, it automatically fetches
both from the RPC node.

Unfortunately, after discussing with @popzxc, we found that there is no way
to reuse the RPC client because our published crates on crates.io are
outdated and do not include the recently merged TEE-specific code
changes. To be fixed in the future.
2024-08-30 12:14:55 +02:00
Harald Hoyer
27f35a7432
Merge pull request #193 from matter-labs/secure-eventfd
fix(container-vault-sgx-azure): remove insecure eventfd setting
2024-08-29 11:22:50 +02:00
Harald Hoyer
8d3f378392
fix(container-vault-sgx-azure): remove insecure eventfd setting
Removed the sys.insecure__allow_eventfd setting, because gramine
has a secure eventfd implementation since
[v1.7](https://github.com/gramineproject/gramine/releases/tag/v1.7).
2024-08-29 10:58:46 +02:00
Harald Hoyer
8ce8f5bccb
Merge pull request #182 from matter-labs/vault_netpoll
fix(vault): maybe fix `netpollBreak` issues
2024-08-08 15:11:27 +02:00
Harald Hoyer
33fe7f17fa
fix(vault): maybe fix netpollBreak issues
- Updated the flake.lock for nixsgx dependency with new revision to get a patched gramine
  https://github.com/matter-labs/nixsgx/pull/54

- Enabled `sys.insecure__allow_eventfd` to support recent golang changes in the `netpoll` implementation
2024-08-08 14:51:04 +02:00
Harald Hoyer
49fb234d2a
Merge pull request #181 from matter-labs/ulimit
fix(container-vault-sgx-azure): increase max file descriptors for vault
2024-08-08 12:19:40 +02:00
Harald Hoyer
2d1d68210b
fix(container-vault-sgx-azure): increase max file descriptors for vault
Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
2024-08-08 11:06:56 +02:00
Harald Hoyer
bb93775252
Merge pull request #179 from matter-labs/renovate/trufflesecurity-trufflehog-3.x
chore(deps): update trufflesecurity/trufflehog action to v3.81.7
2024-08-08 10:20:46 +02:00
renovate[bot]
cec4785d49
chore(deps): update trufflesecurity/trufflehog action to v3.81.7 2024-08-08 08:12:27 +00:00
Harald Hoyer
9b34b30d24
Merge pull request #180 from matter-labs/renovate/serde-monorepo
chore(deps): update rust crate serde to v1.0.205
2024-08-08 10:11:58 +02:00
renovate[bot]
6b7e1b09cb
chore(deps): update rust crate serde to v1.0.205 2024-08-08 02:33:26 +00:00