Private Authorization Key (ask) — logos-docs journey issue #508

Reviewed against logos-blockchain/logos-execution-zone, tag v0.3.0 (commit db66590ab821a4e142c211017a3866d007f6fa77, 2026-09-29) — the same clone and ref used for the #507 review. The issue pins its cited tests at commit f7fda38a4428b9989f1db1dbf5d2411484848fd4 (already confirmed in the #507 review as an ancestor of v0.3.0). Fully Docker-free; this is a code-and-test validation, no sequencer/indexer stand-up needed for this journey. Scope note: per instructions, this review validates that the documented journey is accurate, runnable, and reproducible for Docs' purposes — it does not audit the cryptographic soundness of the ask/nsk/npk/vsk scheme itself, and does not treat testnet-v0.3 incompleteness as a defect.

Verdict: the journey validates. Every claim checked is accurate and reproduces. All 6 named tests exist at (or exactly at) their cited locations and assert exactly what the issue says. The key-derivation hierarchy — domain separator strings, the ask→nsk→npk chain, vsk as a sibling off ssk — was read directly from the cited source files and matches the issue's quoted strings character-for-character. The headline "fail-open" claim (no ask ⇒ still spendable, a tx signer does not substitute for it, authorization is opt-in per program) is confirmed exactly in execution_state.rs's code, not just in test behavior. One precise reproducibility gap was found in the issue's own stated success command (see Findings #1), and the issue's "Failure modes and limits" section is confirmed blank, which is exactly where the fail-open behavior needs to be documented.

Summary

#FindingSeverityStatus
1The issue's own success command doesn't reach 2 of its 6 cited tests: one misses the ask substring filter, the other lives in a different crate (lee_core, not lee) and needs a feature flag to even compile standaloneMedium (doc accuracy)reproduced
2Blank "Failure modes and limits" section — the fail-open behavior (no ask ⇒ unauthorized but still spendable) is exactly the kind of thing that belongs thereMedium (doc gap)confirmed blank
3Private-PDA authorization (WitnessKind::Pda) is a structurally separate scheme from ask, with its own per-call scoping — worth a doc pointer so readers don't conflate the twoLow (doc clarity)confirmed
—All 5 named circuit tests + the engine test: exist at cited lines, assert exactly what's claimedGoodreproduced
—Key-derivation hierarchy (domain strings, ask→nsk→npk, vsk sibling)Goodconfirmed by direct code reading
—execution_state.rs::initialize enforcement, and the authorize() function's exact "authorized ⇔ ask present" mappingGoodconfirmed

Cheap-first check

$ RISC0_DEV_MODE=1 cargo test --release -p lee ask
running 4 tests
test ...::regular_init_with_non_chaining_ask_npk_is_rejected ... ok
test ...::regular_update_with_wrong_ask_nsk_is_rejected ... ok
test ...::a_signer_entry_does_not_authorize_a_private_witness_without_ask ... ok
test ...::private_regular_update_without_ask_is_spendable ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 279 filtered out; finished in 0.11s

PASS as stated — but see finding #1: this command's own ask substring filter only ever catches 4 of the 6 tests the issue cites by name (full log in evidence/ask-test.log).

Findings

MEDIUM (doc accuracy) — 1. The stated success command misses 2 of the 6 cited tests

reproduced

The issue cites 6 tests by name as evidence for the journey, but its own stated success command (cargo test --release -p lee ask) only ever runs 4 of them:

Both confirmed passing once named/invoked correctly (full log in evidence/all-6-named-tests.log):
$ cargo test --release -p lee -- --exact \
    ...::auth_asserting_program_rejects_unauthorized_regular_private_account
test ...::auth_asserting_program_rejects_unauthorized_regular_private_account ... ok

$ cargo test --release -p lee_core --features test_utils -- --exact \
    execution_state::tests::duplicate_witnesses_and_unlinked_authorization_keys_are_rejected
test execution_state::tests::duplicate_witnesses_and_unlinked_authorization_keys_are_rejected ... ok

Why this matters for Docs: a reader following only the issue's stated command gets a clean "4 passed" and would reasonably believe they've reproduced everything the issue cites — when 2 of the 6 named tests silently never ran. Nothing is wrong with the tests or the code; the gap is purely in the issue's own repro instructions.

