This commit is contained in:
Sergio Chouhy 2026-03-19 18:55:19 -03:00
parent 0d46f0798a
commit aeddb56978
6 changed files with 29 additions and 20 deletions

View File

@ -3,7 +3,7 @@ use log::warn;
use nssa::{AccountId, V02State};
use serde::{Deserialize, Serialize};
use crate::{block::BlockId, HashType};
use crate::{HashType, block::BlockId};
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
pub enum NSSATransaction {
@ -56,11 +56,13 @@ impl NSSATransaction {
pub fn execute_check_on_state(
self,
state: &mut V02State,
block_id: BlockId
block_id: BlockId,
) -> Result<Self, nssa::error::NssaError> {
match &self {
Self::Public(tx) => state.transition_from_public_transaction(tx, block_id),
Self::PrivacyPreserving(tx) => state.transition_from_privacy_preserving_transaction(tx, block_id),
Self::PrivacyPreserving(tx) => {
state.transition_from_privacy_preserving_transaction(tx, block_id)
}
Self::ProgramDeployment(tx) => state.transition_from_program_deployment_transaction(tx),
}
.inspect_err(|err| warn!("Error at transition {err:#?}"))?;

View File

@ -3,7 +3,11 @@
use nssa_core::account::Nonce;
use crate::{
Account, AccountId, BedrockStatus, Block, BlockBody, BlockHeader, Ciphertext, Commitment, CommitmentSetDigest, Data, EncryptedAccountData, EphemeralPublicKey, HashType, MantleMsgId, Nullifier, PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage, ProgramDeploymentTransaction, ProgramId, Proof, PublicKey, PublicMessage, PublicTransaction, Signature, Transaction, ValidityWindow, WitnessSet
Account, AccountId, BedrockStatus, Block, BlockBody, BlockHeader, Ciphertext, Commitment,
CommitmentSetDigest, Data, EncryptedAccountData, EphemeralPublicKey, HashType, MantleMsgId,
Nullifier, PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage,
ProgramDeploymentTransaction, ProgramId, Proof, PublicKey, PublicMessage, PublicTransaction,
Signature, Transaction, ValidityWindow, WitnessSet,
};
// ============================================================================

View File

@ -13,7 +13,7 @@ use indexer_service_protocol::{
CommitmentSetDigest, Data, EncryptedAccountData, HashType, MantleMsgId,
PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage,
ProgramDeploymentTransaction, ProgramId, PublicMessage, PublicTransaction, Signature,
Transaction, WitnessSet, ValidityWindow
Transaction, ValidityWindow, WitnessSet,
};
use jsonrpsee::{core::SubscriptionResult, types::ErrorObjectOwned};

View File

@ -1,7 +1,11 @@
use serde::{Deserialize, Serialize};
use crate::{
account::{Account, AccountWithMetadata}, encryption::Ciphertext, program::{ProgramId, ProgramOutput, ValidityWindow}, Commitment, CommitmentSetDigest, MembershipProof, Nullifier, NullifierPublicKey, NullifierSecretKey, SharedSecretKey
Commitment, CommitmentSetDigest, MembershipProof, Nullifier, NullifierPublicKey,
NullifierSecretKey, SharedSecretKey,
account::{Account, AccountWithMetadata},
encryption::Ciphertext,
program::{ProgramId, ProgramOutput, ValidityWindow},
};
#[derive(Serialize, Deserialize)]
@ -32,7 +36,7 @@ pub struct PrivacyPreservingCircuitOutput {
pub ciphertexts: Vec<Ciphertext>,
pub new_commitments: Vec<Commitment>,
pub new_nullifiers: Vec<(Nullifier, CommitmentSetDigest)>,
pub validity_window: ValidityWindow
pub validity_window: ValidityWindow,
}
#[cfg(feature = "host")]

View File

@ -53,7 +53,6 @@ impl ExecutionState {
};
let mut chained_calls = VecDeque::from_iter([(initial_call, None)]);
let mut program_outputs_iter = program_outputs.into_iter();
let mut chain_calls_counter = 0;

View File

@ -163,8 +163,8 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded(
transfer.send_shielded_transfer_to_outer_account(from_id, to_npk, to_vpk, amount),
) {
Ok((response, _shared_key)) => {
let tx_hash = CString::new(response.tx_hash)
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
let tx_hash =
CString::new(response.tx_hash).map_or(ptr::null_mut(), std::ffi::CString::into_raw);
unsafe {
(*out_result).tx_hash = tx_hash;
@ -243,8 +243,8 @@ pub unsafe extern "C" fn wallet_ffi_transfer_deshielded(
match block_on(transfer.send_deshielded_transfer(from_id, to_id, amount)) {
Ok((response, _shared_key)) => {
let tx_hash = CString::new(response.tx_hash)
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
let tx_hash =
CString::new(response.tx_hash).map_or(ptr::null_mut(), std::ffi::CString::into_raw);
unsafe {
(*out_result).tx_hash = tx_hash;
@ -331,8 +331,8 @@ pub unsafe extern "C" fn wallet_ffi_transfer_private(
match block_on(transfer.send_private_transfer_to_outer_account(from_id, to_npk, to_vpk, amount))
{
Ok((response, _shared_key)) => {
let tx_hash = CString::new(response.tx_hash)
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
let tx_hash =
CString::new(response.tx_hash).map_or(ptr::null_mut(), std::ffi::CString::into_raw);
unsafe {
(*out_result).tx_hash = tx_hash;
@ -414,8 +414,8 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded_owned(
match block_on(transfer.send_shielded_transfer(from_id, to_id, amount)) {
Ok((response, _shared_key)) => {
let tx_hash = CString::new(response.tx_hash)
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
let tx_hash =
CString::new(response.tx_hash).map_or(ptr::null_mut(), std::ffi::CString::into_raw);
unsafe {
(*out_result).tx_hash = tx_hash;
@ -497,8 +497,8 @@ pub unsafe extern "C" fn wallet_ffi_transfer_private_owned(
match block_on(transfer.send_private_transfer_to_owned_account(from_id, to_id, amount)) {
Ok((response, _shared_keys)) => {
let tx_hash = CString::new(response.tx_hash)
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
let tx_hash =
CString::new(response.tx_hash).map_or(ptr::null_mut(), std::ffi::CString::into_raw);
unsafe {
(*out_result).tx_hash = tx_hash;
@ -639,8 +639,8 @@ pub unsafe extern "C" fn wallet_ffi_register_private_account(
match block_on(transfer.register_account_private(account_id)) {
Ok((res, _secret)) => {
let tx_hash = CString::new(res.tx_hash)
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);
let tx_hash =
CString::new(res.tx_hash).map_or(ptr::null_mut(), std::ffi::CString::into_raw);
unsafe {
(*out_result).tx_hash = tx_hash;