70 Commits

Author SHA1 Message Date
Marvin Jones
db2ef4356f test: align is_authorized with PrivateForeignInit's flipped semantics 2026-07-23 15:54:47 -04:00
Marvin Jones
a5f7197da1 fix(tests): rename leftover PrivateUnauthorized to PrivateForeignInit and regenerate fixture 2026-07-23 15:54:47 -04:00
Marvin Jones
229750f584 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.
2026-07-23 15:54:40 -04:00
Marvin Jones
b4fa27db42 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).
2026-07-23 15:54:40 -04:00
jonesmarvin8
7bc4c460a2
fix!(state_machine): reject public transactions that silently drop a d… (#625)
* fix(state_machine): reject public transactions that silently drop a declared account

ValidatedStateDiff::from_public_transaction never checked that the accounts
touched in a program's output matched the caller-declared message.account_ids
— it just folded whatever pairs the program returned into the diff. A program
(or a macro-generated dispatcher wrapping one) that silently drops an account
from both sides of its own output together stays internally consistent
(pre_states.len() == post_states.len()) and passes validate_execution's
existing checks, so the dropped account simply vanishes with no error.

Add a check after the chained-call loop: every account_id in
message.account_ids must appear in the final state_diff, or the transaction is
rejected with the new DeclaredAccountMissingFromOutput error.

Add a dropped_account test-guest program that reproduces the exact shape of
the bug (two pre_states in, one consistent (pre, post) pair out) and a
regression test proving the transaction is now rejected. Verified the test
fails with Ok(()) when the check is removed, and passes once it's restored.

* style: tighten comments and apply nightly rustfmt

Condense the explanatory comments on the new account-accounting check and the
dropped_account test guest, and fix imprecise wording (the account is dropped
from both pre_state and post_states together, not just pre_state). Also
applies cargo +nightly fmt's wrapping of the new error message.

* chore: regenerate test fixture after rebase onto dev
2026-07-23 12:09:16 -04:00
erhant
8d09ffd733 feat(sequencer): two-tier chain state and multi-sequencer support
Decentralized-sequencing foundation: a shared chain_state crate (two-tier
head/final ChainState, apply_block, AcceptOutcome, StallReason, and the
absorbed channel-consistency machinery), turn-gated block production, the
publisher follow path for adopted/orphaned/finalized peer blocks, and
persistence that keeps disk order equal to apply order under the chain lock.

Rebased onto dev after #600/#606: chain_consistency is absorbed into
chain_state, the sequencer bootstrap's verify_and_reconstruct is re-wired
onto the two-tier ChainState (reconstruction applies channel history
through the final tier and persists via the follow-path primitives), and
test fixtures adopt the SequencerSetup builder extended with
with_bedrock_signing_key.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 11:43:57 +03:00
Artem Gureev
3474b375e4 test(circuit): view_tag is derived on init, passed through on update 2026-07-22 22:31:32 +04:00
agureev
61cad70f9b feat(circuit): supply a view_tag on private-account updates 2026-07-22 22:31:31 +04:00
Pravdyvy
ba741da37b Merge branch 'dev' into Pravdyvy/multi-sequencer-client 2026-07-15 13:45:44 +03:00
Pravdyvy
ac2bf7f996 Merge branch 'dev' into Pravdyvy/multi-sequencer-client 2026-07-14 13:19:04 +03:00
Pravdyvy
bf237daf71 fix(tintegration_tests): tests work 2026-07-14 13:10:32 +03:00
Artem Gureev
8545ff1466 feat!(sequencer): serve proofs and root in one getProofsAndRoot RPC
BREAKING:

Before: An endpoint exposing getting a single proof for a commitment
existed.

After: There is one endpoint where you give a vector of commitments
and a vector of Maybe proofs back alongside the shared root.

Mitigation: Use the new rpc endpoint with the appopriate vector.
2026-07-13 13:34:03 +00:00
Pravdyvy
1615a06604 fix(wallet_ffi): tests and leading algorithm fixes 2026-07-13 15:37:25 +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
Daniil Polyakov
7408955f08 feat!(wallet): wait for deploy tx inclusion in block
Breaking:
  1. Now a lot of wallet commands return `TransactionExecuted`, instead of `Empty`.
  2. Sequencer's `getTransaction()` RPC response changed from `tx` to `(tx, block_id)`
2026-07-09 00:32:53 +03:00
agureev
bf86d0c05b Merge remote-tracking branch 'origin/dev' into artem/change-wallet-balance-fetch 2026-07-08 22:55:15 +04:00
Artem Gureev
b31aecd2c0 feat(wallet): reject length-mismatched privacy transactions 2026-07-08 18:45:27 +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
49d3823a75 chore: remove unused deps 2026-07-02 20:43:34 +04:00
agureev
8e084e22d1 Merge remote-tracking branch 'origin/dev' into artem/viewing-key-binding 2026-07-02 20:04:30 +04:00
agureev
296afdc4a3 Merge remote-tracking branch 'origin/dev' into artem/change-wallet-balance-fetch 2026-07-01 21:12:14 +04:00
Artem Gureev
6283f5e3ee refactor(state_machine): derive Default for ValidityWindow 2026-07-01 19:16:44 +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
jonesmarvin8
3b3857594f
refactor(lee::key_protocol) - cleaned up duplicated logic (#532)
* Clean up key protocol

* added test for helper function

* address comment

* chore: apply nightly fmt
2026-07-01 10:11:08 -04:00
Marvin Jones
6155bd9a37 fix(encryption): rename os_random to random_seed and fix ESK derivation in tests
Rename os_random field to random_seed per review feedback. Fix tests
that constructed SharedSecretKey with a hardcoded EphemeralSecretKey
instead of deriving it via EphemeralSecretKey::new.
2026-06-29 09:10:43 -04:00
Marvin Jones
060a83879b feat(encryption): derive esk from account state, remove chacha20poly1305 logic
Introduce EphemeralSecretKey as a proper struct with EphemeralSecretKey::new()
that derives esk from SHA256("/LEE/v0.3/esk/" || account_id || os_random || nonce).
Rename witness field from esk to os_random. Simplify encapsulate_deterministic
to accept pre-derived EphemeralSecretKey directly.
2026-06-29 09:10:43 -04:00
Sergio Chouhy
3c54bbf0b9 fix(lee): use test program in empty tx instead of authenticated tranfer 2026-06-25 14:47:22 -03:00
moudyellaz
36ed949be0 chore: some cleanup 2026-06-25 09:38:30 +02:00
Daniil Polyakov
64f8444a67
Merge pull request #524 from logos-blockchain/arjentix/refactor-lee-lez
Decouple last parts of LEZ from LEE
2026-06-24 23:46:43 +03:00
agureev
a815b50275 doc: update encapsulation documentation 2026-06-24 21:34:59 +04:00
jonesmarvin8
77af662ac6
fix: reject public transactions with empty account_ids (#552)
Closes #513
2026-06-24 13:33:51 -04:00
agureev
b31fe5e4a7 refactor: change message_hash to esk for encapsulation 2026-06-24 21:24:12 +04:00
Daniil Polyakov
96b28827f6 fix(tests): fix tests 2026-06-24 20:20:40 +03:00
agureev
01accb788c feat: add prefix to the ML KEM kdf 2026-06-24 21:17:43 +04:00
Daniil Polyakov
d3e507f25d refactor!(artifacts): keep lee and lez artifacts separated 2026-06-24 18:10:41 +03:00
moudyellaz
4fd465b529 test(cross-zone): add lock-on-A mint-on-B bridge round trip 2026-06-24 14:51:52 +02:00
moudyellaz
5d77359fd8 feat(cross-zone)!: add wrapped_token and bridge_lock programs
BREAKING CHANGE: registers the wrapped_token and bridge_lock builtin programs and seeds the wrapped_token config account at genesis, changing the genesis state.
2026-06-24 10:12:40 +02:00
agureev
f2778ea5d0 test: regenerate hardcoded values 2026-06-23 18:02:48 +04:00
agureev
128ebc0c64 tests: add vpk binding tests 2026-06-23 15:51:59 +04:00
agureev
973061e88f test: fix state test 2026-06-23 15:51:58 +04:00
agureev
090c368c14 tests: test and flow updates 2026-06-23 15:51:58 +04:00
agureev
526f9ccb32 feat(ppc)!: introduce protocol-level changes for vpk binding
BREAKING:

Before: The epk and the vpk of the receiver were not bound to the ss
that was directly fed to the circuit.

After: The ss, epk, tag fields are removed as explicit arguments
per-account and instead replaced by supplying a vpk, esk per
account. The ss, epk, tag all constructed in-circuit. Account ID
generation now uses vpk as additional argument.

Mitigation: Change Account ID generation to include the vpk, change
proving inputs.
2026-06-23 15:46:23 +04:00
agureev
10066be8e3 feat: optimize encryption computation by using slices 2026-06-23 14:54:24 +04:00
agureev
2fd8c1b157 refactor: expose ML KEM and esk in-guest 2026-06-23 14:54:03 +04:00
moudyellaz
77cfff5256 feat(cross-zone): add inbox watcher and seed inbox config at genesis 2026-06-23 10:17:46 +02:00
moudyellaz
0631ffc481 feat(cross-zone): add ping_sender and thread target_accounts through outbox emission 2026-06-22 17:55:22 +02:00
moudyellaz
42078d0305 test(cross-zone): add ping_receiver and a single-zone inbox dispatch test 2026-06-19 17:50:50 +02:00