Suggested fix: either broaden the success command (e.g. cargo test --release -p lee -p lee_core --features lee_core/test_utils, or just list the two exact test names separately), or drop the implication that the single stated command covers all 6 cited tests.

MEDIUM (doc gap) — 2. "Failure modes and limits" is blank — exactly where the fail-open behavior belongs

confirmed blank on the issue; confirmed in code

The issue's own code and tests describe a deliberate, correctly-implemented fail-open boundary, confirmed directly in lee/state_machine/core/src/execution_state.rs:

// inside ExecutionState::initialize's witness loop:
WitnessKind::Regular { ask: Some(ask) } => {
    let derived = NullifierSecretKey::from(ask);
    let linked = /* does derived chain to this witness's nsk/npk? */;
    if !linked { return Err(ExecutionError::InvalidAuthorizationKey { account_id }); }
}
WitnessKind::Regular { ask: None } => {}   // <-- no error. Spending proceeds.

And later, in authorize() — the exact source of the program-visible AccountMeta.is_authorized flag:

Origin::Private(index) => {
    let witness = &self.witnesses[index];
    (matches!(witness.kind, WitnessKind::Regular { ask: Some(_) }), ...)
    //          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "authorized" IS "ask was Some"

This precisely matches the issue's own claim, and is confirmed live by the 5 circuit tests: an account with ask: None and a plain noop program spends successfully (private_regular_update_without_ask_is_spendable); the SAME witness, with a tx-level signer entry added, is still rejected by a program that checks authorization (a_signer_entry_does_not_authorize_a_private_witness_without_ask — the signer entry does nothing for private-witness authorization); and the rejection in both "no ask" cases comes from the program panicking (auth_asserting_noop asserting account.is_authorized), via LeeError::ProgramProveFailed — never from the engine itself, which only ever raises InvalidAuthorizationKey when a wrong ask is supplied, not when none is.

This is a deliberate, sound design (delegation requires it — a tracking-only holder must be able to drive unauthorized state updates for the owner to later see/finalize). But it is a genuine trap for a reader who assumes "no credential ⇒ locked," and the issue's "Failure modes and limits" field is confirmed blank (the GitHub page shows "No response" under that heading) — this is exactly the content that belongs there.

Suggested fix: add to "Failure modes and limits": "An account with no ask witnessed is NOT locked — it can still be spent/updated via its nsk alone. This is intentional (it's what makes delegation possible) but means authorization is purely opt-in: only a program that explicitly checks account.is_authorized on its inputs will ever reject an unauthorized update. A transaction's top-level signer list does not substitute for a missing ask on a private witness."

LOW (doc clarity) — 3. Private-PDA authorization is a separate scheme from ask — worth a pointer

confirmed

WitnessKind (lee/state_machine/core/src/circuit_io.rs:143) has exactly two variants:

pub enum WitnessKind {
    Regular { ask: Option<AuthorizationSecretKey> },
    Pda { binding: (AccountId, PdaSeed) },
}

A private PDA's credential is its (program, seed) binding, not an ask/nsk chain at all, and its grant is scoped narrowly per call — confirmed in private_seed_grant():

fn private_seed_grant(caller_account_id, pda_seeds, witness) -> Option<(AccountId, PdaSeed)> {
    witness.pda_binding()
        .filter(|&(program, seed)| Some(program) == caller_account_id && pda_seeds.contains(&seed))
}

i.e. a PDA is only authorized within a call whose caller is the PDA's own owning program AND which explicitly passed that seed down via ChainedCall.pda_seeds — a per-call, subtree-scoped grant, composed with the ask-based credential via OR (credential || grants.contains(&account_id) in authorize()), not derived from or related to ask in any way. The issue doesn't claim otherwise, but doesn't mention this sibling mechanism either; a reader moving from "ask" docs to "private PDA" docs could reasonably wonder if they're the same credential. They aren't.

Suggested fix: one sentence and a link: "Private PDAs use a separate, call-scoped seed-grant mechanism, not ask — see [private-PDA doc]."

Claim-by-claim confirmation

ClaimStatusWhere checked
5 named circuit tests exist at their exact cited lines (702/731/763/800/837) and assert what's claimedreproducedlee/state_machine/src/privacy_preserving_transaction/circuit/tests.rs; all 5 run and pass individually
Engine test duplicate_witnesses_and_unlinked_authorization_keys_are_rejected exists and asserts both DuplicateWitness and InvalidAuthorizationKeyreproducedlee/state_machine/core/src/execution_state/tests.rs:1020 (note: needs -p lee_core --features test_utils, see finding #1)
generate_authorization_secret_key = sha256("/LEE-Keys/v1/Authorization/Secret" || ssk || index)confirmed, exact byteslee/key_protocol/src/key_management/secret_holders.rs:92-103
nsk derived from ask via impl From<&AuthorizationSecretKey> for NullifierSecretKeyconfirmedlee/state_machine/core/src/nullifier.rs:144-155 (domain "/LEE-Keys/v1/Nullifier/Secret")
npk derived from nskconfirmednullifier.rs:157-170 (domain "/LEE-Keys/v1/Nullifier/Public")
vsk is a sibling off ssk, never through ask/nskconfirmedsecret_holders.rs:112-125: generate_viewing_secret_seed_key hashes ssk.0 directly under domain "/LEE-Keys/v1/Viewing/Secret", independent of generate_authorization_secret_key
PrivateKeyHolder { authorization_secret_key, viewing_secret_key } field names/orderconfirmed, exact matchsecret_holders.rs:40-43
A supplied ask that doesn't chain to the witness's nsk/npk fails the whole execution with InvalidAuthorizationKeyconfirmedexecution_state.rs:212-223, plus 2 tests + the engine test
"Authorized" for a private account ⇔ a (validated) ask was witnessedconfirmed, literal code matchexecution_state.rs:343-349 (authorize())
No ask ⇒ account is still spendable (fail-open), not lockedconfirmedexecution_state.rs:224 (no-op branch) + private_regular_update_without_ask_is_spendable
A tx-level signer entry does not back-stop a missing askconfirmeda_signer_entry_does_not_authorize_a_private_witness_without_ask — rejection comes from the program (auth_asserting_noop), not the engine; a bare signer entry has no effect on private-witness authorization
Authorization is only meaningful to programs that explicitly assert itconfirmedsame witness (ask: None) succeeds against noop, fails against auth_asserting_noop — the only difference is whether the program checks is_authorized
Private-PDA path (WitnessKind::Pda) is a separate scheme from ask, seed grants scoped to the callee subtreeconfirmedcircuit_io.rs:143-151, execution_state.rs:570-578 (private_seed_grant) — see finding #3

What works well

Not tested

How to re-run

# Toolchain (one-time, if not already set up — see the #507 review for the full list)
export PATH="$HOME/.risc0/bin:$HOME/.cargo/bin:$PATH"

git clone https://github.com/logos-blockchain/logos-execution-zone.git lez
cd lez
git checkout v0.3.0   # db66590ab821a4e142c211017a3866d007f6fa77

# The issue's own stated success command:
RISC0_DEV_MODE=1 cargo test --release -p lee ask
# -> 4 passed (misses 2 of the 6 cited tests — see finding #1)

# All 6 cited tests, run explicitly and exactly:
RISC0_DEV_MODE=1 cargo test --release -p lee -- --exact \
    privacy_preserving_transaction::circuit::tests::private_regular_update_without_ask_is_spendable \
    privacy_preserving_transaction::circuit::tests::a_signer_entry_does_not_authorize_a_private_witness_without_ask \
    privacy_preserving_transaction::circuit::tests::regular_update_with_wrong_ask_nsk_is_rejected \
    privacy_preserving_transaction::circuit::tests::regular_init_with_non_chaining_ask_npk_is_rejected \
    privacy_preserving_transaction::circuit::tests::auth_asserting_program_rejects_unauthorized_regular_private_account
# -> 5 passed

RISC0_DEV_MODE=1 cargo test --release -p lee_core --features test_utils -- --exact \
    execution_state::tests::duplicate_witnesses_and_unlinked_authorization_keys_are_rejected
# -> 1 passed