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.
This commit is contained in:
Sergio Chouhy
2026-06-01 17:11:42 -03:00
parent d3390efc6d
commit 4bcffafe27
305 changed files with 1985 additions and 1915 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ workspace = true
[dependencies]
common.workspace = true
nssa.workspace = true
nssa_core.workspace = true
lee.workspace = true
lee_core.workspace = true
sequencer_service_rpc = { workspace = true, features = ["client"] }
wallet.workspace = true
+6 -6
View File
@@ -134,7 +134,7 @@ echo -n SG9sYSBtdW5kbyE= | base64 -d
You should see `Hola mundo!`.
# 5. Understanding the code in `hello_world.rs`.
The Hello world example demonstrates the minimal structure of an NSSA program.
The Hello world example demonstrates the minimal structure of a LEE program.
Its purpose is very simple: append the instruction bytes to the data field of a single account.
### What this program does in a nutshell
@@ -145,7 +145,7 @@ Its purpose is very simple: append the instruction bytes to the data field of a
2. Checks that there is exactly one input account: this example operates on a single account, so it expects `pre_states` to contain exactly one entry.
3. Builds the post-state: It clones the input account and appends the instruction bytes to its data field.
4. Handles account claiming logic: If the account is uninitialized (i.e. not yet claimed by any program), its program_owner will equal `DEFAULT_PROGRAM_ID`. In that case, the program issues a claim request, meaning: "This program now owns this account."
5. Outputs the proposed state transition: `write_nssa_outputs` emits:
5. Outputs the proposed state transition: `write_lee_outputs` emits:
- The original instruction data
- The original pre-states
- The new post-states
@@ -154,7 +154,7 @@ Its purpose is very simple: append the instruction bytes to the data field of a
1. Reading inputs:
```rust
let (ProgramInput { pre_states, instruction: greeting }, instruction_data)
= read_nssa_inputs::<Instruction>();
= read_lee_inputs::<Instruction>();
```
2. Extracting the single account:
```rust
@@ -179,7 +179,7 @@ let post_state = if post_account.program_owner == DEFAULT_PROGRAM_ID {
```
5. Emmiting the output
```rust
write_nssa_outputs(instruction_data, vec![pre_state], vec![post_state]);
write_lee_outputs(instruction_data, vec![pre_state], vec![post_state]);
```
# 6. Understanding the runner script `run_hello_world.rs`
@@ -348,7 +348,7 @@ Check the `run_hello_world_private.rs` file to see how it is used.
# 8. Account authorization mechanism
The Hello world example does not enforce any authorization on the input account. This means any user can execute it on any account, regardless of ownership.
NSSA provides a mechanism for programs to enforce proper authorization before an execution can succeed. The meaning of authorization differs between public and private accounts:
LEE provides a mechanism for programs to enforce proper authorization before an execution can succeed. The meaning of authorization differs between public and private accounts:
- Public accounts: authorization requires that the transaction is signed with the accounts signing key.
- Private accounts: authorization requires that the circuit verifies knowledge of the accounts nullifier secret key.
@@ -594,7 +594,7 @@ wallet account get --account-id Private/8vzkK7vsdrS2gdPhLk72La8X4FJkgJ5kJLUBRbEV
## Digression: account authority vs account program ownership
In NSSA there are two distinct concepts that control who can modify an account:
In LEE there are two distinct concepts that control who can modify an account:
**Program Ownership:** Each account has a field: `program_owner: ProgramId`.
This indicates which program is allowed to update the accounts state during execution.
- If a program is the program_owner of an account, it can freely mutate its fields.
@@ -8,7 +8,7 @@ license = { workspace = true }
workspace = true
[dependencies]
nssa_core.workspace = true
lee_core.workspace = true
hex.workspace = true
bytemuck.workspace = true
@@ -1,4 +1,4 @@
use nssa_core::program::{AccountPostState, Claim, ProgramInput, ProgramOutput, read_nssa_inputs};
use lee_core::program::{AccountPostState, Claim, ProgramInput, ProgramOutput, read_lee_inputs};
// Hello-world example program.
//
@@ -25,7 +25,7 @@ fn main() {
instruction: greeting,
},
instruction_data,
) = read_nssa_inputs::<Instruction>();
) = read_lee_inputs::<Instruction>();
// Unpack the input account pre state
let [pre_state] = pre_states
@@ -49,7 +49,7 @@ fn main() {
// The output is a proposed state difference. It will only succeed if the pre states coincide
// with the previous values of the accounts, and the transition to the post states conforms
// with the NSSA program rules.
// with the LEE program rules.
// WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be
// called to commit the output.
ProgramOutput::new(
@@ -1,4 +1,4 @@
use nssa_core::program::{AccountPostState, Claim, ProgramInput, ProgramOutput, read_nssa_inputs};
use lee_core::program::{AccountPostState, Claim, ProgramInput, ProgramOutput, read_lee_inputs};
// Hello-world with authorization example program.
//
@@ -25,7 +25,7 @@ fn main() {
instruction: greeting,
},
instruction_data,
) = read_nssa_inputs::<Instruction>();
) = read_lee_inputs::<Instruction>();
// Unpack the input account pre state
let [pre_state] = pre_states
@@ -56,7 +56,7 @@ fn main() {
// The output is a proposed state difference. It will only succeed if the pre states coincide
// with the previous values of the accounts, and the transition to the post states conforms
// with the NSSA program rules.
// with the LEE program rules.
// WARNING: constructing a `ProgramOutput` has no effect on its own. `.write()` must be
// called to commit the output.
ProgramOutput::new(
@@ -1,6 +1,6 @@
use nssa_core::{
use lee_core::{
account::{AccountWithMetadata, Data},
program::{AccountPostState, Claim, ProgramInput, ProgramOutput, read_nssa_inputs},
program::{AccountPostState, Claim, ProgramInput, ProgramOutput, read_lee_inputs},
};
// Hello-world with write + move_data example program.
@@ -72,7 +72,7 @@ fn main() {
instruction: (function_id, data),
},
instruction_words,
) = read_nssa_inputs::<Instruction>();
) = read_lee_inputs::<Instruction>();
let post_states = match (pre_states.as_slice(), function_id, data.len()) {
([account_pre], WRITE_FUNCTION_ID, _) => {
@@ -1,5 +1,5 @@
use nssa_core::program::{
AccountPostState, ChainedCall, ProgramId, ProgramInput, ProgramOutput, read_nssa_inputs,
use lee_core::program::{
AccountPostState, ChainedCall, ProgramId, ProgramInput, ProgramOutput, read_lee_inputs,
};
// Tail Call example program.
@@ -33,7 +33,7 @@ fn main() {
instruction: (),
},
instruction_data,
) = read_nssa_inputs::<()>();
) = read_lee_inputs::<()>();
// Unpack the input account pre state
let [pre_state] = pre_states
@@ -1,6 +1,5 @@
use nssa_core::program::{
AccountPostState, ChainedCall, PdaSeed, ProgramId, ProgramInput, ProgramOutput,
read_nssa_inputs,
use lee_core::program::{
AccountPostState, ChainedCall, PdaSeed, ProgramId, ProgramInput, ProgramOutput, read_lee_inputs,
};
// Tail Call with PDA example program.
@@ -39,7 +38,7 @@ fn main() {
instruction: (),
},
instruction_data,
) = read_nssa_inputs::<()>();
) = read_lee_inputs::<()>();
// Unpack the input account pre state
let [pre_state] = pre_states
@@ -1,5 +1,5 @@
use common::transaction::NSSATransaction;
use nssa::{
use common::transaction::LeeTransaction;
use lee::{
AccountId, PublicTransaction,
program::Program,
public_transaction::{Message, WitnessSet},
@@ -60,7 +60,7 @@ async fn main() {
// Submit the transaction
let _response = wallet_core
.sequencer_client
.send_transaction(NSSATransaction::Public(tx))
.send_transaction(LeeTransaction::Public(tx))
.await
.unwrap();
}
@@ -1,4 +1,4 @@
use nssa::{AccountId, program::Program};
use lee::{AccountId, program::Program};
use wallet::{AccountIdentity, WalletCore};
// Before running this example, compile the `hello_world.rs` guest program with:
@@ -1,5 +1,5 @@
use common::transaction::NSSATransaction;
use nssa::{
use common::transaction::LeeTransaction;
use lee::{
AccountId, PublicTransaction,
program::Program,
public_transaction::{Message, WitnessSet},
@@ -56,7 +56,7 @@ async fn main() {
// Submit the transaction
let _response = wallet_core
.sequencer_client
.send_transaction(NSSATransaction::Public(tx))
.send_transaction(LeeTransaction::Public(tx))
.await
.unwrap();
}
@@ -1,6 +1,6 @@
use std::collections::HashMap;
use nssa::{
use lee::{
AccountId, ProgramId, privacy_preserving_transaction::circuit::ProgramWithDependencies,
program::Program,
};
@@ -1,5 +1,5 @@
use common::transaction::NSSATransaction;
use nssa::{
use common::transaction::LeeTransaction;
use lee::{
AccountId, PublicTransaction,
program::Program,
public_transaction::{Message, WitnessSet},
@@ -73,7 +73,7 @@ async fn main() {
// Submit the transaction
let _response = wallet_core
.sequencer_client
.send_transaction(NSSATransaction::Public(tx))
.send_transaction(LeeTransaction::Public(tx))
.await
.unwrap();
}
@@ -3,13 +3,13 @@
reason = "This is an example program, it's fine to print to stdout"
)]
use common::transaction::NSSATransaction;
use nssa::{
use common::transaction::LeeTransaction;
use lee::{
AccountId, PublicTransaction,
program::Program,
public_transaction::{Message, WitnessSet},
};
use nssa_core::program::PdaSeed;
use lee_core::program::PdaSeed;
use sequencer_service_rpc::RpcClient as _;
use wallet::WalletCore;
@@ -58,7 +58,7 @@ async fn main() {
// Submit the transaction
let _response = wallet_core
.sequencer_client
.send_transaction(NSSATransaction::Public(tx))
.send_transaction(LeeTransaction::Public(tx))
.await
.unwrap();
@@ -1,6 +1,6 @@
use clap::{Parser, Subcommand};
use common::transaction::NSSATransaction;
use nssa::{PublicTransaction, program::Program, public_transaction};
use common::transaction::LeeTransaction;
use lee::{PublicTransaction, program::Program, public_transaction};
use sequencer_service_rpc::RpcClient as _;
use wallet::{AccountIdentity, WalletCore};
@@ -89,7 +89,7 @@ async fn main() {
// Submit the transaction
let _response = wallet_core
.sequencer_client
.send_transaction(NSSATransaction::Public(tx))
.send_transaction(LeeTransaction::Public(tx))
.await
.unwrap();
}
@@ -128,7 +128,7 @@ async fn main() {
// Submit the transaction
let _response = wallet_core
.sequencer_client
.send_transaction(NSSATransaction::Public(tx))
.send_transaction(LeeTransaction::Public(tx))
.await
.unwrap();
}