Commit Graph
44 Commits
Author SHA1 Message Date
Marvin Jones 4c65fd0dd3 docs(lee): trim comments in PR3 diff, rebuild artifacts
Cut duplicated/wordy comments introduced across the PR3 rebase to a
single canonical explanation each, remove stray "see X" pointers in
favor of self-contained comments, and drop a task-label reference.
Rebuild every guest ELF/program artifact and the prebuilt sequencer
fixture to match (comments don't affect codegen, but keeping the
artifacts freshly rebuilt after each source touch).
2026-08-22 14:27:26 -04:00
Marvin JonesandClaude Sonnet 5 75f2d7648a chore(lee,lez): rebuild artifacts, fix fmt/clippy, update tests after rebase onto incremental-updates-2
Rebuild every guest ELF, program artifact, and the prebuilt sequencer
fixture from the final rebased source (the carried-over v2-v2 binaries
were stale, causing amm_program guest-execution deserialization
failures).

Fix the one post-rebase fmt violation and one clippy
too_many_arguments finding (authorize_first_sight_without_pda_witness
gained is_public/is_signer params during the rebase merge).

Update three pre-existing state::tests::circuit tests that predate
PR3 on this branch and exercised behavior the rebased signer-set
check now correctly rejects: unbacked self-declared authorization on
a first-sighted public account. Two are flipped into regression pins
for that forgery; the third (already trimmed of its now-removed
journal-export assertion) is left as a success-path check.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 12:23:10 -04:00
Marvin Jones 6ed4ad8957 feat(lee): remove public_pre_states from privacy-preserving circuit output
Public accounts' pre-transaction values no longer need to be part of the
circuit's proven public output. Materialization already replays
public_diffs against live sequencer state, never the witnessed
pre-state, and proof-internal consistency has nothing left to check
once the field isn't part of the output at all. Duplicate/inconsistent
witnessing was already structurally impossible via the circuit's own
post_states tracking, independent of whether pre_state was exported, so
no new in-circuit assertion is needed to compensate.

Drop the field from PrivacyPreservingCircuitOutput and Message;
reimplement Message::public_account_ids() from deduped public_diffs
account ids. Update every downstream mirror (indexer protocol/FFI,
explorer UI, mock service) to the same id-only shape, and rebuild the
guest ELF, program artifacts, and prebuilt sequencer fixture to match
the changed journal layout.
2026-08-22 11:41:07 -04:00
Marvin Jones 58cc795ae8 docs(lee): trim/dedup docstrings introduced in PR3, fix clippy debt
Trim the signer_account_ids/PublicDiff explanation down to one canonical
location per concept instead of restating it at every call site, drop
dangling "See X" pointers in favor of letting readers look up the code
directly, and shorten the two malicious-victim test docstrings that
re-derived the same mechanism already covered elsewhere.

