Skip to content

Commit 0b8665c

Browse files
committed
mirror_worker: implement the add-entries submission API
Stream and verify entry packages against the target pending checkpoint, persist them as tlog-tiles entry bundles and hash tiles (see commit.rs), and advance the persisted-entry frontier. A complete upload cosigns the mirror checkpoint and returns 200; a client-truncated upload persists the verified prefix and returns 202 with the advanced next entry so the client can resume (C2SP/C2SP#253). Includes body-decoding (transparent gzip), a streaming buffer adapter, per-origin prefixed R2 storage, and the ticket-sealer for recovering a past pending checkpoint on resume.
1 parent ce9dee4 commit 0b8665c

12 files changed

Lines changed: 2193 additions & 15 deletions

File tree

Cargo.lock

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ der = { version = "0.8", features = ["oid"] }
121121
# (crypto-common 0.2 / signature 3.0), so it remains pinned to a pre-release.
122122
# The rest of the batch is now stable.
123123
ed25519-dalek = { version = "3.0.0", features = ["pem"] }
124+
flate2 = { version = "1", default-features = false, features = ["rust_backend"] }
124125
futures-executor = "0.3.31"
125126
futures-util = "0.3.31"
126127
getrandom = { version = "0.4", features = ["wasm_js"] }
@@ -157,6 +158,7 @@ tlog_checkpoint = { path = "crates/tlog_checkpoint", version = "0.2.0" }
157158
tlog_core = { path = "crates/tlog_core", version = "0.2.0" }
158159
tlog_cosignature = { path = "crates/tlog_cosignature", version = "0.2.0" }
159160
tlog_entry = { path = "crates/tlog_entry", version = "0.2.0" }
161+
tlog_mirror = { path = "crates/tlog_mirror", version = "0.2.0" }
160162
tlog_tiles = { path = "crates/tlog_tiles", version = "0.2.0" }
161163
tlog_witness = { path = "crates/tlog_witness", version = "0.2.0" }
162164
tokio = { version = "1", features = ["sync"] }

crates/mirror_worker/.dev.vars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
MIRROR_SIGNING_KEY="-----BEGIN PRIVATE KEY-----\nMDQCAQAwCwYJYIZIAWUDBAMRBCKAIEJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJC\nQkJCQkJC\n-----END PRIVATE KEY-----\n"
2+
MIRROR_TICKET_KEY="Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc="

crates/mirror_worker/Cargo.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,39 @@ serde_json.workspace = true
3232

3333
[dependencies]
3434
axum.workspace = true
35+
base64.workspace = true
3536
config = { path = "./config", package = "mirror_worker_config" }
3637
console_error_panic_hook.workspace = true
3738
console_log.workspace = true
39+
flate2.workspace = true
40+
futures-util.workspace = true
3841
generic_log_worker.workspace = true
3942
getrandom.workspace = true
4043
getrandom_03.workspace = true
4144
hex.workspace = true
45+
length_prefixed.workspace = true
4246
log.workspace = true
4347
ml-dsa.workspace = true
4448
pkcs8.workspace = true
4549
serde.workspace = true
4650
serde_json.workspace = true
4751
serde_with.workspace = true
52+
sha2.workspace = true
4853
signed_note.workspace = true
4954
tlog_checkpoint.workspace = true
5055
tlog_core.workspace = true
5156
tlog_cosignature.workspace = true
57+
tlog_mirror.workspace = true
58+
tlog_tiles.workspace = true
5259
tlog_witness.workspace = true
5360
tower-service.workspace = true
5461
worker = { workspace = true, features = ["http", "axum"] }
5562

5663
[dev-dependencies]
57-
# base64 is used only by the dev-config pin tests; ed25519-dalek only to
58-
# check that a non-ML-DSA-44 MIRROR_SIGNING_KEY is rejected. The shipped
59-
# worker is ML-DSA-44 only.
60-
base64.workspace = true
64+
# Ed25519 is used only by unit tests, to check that a non-ML-DSA-44
65+
# MIRROR_SIGNING_KEY is rejected. The shipped worker is ML-DSA-44 only.
6166
ed25519-dalek.workspace = true
67+
tokio = { workspace = true, features = ["macros", "rt"] }
6268

6369
[lints.rust]
6470
unexpected_cfgs = { level = "warn", check-cfg = [

0 commit comments

Comments
 (0)