Commit Graph
26 Commits
Author SHA1 Message Date
Marvin Jones 55b678cc85 fix(lee): stop routing Deploy's bytecode through instruction_data's word-serde
instruction_data is word-serialized (risc0_zkvm::serde) for guest consumption,
which encodes Vec<u8> at 4 bytes/word since it doesn't route through
serialize_bytes — a Deploy transaction's wire size ran ~4x its raw bytecode.
Add Message/ChainedCall::raw_payload, a plain borsh-encoded Vec<u8> alongside
instruction_data, and move Deploy's bytecode there instead; Instruction::Deploy
now only carries update_auth.

Also stop transmitting and storing the ~32KB RISC0 platform kernel on every
single deployment: it's byte-identical across every guest artifact in this
repo, so Deploy now carries only the program-specific user_elf and
execute_deploy reconstructs the full two-ELF binary from an embedded kernel
constant to compute image_id. Segment accounts store user_elf only, roughly
halving their footprint for a typical program.

Measured on real Deploy dispatch (claimer, ~366KB): encoded transaction size
dropped from 1,464,777 bytes to 334,094 bytes.
2026-08-23 00:51:50 -04:00
Marvin Jones 013e439c60 fix(lee,lez): derive PDAs from AccountId instead of ProgramId
CallerData and the PDA derivation primitives keyed authorization off a
program's image id (ProgramId), so two deployments of identical bytecode
with different update_auth collided on the same PDA. Switch derivation,
wire fields, and comparisons to the program's real dispatch AccountId
throughout the host, guest, and test-harness code, including the
privacy-circuit test harness's default dispatch address and the
wrapped_token/ping_receiver governance-authorization check, which
compared against the wrong address via the legacy bijection.
2026-08-23 00:27:07 -04:00
Marvin Jones 90a3ee7812 refactor(lee): migrate program self/caller identity from ProgramId to AccountId
ProgramInput/ProgramOutput.self_program_id/caller_program_id, and the
dispatcher's CallerData.program_id, now carry AccountId (renamed to
self_account_id/caller_account_id) instead of ProgramId. These fields
are self-reported/cross-checked dispatch bookkeeping, not RISC0 image
identity, and AccountId already crosses the guest/host boundary this
way via every pre_state.account_id.

ProgramId is now confined to what's actually image-id-keyed:
env::verify, Program.id (from compute_image_id()), and the
for_public_pda/for_private_pda derivation formulas, each recovering
the real ProgramId from AccountId via the existing bijection exactly
where needed.

Rebuilds artifacts and the prebuilt sequencer db fixture to match.
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 4bcffafe27 refactor!: rename nssa crate to lee
BREAKING CHANGE:
- Crate `nssa` renamed to `lee`; update `Cargo.toml` dependencies from `nssa = { workspace = true }` to `lee = { workspace = true }`.
- Crate `nssa_core` renamed to `lee_core`; update similarly.
- Crate `key_protocol` moved under `lee`; update `Cargo.toml` dependencies from `key_protocol = { workspace = true }` to `lee_key_protocol = { workspace = true }`.
- Type `NSSATransaction` (in `common`) renamed to `LeeTransaction`.
- Error type `nssa::error::NssaError` renamed to `lee::error::LeeError`.
- Error type `nssa_core::error::NssaCoreError` renamed to `lee_core::error::LeeCoreError`.
- All `use nssa::` and `use nssa_core::` import paths must be updated to `use lee::` and `use lee_core::` respectively.
- Guest programs must replace `write_nssa_outputs` with `write_lee_outputs`.
- The sequencer RocksDB column family for the chain state was renamed. Existing databases are incompatible and must be wiped before running the new version.
- Domain separators updated: `"NSSA_seed"` → `"LEE_seed"` (key derivation), `"NSSA/v0.2/KDF-SHA256/"` → `"LEE/v0.2/KDF-SHA256/"` (encryption KDF), `"/NSSA/v0.2/AccountId/PDA/"` →
  `"/LEE/v0.2/AccountId/PDA/"` (public PDA address derivation). All previously derived keys, encrypted outputs, and public PDA addresses are invalidated.
2026-06-01 17:11:42 -03:00
Moudy a87e8d93dc fix: cargo fmt 2026-04-07 20:16:42 +02:00
Moudy 7d465dded7 fix: verify caller_program_id in program output 2026-04-07 19:03:06 +02:00
Moudy 74e16db68f fix: apply formatting and rebuild artifacts 2026-04-03 01:17:42 +02:00
moudyellaz 087baebcca feat: add caller_program_id to ProgramInput 2026-04-03 00:58:11 +02:00
Moudy 702ef4a46f fix: cargo fmt 2026-04-02 20:30:27 +02:00
moudyellaz 7def0c4664 refactor: pass self_program_id to ProgramOutput in test and example guest programs 2026-04-02 20:30:16 +02:00
Moudy 59d3d38448 fix: serialize write_inputs fields separately to match guest deserialization 2026-04-02 20:29:12 +02:00
Daniil Polyakov 6780f1c9a4 feat: protect from public pda griefing attacks 2026-03-28 01:23:57 +03:00
Sergio Chouhy abc30c0ce0 remove old program output constructors 2026-03-25 16:56:04 -03:00
Daniil Polyakov aa462b66eb feat: add nursery clippy lints 2026-03-17 21:25:30 +03:00
Daniil Polyakov e3b93b6e9a feat: add restriction clippy lints 2026-03-17 21:25:30 +03:00
Daniil Polyakov efe8393ba0 feat: add pedantic clippy lints 2026-03-17 21:25:30 +03:00
Daniil Polyakov 756f2f4135 feat: add workspace lints to every crate 2026-03-17 15:13:44 +03:00
David Rusu 38f1f68030 feat(license): MIT/Apache2 license and add cargo deny config 2026-01-31 23:13:36 +04:00
Daniil Polyakov 9b37a2a8b7 Merge pull request #248 from logos-blockchain/arjentix/build-docker-image
Publish sequencer_runner Docker image with CI
2025-12-19 21:05:28 +03:00
Daniil Polyakov ddf6e707ec feat: add cargo machete check to CI 2025-12-19 18:30:40 +03:00
Daniil Polyakov 87f45b8215 feat: move all crates into workspace 2025-12-19 18:30:40 +03:00
Sergio Chouhy a360df29bf Merge branch 'schouhy/add-program-deployment-example' into schouhy/add-program-deployment-example-pda 2025-12-12 17:35:01 -03:00
Sergio Chouhy 63f102643b add instructions to get the hello world program id in hex 2025-12-12 14:30:36 -03:00
Sergio Chouhy 89c1a97798 add example and instructions for pda 2025-12-12 13:00:16 -03:00
Sergio Chouhy 8c92a58bbc add program deployment examples 2025-12-11 20:59:37 -03:00