Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Dockerfile.ui
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ COPY front/package.json front/bun.lock ./

RUN bun install --frozen-lockfile

COPY front .
COPY front/index.html ./index.html
COPY front/public ./public
COPY fixtures/programs/hyli_utxo.json ./public/hyli_utxo.json
COPY fixtures/programs/hyli_smt_incl_proof.json ./public/hyli_smt_incl_proof.json
COPY front/src ./src
COPY front/*.json ./
COPY front/*.js ./
COPY front/*.ts ./
COPY front/*.tsx ./
COPY front/*.css ./

RUN bun run build --mode production

Expand Down
36 changes: 23 additions & 13 deletions contracts/hyli-utxo-state/src/zk/smt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,25 +333,32 @@ pub mod smt_fixture {
/// and input_notes provides note fields + secret key for commitment/nullifier computation.
pub fn print_prover_toml() {
// Known note fields (Field elements as BE hex)
let kind = FieldElement::from(1u128); // non-zero = real note
let value = FieldElement::from(100u128);
let psi = FieldElement::from(42u128);
let kind = FieldElement::from(1u128); // non-zero = real note
let value = FieldElement::from(100u128);
let psi = FieldElement::from(42u128);
let secret_key = FieldElement::from(7u128);
let address = bn254_blackbox_solver::poseidon_hash(&[secret_key, FieldElement::zero()]).unwrap();
let address =
bn254_blackbox_solver::poseidon_hash(&[secret_key, FieldElement::zero()]).unwrap();

// Commitment = poseidon2([0x2, kind, value, address, psi, 0, 0])
let commitment = bn254_blackbox_solver::poseidon_hash(&[
FieldElement::from(2u128), kind, value, address, psi,
FieldElement::zero(), FieldElement::zero(),
]).unwrap();
FieldElement::from(2u128),
kind,
value,
address,
psi,
FieldElement::zero(),
FieldElement::zero(),
])
.unwrap();

// Nullifier = poseidon2([psi, secret_key])
let nullifier = bn254_blackbox_solver::poseidon_hash(&[psi, secret_key]).unwrap();

// Padding nullifier = poseidon2([0, 0])
let padding_nullifier = bn254_blackbox_solver::poseidon_hash(&[
FieldElement::zero(), FieldElement::zero(),
]).unwrap();
let padding_nullifier =
bn254_blackbox_solver::poseidon_hash(&[FieldElement::zero(), FieldElement::zero()])
.unwrap();

// Store commitment as BE bytes in SMT (matching how app.rs stores them)
let commitment_be: [u8; 32] = commitment.to_be_bytes().try_into().unwrap();
Expand Down Expand Up @@ -440,17 +447,20 @@ pub mod smt_fixture {
println!();
// Input note 1: padding note
println!("[[input_notes]]");
println!("secret_key = \"0x0000000000000000000000000000000000000000000000000000000000000000\"");
println!(
"secret_key = \"0x0000000000000000000000000000000000000000000000000000000000000000\""
);
println!("[input_notes.note]");
println!("kind = \"0x0000000000000000000000000000000000000000000000000000000000000000\"");
println!("value = \"0x0000000000000000000000000000000000000000000000000000000000000000\"");
println!("address = \"0x0000000000000000000000000000000000000000000000000000000000000000\"");
println!(
"address = \"0x0000000000000000000000000000000000000000000000000000000000000000\""
);
println!("psi = \"0x0000000000000000000000000000000000000000000000000000000000000000\"");
}

#[test]
fn generate_smt_prover_toml() {
print_prover_toml();
}

}
4 changes: 2 additions & 2 deletions server/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use hyli_modules::{
use hyli_smt_token::SmtTokenAction;
use hyli_utxo_state::{state::HYLI_UTXO_STATE_ACTION, zk::BorshableH256};
use sdk::{
Blob, BlobData, BlobIndex, BlobTransaction, ContractAction, ContractName, Identity,
ProgramId, ProofData, ProofTransaction, StructuredBlobData, TxHash, Verifier,
Blob, BlobData, BlobIndex, BlobTransaction, ContractAction, ContractName, Identity, ProgramId,
ProofData, ProofTransaction, StructuredBlobData, TxHash, Verifier,
};
use tracing::{info, warn};
use zk_primitives::{
Expand Down
8 changes: 3 additions & 5 deletions server/src/hyli_utxo_state_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ use hyli_utxo_state::{
HyliUtxoZkVmBatch, HyliUtxoZkVmState,
};
use sdk::{
caller::ExecutionContext,
utils::as_hyli_output,
BlobIndex, BlobTransaction, Calldata, Contract, ContractName, HyliOutput,
RegisterContractAction, RunResult, StateCommitment, TxContext,
StructuredBlobData,
caller::ExecutionContext, utils::as_hyli_output, BlobIndex, BlobTransaction, Calldata,
Contract, ContractName, HyliOutput, RegisterContractAction, RunResult, StateCommitment,
StructuredBlobData, TxContext,
};
use std::sync::Arc;
use tracing::info;
Expand Down
Loading