Commit Graph
196 Commits
Author SHA1 Message Date
Marvin Jones 6b1f016aee fix(lee): address PR #733 review comments
- RESERVED_DEPLOYMENT_PROGRAM_ACCOUNT_ID: restore the SHA256 derivation
  docstring that explains the constant instead of leaving it as an opaque
  byte array, and switch the array itself to a hex literal (hex-literal,
  already a workspace dependency) for readability.
- Rename the loader/loader_core crate to program_loader/program_loader_core
  to disambiguate it, across the directory, package name, workspace
  members/dependency alias, both dependent crates, and every call site.
2026-08-22 17:39:23 -04:00
Marvin Jones bef0edf294 docs(lee): correct the chain-called Deploy limitation's root cause
The AccountId migration (marvin/program-as-account-3-1) fixed dispatch
locating a Deploy-created PDA-addressed program, but that was never
what blocked this test: the forwarder exhausts its 32M public-execution
cycle budget just carrying the target bytecode through its own
instruction_data before dispatch's addressing even matters. Chain-called
Deploy needs a mechanism where bytecode reaches Deploy without being
copied through an intermediary guest's interpreted execution, deferred
to a future PR. Deploy as the top-level entry point, natively emitting
its own follow-up chained calls after deploying, is the supported
pattern today.
2026-08-22 17:39:23 -04:00
Marvin Jones c9510be3ef fix(lee): fix post-rebase fallout after rebasing onto marvin/program-as-account-3-1
chained_call_forwarder.rs and the deploy tests in sequencer_core were
added on top of the pre-migration ProgramId-typed ChainedCall/Message/
ProgramInput/ProgramOutput API and didn't conflict during the rebase
since they're new code, so they needed the same field rename/.into()
treatment already applied everywhere else on -3-1.
2026-08-22 17:39:23 -04:00
Marvin Jones 5470a881e5 test(lee): add Deploy validation-failure and chained-call coverage
Adds tests for the remaining execute_deploy failure modes (invalid
bytecode, wrong target account, wrong number of accounts) and a
generic chained_call_forwarder test guest to exercise Deploy invoked
via a chained call rather than only top-level.

The chained-call test is #[ignore]d: it surfaces a real limitation,
not a bug in the test. The forwarding program has to carry the
deployed bytecode through its own instruction_data to build the
chained call, which blows the interpreted 32M-cycle public-execution
cap for any realistically-sized program — the native Deploy fast-path
only covers the loader's own execution, not the caller's. Root cause
is ChainedCall/Message still referencing programs by ProgramId rather
than AccountId, which also means dispatch can't locate a
Deploy-created (PDA-addressed) program at all. Tracked for
marvin/program-as-account-3-1.
2026-08-22 17:39:23 -04:00
Marvin Jones d81ea687ca refactor(lee): drop the loader guest binary, native-only Deploy
Deploy is not intended to ever run privately, and public dispatch
already always takes the native fast-path for it, so the guest ELF
had no real execution path left. Removes lez/programs/loader's guest
binary crate, its [[bin]] wiring, programs::loader(), and the
now-pointless guest-vs-native equivalence test along with the
test-only Program::execute_for_test it depended on.

loader_core (Instruction, ProgramData, execute_deploy) stays — native
dispatch still calls it directly. Deploy is now honestly just native
dispatch logic with a program-shaped interface, not a program with a
guest binary nobody executes.
2026-08-22 17:39:23 -04:00
Marvin Jones dcc0c4b950 feat(lee): add loader program with native Deploy dispatch fast-path
Introduces a new loader_program/loader_core crate pair implementing a
Deploy instruction that claims a program's ProgramData PDA account
(image_id, segment_number, update_auth, elf_segment), unifying
deployment with ordinary PublicTransaction dispatch instead of the
separate ProgramDeploymentTransaction path.

Measured against every real program in this repo, computing a
program's image_id inside the zkVM costs ~1,400-1,500 cycles per byte
of deployed bytecode, pushing real deployments to 500M-900M cycles
against the 32M public-execution cap (vs. ~27ms natively, since
ProgramDeploymentTransaction's equivalent check runs as a plain host
function today). To keep the unified dispatch path viable, Deploy is
special-cased in from_public_transaction: calls targeting the reserved
RESERVED_DEPLOYMENT_PROGRAM_ACCOUNT_ID run loader_core::execute_deploy
natively instead of through the interpreted guest executor, wrapped in
catch_unwind since the shared execute_deploy logic validates via
assert!/expect() like every other guest program, relying on that
boundary instead of the zkVM's own panic-to-Result conversion.