Separately, fix pre-existing clippy debt that was hidden behind compile
errors in the two guest binaries clippy could originally reach:
- update_from_diff implementations across most lez/programs/* guests,
  test_methods_guests, test_programs/guest, and the program_deployment
  examples returned Result<Data, Infallible> for no reason; now return
  Data directly.
- unchanged(...) helpers made const fn.
- Program::execute_update_from_diff/prove_update_from_diff took Account/Data
  by value without consuming them; now take references, dropping the
  now-unnecessary clones at every call site.
- One redundant clone, one redundant closure, one large enum variant
  (TxEvaluation::Accept now boxes its LeeTransaction), and four
  if-let/else patterns simplified to map_or_else/bool::then in the
  indexer FFI's AccountDiff/Claim conversions.

Rebuild every affected guest artifact and the prebuilt test fixture.
2026-08-22 11:37:57 -04:00
Marvin Jones c010843a6a feat(lee): decouple privacy proof verification from live public state (incremental update PR3)
The privacy-preserving circuit's output no longer commits materialized
public-account post-states; it commits the raw AccountDiffs it produced
instead, plus a signer_account_ids set the sequencer cross-checks
against real signatures. Proof verification now checks the proof
against exactly what the circuit witnessed, with no dependency on live
sequencer state, fixing the race condition where an unrelated public
transaction landing between proving and validation would invalidate an
otherwise-valid proof. Materialization moves to a separate step that
replays public_diffs against whatever the live account state actually
is at apply time, mirroring how the public-transaction path already
applies diffs.

Also updates lez/indexer and lez/explorer_service for the new Message
shape, and fixes the pre-existing clippy debt this surfaced across
lez/programs (needless_pass_by_value/missing_const_for_fn/etc.) now
that the workspace builds and lints clean end to end.
2026-08-22 11:32:22 -04:00
Marvin Jones 15dbd6f1a6 chore(lez,lee): fix clippy pedantic/nursery/restriction findings
Resolves needless_pass_by_value (take AccountWithMetadata/Account by
reference where only borrowed), unnecessary_wraps (drop Result<Data,
Infallible> from passthrough update_from_diff implementations),
missing_const_for_fn, useless_let_if_seq, arbitrary_source_item_ordering,
too_many_arguments, redundant_clone, and useless_conversion across the
guest programs and lee core touched by the incremental-updates rebase.
2026-08-22 02:03:43 -04:00
Marvin Jones e43611c7cc feat(lee): wire programs to diff-native execution (incremental update PR2)
Programs now report AccountDiff/AccountDiffOutput instead of full
post-states; balance changes are applied via apply_balance_diff's
checked arithmetic at the protocol level rather than checked in-guest,
and data changes are materialized through a new update_from_diff
guest entrypoint (trusted execution for public transactions, proven
via a recursive receipt for the privacy-preserving circuit). All 15
production programs and test/example guest programs are converted;
attack-surface guest programs that are now structurally impossible
(nonce/program_owner mutation) or redundant (manual balance-sufficiency
bypass) are moved to a dormant/ directory rather than deleted outright.
2026-08-22 01:15:25 -04:00
Marvin Jones 3e7d2be961 fix(lee): clarify UpdateFromDiffOutput docs, drop needless clones, rebuild artifacts
UpdateFromDiffOutput's docstring didn't make clear that this journal is
never the privacy-preserving circuit's own output — it's a separate
program's inner receipt, reconstructed and checked via env::verify, then
discarded. Clarify that, and trim the rest of the comment down.

write_update_from_diff_output took its inputs by reference and cloned
them to build the owned UpdateFromDiffOutput it commits. It has no
callers yet on this branch and nothing else needs the values afterward,
so take them by value and move them in instead.

Rebuild every guest artifact and the prebuilt sequencer fixture: they
were stale relative to this branch's own committed source (confirmed via
mtimes — most of lee_core and every touched program's source postdated
the checked-in .bin files), causing spurious DeserializeBadBool failures
for anyone running tests against a fresh checkout without first running
`just build-artifacts`.
2026-08-21 23:40:07 -04:00
Marvin Jones a7ceef3879 chore(lee,lez): bump h2 to fix RUSTSEC-2026-0258, run cargo fmt, rebuild artifacts
h2 0.4.14 had an unbounded empty DATA frames flaw (low severity); bumped to
0.4.18 via cargo update -p h2. cargo deny check now passes clean
(advisories/bans/licenses/sources all ok).

Rebuild every guest artifact and the prebuilt test fixture to match the
dependency bump.
2026-08-20 22:16:18 -04:00
jonesmarvin8andClaude Sonnet 5 2a7a586a59 refactor(key-protocol)!: introduce constitent domain separators for key protocol (#717)
* feat(key_protocol): version-independent domain separators for normal keys

Introduce a /LEE-Keys/v1/... namespace for account key derivation
(private and public), distinct from LEE protocol versioning
(/LEE/v0.3/...). This lets the key derivation protocol evolve
independently of the transaction/message format version, so a LEE
version bump doesn't silently rotate or orphan user keys.

Covers master/child private and public key derivation, authorization
and viewing secret keys, and nullifier secret/public key derivation
(the latter also used by the privacy-preserving guest circuit).
Pinned regression tests updated to match the new derivation outputs.

* chore(artifacts): rebuild guest ELFs and test fixture for key protocol change

Regenerated via just build-artifacts after the /LEE-Keys/v1/... domain
separator migration touched lee_core::nullifier, which every guest
program links against, and changed derived account IDs embedded in
the prebuilt sequencer fixture.

* test(testnet_initial_state): update pinned private-account values for new key domain separators

initial_priv_accounts_private_keys() derives from fixed SSK roots
through the key_protocol chain the /LEE-Keys/v1/... migration changed,
so the derived viewing secret keys and account addresses shifted even
though the SSK roots themselves didn't. Public account addresses are
unaffected since they sign with a raw PrivateKey outside this chain.

* chore(artifacts): rebuild guest ELFs and test fixture after dev rebase

The rebase onto dev conflicted on these binaries (dev had independently
rebuilt them since this branch diverged). Conflicts were resolved
provisionally during the rebase and are now replaced with a fresh
build-artifacts run against the fully merged tree.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 10:08:12 -04:00
Sergio Chouhy 0332c84ee6 refactor(sequencer): rename produce_new_block to run_production_turn 2026-08-13 18:48:27 -03:00
moudyellaz ae3fd849e3 Merge remote-tracking branch 'origin/dev' into moudy/cross-zone-outbox-log
# Conflicts:
#	artifacts/lez/programs/amm.bin
#	artifacts/lez/programs/associated_token_account.bin
#	artifacts/lez/programs/authenticated_transfer.bin
#	artifacts/lez/programs/bridge.bin
#	artifacts/lez/programs/bridge_lock.bin
#	artifacts/lez/programs/clock.bin
#	artifacts/lez/programs/cross_zone_inbox.bin
#	artifacts/lez/programs/cross_zone_outbox.bin
#	artifacts/lez/programs/faucet.bin
#	artifacts/lez/programs/pinata.bin
#	artifacts/lez/programs/pinata_token.bin
#	artifacts/lez/programs/ping_receiver.bin
#	artifacts/lez/programs/ping_sender.bin
#	artifacts/lez/programs/token.bin
#	artifacts/lez/programs/vault.bin
#	artifacts/lez/programs/wrapped_token.bin
#	test_fixtures/fixtures/prebuilt_sequencer_db.dump
2026-08-12 22:37:45 +02:00
moudyellaz 869a130eec chore: regenerate artifacts and the prebuilt sequencer fixture
Every guest moved, not only the ones whose source changed: adding real
dependencies (borsh to two cores, cross_zone_inbox_core to two targets) changes
the build graph, and with it the metadata hash of every crate in the guest build.
Piece A moved only three because it added a dev-dependency, which the guest build
never sees.
2026-08-10 15:01:26 +02:00
agureev 736102329f chore: regenerate artifacts 2026-08-07 15:51:00 +04:00
agureev d05035eb9e refactor(lee): refactor private kinds 2026-08-04 15:55:09 +04:00
agureev ccb426960f Merge remote-tracking branch 'origin/dev' into artem/bundle-actions 2026-08-04 14:21:00 +04:00
Daniil Polyakov 2c9c824a0c chore(artifacts): regenerate artifacts with r0.1.91.1 risc0 docker container 2026-07-31 18:26:34 +03:00
Sergio Chouhy 2f42a7b119 fix(nix): update flake nix to add pcsclite 2026-07-30 22:24:18 -03:00
agureev 0e957b5c08 chore: docs for PrivateAction commitment field 2026-07-31 00:47:04 +04:00
agureev dbcdbb29f3 Merge remote-tracking branch 'origin/dev' into artem/bundle-actions 2026-07-31 00:16:31 +04:00
erhant 6203d65131 chore: update artifacts 2026-07-30 14:41:42 +03:00
agureev 846e1944bf chore: regenerate fixtures 2026-07-29 22:53:21 +04:00
Artem Gureev f16c3bd1e2 refactor: bundle private/public i/o into action struccts 2026-07-29 18:16:13 +00:00
agureev b5d5d862af chore: regenerate artifacts 2026-07-28 16:14:06 +04:00
agureev 8cebe109fe chore: regen artifacts, fixtures 2026-07-28 11:13:47 +00:00
agureev a4805382bd chore: format, regenerate artifacts and fixtures 2026-07-28 11:12:52 +00:00
agureev df13f3f17d chore: regenerate artifacts 2026-07-24 21:48:24 +04:00
agureev 2ed620097b chore: regenerate artifacts and fixtures 2026-07-24 16:38:04 +00:00
agureev 93b1ee2839 chore: regenerate artifacts and fixtures 2026-07-24 16:38:04 +00:00
jonesmarvin8andClaude Sonnet 5 6c0bd71523 refactor: PrivateUnauthorized authorization changed to true (#621)
* refactor: rename PrivateUnauthorized to PrivateForeignInit

The account_identity's is_authorized flag no longer determines
authorization for this variant, so keep the name tied to what
actually distinguishes it: no nsk, only npk (a foreign account init).

* chore: rebuild guest artifacts and bump spin to clear yanked advisory

Regenerate ELF artifacts after the PrivateForeignInit rename in lee_core
(compiled into every guest program), and update spin 0.9.8 -> 0.9.9 since
0.9.8 was yanked from crates.io, per cargo deny check advisories.

* test: align is_authorized with PrivateForeignInit's flipped semantics

Recipient pre-states built for PrivateForeignInit now need is_authorized:
true to match the assertion in output.rs. Also rewrites the boundary test
that checked the old invalid case to check the new one, and updates
stale "unauthorized" wording left over from the PrivateUnauthorized name.

* chore: rebuild guest artifacts

Reproducible across repeated local builds; likely toolchain drift since
the prior artifact commit rather than a source change, since no
guest-relevant source or Cargo.lock changed in between.

* fix(tests): align integration tests with PrivateForeignInit and regenerate fixture

prove_init_with_commitment_root (private.rs) and build_privacy_transaction
(tps.rs) still built PrivateForeignInit recipients with is_authorized: false,
same stale-semantics bug fixed earlier in the lee crate's own tests.

The prebuilt sequencer DB dump embeds program IDs derived from guest ELF
bytes, which shifted once the PrivateForeignInit rename changed lee_core
(compiled into every guest program). The stale dump caused widespread
"Unknown program" failures across integration test suites that exercise
deployed programs (wallet_ffi, auth_transfer, bridge, amm, token, pinata,
ata, indexer state-consistency checks). Regenerated via
`just regenerate-test-fixture`.

* fix(tests): rename leftover PrivateUnauthorized to PrivateForeignInit and regenerate fixture

* test: align is_authorized with PrivateForeignInit's flipped semantics

* chore: regenerate test fixture after rebase onto dev

* chore: regenerate test fixture after rebase onto dev

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 17:32:01 -04:00
agureev 61cad70f9b feat(circuit): supply a view_tag on private-account updates 2026-07-22 22:31:31 +04:00
Pravdyvy 7cc094f3a4 fix(ci): fixtures and artifacts 2026-07-15 15:01:47 +03:00
agureev ae391612bd Merge remote-tracking branch 'origin/dev' into artem/change-wallet-balance-fetch 2026-07-13 15:19:06 +04:00
moudyellaz eff31df9ce Merge origin/dev 2026-07-11 01:12:00 +02:00
agureev bf86d0c05b Merge remote-tracking branch 'origin/dev' into artem/change-wallet-balance-fetch 2026-07-08 22:55:15 +04:00
moudyellaz 9f7db3fa38 Merge origin/dev 2026-07-04 00:48:40 +02:00
moudyellaz 4f75e29a3c Merge origin/main
Integrates origin/main (per-program-crate refactor) and re-homes the cross-zone messaging feature onto it.

BREAKING CHANGE: Genesis state root changes. This registers six builtin programs
(cross_zone_outbox, cross_zone_inbox, ping_sender, ping_receiver, bridge_lock,
wrapped_token) and seeds their genesis accounts (the wrapped_token authorized
minter config, the per-zone inbox config, and optional bridge-lock holdings).
Building the new cores alongside the existing builtins also enables serde/alloc
for the shared programs build, regenerating every builtin program image id. All
nodes must upgrade together.
2026-07-04 00:47:20 +02:00
agureev 8e084e22d1 Merge remote-tracking branch 'origin/dev' into artem/viewing-key-binding 2026-07-02 20:04:30 +04:00
agureev 37b0108c43 chore: update artifacts 2026-07-01 21:57:07 +04:00
jonesmarvin8 072ea3b066 refactor(lee::state_machine): clean up long functions and files (#535)
* refactor(lee): split large modules into directories and extract tests

Split state.rs, program.rs, circuit.rs, validated_state_diff.rs,
merkle_tree, and core/program.rs into module directories with separate
test files. State tests are further split into themed files (genesis,
authenticated_transfer, circuit, claiming, etc.). Extract
authenticate_public_transaction_signers helper in validated_state_diff
to remove duplicated authentication logic.

* chore: rebuild artifacts
2026-07-01 11:11:08 -04:00
jonesmarvin8 f8d859394b refactor(privacy_preserving_circuit): introduce helper functions to shorten long functions (#545)
* refactor(privacy_preserving_circuit): extract functions for readability

* refactor(privacy_preserving_circuit): address PR review comments

Bundle shared handle_* arguments into PrivateOutputHandler struct in
output.rs and fix misplaced docstring on resolve_external_seed in
execution_state.rs.

* feat: update commitment mechanism for new private account (#546)

* refactor(privacy_preserving_circuit): extract functions for readability

* feat: update commitment mechanism for new private accounts

Allow init accounts to optionally use a real membership proof for
DUMMY_COMMITMENT instead of hardcoding DUMMY_COMMITMENT_HASH as the
CommitmentSetDigest. The wallet fetches the proof from the sequencer
and passes it through the circuit.

* fix: address clippy lints and fix integration test visibility

* add tests

* refactor: removed duplicated code

* refactor: simplify init nullifier mechanism

Replace Option<MembershipProof> with Option<CommitmentSetDigest> on init
variants (PrivateAuthorizedInit, PrivateUnauthorized, PrivatePdaInit).
The circuit now receives the commitment tree root directly instead of
recomputing it from a Merkle proof.

* refactor: use CommitmentSetDigest directly instead of Option for init commitment root

Address PR #546 review feedback: the circuit now accepts CommitmentSetDigest
directly on init variants (PrivateAuthorizedInit, PrivateUnauthorized,
PrivatePdaInit), with callers providing DUMMY_COMMITMENT_HASH as the default.
Also fixes duplicate resolve_external_seed from rebase and rebuilds artifacts.

* style: run cargo +nightly fmt
2026-07-01 10:14:32 -04:00
Daniil Polyakov e428a6df71 chore(lock): update anyhow to 1.0.103 to satisfy cargo deny 2026-06-30 13:02:17 +03:00
Daniil Polyakov 9977cc5374 fix(ci, programs, privacy_preserving_circuit): properly check programs ci 2026-06-24 20:20:40 +03:00
Daniil Polyakov d3e507f25d refactor!(artifacts): keep lee and lez artifacts separated 2026-06-24 18:10:41 +03:00