mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-03 22:03:06 +00:00
fix: lints fix
This commit is contained in:
parent
411d8e9034
commit
cdd1bdbfbd
@ -136,7 +136,7 @@ mod tests {
|
|||||||
|
|
||||||
// Generate a random ephemeral public key sender
|
// Generate a random ephemeral public key sender
|
||||||
let scalar = Scalar::random(&mut OsRng);
|
let scalar = Scalar::random(&mut OsRng);
|
||||||
let ephemeral_public_key_sender = (ProjectivePoint::generator() * scalar).to_affine();
|
let ephemeral_public_key_sender = (ProjectivePoint::GENERATOR * scalar).to_affine();
|
||||||
|
|
||||||
// Calculate shared secret
|
// Calculate shared secret
|
||||||
let shared_secret =
|
let shared_secret =
|
||||||
@ -170,7 +170,7 @@ mod tests {
|
|||||||
.decrypt_data(
|
.decrypt_data(
|
||||||
ephemeral_public_key_sender,
|
ephemeral_public_key_sender,
|
||||||
CipherText::from(ciphertext),
|
CipherText::from(ciphertext),
|
||||||
nonce.clone(),
|
*nonce,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ mod tests {
|
|||||||
assert!(!Into::<bool>::into(
|
assert!(!Into::<bool>::into(
|
||||||
address_key_holder.viewing_public_key.is_identity()
|
address_key_holder.viewing_public_key.is_identity()
|
||||||
));
|
));
|
||||||
assert!(address_key_holder.address.as_slice().len() > 0); // Assume TreeHashType has non-zero length for a valid address
|
assert!(!address_key_holder.address.as_slice().is_empty()); // Assume TreeHashType has non-zero length for a valid address
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -232,7 +232,7 @@ mod tests {
|
|||||||
.decrypt_data(
|
.decrypt_data(
|
||||||
ephemeral_public_key_sender,
|
ephemeral_public_key_sender,
|
||||||
CipherText::from(ciphertext.clone()),
|
CipherText::from(ciphertext.clone()),
|
||||||
incorrect_nonce.clone(),
|
*incorrect_nonce,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ mod tests {
|
|||||||
.decrypt_data(
|
.decrypt_data(
|
||||||
ephemeral_public_key_sender,
|
ephemeral_public_key_sender,
|
||||||
CipherText::from(corrupted_ciphertext),
|
CipherText::from(corrupted_ciphertext),
|
||||||
nonce.clone(),
|
*nonce,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ mod tests {
|
|||||||
.decrypt_data(
|
.decrypt_data(
|
||||||
ephemeral_public_key_sender,
|
ephemeral_public_key_sender,
|
||||||
CipherText::from(ciphertext),
|
CipherText::from(ciphertext),
|
||||||
nonce.clone(),
|
*nonce,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|||||||
@ -447,7 +447,7 @@ mod tests {
|
|||||||
/// A helper for the `broken` test.
|
/// A helper for the `broken` test.
|
||||||
///
|
///
|
||||||
/// Check that the given JSON string parses, but is not recognized as a valid RPC message.
|
/// Check that the given JSON string parses, but is not recognized as a valid RPC message.
|
||||||
|
///
|
||||||
/// Test things that are almost but not entirely JSONRPC are rejected
|
/// Test things that are almost but not entirely JSONRPC are rejected
|
||||||
///
|
///
|
||||||
/// The reject is done by returning it as Unmatched.
|
/// The reject is done by returning it as Unmatched.
|
||||||
|
|||||||
@ -237,21 +237,21 @@ impl Transaction {
|
|||||||
"Transaction utxo_commitments_spent_hashes is {:?}",
|
"Transaction utxo_commitments_spent_hashes is {:?}",
|
||||||
self.utxo_commitments_spent_hashes
|
self.utxo_commitments_spent_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| hex::encode(val.clone()))
|
.map(|val| hex::encode(*val))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
"Transaction utxo_commitments_created_hashes is {:?}",
|
"Transaction utxo_commitments_created_hashes is {:?}",
|
||||||
self.utxo_commitments_created_hashes
|
self.utxo_commitments_created_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| hex::encode(val.clone()))
|
.map(|val| hex::encode(*val))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
"Transaction nullifier_created_hashes is {:?}",
|
"Transaction nullifier_created_hashes is {:?}",
|
||||||
self.nullifier_created_hashes
|
self.nullifier_created_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| hex::encode(val.clone()))
|
.map(|val| hex::encode(*val))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
info!(
|
info!(
|
||||||
|
|||||||
@ -54,7 +54,7 @@ mod tests {
|
|||||||
let mut store = NodeAccountsStore::new();
|
let mut store = NodeAccountsStore::new();
|
||||||
|
|
||||||
let account = create_sample_account(100);
|
let account = create_sample_account(100);
|
||||||
let account_addr = account.address.clone();
|
let account_addr = account.address;
|
||||||
|
|
||||||
store.register_account(account);
|
store.register_account(account);
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ mod tests {
|
|||||||
let mut store = NodeAccountsStore::new();
|
let mut store = NodeAccountsStore::new();
|
||||||
|
|
||||||
let account = create_sample_account(100);
|
let account = create_sample_account(100);
|
||||||
let account_addr = account.address.clone();
|
let account_addr = account.address;
|
||||||
store.register_account(account);
|
store.register_account(account);
|
||||||
|
|
||||||
assert_eq!(store.accounts.len(), 1);
|
assert_eq!(store.accounts.len(), 1);
|
||||||
@ -94,8 +94,8 @@ mod tests {
|
|||||||
let account1 = create_sample_account(100);
|
let account1 = create_sample_account(100);
|
||||||
let account2 = create_sample_account(200);
|
let account2 = create_sample_account(200);
|
||||||
|
|
||||||
let address_1 = account1.address.clone();
|
let address_1 = account1.address;
|
||||||
let address_2 = account2.address.clone();
|
let address_2 = account2.address;
|
||||||
|
|
||||||
store.register_account(account1);
|
store.register_account(account1);
|
||||||
store.register_account(account2);
|
store.register_account(account2);
|
||||||
|
|||||||
@ -145,8 +145,8 @@ mod tests {
|
|||||||
|
|
||||||
fn create_sample_block(block_id: u64, prev_block_id: u64) -> Block {
|
fn create_sample_block(block_id: u64, prev_block_id: u64) -> Block {
|
||||||
Block {
|
Block {
|
||||||
block_id: block_id,
|
block_id,
|
||||||
prev_block_id: prev_block_id,
|
prev_block_id,
|
||||||
prev_block_hash: [0; 32],
|
prev_block_hash: [0; 32],
|
||||||
hash: [1; 32],
|
hash: [1; 32],
|
||||||
transactions: vec![],
|
transactions: vec![],
|
||||||
@ -211,7 +211,7 @@ mod tests {
|
|||||||
|
|
||||||
// The genesis block should be available on reload
|
// The genesis block should be available on reload
|
||||||
let result = node_store.get_block_at_id(0);
|
let result = node_store.get_block_at_id(0);
|
||||||
assert!(!result.is_err());
|
assert!(result.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@ -80,7 +80,7 @@ impl NodeChainStore {
|
|||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
Self {
|
Self {
|
||||||
acc_map: From::from(acc_map),
|
acc_map,
|
||||||
block_store,
|
block_store,
|
||||||
nullifier_store,
|
nullifier_store,
|
||||||
utxo_commitments_store,
|
utxo_commitments_store,
|
||||||
@ -324,8 +324,8 @@ mod tests {
|
|||||||
|
|
||||||
fn create_sample_block(block_id: u64, prev_block_id: u64) -> Block {
|
fn create_sample_block(block_id: u64, prev_block_id: u64) -> Block {
|
||||||
Block {
|
Block {
|
||||||
block_id: block_id,
|
block_id,
|
||||||
prev_block_id: prev_block_id,
|
prev_block_id,
|
||||||
prev_block_hash: [0; 32],
|
prev_block_hash: [0; 32],
|
||||||
hash: [1; 32],
|
hash: [1; 32],
|
||||||
transactions: vec![],
|
transactions: vec![],
|
||||||
@ -434,9 +434,6 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(block_id, 1);
|
assert_eq!(block_id, 1);
|
||||||
assert_eq!(recovered_store.acc_map.len(), 1);
|
assert_eq!(recovered_store.acc_map.len(), 1);
|
||||||
assert_eq!(
|
assert!(recovered_store.utxo_commitments_store.get_root().is_some());
|
||||||
recovered_store.utxo_commitments_store.get_root().is_some(),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,16 +71,11 @@ impl PublicSCContext {
|
|||||||
|
|
||||||
//`ToDo` Replace with `next_chunk` usage, when feature stabilizes in Rust
|
//`ToDo` Replace with `next_chunk` usage, when feature stabilizes in Rust
|
||||||
for i in 0..=(ser_data.len() / 8) {
|
for i in 0..=(ser_data.len() / 8) {
|
||||||
let next_chunk: Vec<u8>;
|
let next_chunk: Vec<u8> = if (i + 1) * 8 < ser_data.len() {
|
||||||
|
ser_data[(i * 8)..((i + 1) * 8)].to_vec()
|
||||||
if (i + 1) * 8 < ser_data.len() {
|
|
||||||
next_chunk = ser_data[(i * 8)..((i + 1) * 8)].iter().cloned().collect();
|
|
||||||
} else {
|
} else {
|
||||||
next_chunk = ser_data[(i * 8)..(ser_data.len())]
|
ser_data[(i * 8)..(ser_data.len())].to_vec()
|
||||||
.iter()
|
};
|
||||||
.cloned()
|
|
||||||
.collect();
|
|
||||||
}
|
|
||||||
|
|
||||||
u64_list.push(PublicSCContext::produce_u64_from_fit_vec(next_chunk));
|
u64_list.push(PublicSCContext::produce_u64_from_fit_vec(next_chunk));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,19 +204,18 @@ impl NodeCore {
|
|||||||
serde_json::to_vec(&ephm_key_holder.generate_ephemeral_public_key()).unwrap();
|
serde_json::to_vec(&ephm_key_holder.generate_ephemeral_public_key()).unwrap();
|
||||||
|
|
||||||
let encoded_data = Account::encrypt_data(
|
let encoded_data = Account::encrypt_data(
|
||||||
&ephm_key_holder,
|
ephm_key_holder,
|
||||||
account.key_holder.viewing_public_key,
|
account.key_holder.viewing_public_key,
|
||||||
&serde_json::to_vec(&utxo).unwrap(),
|
&serde_json::to_vec(&utxo).unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let tag = account.make_tag();
|
let tag = account.make_tag();
|
||||||
|
|
||||||
let comm = generate_commitments(&vec![utxo]);
|
let comm = generate_commitments(&[utxo]);
|
||||||
|
|
||||||
let mint_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::MINT_UTXO_ID
|
let mint_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::MINT_UTXO_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let sc_addr = hex::encode(mint_utxo_addr_bytes);
|
let sc_addr = hex::encode(mint_utxo_addr_bytes);
|
||||||
|
|
||||||
@ -297,7 +296,7 @@ impl NodeCore {
|
|||||||
.map(|utxo| {
|
.map(|utxo| {
|
||||||
(
|
(
|
||||||
Account::encrypt_data(
|
Account::encrypt_data(
|
||||||
&ephm_key_holder,
|
ephm_key_holder,
|
||||||
account.key_holder.viewing_public_key,
|
account.key_holder.viewing_public_key,
|
||||||
&serde_json::to_vec(&utxo).unwrap(),
|
&serde_json::to_vec(&utxo).unwrap(),
|
||||||
),
|
),
|
||||||
@ -312,8 +311,7 @@ impl NodeCore {
|
|||||||
let mint_multiple_utxo_addr_bytes: Vec<u8> =
|
let mint_multiple_utxo_addr_bytes: Vec<u8> =
|
||||||
zkvm::test_methods::MINT_UTXO_MULTIPLE_ASSETS_ID
|
zkvm::test_methods::MINT_UTXO_MULTIPLE_ASSETS_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let sc_addr = hex::encode(mint_multiple_utxo_addr_bytes);
|
let sc_addr = hex::encode(mint_multiple_utxo_addr_bytes);
|
||||||
|
|
||||||
@ -386,14 +384,13 @@ impl NodeCore {
|
|||||||
.key_holder
|
.key_holder
|
||||||
.utxo_secret_key_holder
|
.utxo_secret_key_holder
|
||||||
.nullifier_secret_key
|
.nullifier_secret_key
|
||||||
.to_bytes()
|
.to_bytes(),
|
||||||
.to_vec(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let (resulting_utxos, receipt) = prove_send_utxo(utxo, receivers)?;
|
let (resulting_utxos, receipt) = prove_send_utxo(utxo, receivers)?;
|
||||||
let utxo_hashes = resulting_utxos
|
let utxo_hashes = resulting_utxos
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(utxo, addr)| (addr.clone(), utxo.hash))
|
.map(|(utxo, addr)| (*addr, utxo.hash))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let utxos: Vec<UTXO> = resulting_utxos
|
let utxos: Vec<UTXO> = resulting_utxos
|
||||||
@ -413,7 +410,7 @@ impl NodeCore {
|
|||||||
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
||||||
|
|
||||||
let (ciphertext, nonce) = Account::encrypt_data(
|
let (ciphertext, nonce) = Account::encrypt_data(
|
||||||
&ephm_key_holder,
|
ephm_key_holder,
|
||||||
accout_enc.key_holder.viewing_public_key,
|
accout_enc.key_holder.viewing_public_key,
|
||||||
&serde_json::to_vec(&utxo_enc).unwrap(),
|
&serde_json::to_vec(&utxo_enc).unwrap(),
|
||||||
);
|
);
|
||||||
@ -428,8 +425,7 @@ impl NodeCore {
|
|||||||
|
|
||||||
let send_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
let send_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let sc_addr = hex::encode(send_utxo_addr_bytes);
|
let sc_addr = hex::encode(send_utxo_addr_bytes);
|
||||||
|
|
||||||
@ -535,7 +531,7 @@ impl NodeCore {
|
|||||||
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
||||||
|
|
||||||
let (ciphertext, nonce) = Account::encrypt_data(
|
let (ciphertext, nonce) = Account::encrypt_data(
|
||||||
&ephm_key_holder,
|
ephm_key_holder,
|
||||||
accout_enc.key_holder.viewing_public_key,
|
accout_enc.key_holder.viewing_public_key,
|
||||||
&serde_json::to_vec(&utxo_enc).unwrap(),
|
&serde_json::to_vec(&utxo_enc).unwrap(),
|
||||||
);
|
);
|
||||||
@ -552,7 +548,7 @@ impl NodeCore {
|
|||||||
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
||||||
|
|
||||||
let (ciphertext, nonce) = Account::encrypt_data(
|
let (ciphertext, nonce) = Account::encrypt_data(
|
||||||
&ephm_key_holder,
|
ephm_key_holder,
|
||||||
accout_enc.key_holder.viewing_public_key,
|
accout_enc.key_holder.viewing_public_key,
|
||||||
&serde_json::to_vec(&utxo_enc).unwrap(),
|
&serde_json::to_vec(&utxo_enc).unwrap(),
|
||||||
);
|
);
|
||||||
@ -573,8 +569,7 @@ impl NodeCore {
|
|||||||
let send_multiple_utxo_addr_bytes: Vec<u8> =
|
let send_multiple_utxo_addr_bytes: Vec<u8> =
|
||||||
zkvm::test_methods::SEND_UTXO_MULTIPLE_ASSETS_ID
|
zkvm::test_methods::SEND_UTXO_MULTIPLE_ASSETS_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let sc_addr = hex::encode(send_multiple_utxo_addr_bytes);
|
let sc_addr = hex::encode(send_multiple_utxo_addr_bytes);
|
||||||
|
|
||||||
@ -654,14 +649,13 @@ impl NodeCore {
|
|||||||
.key_holder
|
.key_holder
|
||||||
.utxo_secret_key_holder
|
.utxo_secret_key_holder
|
||||||
.nullifier_secret_key
|
.nullifier_secret_key
|
||||||
.to_bytes()
|
.to_bytes(),
|
||||||
.to_vec(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let (resulting_utxos, receipt) = prove_send_utxo_shielded(acc, balance as u128, receivers)?;
|
let (resulting_utxos, receipt) = prove_send_utxo_shielded(acc, balance as u128, receivers)?;
|
||||||
let utxo_hashes = resulting_utxos
|
let utxo_hashes = resulting_utxos
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(utxo, addr)| (addr.clone(), utxo.hash))
|
.map(|(utxo, addr)| (*addr, utxo.hash))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let utxos: Vec<UTXO> = resulting_utxos
|
let utxos: Vec<UTXO> = resulting_utxos
|
||||||
@ -681,7 +675,7 @@ impl NodeCore {
|
|||||||
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
||||||
|
|
||||||
let (ciphertext, nonce) = Account::encrypt_data(
|
let (ciphertext, nonce) = Account::encrypt_data(
|
||||||
&ephm_key_holder,
|
ephm_key_holder,
|
||||||
accout_enc.key_holder.viewing_public_key,
|
accout_enc.key_holder.viewing_public_key,
|
||||||
&serde_json::to_vec(&utxo_enc).unwrap(),
|
&serde_json::to_vec(&utxo_enc).unwrap(),
|
||||||
);
|
);
|
||||||
@ -696,8 +690,7 @@ impl NodeCore {
|
|||||||
|
|
||||||
let mint_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
let mint_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let sc_addr = hex::encode(mint_utxo_addr_bytes);
|
let sc_addr = hex::encode(mint_utxo_addr_bytes);
|
||||||
|
|
||||||
@ -782,16 +775,14 @@ impl NodeCore {
|
|||||||
.key_holder
|
.key_holder
|
||||||
.utxo_secret_key_holder
|
.utxo_secret_key_holder
|
||||||
.nullifier_secret_key
|
.nullifier_secret_key
|
||||||
.to_bytes()
|
.to_bytes(),
|
||||||
.to_vec(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let (resulting_balances, receipt) = prove_send_utxo_deshielded(utxo, receivers)?;
|
let (resulting_balances, receipt) = prove_send_utxo_deshielded(utxo, receivers)?;
|
||||||
|
|
||||||
let send_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
let send_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let sc_addr = hex::encode(send_utxo_addr_bytes);
|
let sc_addr = hex::encode(send_utxo_addr_bytes);
|
||||||
|
|
||||||
@ -1372,14 +1363,13 @@ impl NodeCore {
|
|||||||
.key_holder
|
.key_holder
|
||||||
.utxo_secret_key_holder
|
.utxo_secret_key_holder
|
||||||
.nullifier_secret_key
|
.nullifier_secret_key
|
||||||
.to_bytes()
|
.to_bytes(),
|
||||||
.to_vec(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let (resulting_utxos, receipt) = prove_send_utxo(utxo, receivers)?;
|
let (resulting_utxos, receipt) = prove_send_utxo(utxo, receivers)?;
|
||||||
let utxo_hashes = resulting_utxos
|
let utxo_hashes = resulting_utxos
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(utxo, addr)| (addr.clone(), utxo.hash))
|
.map(|(utxo, addr)| (*addr, utxo.hash))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let utxos: Vec<UTXO> = resulting_utxos
|
let utxos: Vec<UTXO> = resulting_utxos
|
||||||
@ -1399,7 +1389,7 @@ impl NodeCore {
|
|||||||
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
let accout_enc = acc_map_read_guard.acc_map.get(&utxo_enc.owner).unwrap();
|
||||||
|
|
||||||
let (ciphertext, nonce) = Account::encrypt_data(
|
let (ciphertext, nonce) = Account::encrypt_data(
|
||||||
&ephm_key_holder,
|
ephm_key_holder,
|
||||||
accout_enc.key_holder.viewing_public_key,
|
accout_enc.key_holder.viewing_public_key,
|
||||||
&serde_json::to_vec(&utxo_enc).unwrap(),
|
&serde_json::to_vec(&utxo_enc).unwrap(),
|
||||||
);
|
);
|
||||||
@ -1428,8 +1418,7 @@ impl NodeCore {
|
|||||||
|
|
||||||
let send_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
let send_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let sc_addr = hex::encode(send_utxo_addr_bytes);
|
let sc_addr = hex::encode(send_utxo_addr_bytes);
|
||||||
|
|
||||||
@ -1528,10 +1517,7 @@ impl NodeCore {
|
|||||||
.send_split_tx(
|
.send_split_tx(
|
||||||
utxo.clone(),
|
utxo.clone(),
|
||||||
comm_gen_hash,
|
comm_gen_hash,
|
||||||
addrs_receivers
|
addrs_receivers.map(|addr| (utxo.amount / 3, addr)).to_vec(),
|
||||||
.clone()
|
|
||||||
.map(|addr| (utxo.amount / 3, addr))
|
|
||||||
.to_vec(),
|
|
||||||
visibility_list,
|
visibility_list,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
@ -22,8 +22,7 @@ pub async fn setup_empty_sc_states(node: &NodeChainStore) -> Result<()> {
|
|||||||
|
|
||||||
let mint_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::MINT_UTXO_ID
|
let mint_utxo_addr_bytes: Vec<u8> = zkvm::test_methods::MINT_UTXO_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let mint_utxo_addr = hex::encode(mint_utxo_addr_bytes);
|
let mint_utxo_addr = hex::encode(mint_utxo_addr_bytes);
|
||||||
node.block_store
|
node.block_store
|
||||||
@ -32,8 +31,7 @@ pub async fn setup_empty_sc_states(node: &NodeChainStore) -> Result<()> {
|
|||||||
|
|
||||||
let single_utxo_transfer_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
let single_utxo_transfer_addr_bytes: Vec<u8> = zkvm::test_methods::SEND_UTXO_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let single_utxo_transfer_addr = hex::encode(single_utxo_transfer_addr_bytes);
|
let single_utxo_transfer_addr = hex::encode(single_utxo_transfer_addr_bytes);
|
||||||
node.block_store.put_sc_sc_state(
|
node.block_store.put_sc_sc_state(
|
||||||
@ -46,8 +44,7 @@ pub async fn setup_empty_sc_states(node: &NodeChainStore) -> Result<()> {
|
|||||||
let mint_utxo_multiple_assets_addr_bytes: Vec<u8> =
|
let mint_utxo_multiple_assets_addr_bytes: Vec<u8> =
|
||||||
zkvm::test_methods::MINT_UTXO_MULTIPLE_ASSETS_ID
|
zkvm::test_methods::MINT_UTXO_MULTIPLE_ASSETS_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let mint_utxo_multiple_assets_addr = hex::encode(mint_utxo_multiple_assets_addr_bytes);
|
let mint_utxo_multiple_assets_addr = hex::encode(mint_utxo_multiple_assets_addr_bytes);
|
||||||
node.block_store.put_sc_sc_state(
|
node.block_store.put_sc_sc_state(
|
||||||
@ -60,8 +57,7 @@ pub async fn setup_empty_sc_states(node: &NodeChainStore) -> Result<()> {
|
|||||||
let multiple_assets_utxo_transfer_addr_bytes: Vec<u8> =
|
let multiple_assets_utxo_transfer_addr_bytes: Vec<u8> =
|
||||||
zkvm::test_methods::SEND_UTXO_MULTIPLE_ASSETS_ID
|
zkvm::test_methods::SEND_UTXO_MULTIPLE_ASSETS_ID
|
||||||
.iter()
|
.iter()
|
||||||
.map(|num| num.to_le_bytes())
|
.flat_map(|num| num.to_le_bytes())
|
||||||
.flatten()
|
|
||||||
.collect();
|
.collect();
|
||||||
let multiple_assets_utxo_transfer_addr = hex::encode(multiple_assets_utxo_transfer_addr_bytes);
|
let multiple_assets_utxo_transfer_addr = hex::encode(multiple_assets_utxo_transfer_addr_bytes);
|
||||||
node.block_store.put_sc_sc_state(
|
node.block_store.put_sc_sc_state(
|
||||||
|
|||||||
@ -330,17 +330,17 @@ impl JsonHandler {
|
|||||||
utxo_commitments_created_hashes: tx
|
utxo_commitments_created_hashes: tx
|
||||||
.utxo_commitments_created_hashes
|
.utxo_commitments_created_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| hex::encode(val.clone()))
|
.map(hex::encode)
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
utxo_commitments_spent_hashes: tx
|
utxo_commitments_spent_hashes: tx
|
||||||
.utxo_commitments_spent_hashes
|
.utxo_commitments_spent_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| hex::encode(val.clone()))
|
.map(hex::encode)
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
utxo_nullifiers_created_hashes: tx
|
utxo_nullifiers_created_hashes: tx
|
||||||
.nullifier_created_hashes
|
.nullifier_created_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|val| hex::encode(val.clone()))
|
.map(hex::encode)
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
encoded_data: tx
|
encoded_data: tx
|
||||||
.encoded_data
|
.encoded_data
|
||||||
@ -529,7 +529,7 @@ impl JsonHandler {
|
|||||||
utxo_result: UTXOShortEssentialStruct {
|
utxo_result: UTXOShortEssentialStruct {
|
||||||
hash: hex::encode(new_utxo_rec.hash),
|
hash: hex::encode(new_utxo_rec.hash),
|
||||||
asset: new_utxo_rec.asset.clone(),
|
asset: new_utxo_rec.asset.clone(),
|
||||||
commitment_hash: hex::encode(generate_commitments_helper(&vec![new_utxo_rec])[0]),
|
commitment_hash: hex::encode(generate_commitments_helper(&[new_utxo_rec])[0]),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ impl JsonHandler {
|
|||||||
utxo_result: UTXOShortEssentialStruct {
|
utxo_result: UTXOShortEssentialStruct {
|
||||||
hash: hex::encode(new_utxo_rec.hash),
|
hash: hex::encode(new_utxo_rec.hash),
|
||||||
asset: new_utxo_rec.asset.clone(),
|
asset: new_utxo_rec.asset.clone(),
|
||||||
commitment_hash: hex::encode(generate_commitments_helper(&vec![new_utxo_rec])[0]),
|
commitment_hash: hex::encode(generate_commitments_helper(&[new_utxo_rec])[0]),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ pub fn generate_commitments(input_utxos: &[UTXO]) -> Vec<Vec<u8>> {
|
|||||||
// takes the in_commitments[i] as a leaf, the root hash root_commitment and the path in_commitments_proofs[i][],
|
// takes the in_commitments[i] as a leaf, the root hash root_commitment and the path in_commitments_proofs[i][],
|
||||||
// returns True if the in_commitments[i] is in the tree with root hash root_commitment otherwise returns False, as membership proof.
|
// returns True if the in_commitments[i] is in the tree with root hash root_commitment otherwise returns False, as membership proof.
|
||||||
pub fn validate_in_commitments_proof(
|
pub fn validate_in_commitments_proof(
|
||||||
_in_commitment: &Vec<u8>,
|
_in_commitment: &[u8],
|
||||||
_root_commitment: Vec<u8>,
|
_root_commitment: Vec<u8>,
|
||||||
_in_commitments_proof: &[Vec<u8>],
|
_in_commitments_proof: &[Vec<u8>],
|
||||||
) -> bool {
|
) -> bool {
|
||||||
@ -65,11 +65,11 @@ fn private_kernel(
|
|||||||
nullifier_secret_key: Scalar,
|
nullifier_secret_key: Scalar,
|
||||||
) -> (Vec<u8>, Vec<Vec<u8>>) {
|
) -> (Vec<u8>, Vec<Vec<u8>>) {
|
||||||
let nullifiers: Vec<_> = input_utxos
|
let nullifiers: Vec<_> = input_utxos
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|utxo| generate_nullifiers(&utxo, &nullifier_secret_key.to_bytes()))
|
.map(|utxo| generate_nullifiers(utxo, &nullifier_secret_key.to_bytes()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let in_commitments = generate_commitments(&input_utxos);
|
let in_commitments = generate_commitments(input_utxos);
|
||||||
|
|
||||||
for in_commitment in in_commitments {
|
for in_commitment in in_commitments {
|
||||||
validate_in_commitments_proof(
|
validate_in_commitments_proof(
|
||||||
@ -183,11 +183,11 @@ fn de_kernel(
|
|||||||
check_balances(public_info as u128, input_utxos);
|
check_balances(public_info as u128, input_utxos);
|
||||||
|
|
||||||
let nullifiers: Vec<_> = input_utxos
|
let nullifiers: Vec<_> = input_utxos
|
||||||
.into_iter()
|
.iter()
|
||||||
.map(|utxo| generate_nullifiers(&utxo, &nullifier_secret_key.to_bytes()))
|
.map(|utxo| generate_nullifiers(utxo, &nullifier_secret_key.to_bytes()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let in_commitments = generate_commitments(&input_utxos);
|
let in_commitments = generate_commitments(input_utxos);
|
||||||
|
|
||||||
for in_commitment in in_commitments {
|
for in_commitment in in_commitments {
|
||||||
validate_in_commitments_proof(
|
validate_in_commitments_proof(
|
||||||
@ -235,6 +235,7 @@ pub fn generate_nullifiers_se(pedersen_commitment: &PedersenCommitment, nsk: &[u
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn se_kernel(
|
fn se_kernel(
|
||||||
root_commitment: &[u8],
|
root_commitment: &[u8],
|
||||||
root_nullifier: [u8; 32],
|
root_nullifier: [u8; 32],
|
||||||
|
|||||||
@ -43,7 +43,7 @@ pub fn encode_utxos_to_receivers(
|
|||||||
let ephm_key_holder = &receiver.produce_ephemeral_key_holder();
|
let ephm_key_holder = &receiver.produce_ephemeral_key_holder();
|
||||||
|
|
||||||
let encoded_data = Account::encrypt_data(
|
let encoded_data = Account::encrypt_data(
|
||||||
&ephm_key_holder,
|
ephm_key_holder,
|
||||||
receiver.key_holder.viewing_public_key,
|
receiver.key_holder.viewing_public_key,
|
||||||
&serde_json::to_vec(&utxo).unwrap(),
|
&serde_json::to_vec(&utxo).unwrap(),
|
||||||
);
|
);
|
||||||
@ -66,8 +66,7 @@ pub fn generate_nullifiers_spent_utxos(utxos_spent: Vec<(UTXO, &Account)>) -> Ve
|
|||||||
.key_holder
|
.key_holder
|
||||||
.utxo_secret_key_holder
|
.utxo_secret_key_holder
|
||||||
.nullifier_secret_key
|
.nullifier_secret_key
|
||||||
.to_bytes()
|
.to_bytes(),
|
||||||
.to_vec(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
all_nullifiers.push(nullifier);
|
all_nullifiers.push(nullifier);
|
||||||
@ -91,8 +90,7 @@ pub fn generate_secret_random_commitment(
|
|||||||
.key_holder
|
.key_holder
|
||||||
.utxo_secret_key_holder
|
.utxo_secret_key_holder
|
||||||
.viewing_secret_key
|
.viewing_secret_key
|
||||||
.to_bytes()
|
.to_bytes(),
|
||||||
.to_vec(),
|
|
||||||
)?,
|
)?,
|
||||||
generator_blinding_factor: Tweak::new(&mut thread_rng()),
|
generator_blinding_factor: Tweak::new(&mut thread_rng()),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -306,12 +306,14 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn common_setup(mut sequencer: &mut SequencerCore) {
|
fn common_setup(sequencer: &mut SequencerCore) {
|
||||||
let tx = create_dummy_transaction([12; 32], vec![[9; 32]], vec![[7; 32]], vec![[8; 32]]);
|
let tx = create_dummy_transaction([12; 32], vec![[9; 32]], vec![[7; 32]], vec![[8; 32]]);
|
||||||
let tx_mempool = TransactionMempool { tx };
|
let tx_mempool = TransactionMempool { tx };
|
||||||
sequencer.mempool.push_item(tx_mempool);
|
sequencer.mempool.push_item(tx_mempool);
|
||||||
|
|
||||||
sequencer.produce_new_block_with_mempool_transactions();
|
sequencer
|
||||||
|
.produce_new_block_with_mempool_transactions()
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@ -316,7 +316,7 @@ impl RocksDBIO {
|
|||||||
let cf_sc = self.sc_column();
|
let cf_sc = self.sc_column();
|
||||||
|
|
||||||
let sc_addr_loc = format!("{sc_addr:?}{SC_LEN_SUFFIX}");
|
let sc_addr_loc = format!("{sc_addr:?}{SC_LEN_SUFFIX}");
|
||||||
let sc_len_addr = sc_addr_loc.as_str().as_bytes();
|
let sc_len_addr = sc_addr_loc.as_bytes();
|
||||||
|
|
||||||
self.db
|
self.db
|
||||||
.put_cf(&cf_sc, sc_len_addr, length.to_be_bytes())
|
.put_cf(&cf_sc, sc_len_addr, length.to_be_bytes())
|
||||||
@ -360,7 +360,7 @@ impl RocksDBIO {
|
|||||||
let cf_sc = self.sc_column();
|
let cf_sc = self.sc_column();
|
||||||
let sc_addr_loc = format!("{sc_addr:?}{SC_LEN_SUFFIX}");
|
let sc_addr_loc = format!("{sc_addr:?}{SC_LEN_SUFFIX}");
|
||||||
|
|
||||||
let sc_len_addr = sc_addr_loc.as_str().as_bytes();
|
let sc_len_addr = sc_addr_loc.as_bytes();
|
||||||
|
|
||||||
let sc_len = self
|
let sc_len = self
|
||||||
.db
|
.db
|
||||||
@ -379,11 +379,11 @@ impl RocksDBIO {
|
|||||||
///Get full sc state from DB
|
///Get full sc state from DB
|
||||||
pub fn get_sc_sc_state(&self, sc_addr: &str) -> DbResult<Vec<DataBlob>> {
|
pub fn get_sc_sc_state(&self, sc_addr: &str) -> DbResult<Vec<DataBlob>> {
|
||||||
let cf_sc = self.sc_column();
|
let cf_sc = self.sc_column();
|
||||||
let sc_len = self.get_sc_sc_state_len(&sc_addr)?;
|
let sc_len = self.get_sc_sc_state_len(sc_addr)?;
|
||||||
let mut data_blob_list = vec![];
|
let mut data_blob_list = vec![];
|
||||||
|
|
||||||
for id in 0..sc_len {
|
for id in 0..sc_len {
|
||||||
let blob_addr = produce_address_for_data_blob_at_id(&sc_addr, id);
|
let blob_addr = produce_address_for_data_blob_at_id(sc_addr, id);
|
||||||
|
|
||||||
let blob = self
|
let blob = self
|
||||||
.db
|
.db
|
||||||
@ -541,7 +541,7 @@ impl RocksDBIO {
|
|||||||
|
|
||||||
///Creates address for sc data blob at corresponding id
|
///Creates address for sc data blob at corresponding id
|
||||||
fn produce_address_for_data_blob_at_id(sc_addr: &str, id: usize) -> Vec<u8> {
|
fn produce_address_for_data_blob_at_id(sc_addr: &str, id: usize) -> Vec<u8> {
|
||||||
let mut prefix_bytes: Vec<u8> = sc_addr.as_bytes().iter().cloned().collect();
|
let mut prefix_bytes: Vec<u8> = sc_addr.as_bytes().to_vec();
|
||||||
|
|
||||||
let id_bytes = id.to_be_bytes();
|
let id_bytes = id.to_be_bytes();
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
use serde::{de::Error, Deserialize, Serialize};
|
use serde::{de::Error, Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::SC_DATA_BLOB_SIZE;
|
use crate::SC_DATA_BLOB_SIZE;
|
||||||
@ -49,6 +51,7 @@ impl DataBlob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||||
pub enum DataBlobChangeVariant {
|
pub enum DataBlobChangeVariant {
|
||||||
Created {
|
Created {
|
||||||
@ -95,19 +98,11 @@ pub fn produce_blob_list_from_sc_public_state<S: Serialize>(
|
|||||||
|
|
||||||
//`ToDo` Replace with `next_chunk` usage, when feature stabilizes in Rust
|
//`ToDo` Replace with `next_chunk` usage, when feature stabilizes in Rust
|
||||||
for i in 0..=(ser_data.len() / SC_DATA_BLOB_SIZE) {
|
for i in 0..=(ser_data.len() / SC_DATA_BLOB_SIZE) {
|
||||||
let next_chunk: Vec<u8>;
|
let next_chunk: Vec<u8> = if (i + 1) * SC_DATA_BLOB_SIZE < ser_data.len() {
|
||||||
|
ser_data[(i * SC_DATA_BLOB_SIZE)..((i + 1) * SC_DATA_BLOB_SIZE)].to_vec()
|
||||||
if (i + 1) * SC_DATA_BLOB_SIZE < ser_data.len() {
|
|
||||||
next_chunk = ser_data[(i * SC_DATA_BLOB_SIZE)..((i + 1) * SC_DATA_BLOB_SIZE)]
|
|
||||||
.iter()
|
|
||||||
.cloned()
|
|
||||||
.collect();
|
|
||||||
} else {
|
} else {
|
||||||
next_chunk = ser_data[(i * SC_DATA_BLOB_SIZE)..(ser_data.len())]
|
ser_data[(i * SC_DATA_BLOB_SIZE)..(ser_data.len())].to_vec()
|
||||||
.iter()
|
};
|
||||||
.cloned()
|
|
||||||
.collect();
|
|
||||||
}
|
|
||||||
|
|
||||||
blob_list.push(produce_blob_from_fit_vec(next_chunk));
|
blob_list.push(produce_blob_from_fit_vec(next_chunk));
|
||||||
}
|
}
|
||||||
@ -126,17 +121,21 @@ pub fn compare_blob_lists(
|
|||||||
let old_len = blob_list_old.len();
|
let old_len = blob_list_old.len();
|
||||||
let new_len = blob_list_new.len();
|
let new_len = blob_list_new.len();
|
||||||
|
|
||||||
if old_len > new_len {
|
match old_len.cmp(&new_len) {
|
||||||
for id in new_len..old_len {
|
Ordering::Greater => {
|
||||||
changed_ids.push(DataBlobChangeVariant::Deleted { id });
|
for id in new_len..old_len {
|
||||||
|
changed_ids.push(DataBlobChangeVariant::Deleted { id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if new_len > old_len {
|
Ordering::Less => {
|
||||||
for id in old_len..new_len {
|
for (id, blob_item) in blob_list_new.iter().enumerate().take(new_len).skip(old_len) {
|
||||||
changed_ids.push(DataBlobChangeVariant::Created {
|
changed_ids.push(DataBlobChangeVariant::Created {
|
||||||
id,
|
id,
|
||||||
blob: blob_list_new[id],
|
blob: *blob_item,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Ordering::Equal => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
@ -172,7 +171,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_produce_blob_from_fit_vec() {
|
fn test_produce_blob_from_fit_vec() {
|
||||||
let data = (0..0 + 255).collect();
|
let data = (0..255).collect();
|
||||||
let blob = produce_blob_from_fit_vec(data);
|
let blob = produce_blob_from_fit_vec(data);
|
||||||
assert_eq!(blob.0[..4], [0, 1, 2, 3]);
|
assert_eq!(blob.0[..4], [0, 1, 2, 3]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,7 @@ impl UTXO {
|
|||||||
}
|
}
|
||||||
pub fn create_utxo_from_payload(payload_with_asset: UTXOPayload) -> Self {
|
pub fn create_utxo_from_payload(payload_with_asset: UTXOPayload) -> Self {
|
||||||
let mut hasher = sha2::Sha256::new();
|
let mut hasher = sha2::Sha256::new();
|
||||||
hasher.update(&payload_with_asset.to_bytes());
|
hasher.update(payload_with_asset.to_bytes());
|
||||||
let hash = <TreeHashType>::from(hasher.finalize_fixed());
|
let hash = <TreeHashType>::from(hasher.finalize_fixed());
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
@ -160,12 +160,12 @@ pub fn prove_send_utxo_multiple_assets_one_receiver(
|
|||||||
digest
|
digest
|
||||||
.0
|
.0
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|payload| UTXO::create_utxo_from_payload(payload))
|
.map(UTXO::create_utxo_from_payload)
|
||||||
.collect(),
|
.collect(),
|
||||||
digest
|
digest
|
||||||
.1
|
.1
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|payload| UTXO::create_utxo_from_payload(payload))
|
.map(UTXO::create_utxo_from_payload)
|
||||||
.collect(),
|
.collect(),
|
||||||
receipt,
|
receipt,
|
||||||
))
|
))
|
||||||
@ -432,7 +432,7 @@ mod tests {
|
|||||||
|
|
||||||
let (digest, receipt) = prove(vec![message, message_2], SUMMATION_ELF).unwrap();
|
let (digest, receipt) = prove(vec![message, message_2], SUMMATION_ELF).unwrap();
|
||||||
|
|
||||||
verify(receipt, SUMMATION_ID);
|
let _ = verify(receipt, SUMMATION_ID);
|
||||||
assert_eq!(digest, message + message_2);
|
assert_eq!(digest, message + message_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ mod tests {
|
|||||||
|
|
||||||
let (digest, receipt) = prove(vec![message, message_2], SUMMATION_ELF).unwrap();
|
let (digest, receipt) = prove(vec![message, message_2], SUMMATION_ELF).unwrap();
|
||||||
|
|
||||||
verify(receipt, SUMMATION_ID);
|
let _ = verify(receipt, SUMMATION_ID);
|
||||||
assert_eq!(digest, message + message_2);
|
assert_eq!(digest, message + message_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ mod tests {
|
|||||||
|
|
||||||
let (digest, receipt) = prove(vec![message, message_2], MULTIPLICATION_ELF).unwrap();
|
let (digest, receipt) = prove(vec![message, message_2], MULTIPLICATION_ELF).unwrap();
|
||||||
|
|
||||||
verify(receipt, MULTIPLICATION_ID);
|
let _ = verify(receipt, MULTIPLICATION_ID);
|
||||||
assert_eq!(digest, message * message_2);
|
assert_eq!(digest, message * message_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ mod tests {
|
|||||||
|
|
||||||
let (digest, receipt) = prove(vec![message, message_2], MULTIPLICATION_ELF).unwrap();
|
let (digest, receipt) = prove(vec![message, message_2], MULTIPLICATION_ELF).unwrap();
|
||||||
|
|
||||||
verify(receipt, MULTIPLICATION_ID);
|
let _ = verify(receipt, MULTIPLICATION_ID);
|
||||||
assert_eq!(digest, message * message_2);
|
assert_eq!(digest, message * message_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user