Skip to content

Commit 99fdd00

Browse files
committed
refactor(loc-cap): extract registry keys and sync under crate caps
Split gateway registry, challenge key load, and validator SyncChain into workspace crates so each package stays at or below the 1500 non-test LOC cap. Preserve public parent APIs via pub use facades.
1 parent 1f33a57 commit 99fdd00

16 files changed

Lines changed: 99 additions & 27 deletions

File tree

Cargo.lock

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "agent-challenge-keys"
3+
description = "Challenge signing key load for agent-v1"
4+
version.workspace = true
5+
edition.workspace = true
6+
license.workspace = true
7+
repository.workspace = true
8+
rust-version.workspace = true
9+
publish = false
10+
11+
[dependencies]
12+
crypto = { path = "../crypto" }
13+
hex = "0.4"
14+
thiserror = "2"
15+
16+
[lints]
17+
workspace = true

crates/agent-challenge/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ publish = false
1212
bundle = { path = "../bundle" }
1313
chain = { path = "../chain" }
1414
crypto = { path = "../crypto" }
15+
agent-challenge-keys = { path = "../agent-challenge-keys" }
1516
trustroot = { path = "../trustroot" }
1617
agent-pack = { path = "../agent-pack" }
1718
agent-dispatch = { path = "../agent-dispatch" }

crates/agent-challenge/src/challenge.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ mod tests {
362362
#![allow(clippy::unwrap_used, clippy::expect_used)]
363363

364364
use super::*;
365-
use crate::keys::public_key_from_secret;
365+
use agent_challenge_keys::public_key_from_secret;
366366
use rand_core::OsRng;
367367
use trustroot::{ChallengeEntry, ParticipantPolicy, BPS_DENOM};
368368

crates/agent-challenge/src/lib.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@
77
88
#![forbid(unsafe_code)]
99

10-
mod challenge;
11-
mod epoch_loop;
12-
mod expected_set;
13-
mod intake;
14-
mod keys;
15-
mod leaf_map;
16-
mod score;
17-
mod submit;
18-
mod task_gen;
19-
mod verify;
10+
mod challenge; mod epoch_loop; mod expected_set;
11+
mod intake; mod leaf_map; mod score;
12+
mod submit; mod task_gen; mod verify;
2013

14+
pub use agent_challenge_keys::{load_challenge_secret, public_key_from_secret, ChallengeKeyError};
2115
pub use challenge::{
2216
correct_http200, correct_http200_fixture, emit_signed_leaf_set, leaf_from_verify_result,
2317
score_epoch_from_verify, silence_is_bug_leaf, AgentV1Challenge, AttestationLookup, Challenge,
@@ -37,7 +31,6 @@ pub use intake::{
3731
intake_and_grade, verify_intake_receipt, ExpectedReceiptBind, IntakeOk, IntakePatch,
3832
ReceiptBindError,
3933
};
40-
pub use keys::{load_challenge_secret, public_key_from_secret, ChallengeKeyError};
4134
pub use leaf_map::{
4235
attempts_within_seal_budget, cover_expected_verify_leaves, grade_to_score_or_absence,
4336
grade_to_score_or_absence_budgeted, is_operator_fault, is_retryable_operator_fault, map_reward,
@@ -52,17 +45,12 @@ pub use submit::{
5245
SubmitError, SubmitOutcome, DEFAULT_MAX_RETRIES,
5346
};
5447
pub use task_gen::{
55-
answer_digest, answer_digest_v2, task_blob, task_blob_v2, task_id, task_id_v2,
56-
ANSWER_DOMAIN_V2, CHALLENGE_ID, CHALLENGE_ID_BYTES, FIXTURE_MODEL_PATCH, FIXTURE_PACK_ID,
57-
SCORING_VERSION, SCORING_VERSION_V2, TASK_BLOB_DOMAIN_V2, TASK_ID_DOMAIN_V2,
58-
};
59-
60-
pub use bundle::{
61-
make_signed_leaf, raw_weight_payload, LeafV1, NoScoreReasonCode, RawWeightBodyV1,
62-
ScoreOrAbsence,
48+
answer_digest, answer_digest_v2, task_blob, task_blob_v2, task_id, task_id_v2, ANSWER_DOMAIN_V2,
49+
CHALLENGE_ID, CHALLENGE_ID_BYTES, FIXTURE_MODEL_PATCH, FIXTURE_PACK_ID, SCORING_VERSION,
50+
SCORING_VERSION_V2, TASK_BLOB_DOMAIN_V2, TASK_ID_DOMAIN_V2,
6351
};
52+
pub use bundle::{make_signed_leaf, raw_weight_payload, LeafV1, NoScoreReasonCode, RawWeightBodyV1, ScoreOrAbsence};
6453
pub use crypto::{KEY_LEN, SIGNATURE_LEN};
65-
6654
pub use verify::{
6755
map_docker_timeout, reward_from_json_bytes, HarborVerifier, HarborVerifierConfig, Reward,
6856
Verifier, VerifyError, ZeroReason, DEFAULT_VERIFIER_TIMEOUT_SEC,

crates/gateway-registry/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "gateway-registry"
3+
description = "Gateway backend registry (routing only, D18) — extracted for loc-cap"
4+
version.workspace = true
5+
edition.workspace = true
6+
license.workspace = true
7+
repository.workspace = true
8+
rust-version.workspace = true
9+
publish = false
10+
11+
[dependencies]
12+
parking_lot = "0.12"
13+
serde = { version = "1", features = ["derive"] }
14+
thiserror = "2"
15+
uuid = { version = "1", features = ["v4", "serde"] }
16+
17+
[dev-dependencies]
18+
serde_json = "1"
19+
20+
[lints]
21+
workspace = true

crates/gateway/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ publish = false
1212
axum = { version = "0.8", default-features = false, features = ["http1", "tokio", "json", "query"] }
1313
bytes = "1"
1414
aggregate = { path = "../aggregate" }
15+
gateway-registry = { path = "../gateway-registry" }
1516
bundle = { path = "../bundle" }
1617
chain = { path = "../chain" }
1718
config = { path = "../config" }

crates/gateway/src/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use serde::Deserialize;
1414
use trustroot::ChallengesBody;
1515
use uuid::Uuid;
1616

17-
use crate::registry::{BackendView, CreateBackend, Registry, RegistryError};
1817
use crate::sealer::{MemoryBundleStore, SharedBundleStore};
1918
use crate::weights::{MemoryRawWeightStore, SharedWeightStore};
19+
use gateway_registry::{BackendView, CreateBackend, Registry, RegistryError};
2020

2121
/// Shared axum state for registry + proxy + weights + sealed bundles.
2222
#[derive(Clone)]

0 commit comments

Comments
 (0)