The loader guest binary is kept buildable and covered by a test that
runs it for real and asserts its output matches the native path
exactly, so the two can't silently drift apart.
2026-08-22 17:39:13 -04:00
Marvin Jones 35ca054a1d fix(lee): apply self/caller AccountId migration to code added after rebase
dev grew new self_program_id/caller_program_id and ChainedCall.program_id
call sites (sequencer_stake's rewritten main.rs, gossip validation,
cross_zone's shared ping_emission test helper, and three guest test
programs) after this branch's ProgramId->AccountId migration commits
were originally written, so they predated the self_account_id/
caller_account_id/program_account_id rename and didn't conflict during
the rebase - they just still assumed the old ProgramId-typed fields.
Converts all of them, recovering ProgramId via the existing bijection
only where the RISC0 image id is actually needed, and rebuilds
artifacts against the fixed source.
2026-08-22 16:58:50 -04:00
Marvin Jones b9152f58c0 refactor(lee): migrate ChainedCall/Message program reference from ProgramId to AccountId
Chained-call and public-transaction dispatch now address the target
program directly by AccountId instead of routing through ProgramId and
converting internally, closing the gap that blocked PDA-addressed
program invocation. The field is named program_account_id (not
account_id) to stay unambiguous next to the account_ids list it sits
beside in the same structs.

