Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ananas-block committed Nov 12, 2024
1 parent 721f973 commit 5d92da6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
5 changes: 3 additions & 2 deletions js/stateless.js/tests/e2e/compress.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ function txFees(
const solanaBaseFee = tx.base === 0 ? bn(0) : bn(tx.base || 5000);

/// Fee per output
const stateOutFee = (STATE_MERKLE_TREE_ROLLOVER_FEE.mul(bn(tx.out)));
const stateOutFee = STATE_MERKLE_TREE_ROLLOVER_FEE.mul(bn(tx.out));

/// Fee per new address created
const addrFee = tx.addr
? ADDRESS_QUEUE_ROLLOVER_FEE.mul(bn(tx.addr))
: bn(0);

/// Fee if the tx nullifies at least one input account
const networkInFee = (tx.in || tx.out) ? STATE_MERKLE_TREE_NETWORK_FEE : bn(0);
const networkInFee =
tx.in || tx.out ? STATE_MERKLE_TREE_NETWORK_FEE : bn(0);

/// Fee if the tx creates at least one address
const networkAddressFee = tx.addr ? ADDRESS_TREE_NETWORK_FEE : bn(0);
Expand Down
3 changes: 2 additions & 1 deletion js/stateless.js/tests/e2e/test-rpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ describe('test-rpc', () => {
postCompressBalance,
preCompressBalance -
compressLamportsAmount -
5000 - 5000 -
5000 -
5000 -
STATE_MERKLE_TREE_ROLLOVER_FEE.toNumber(),
);
});
Expand Down
2 changes: 0 additions & 2 deletions programs/system/src/invoke/append_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ pub fn create_cpi_accounts_and_instruction_data<'a>(
let mut network_fee_bundle = None;
let num_leaves = output_compressed_account_hashes.len();
let mut instruction_data = Vec::<u8>::with_capacity(12 + 33 * num_leaves);
let initial_capacity = instruction_data.capacity();
let mut hashed_merkle_tree = [0u8; 32];
let mut index_merkle_tree_account = 0;
let number_of_merkle_trees =
Expand Down Expand Up @@ -242,7 +241,6 @@ pub fn create_cpi_accounts_and_instruction_data<'a>(
instruction_data.extend_from_slice(&output_compressed_account_hashes[j]);
}

assert_eq!(instruction_data.len(), initial_capacity);
Ok((instruction_data, network_fee_bundle))
}

Expand Down
4 changes: 1 addition & 3 deletions programs/system/src/invoke/sum_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ mod test {
relay_fee: Option<u64>,
compress_or_decompress_lamports: Option<u64>,
is_compress: bool,
) -> Result<()> {
) -> Result<(usize, usize)> {
let mut inputs = Vec::new();
for i in input_amounts.iter() {
inputs.push(PackedCompressedAccountWithMerkleContext {
Expand Down Expand Up @@ -178,7 +178,5 @@ mod test {
&compress_or_decompress_lamports,
&is_compress,
)
.unwrap();
Ok(())
}
}

0 comments on commit 5d92da6

Please sign in to comment.