Commit Graph
45 Commits
Author SHA1 Message Date
Artem Gureev 695ebf439d chore: prune unused serde/risc0-zkvm deps after borsh migration 2026-08-23 09:35:41 +00:00
agureev cf36a7dec9 chore: fmt + artifacts 2026-08-23 09:35:41 +00:00
Artem Gureev 12dabb9341 refactor: rename remaining instruction_words to instruction_data across programs, tests, tools, ffi 2026-08-23 09:35:41 +00:00
Artem Gureev 3213cd18ce refactor(lez): rename instruction_words to instruction_data across cross-zone programs 2026-08-23 09:35:23 +00:00
Artem Gureev 1804283d8f refactor(lez): make program-core config types borsh-only 2026-08-23 09:35:23 +00:00
Artem Gureev 5a393d2bff refactor!: carry zkVM instruction_data as borsh bytes end-to-end 2026-08-23 09:35:23 +00:00
Artem Gureev 0560270146 chore(programs): derive borsh on program-core instruction types 2026-08-23 09:13:07 +00: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 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
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
jonesmarvin8andClaude Sonnet 5 d52c76e2b5 refactor(lee): change programs shape (#720)
* 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.

* chore: regenerate artifacts after rebasing onto dev

Binary program artifacts and the prebuilt sequencer DB dump were left
as rebase-conflict placeholders; regenerated via `just build-artifacts`
against the fully rebased source.

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 10:06:42 -04:00
moudyellaz 073c9baa2d perf(lez)!: borrow account data in the guests instead of cloning
BREAKING CHANGE: six guest image ids move.
2026-08-16 23:41:00 +02: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 fa3720ee56 refactor(sequencer_stake)use the vacant/occupied pattern in the stake function 2026-08-13 18:47:50 -03:00
Sergio Chouhy 0ec811b0fc chore: add lints to sequencer_stake 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
erhant a99112aa8f feat(lez): implement self-join/leave mechanism 2026-08-13 18:47:23 -03:00
moudyellaz 44acb4ba73 feat(cross-zone)!: let the authority act through a configured governance program
BREAKING CHANGE: WrappedTokenConfig and ReceiverConfig gain a governance field and CrossZoneConfig gains source_governance, so the config layouts change and every program image id moves.
2026-08-12 15:44:29 +02:00
moudyellaz 23cd084bdb fix(cross-zone)!: claim the source authority, and guard its precondition
BREAKING CHANGE: the targets claim the authority account on their first use of it, so both target image ids move.
2026-08-12 14:55:23 +02:00
moudyellaz b1681b854f feat(cross-zone)!: let a target's peer sources be updated by a named authority
BREAKING CHANGE: WrappedTokenConfig and ReceiverConfig gain an authority field and CrossZoneConfig gains source_authority, so the config layouts change and every program image id moves.
2026-08-12 14:10:24 +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
moudyellaz f26193eedc fix(cross-zone)!: drop the inbox route allowlist now targets authorize themselves
BREAKING CHANGE: InboxConfig is just self_zone; allowed_routes, InboxConfig::permits
and routes_permit are gone, and build_inbox_init_config_tx no longer takes the
cross-zone config. The operator's per-peer routes still configure the same thing,
fanned out at genesis into each target's own config instead. The watcher keeps
only a hygiene filter refusing a peer that names a sequencer-only program, kept
host-side so it cannot make the verifier disagree.
2026-08-10 14:15:57 +02:00
moudyellaz 6a15eaec93 feat(cross-zone)!: have ping_receiver authorize its own peer sources
BREAKING CHANGE: ping_receiver gains a config PDA holding the deliverer and the
peer sources it accepts, ReceiverInstruction gains InitConfig, and Record takes
[source marker, config, record] instead of the record alone. Every emitter aimed
at ping_receiver must name its config account in target_accounts. The
ping_receiver and ping_sender image ids move, and a fresh genesis is required.
2026-08-10 13:30:28 +02:00
moudyellaz 03033f0f41 feat(cross-zone)!: have wrapped_token authorize its own peer sources
BREAKING CHANGE: the wrapped-token config PDA holds a borsh WrappedTokenConfig
(minter plus authorized source pairs) rather than a bare minter id, and
Instruction::InitConfig takes it as a single field. Mint now refuses a source the
token has not authorized, checked against the inbox's source marker. The
wrapped_token image id moves, and bridge_lock's with it, since it links
wrapped_token_core.
2026-08-10 11:59:00 +02:00
moudyellaz cc7192a2d9 feat(cross-zone)!: carry the peer source to the target as a marker account
BREAKING CHANGE: an inbox dispatch now declares [config, seen shard, source
marker, ...target accounts], and a target's chained call receives the marker at
position 0, so wrapped_token::Mint and ping_receiver::Record each take one more
leading account. The inbox, wrapped_token and ping_receiver image ids move,
relocating their PDAs and requiring a fresh genesis.
2026-08-10 11:11:05 +02:00
moudyellaz 421e76b946 feat(cross-zone)!: pin bridge_lock's outbox, mint target, and mint accounts
BREAKING CHANGE: Instruction::Lock drops outbox_program_id and takes the
bridge-lock config PDA as its first account, changing both the instruction
encoding and the account list. bridge_lock's image id moves, relocating its
escrow and config PDAs and requiring a fresh genesis. Sequencer, indexer and
every peer zone must upgrade together: a stale decoder re-derives a different
dispatch and reports Forged.
2026-08-09 19:02:28 +02:00
moudyellaz a04b3eeaa9 feat(cross-zone)!: pin ping_sender's outbox to a genesis-seeded config
BREAKING CHANGE: SenderInstruction::Send drops outbox_program_id and takes the
sender config PDA as its first account, changing both the instruction encoding
and the account list. ping_sender's image id moves, relocating its PDAs and
requiring a fresh genesis. Sequencer, indexer and every peer zone must upgrade
together: a stale decoder re-derives a different dispatch and reports Forged.
2026-08-09 18:01:38 +02:00
moudyellaz 41936b658b feat(cross-zone)!: make an outbox slot a write-once log entry keyed by its emitter
Closes #675.

BREAKING CHANGE: an outbox message PDA is now derived from the emitting program
as well as the destination zone and ordinal, and the seed domain moves to
/00001/, so every outbox record address changes. `OutboxRecord` gains `emitter`
and `ordinal`, changing its borsh layout, so records written by earlier code are
orphaned at their old addresses and no longer decode. A second `Emit` at the same
(emitter, target_zone, ordinal) now fails the transaction instead of silently
overwriting the record, so a caller must choose an ordinal the chain does not
already hold rather than counting from zero. A fresh genesis is required.
2026-08-09 00:18:14 +02:00
moudyellaz bb54bd0581 docs: simplify comments 2026-08-07 18:30:14 +02:00
moudyellaz 69a5aa7899 fix(cross-zone)!: cap a single wrapped-token mint
Closes #678.

BREAKING CHANGE: `wrapped_token` and `bridge_lock` image ids move, relocating the
wrapped-token config and every holding PDA. A lock above the cap is now refused
at the source rather than escrowing balance the destination will not mint.
2026-08-07 14:56:55 +02:00
moudyellaz 5cbd821261 fix(cross-zone)!: shard the inbox seen-set per peer block, keyed by tx index
Closes #676.

BREAKING CHANGE: the seen-shard PDA address and its data layout both change, so
every message delivered under the old layout becomes deliverable again at the new
address, and the old shards are orphaned. A fresh genesis is required.
2026-08-07 11:48:56 +02:00
moudyellaz af2a025b8f feat(cross-zone)!: bind a delivery to the peer block hash it came from
BREAKING CHANGE: `CrossZoneMessage` gains `src_block_hash`, changing the risc0
encoding of `cross_zone_inbox::Instruction::Dispatch` and the inbox image id,
and with it the inbox config and seen-shard PDA addresses. A pending dispatch
record written by earlier code no longer names a registered program, so it fails
production and is dead-lettered rather than delivered. Drain the pending list
before upgrading, or accept that in-flight deliveries are lost.
2026-08-07 11:01:16 +02:00
moudyellaz 09f4bfdd03 feat(cross-zone)!: authorize deliveries by source program and target
BREAKING CHANGE: `CrossZonePeer.allowed_targets` is replaced by `allowed_routes`,
a list of `{src_program_id, target_program_id}` pairs. `InboxConfig.allowed_peers`
is removed.
2026-08-03 04:40:05 +02:00
Daniil Polyakov 93a93c6b96 feat(sequencer): disable withdraws 2026-07-31 18:26:33 +03:00
erhant 931b0e9956 chore(bridge): add a comment on observability [skip ci] 2026-07-30 14:23:49 +03:00
erhant 57759d8953 fix(bridge): enforce deposit exactly-once via a per-op-id receipt PDA 2026-07-30 14:21:10 +03:00
moudyellaz 113d5db6f5 fix(cross-zone): make InitConfig idempotent under genesis replay 2026-07-24 08:32:45 +02:00
moudyellaz e278437266 refactor(cross-zone): fund bridge-lock holdings with a real native balance 2026-07-21 18:28:04 +02:00
moudyellaz f4a5d85c65 refactor(cross-zone): seed cross-zone config via genesis transactions 2026-07-21 15:19:16 +02:00
moudyellaz eff31df9ce Merge origin/dev 2026-07-11 01:12:00 +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
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