Execution/PDA-derivation logic that fundamentally needs the RISC0 image
id (self_program_id, caller_program_id, env::verify, PDA seed
derivation) stays ProgramId-typed, recovering it from the dispatched
AccountId via the existing bijection where needed.
2026-08-22 16:58:27 -04:00
Sergio Chouhy cade003868 fix(lez/sequencer): use slot to track finalized config ops 2026-08-21 11:33:01 -03:00
Sergio Chouhy c1644a8cc5 feat(sequencer): implement sequencer join/exit queues 2026-08-21 11:32:31 -03:00
7dac077487 test: add cucumber environment with initial ported integration tests (#741)
This PR introduces the initial Cucumber-based integration test framework for the LEZ, building on the testing-framework integration work started by @andrussal, adds the first set of Cucumber integration scenarios and establishes reusable infrastructure for future Cucumber scenarios.

---------

Co-authored-by: Andrus Salumets <salumets.andrus@gmail.com>
Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com>
Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
Co-authored-by: Roman <zajic@zajic.net>
Co-authored-by: Daniil Polyakov <arjentix@gmail.com>
Co-authored-by: Moudy <m.ellaz@hotmail.com>
Co-authored-by: andrussal <salumets.andrus@gmail.com>
2026-08-20 21:15:05 +02:00
moudyellaz 2d7dbf4d85 Merge remote-tracking branch 'origin/dev' into moudy/cross-zone-halt-operability
# Conflicts:
#	artifacts/lez/programs/cross_zone_inbox.bin
#	artifacts/lez/programs/ping_receiver.bin
#	artifacts/lez/programs/wrapped_token.bin
#	test_fixtures/fixtures/prebuilt_sequencer_db.dump
2026-08-20 12:13:50 +02:00
moudyellaz cbdb5e7646 Merge remote-tracking branch 'origin/dev' into moudy/cross-zone-target-auth
# Conflicts:
#	test_fixtures/fixtures/prebuilt_sequencer_db.dump
2026-08-20 02:37:25 +02:00
moudyellaz 968a17f867 Merge remote-tracking branch 'origin/dev' into moudy/cross-zone-target-auth
# Conflicts:
#	Cargo.lock
#	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-19 23:40:53 +02:00
Daniil Polyakov 578350beea refactor(sequencer, storage): move transaction index into StorageActor 2026-08-20 00:37:23 +03:00
Daniil Polyakov 6290f09127 fix(executor): make GetBlockRange bounded, non-over-allocating and non-blocking 2026-08-20 00:37:23 +03:00
Daniil Polyakov 7249f2f881 refactor(sequencer): actor architecture, phase 2: Storage Actor 2026-08-20 00:37:23 +03:00
moudyellaz 7c9d9dac10 Merge remote-tracking branch 'origin/dev' into moudy/pending-dispatch-per-key
# Conflicts:
#	lez/sequencer/core/src/cross_zone_watcher.rs
2026-08-19 01:59:01 +02:00
moudyellaz aeb71b73ad test(cross_zone): cover multi-key acceptance at every enforcement site 2026-08-18 18:20:49 +02:00
moudyellaz 4309c2a214 feat(cross_zone)!: accept peer blocks signed by any key in a configured set
BREAKING CHANGE: CrossZonePeer.expected_block_signing_pubkey (single optional
key) is renamed to expected_block_signing_pubkeys (a list, empty = unchecked),
and cross-zone config now refuses unknown fields at startup.
2026-08-18 18:06:25 +02:00
jonesmarvin8andClaude Sonnet 5 2ba1ecd609 refactor!(lee): Change program_owner: ProgramId to AccountId (#722)
* feat(lee): store deployed programs as Account-shaped state, keyed by AccountId

Program-as-Account migration, first slice: V03State.programs becomes
HashMap<AccountId, Account> instead of HashMap<ProgramId, Program>,
with the elf held directly in Account.data. The map key is derived
from ProgramId via a new 1:1 From<ProgramId> for AccountId conversion
(both types are exactly 32 bytes) rather than a hash, since ProgramId
is already content-derived from the elf.

Account.program_owner stays ProgramId-typed everywhere - this only
changes how deployed programs are stored and looked up host-side, not
the dispatch/authorization model any guest program logic depends on.
Dispatch resolves a ChainedCall's program_id by converting to
AccountId, fetching the Account, and reconstructing a Program via
new_unchecked for execution.

DATA_MAX_LENGTH is raised from 100 KiB to 700 KiB to fit real program
elfs (observed 375 KB-631 KB) directly in Account.data; noted in its
docstring as a rough placeholder pending real transaction/block-size
budget analysis.

* fix(lee): store deployed programs as Account-shaped state, correct SeenShard cap

Corrects lee/state_machine internals for the Program-as-Account migration
and fixes SeenShard::MAX_DELIVERIES, which was still calibrated for the
old 100 KiB DATA_MAX_LENGTH instead of the current 700 KiB cap. Rebuilds
program artifacts and the sequencer test fixture to match.

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

* address PR #720 review nits

- Use FIXME instead of TODO for the temporary ProgramId->AccountId
  conversion, per review convention for patches guaranteed to be
  fixed later.
- Derive cross_zone_inbox's MAX_DELIVERIES from DATA_MAX_LENGTH
  instead of a hand-recomputed literal, so it stays in sync
  automatically the next time the cap changes.

* feat(lee): migrate Account.program_owner from ProgramId to AccountId

Account.program_owner is now AccountId-typed instead of ProgramId,
via a new bijective From<ProgramId> for AccountId / From<AccountId>
for ProgramId conversion pair (pure byte reinterpretation, not a
hash - both types are exactly 32 bytes). Adds DEFAULT_PROGRAM_OWNER
as the AccountId-typed counterpart to DEFAULT_PROGRAM_ID, used at
every program_owner comparison/claim site instead of an inline
AccountId::default().

Touches every call site across lee_core, lee (including the
guest-side privacy-preserving circuit), all 16 deployed guest
programs, wallet/wallet-ffi, indexer_ffi/indexer_service/
indexer_service_protocol, sequencer_core, testnet_initial_state,
system_accounts, cross_zone, storage, cycle_bench, and
integration_tests - mostly mechanical .into() conversions, plus two
simplifications: wallet's manual base58 encode/decode of
program_owner was dead code once it's AccountId (which already has
Display/FromStr), and the FFI crates' program_owner field now reuses
the existing generic FfiBytes32 wrapper instead of the now-unused
FfiProgramId one.

Rebuilds every guest ELF artifact and the prebuilt sequencer test
fixture via just build-artifacts, since execute_and_prove runs
against the checked-in precompiled privacy_preserving_circuit.bin,
which isn't rebuilt automatically by cargo test/check.

* chore(lee): rebuild artifacts after rebase, drop unused base58 dep

Rebases marvin/program-as-account-2 onto the updated
marvin/program-as-account (SeenShard cap fix), regenerating program
and circuit artifacts plus the sequencer test fixture to match.
Also removes lez/wallet's now-unused base58 dependency, dead since
AccountId gained its own Display/FromStr base58 encoding.

* docs(lee): trim DEFAULT_PROGRAM_OWNER and From<AccountId> for ProgramId docs

* test(lee): add known-answer tests for ProgramId/AccountId conversion, rebuild artifacts

* fix(lee): apply program_owner AccountId migration to code added after rebase

dev grew new program_owner call sites (sequencer_stake genesis/config
handling, committee_discovery, a new selective_pda_delegator test
program, and related tests) after this branch's ProgramId->AccountId
migration commit was originally written, so they predated the .into()
sweep and didn't conflict during the rebase - they just still assumed
the old ProgramId-typed field. Converts all of them, fixes a stray
unseparated hex literal clippy caught along the way, and rebuilds
artifacts against the fixed source.

* chore(lee): regenerate test fixture after rebasing onto dev

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:26:57 -04:00
Moudy 3e1412ee6a Merge pull request #721 from logos-blockchain/moudy/cross-zone-shared-acceptance
fix(cross-zone): one peer-block acceptance policy for watcher and verifier
2026-08-18 00:33:09 +02:00
moudyellaz 54c834a16c test(sequencer): sort inside recorded_keys instead of a helper 2026-08-16 22:26:41 +02:00
Sergio Chouhy 0332c84ee6 refactor(sequencer): rename produce_new_block to run_production_turn 2026-08-13 18:48:27 -03:00
Sergio Chouhy 6c60012dd9 refactor(sequencer)!: move the stake signing key to a file 2026-08-13 18:47:50 -03:00
Sergio Chouhy 96832310d1 refactor(sequencer_stake)!: use a sequencer key type that verifies correctness on deserialization 2026-08-13 18:47:50 -03:00
Sergio Chouhy 0633c17c5c refactor(lez/sequencer): config submission cooldown is expressed in bedrock slots instead of time 2026-08-13 18:47:50 -03:00
Sergio Chouhy b1eb69322c fix(integration_tests): multi sequencer now builds the state with two accredited keys from channel creation 2026-08-13 18:47:50 -03:00
Sergio Chouhy be81184028 fix(lez): sequencer refuses to submit a channel config update with empty accredited_keys 2026-08-13 18:47:50 -03:00
Sergio Chouhy 818bcb066d refactor(lez): sequencer retries on startup when bedrock is unreachable 2026-08-13 18:47:50 -03:00
Sergio Chouhy 17b49f5a94 fix: verify l1 key in-guest 2026-08-13 18:47:50 -03:00
Sergio Chouhy 05f481ddb6 fix(lez): bump bedrock and remove hotfix for zone-sdk signing channel config bug 2026-08-13 18:47:50 -03:00
Sergio Chouhy 1fd81a7889 fix(lez)!: first sequencer stake ownership account on genesis block 2026-08-13 18:47:50 -03:00
Sergio Chouhy 39d19151ba add sequencer script to join/leave 2026-08-13 18:47:50 -03:00
Sergio Chouhy cf875398ef fix(lez): bootstrapping behavior depends on Bedrock channel existance 2026-08-13 18:47:23 -03:00
erhant a99112aa8f feat(lez): implement self-join/leave mechanism 2026-08-13 18:47:23 -03:00
moudyellaz 5b87891230 feat(cross-zone): extract one peer-block acceptance policy and adopt it in the watcher 2026-08-13 21:46:19 +02:00
erhant 5171a30552 chore(sequencer): add FIXME comment about unsecured key to bytes [skip ci] 2026-08-13 21:42:27 +03:00
erhant 0203b8c55f test(sequencer): gossip end-to-end integration test 2026-08-13 21:02:07 +03:00
erhant bc2302b19b fix(sequencer): retry gossip bootstrap and requeue failed publishes 2026-08-13 19:33:45 +03:00
erhantandClaude Fable 5 ebe4123386 Merge remote-tracking branch 'origin/dev' into erhant/sequencer-gossip
Resolves the actors-refactor (#691) collision: gossip now starts in
sequencer_service::run() after ExecutorActor construction (which exposes
its mempool handle), and the RPC-side publish hook threads through
RpcServerActor::new into the actor's Service.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 19:04:09 +03:00
moudyellaz b9173e675f Merge remote-tracking branch 'origin/dev' into moudy/cross-zone-outbox-log
# Conflicts:
#	test_fixtures/fixtures/prebuilt_sequencer_db.dump
#	tools/cross_zone_chat/src/main.rs
2026-08-13 09:35:37 +02:00
moudyellaz dc2d8ac93f fix(storage): store pending cross-zone dispatches as per-message entries 2026-08-13 09:06:52 +02:00
Pravdyvy f0861d2497 Merge branch 'dev' into Pravdyvy/multi-sequencer-integration-tests 2026-08-13 04:10:13 +03:00
Daniil Polyakov 6af1bf6cd0 fix(rpc_server): remove useless features 2026-08-13 00:13:05 +03:00
Daniil Polyakov 53295db71c refactor(sequencer): move common actor logic into ActorHandle 2026-08-12 23:40:07 +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
Daniil Polyakov a4fa9e08e2 fix(sequencer): fixes after rebase 2026-08-12 23:00:22 +03:00
Daniil Polyakov 774c8167f3 chore(sequencer): remove useless long comment 2026-08-12 22:50:50 +03:00
Daniil Polyakov c75eecc0fb refactor(rpc_server): move service into actor submodule 2026-08-12 22:50:50 +03:00