This commit is contained in:
jonesmarvin8 2026-03-30 13:15:32 -04:00
parent 73aa3af4db
commit d7adc391a4
28 changed files with 21 additions and 15 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -11,7 +11,7 @@ use logos_blockchain_core::mantle::{
Op, SignedMantleTx,
ops::channel::{ChannelId, inscribe::InscriptionOp},
};
use nssa::V03State;
use nssa::{AccountId, V03State};
use testnet_initial_state::initial_state_testnet;
use crate::{block_store::IndexerStore, config::IndexerConfig};
@ -71,7 +71,10 @@ impl IndexerCore {
acc.program_owner =
nssa::program::Program::authenticated_transfer_program().id();
nssa_core::Commitment::new(npk, &acc)
nssa_core::Commitment::new(
&AccountId::account_id_without_identifier(npk),
&acc,
)
})
.collect()
});

View File

@ -130,11 +130,12 @@ pub struct AccountWithMetadata {
#[cfg(feature = "host")]
impl AccountWithMetadata {
pub fn new(account: Account, is_authorized: bool, account_id: AccountId) -> Self {
#[must_use]
pub const fn new(account: Account, is_authorized: bool, account_id: AccountId) -> Self {
Self {
account,
is_authorized,
account_id: account_id,
account_id,
}
}
}
@ -188,7 +189,7 @@ impl AccountId {
bytes.extend_from_slice(&value.0);
match identifier {
None => {},
None => {}
Some(identifier) => bytes.extend_from_slice(&identifier.to_le_bytes()),
}
@ -209,7 +210,6 @@ impl AccountId {
pub fn account_id_without_identifier(value: &NullifierPublicKey) -> Self {
Self::generate_account_id(value, None)
}
}
impl AsRef<[u8]> for AccountId {
@ -385,7 +385,6 @@ mod tests {
assert_eq!(nonce, nonce_restored);
}
#[test]
fn account_id_from_nullifier_public_key() {
let nsk = [

View File

@ -48,7 +48,6 @@ impl PrivacyPreservingCircuitOutput {
}
}
#[cfg(feature = "host")]
#[cfg(test)]
mod tests {
@ -93,12 +92,17 @@ mod tests {
}],
ciphertexts: vec![Ciphertext(vec![255, 255, 1, 1, 2, 2])],
new_commitments: vec![Commitment::new(
&AccountId::account_id_without_identifier(&NullifierPublicKey::from(&[1_u8;32])),
&AccountId::account_id_without_identifier(&NullifierPublicKey::from(&[1_u8; 32])),
&Account::default(),
)],
new_nullifiers: vec![(
Nullifier::for_account_update(
&Commitment::new(&AccountId::account_id_without_identifier(&NullifierPublicKey::from(&[2_u8;32])), &Account::default()),
&Commitment::new(
&AccountId::account_id_without_identifier(&NullifierPublicKey::from(
&[2_u8; 32],
)),
&Account::default(),
),
&[1; 32],
),
[0xab; 32],
@ -110,4 +114,3 @@ mod tests {
assert_eq!(output, output_from_slice);
}
}
*/

View File

@ -2,7 +2,7 @@ use borsh::{BorshDeserialize, BorshSerialize};
use risc0_zkvm::sha::{Impl, Sha256 as _};
use serde::{Deserialize, Serialize};
use crate::{account::{Account, AccountId}};
use crate::account::{Account, AccountId};
/// A commitment to all zero data.
/// ```python
@ -50,7 +50,7 @@ impl std::fmt::Debug for Commitment {
impl Commitment {
/// Generates the commitment to a private account owned by user for npk:
/// SHA256( `Comm_DS` || account_id || `program_owner` || balance || nonce || SHA256(data)).
/// SHA256( `Comm_DS` || `account_id` || `program_owner` || balance || nonce || SHA256(data)).
#[must_use]
pub fn new(account_id: &AccountId, account: &Account) -> Self {
const COMMITMENT_PREFIX: &[u8; 32] =
@ -115,7 +115,8 @@ mod tests {
use risc0_zkvm::sha::{Impl, Sha256 as _};
use crate::{
Commitment, DUMMY_COMMITMENT, DUMMY_COMMITMENT_HASH, account::{Account, AccountId},
Commitment, DUMMY_COMMITMENT, DUMMY_COMMITMENT_HASH,
account::{Account, AccountId},
};
#[test]

View File

@ -372,7 +372,7 @@ mod tests {
let pre = AccountWithMetadata::new(
Account::default(),
false,
AccountId::from(&account_keys.npk()),
AccountId::account_id_without_identifier(&account_keys.npk()),
);
let validity_window_chain_caller = Program::validity_window_chain_caller();