chore: update to release set v0.2.1

This commit is contained in:
r4bbit
2026-08-25 12:49:19 +02:00
parent 3994ba3055
commit 730053dcc7
63 changed files with 25164 additions and 12571 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ edition = "2021"
workspace = true
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
amm_core = { path = "core" }
token_core = { path = "../token/core" }
twap_oracle_core = { path = "../twap_oracle/core" }
+2 -2
View File
@@ -7,8 +7,8 @@ edition = "2021"
workspace = true
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework-macros" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework-macros" }
token_core = { path = "../../token/core" }
borsh = { version = "1.5", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
+5 -5
View File
@@ -751,7 +751,7 @@ dependencies = [
[[package]]
name = "clock_core"
version = "0.1.0"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
dependencies = [
"borsh",
"lee_core",
@@ -1637,7 +1637,7 @@ dependencies = [
[[package]]
name = "lee_core"
version = "0.1.0"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
dependencies = [
"base58",
"borsh",
@@ -2640,7 +2640,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "spel-framework"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"borsh",
"lee_core",
@@ -2652,7 +2652,7 @@ dependencies = [
[[package]]
name = "spel-framework-core"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"base58",
"borsh",
@@ -2669,7 +2669,7 @@ dependencies = [
[[package]]
name = "spel-framework-macros"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"proc-macro2",
"quote",
+3 -3
View File
@@ -56,11 +56,11 @@ name = "amm"
path = "src/bin/amm.rs"
[dependencies]
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
risc0-zkvm = { version = "=3.0.5", default-features = false }
amm_core = { path = "../../core" }
amm_program = { path = "../..", package = "amm_program" }
token_core = { path = "../../../token/core" }
serde = { version = "1.0", features = ["derive"] }
borsh = "1.5"
borsh = "1.5"
+1 -1
View File
@@ -8,7 +8,7 @@ use std::num::NonZeroU128;
use spel_framework::prelude::*;
use spel_framework::context::ProgramContext;
use nssa_core::{
use lee_core::{
account::{AccountId, AccountWithMetadata},
program::ProgramId,
};
+1 -1
View File
@@ -7,6 +7,6 @@ edition = "2021"
workspace = true
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
ata_core = { path = "core" }
token_core = { path = "../token/core" }
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2021"
workspace = true
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
borsh = { version = "1.5", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
risc0-zkvm = { version = "=3.0.5", default-features = false }
+4 -4
View File
@@ -1099,7 +1099,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "lee_core"
version = "0.1.0"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
dependencies = [
"base58",
"borsh",
@@ -1856,7 +1856,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "spel-framework"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"borsh",
"lee_core",
@@ -1868,7 +1868,7 @@ dependencies = [
[[package]]
name = "spel-framework-core"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"base58",
"borsh",
@@ -1885,7 +1885,7 @@ dependencies = [
[[package]]
name = "spel-framework-macros"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"proc-macro2",
"quote",
+3 -3
View File
@@ -56,8 +56,8 @@ name = "ata"
path = "src/bin/ata.rs"
[dependencies]
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
risc0-zkvm = { version = "=3.0.5", default-features = false }
# Pin ruint (transitive via risc0-binfmt) below 1.18, which raised its MSRV to
# rustc 1.90. The risc0 guest toolchain ships rustc 1.88, so 1.18+ fails the
@@ -68,4 +68,4 @@ ata_core = { path = "../../core" }
ata_program = { path = "../..", package = "ata_program" }
token_core = { path = "../../../token/core" }
serde = { version = "1.0", features = ["derive"] }
borsh = "1.5"
borsh = "1.5"
+1 -1
View File
@@ -2,7 +2,7 @@
use spel_framework::prelude::*;
use spel_framework::context::ProgramContext;
use nssa_core::{account::AccountWithMetadata, program::ProgramId};
use lee_core::{account::AccountWithMetadata, program::ProgramId};
#[cfg(not(test))]
risc0_zkvm::guest::entry!(main);
+3 -3
View File
@@ -11,9 +11,9 @@ edition = "2021"
[workspace]
[dependencies]
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", package = "lee" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
twap_oracle_core = { path = "../twap_oracle/core" }
twap-oracle-methods = { path = "../twap_oracle/methods" }
# `prove` exposes `ExecutorImpl`/`Session` (the cycle split); we only execute, never prove.
+1 -1
View File
@@ -9,7 +9,7 @@ workspace = true
[dependencies]
nssa = { workspace = true }
nssa_core = { workspace = true, features = ["host", "test_utils"] }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
amm_core = { workspace = true }
token_core = { workspace = true }
ata_core = { workspace = true }
+6
View File
@@ -1885,6 +1885,12 @@ fn advance_clock(state: &mut V03State, timestamp: u64) {
}
.to_bytes();
let clock_account = Account {
// The real CLOCK_01 system account is owned by the clock program, not the
// default program (see lee `system_accounts::clock_account`). A default owner
// makes the spel-framework output filter drop the (unchanged, unclaimed)
// clock post-state, which v0.2.1's DeclaredAccountMissingFromOutput invariant
// then rejects. Use a non-default placeholder owner, as the oracle fixtures do.
program_owner: [8u32; 8],
data: Data::try_from(data).expect("clock account data fits"),
..Account::default()
};
+13 -17
View File
@@ -8,12 +8,12 @@ use nssa::{
},
program::Program,
program_deployment_transaction::{self, ProgramDeploymentTransaction},
public_transaction, PrivateKey, PublicKey, PublicTransaction, SharedSecretKey, V03State,
public_transaction, PrivateKey, PublicKey, PublicTransaction, V03State,
};
use nssa_core::{
account::{Account, AccountId, AccountWithMetadata, Data, Nonce},
encryption::{EphemeralPublicKey, ViewingPublicKey},
EncryptedAccountData, InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
encryption::ViewingPublicKey,
InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
};
use token_core::{TokenDefinition, TokenHolding};
@@ -515,14 +515,14 @@ fn ata_create_from_private_owner() {
let owner_npk = NullifierPublicKey::from(&owner_nsk);
// `ViewingPublicKey::from_seed` needs two 32-byte halves `(d, z)`.
let owner_vpk = ViewingPublicKey::from_seed(&[31u8; 32], &[32u8; 32]);
let owner_id = AccountId::for_regular_private_account(&owner_npk, 0);
let owner_id = AccountId::for_regular_private_account(&owner_npk, &owner_vpk, 0);
// ATA derived from the private owner
let seed = compute_ata_seed(Ids::token_program(), owner_id, Ids::token_definition());
let owner_ata_id = get_associated_token_account_id(&Ids::ata_program(), &seed);
// Pre-states: private uninitialized owner, public token definition, public uninitialized ATA.
let owner_pre = AccountWithMetadata::new(Account::default(), false, owner_id);
let owner_pre = AccountWithMetadata::new(Account::default(), true, owner_id);
let def_pre = AccountWithMetadata::new(
Accounts::token_definition_init(),
false,
@@ -535,8 +535,9 @@ fn ata_create_from_private_owner() {
};
let instruction_data = Program::serialize_instruction(instruction).unwrap();
// Encapsulate a shared secret against the owner's viewing key; the circuit fills the EPK.
let shared_secret = SharedSecretKey::encapsulate_deterministic(&owner_vpk, &[0u8; 32], 0).0;
// The private owner is a fresh account the caller does not own: PrivateForeignInit.
// The circuit derives the EPK from `random_seed`; the init references the current root.
let commitment_root = state.commitment_root();
let ata_program = Program::new(ata_methods::ATA_ELF.to_vec().into()).unwrap();
let token_program = Program::new(token_methods::TOKEN_ELF.to_vec().into()).unwrap();
@@ -550,12 +551,12 @@ fn ata_create_from_private_owner() {
instruction_data,
vec![
// owner: new private account, not owned/spent by the caller (no nsk, no proof).
InputAccountIdentity::PrivateUnauthorized {
epk: EphemeralPublicKey(Vec::new()),
view_tag: EncryptedAccountData::compute_view_tag(&owner_npk, &owner_vpk),
InputAccountIdentity::PrivateForeignInit {
vpk: owner_vpk,
random_seed: [0; 32],
npk: owner_npk,
ssk: shared_secret,
identifier: 0,
commitment_root,
},
// token_definition: public
InputAccountIdentity::Public,
@@ -566,12 +567,7 @@ fn ata_create_from_private_owner() {
)
.unwrap();
let message = Message::try_from_circuit_output(
vec![Ids::token_definition(), owner_ata_id],
vec![],
output,
)
.unwrap();
let message = Message::from_circuit_output(vec![], output);
let witness_set = WitnessSet::for_message(&message, proof, &[]);
let tx = PrivacyPreservingTransaction::new(message, witness_set);
@@ -226,6 +226,12 @@ fn seed_clock(state: &mut V03State, timestamp: u64) {
}
.to_bytes();
let clock_account = Account {
// The real CLOCK_01 system account is owned by the clock program, not the
// default program (see lee `system_accounts::clock_account`). A default owner
// makes the spel-framework output filter drop the (unchanged, unclaimed)
// clock post-state, which v0.2.1's DeclaredAccountMissingFromOutput invariant
// then rejects. Use a non-default placeholder owner, as the oracle fixture does.
program_owner: [8u32; 8],
data: Data::try_from(data).expect("clock account data fits"),
..Account::default()
};
@@ -258,6 +264,21 @@ fn state_for_stablecoin_tests() -> V03State {
Accounts::collateral_definition_init(),
);
state.force_insert_account(Ids::user_holding(), Accounts::user_holding_init());
// Seed the owner as a non-default-owned account. In nssa, balance-holding user
// accounts are owned by a system program (see lee `system_accounts` / the
// `time_locked_transfer` sender), not the default program. A default-owned owner
// works the first time it signs (its pre-state is still `Account::default()`), but
// once `open_position` bumps its nonce the spel-framework output filter drops the
// (unchanged, unclaimed, default-owned) owner post-state from the second
// transaction — which v0.2.1's DeclaredAccountMissingFromOutput invariant then
// rejects. A non-default owner keeps it in the diff across both transactions.
state.force_insert_account(
Ids::owner(),
Account {
program_owner: [7u32; 8],
..Account::default()
},
);
state
}
+29 -41
View File
@@ -3,12 +3,12 @@ use nssa::{
privacy_preserving_transaction::{Message, PrivacyPreservingTransaction, WitnessSet},
program::Program,
program_deployment_transaction::{self, ProgramDeploymentTransaction},
public_transaction, PrivateKey, PublicKey, PublicTransaction, SharedSecretKey, V03State,
public_transaction, PrivateKey, PublicKey, PublicTransaction, V03State,
};
use nssa_core::{
account::{Account, AccountId, AccountWithMetadata, Data, Nonce},
encryption::{EphemeralPublicKey, ViewingPublicKey},
Commitment, EncryptedAccountData, InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
encryption::ViewingPublicKey,
Commitment, InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
};
use token_core::{TokenDefinition, TokenHolding};
@@ -648,7 +648,7 @@ impl PrivateKeys {
}
fn holder_id() -> AccountId {
AccountId::for_regular_private_account(&Self::holder_npk(), 0)
AccountId::for_regular_private_account(&Self::holder_npk(), &Self::holder_vpk(), 0)
}
fn recipient_nsk() -> NullifierSecretKey {
@@ -664,7 +664,7 @@ impl PrivateKeys {
}
fn recipient_id() -> AccountId {
AccountId::for_regular_private_account(&Self::recipient_npk(), 0)
AccountId::for_regular_private_account(&Self::recipient_npk(), &Self::recipient_vpk(), 0)
}
}
@@ -686,11 +686,12 @@ fn shielded_token_transfer(amount: u128, state: &mut V03State) -> Account {
let recipient_id = PrivateKeys::recipient_id();
let sender = AccountWithMetadata::new(sender_account, true, sender_id);
let recipient = AccountWithMetadata::new(Account::default(), false, recipient_id);
let recipient = AccountWithMetadata::new(Account::default(), true, recipient_id);
// Sender encapsulates a shared secret against the recipient's viewing key. The
// circuit fills the real EPK, so we pass an empty placeholder in the identity.
let shared_secret = SharedSecretKey::encapsulate_deterministic(&recipient_vpk, &[0u8; 32], 0).0;
// The recipient is a fresh private account the sender does not own: PrivateForeignInit.
// The circuit derives the EPK from `random_seed`; the init references the current
// commitment-set root.
let commitment_root = state.commitment_root();
let instruction = token_core::Instruction::Transfer {
amount_to_transfer: amount,
@@ -700,20 +701,19 @@ fn shielded_token_transfer(amount: u128, state: &mut V03State) -> Account {
Program::serialize_instruction(instruction).unwrap(),
vec![
InputAccountIdentity::Public,
InputAccountIdentity::PrivateUnauthorized {
epk: EphemeralPublicKey(Vec::new()),
view_tag: EncryptedAccountData::compute_view_tag(&recipient_npk, &recipient_vpk),
InputAccountIdentity::PrivateForeignInit {
vpk: recipient_vpk,
random_seed: [0; 32],
npk: recipient_npk,
ssk: shared_secret,
identifier: 0,
commitment_root,
},
],
&token_program().into(),
)
.unwrap();
let message =
Message::try_from_circuit_output(vec![sender_id], vec![sender_nonce], output).unwrap();
let message = Message::from_circuit_output(vec![sender_nonce], output);
let witness_set = WitnessSet::for_message(&message, proof, &[&Keys::holder_key()]);
let tx = PrivacyPreservingTransaction::new(message, witness_set);
@@ -766,7 +766,6 @@ fn token_private_transfer() {
// Shield tokens into a private account (becomes the sender for the private transfer).
let sender_account = shielded_token_transfer(shielded_amount, &mut state);
let sender_npk = PrivateKeys::recipient_npk();
let sender_nsk = PrivateKeys::recipient_nsk();
let sender_vpk = PrivateKeys::recipient_vpk();
let sender_id = PrivateKeys::recipient_id();
@@ -779,14 +778,10 @@ fn token_private_transfer() {
let membership_proof = state
.get_proof_for_commitment(&sender_commitment)
.expect("sender's commitment must be in the set");
// Distinct `output_index` per private output keeps the encapsulated secrets reproducible.
let shared_secret_1 = SharedSecretKey::encapsulate_deterministic(&sender_vpk, &[0u8; 32], 0).0;
let shared_secret_2 =
SharedSecretKey::encapsulate_deterministic(&new_recipient_vpk, &[0u8; 32], 1).0;
let commitment_root = state.commitment_root();
let sender_pre = AccountWithMetadata::new(sender_account.clone(), true, sender_id);
let new_recipient_pre = AccountWithMetadata::new(Account::default(), false, new_recipient_id);
let new_recipient_pre = AccountWithMetadata::new(Account::default(), true, new_recipient_id);
let instruction = token_core::Instruction::Transfer {
amount_to_transfer: transfer_amount,
@@ -796,29 +791,26 @@ fn token_private_transfer() {
Program::serialize_instruction(instruction).unwrap(),
vec![
InputAccountIdentity::PrivateAuthorizedUpdate {
epk: EphemeralPublicKey(Vec::new()),
view_tag: EncryptedAccountData::compute_view_tag(&sender_npk, &sender_vpk),
ssk: shared_secret_1,
vpk: sender_vpk,
random_seed: [0; 32],
view_tag: 0,
nsk: sender_nsk,
membership_proof,
identifier: 0,
},
InputAccountIdentity::PrivateUnauthorized {
epk: EphemeralPublicKey(Vec::new()),
view_tag: EncryptedAccountData::compute_view_tag(
&new_recipient_npk,
&new_recipient_vpk,
),
InputAccountIdentity::PrivateForeignInit {
vpk: new_recipient_vpk,
random_seed: [0; 32],
npk: new_recipient_npk,
ssk: shared_secret_2,
identifier: 0,
commitment_root,
},
],
&token_program().into(),
)
.unwrap();
let message = Message::try_from_circuit_output(vec![], vec![], output).unwrap();
let message = Message::from_circuit_output(vec![], output);
let witness_set = WitnessSet::for_message(&message, proof, &[]);
let tx = PrivacyPreservingTransaction::new(message, witness_set);
@@ -863,7 +855,6 @@ fn token_deshielded_transfer() {
// Shield tokens into a private account, then deshield some back to a public account.
let sender_account = shielded_token_transfer(shielded_amount, &mut state);
let sender_npk = PrivateKeys::recipient_npk();
let sender_nsk = PrivateKeys::recipient_nsk();
let sender_vpk = PrivateKeys::recipient_vpk();
let sender_id = PrivateKeys::recipient_id();
@@ -874,8 +865,6 @@ fn token_deshielded_transfer() {
.get_proof_for_commitment(&sender_commitment)
.expect("sender's commitment must be in the set");
let shared_secret = SharedSecretKey::encapsulate_deterministic(&sender_vpk, &[0u8; 32], 0).0;
let public_recipient_pre = AccountWithMetadata::new(
state.get_account_by_id(public_recipient_id),
false,
@@ -891,9 +880,9 @@ fn token_deshielded_transfer() {
Program::serialize_instruction(instruction).unwrap(),
vec![
InputAccountIdentity::PrivateAuthorizedUpdate {
epk: EphemeralPublicKey(Vec::new()),
view_tag: EncryptedAccountData::compute_view_tag(&sender_npk, &sender_vpk),
ssk: shared_secret,
vpk: sender_vpk,
random_seed: [0; 32],
view_tag: 0,
nsk: sender_nsk,
membership_proof,
identifier: 0,
@@ -904,8 +893,7 @@ fn token_deshielded_transfer() {
)
.unwrap();
let message =
Message::try_from_circuit_output(vec![public_recipient_id], vec![], output).unwrap();
let message = Message::from_circuit_output(vec![], output);
let witness_set = WitnessSet::for_message(&message, proof, &[]);
let tx = PrivacyPreservingTransaction::new(message, witness_set);
+2 -2
View File
@@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021"
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
stablecoin_core = { path = "core" }
token_core = { path = "../token/core" }
twap_oracle_core = { path = "../twap_oracle/core" }
+2 -2
View File
@@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
borsh = { version = "1.5", features = ["derive"] }
alloy-primitives = { version = "1", default-features = false }
# Pin ruint (transitive via alloy-primitives) below 1.18, which raised its MSRV to rustc 1.90.
@@ -14,7 +14,7 @@ ruint = { version = "=1.17.0", default-features = false }
serde = { version = "1.0", features = ["derive"] }
twap_oracle_core = { path = "../../twap_oracle/core" }
risc0-zkvm = { version = "=3.0.5", default-features = false }
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework-macros" }
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework-macros" }
[dev-dependencies]
serde_json = "1.0"
@@ -0,0 +1,65 @@
//! Print the stablecoin position + collateral-vault PDAs.
//!
//! Usage:
//! cargo run -q -p stablecoin_program --example stablecoin_pdas -- <stablecoin_pid> <owner>
//! <position_nonce>
//!
//! `stablecoin_pid` is a ProgramId as 8 comma-separated u32 limbs (as printed by
//! `spel program-id`); `owner` is a base58 account id; `position_nonce` is a u64.
use std::str::FromStr;
use nssa_core::{account::AccountId, program::ProgramId};
use stablecoin_core::{compute_position_pda, compute_position_vault_pda};
// Accepts a ProgramId as 8 comma-separated u32 limbs, a 64-char ImageID hex, or a base58
// ImageID. Hex/base58 are decoded as the 32 ImageID bytes read little-endian per u32 word,
// matching how `spel program-id` maps the ImageID to limbs.
fn parse_pid(s: &str) -> ProgramId {
if s.contains(',') {
let limbs: Vec<u32> = s
.split(',')
.map(|x| x.trim().parse().expect("ProgramId limb must be a u32"))
.collect();
assert_eq!(limbs.len(), 8, "ProgramId must be 8 u32 limbs");
let mut pid: ProgramId = [0u32; 8];
pid.copy_from_slice(&limbs);
return pid;
}
let bytes: [u8; 32] = if s.len() == 64 && s.bytes().all(|b| b.is_ascii_hexdigit()) {
let mut out = [0u8; 32];
for (byte, pair) in out.iter_mut().zip(s.as_bytes().chunks_exact(2)) {
let pair: [u8; 2] = pair.try_into().expect("hex pair");
let hex = std::str::from_utf8(&pair).expect("ascii hex");
*byte = u8::from_str_radix(hex, 16).expect("invalid hex digit");
}
out
} else {
AccountId::from_str(s)
.expect("ProgramId must be 8 u32 limbs, a 64-char hex ImageID, or base58")
.into_value()
};
let mut pid: ProgramId = [0u32; 8];
for (limb, chunk) in pid.iter_mut().zip(bytes.chunks_exact(4)) {
*limb = u32::from_le_bytes(chunk.try_into().expect("4-byte chunk"));
}
pid
}
fn main() {
let args: Vec<String> = std::env::args().skip(1).collect();
let [stablecoin_s, owner_s, nonce_s] = args.as_slice() else {
eprintln!("usage: stablecoin_pdas <stablecoin_pid> <owner> <position_nonce>");
std::process::exit(1);
};
let stablecoin = parse_pid(stablecoin_s);
let owner = AccountId::from_str(owner_s).expect("owner must be base58");
let position_nonce: u64 = nonce_s.parse().expect("position_nonce must be a u64");
let position = compute_position_pda(stablecoin, owner, position_nonce);
println!("position {position}");
println!(
"position_vault {}",
compute_position_vault_pda(stablecoin, position)
);
}
+5 -5
View File
@@ -691,7 +691,7 @@ dependencies = [
[[package]]
name = "clock_core"
version = "0.1.0"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
dependencies = [
"borsh",
"lee_core",
@@ -1597,7 +1597,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "lee_core"
version = "0.1.0"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
dependencies = [
"base58",
"borsh",
@@ -2610,7 +2610,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "spel-framework"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"borsh",
"lee_core",
@@ -2622,7 +2622,7 @@ dependencies = [
[[package]]
name = "spel-framework-core"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"base58",
"borsh",
@@ -2639,7 +2639,7 @@ dependencies = [
[[package]]
name = "spel-framework-macros"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"proc-macro2",
"quote",
+3 -3
View File
@@ -14,12 +14,12 @@ name = "stablecoin"
path = "src/bin/stablecoin.rs"
[dependencies]
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
risc0-zkvm = { version = "=3.0.5", default-features = false }
twap_oracle_core = { path = "../../../twap_oracle/core" }
stablecoin_core = { path = "../../core" }
stablecoin_program = { path = "../..", package = "stablecoin_program" }
token_core = { path = "../../../token/core" }
serde = { version = "1.0", features = ["derive"] }
borsh = "1.5"
borsh = "1.5"
@@ -1,6 +1,6 @@
#![cfg_attr(not(test), no_main)]
use nssa_core::account::AccountWithMetadata;
use lee_core::account::AccountWithMetadata;
use spel_framework::context::ProgramContext;
use spel_framework::prelude::*;
@@ -43,7 +43,7 @@ mod stablecoin {
collateral_definition: AccountWithMetadata,
market_price_oracle: AccountWithMetadata,
clock: AccountWithMetadata,
freeze_authority_account_id: nssa_core::account::AccountId,
freeze_authority_account_id: lee_core::account::AccountId,
initial_stability_fee_per_millisecond: u128,
initial_controller_proportional_gain: i128,
initial_controller_integral_gain: i128,
+1 -1
View File
@@ -7,5 +7,5 @@ edition = "2021"
workspace = true
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
token_core = { path = "core" }
+2 -2
View File
@@ -7,7 +7,7 @@ edition = "2021"
workspace = true
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework-macros" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework-macros" }
borsh = { version = "1.5", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
+4 -4
View File
@@ -1065,7 +1065,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "lee_core"
version = "0.1.0"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
dependencies = [
"base58",
"borsh",
@@ -1822,7 +1822,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "spel-framework"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"borsh",
"lee_core",
@@ -1834,7 +1834,7 @@ dependencies = [
[[package]]
name = "spel-framework-core"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"base58",
"borsh",
@@ -1851,7 +1851,7 @@ dependencies = [
[[package]]
name = "spel-framework-macros"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"proc-macro2",
"quote",
+3 -3
View File
@@ -56,8 +56,8 @@ name = "token"
path = "src/bin/token.rs"
[dependencies]
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
risc0-zkvm = { version = "=3.0.5", default-features = false }
# Pin ruint (transitive via risc0-binfmt) below 1.18, which raised its MSRV to
# rustc 1.90. The risc0 guest toolchain ships rustc 1.88, so 1.18+ fails the
@@ -67,4 +67,4 @@ ruint = { version = "=1.17.0", default-features = false }
token_core = { path = "../../core" }
token_program = { path = "../..", package = "token_program" }
serde = { version = "1.0", features = ["derive"] }
borsh = "1.5"
borsh = "1.5"
@@ -4,7 +4,7 @@
reason = "SPEL macro emits cloned validation slices for one-account instructions"
)]
use nssa_core::account::{AccountId, AccountWithMetadata};
use lee_core::account::{AccountId, AccountWithMetadata};
use spel_framework::context::ProgramContext;
use spel_framework::prelude::*;
+2 -2
View File
@@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021"
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
twap_oracle_core = { path = "core" }
[lints]
+2 -2
View File
@@ -7,10 +7,10 @@ edition = "2021"
workspace = true
[dependencies]
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", features = ["host"], package = "lee_core" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2", features = ["host"], package = "lee_core" }
borsh = { version = "1.5", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework-macros" }
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework-macros" }
risc0-zkvm = { version = "=3.0.5", default-features = false }
uniswap_v3_math = "0.6.2"
alloy-primitives = { version = "1", default-features = false }
+5 -5
View File
@@ -691,7 +691,7 @@ dependencies = [
[[package]]
name = "clock_core"
version = "0.1.0"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
dependencies = [
"borsh",
"lee_core",
@@ -1597,7 +1597,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "lee_core"
version = "0.1.0"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0#a58fbce2ff48c58b7bb5001b1a27e64b9596ee3a"
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.2#d6e4ae694e7419f5906b340c232704466a1917b7"
dependencies = [
"base58",
"borsh",
@@ -2610,7 +2610,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "spel-framework"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"borsh",
"lee_core",
@@ -2622,7 +2622,7 @@ dependencies = [
[[package]]
name = "spel-framework-core"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"base58",
"borsh",
@@ -2639,7 +2639,7 @@ dependencies = [
[[package]]
name = "spel-framework-macros"
version = "0.6.0"
source = "git+https://github.com/logos-co/spel.git?tag=v0.6.0#0cb7e0980535af619482cf1c823f4d394b3ebd61"
source = "git+https://github.com/0x-r4bbit/spel.git?rev=3655513edbc516b76e5d6f725cb2089239e03b7f#3655513edbc516b76e5d6f725cb2089239e03b7f"
dependencies = [
"proc-macro2",
"quote",
@@ -14,11 +14,11 @@ name = "twap_oracle"
path = "src/bin/twap_oracle.rs"
[dependencies]
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.6.0", package = "spel-framework" }
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0", package = "lee_core" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0" }
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", rev = "3655513edbc516b76e5d6f725cb2089239e03b7f", package = "spel-framework" }
lee_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.2" }
risc0-zkvm = { version = "=3.0.5", default-features = false }
twap_oracle_core = { path = "../../core" }
twap_oracle_program = { path = "../..", package = "twap_oracle_program" }
serde = { version = "1.0", features = ["derive"] }
borsh = "1.5"
borsh = "1.5"
@@ -1,6 +1,6 @@
#![cfg_attr(not(test), no_main)]
use nssa_core::account::{AccountId, AccountWithMetadata};
use lee_core::account::{AccountId, AccountWithMetadata};
use spel_framework::context::ProgramContext;
use spel_framework::prelude::*;