Skip to content

Commit 08df112

Browse files
format
1 parent 7f3d93e commit 08df112

14 files changed

Lines changed: 51 additions & 66 deletions

File tree

forester/src/processor/v2/helpers.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ impl StreamingAddressQueue {
496496
if available < end || start >= end {
497497
return Ok(None);
498498
}
499+
let actual_end = end;
499500
let data = lock_recover(&self.data, "streaming_address_queue.data");
500501

501502
let min_len = [
@@ -560,10 +561,6 @@ impl StreamingAddressQueue {
560561
{
561562
return Ok(None);
562563
}
563-
let low_element_proofs = match data.reconstruct_proofs::<HEIGHT>(start..end) {
564-
Ok(proofs) if proofs.len() == expected_len => proofs,
565-
Ok(_) | Err(_) => return Ok(None),
566-
};
567564

568565
let leaves_hashchain = match data.leaves_hash_chains.get(hashchain_idx).copied() {
569566
Some(hashchain) => hashchain,

js/token-interface/src/instructions/mint-to-compressed.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
SystemProgram,
3-
TransactionInstruction,
4-
} from '@solana/web3.js';
1+
import { SystemProgram, TransactionInstruction } from '@solana/web3.js';
52
import { Buffer } from 'buffer';
63
import {
74
LIGHT_TOKEN_PROGRAM_ID,
@@ -125,9 +122,17 @@ export function createMintToCompressedInstruction({
125122
isSigner: false,
126123
isWritable: false,
127124
},
128-
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
125+
{
126+
pubkey: SystemProgram.programId,
127+
isSigner: false,
128+
isWritable: false,
129+
},
129130
{ pubkey: outputQueue, isSigner: false, isWritable: true },
130-
{ pubkey: merkleContext.treeInfo.tree, isSigner: false, isWritable: true },
131+
{
132+
pubkey: merkleContext.treeInfo.tree,
133+
isSigner: false,
134+
isWritable: true,
135+
},
131136
{
132137
pubkey: merkleContext.treeInfo.queue,
133138
isSigner: false,

js/token-interface/tests/e2e/ata-read.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { describe, expect, it } from 'vitest';
22
import { newAccountWithLamports } from '@lightprotocol/stateless.js';
3-
import { createAtaInstructions, getAta, getAssociatedTokenAddress } from '../../src';
3+
import {
4+
createAtaInstructions,
5+
getAta,
6+
getAssociatedTokenAddress,
7+
} from '../../src';
48
import { createMintFixture, sendInstructions } from './helpers';
59

610
describe('ata creation and reads', () => {

js/token-interface/tests/e2e/mint-to-compressed.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ describe('mint-to-compressed instruction', () => {
5252
[COMPRESSED_MINT_SEED, mintSigner.publicKey.toBuffer()],
5353
LIGHT_TOKEN_PROGRAM_ID,
5454
);
55-
const mintInfo = await getMint(rpc, mint, undefined, LIGHT_TOKEN_PROGRAM_ID);
55+
const mintInfo = await getMint(
56+
rpc,
57+
mint,
58+
undefined,
59+
LIGHT_TOKEN_PROGRAM_ID,
60+
);
5661
if (!mintInfo.merkleContext || !mintInfo.mintContext) {
5762
throw new Error('Light mint context missing.');
5863
}
@@ -103,7 +108,12 @@ describe('mint-to-compressed instruction', () => {
103108
recipientB.publicKey,
104109
{ mint },
105110
);
106-
const mintAfter = await getMint(rpc, mint, undefined, LIGHT_TOKEN_PROGRAM_ID);
111+
const mintAfter = await getMint(
112+
rpc,
113+
mint,
114+
undefined,
115+
LIGHT_TOKEN_PROGRAM_ID,
116+
);
107117

108118
const amountA = aAccounts.items.reduce(
109119
(sum, account) => sum + BigInt(account.parsed.amount.toString()),

js/token-interface/tests/unit/instruction-builders.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,9 @@ describe('instruction builders', () => {
670670
mintSigner: Keypair.generate().publicKey.toBytes(),
671671
bump: 255,
672672
},
673-
recipients: [{ recipient: Keypair.generate().publicKey, amount: 42n }],
673+
recipients: [
674+
{ recipient: Keypair.generate().publicKey, amount: 42n },
675+
],
674676
});
675677

676678
expect(instruction.programId.equals(LIGHT_TOKEN_PROGRAM_ID)).toBe(true);

program-tests/utils/src/e2e_test_env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ where
837837
let (proof_a, proof_b, proof_c) =
838838
proof_from_json_struct(proof_json).unwrap();
839839
let (proof_a, proof_b, proof_c) =
840-
compress_proof(&proof_a, &proof_b, &proof_c).unwrap();
840+
compress_proof(&proof_a, &proof_b, &proof_c);
841841
let instruction_data = InstructionDataBatchNullifyInputs {
842842
new_root: circuit_inputs_new_root,
843843
compressed_proof: CompressedProof {

program-tests/utils/src/test_batch_forester.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub async fn create_append_batch_ix_data<R: Rpc>(
164164
bigint_to_be_bytes_array::<32>(&circuit_inputs.new_root.to_biguint().unwrap()).unwrap(),
165165
bundle.merkle_tree.root()
166166
);
167-
let proof_client = ProofClient::local().unwrap();
167+
let proof_client = ProofClient::local();
168168
let inputs_json = BatchAppendInputsJson::from_inputs(&circuit_inputs).to_string();
169169

170170
match proof_client.generate_proof(inputs_json).await {
@@ -293,7 +293,7 @@ pub async fn get_batched_nullify_ix_data<R: Rpc>(
293293
&[],
294294
)
295295
.unwrap();
296-
let proof_client = ProofClient::local().unwrap();
296+
let proof_client = ProofClient::local();
297297
let circuit_inputs_new_root =
298298
bigint_to_be_bytes_array::<32>(&inputs.new_root.to_biguint().unwrap()).unwrap();
299299
let inputs_json = update_inputs_string(&inputs);
@@ -715,7 +715,7 @@ pub async fn create_batch_update_address_tree_instruction_data_with_proof<R: Rpc
715715
)
716716
.unwrap();
717717

718-
let proof_client = ProofClient::local().unwrap();
718+
let proof_client = ProofClient::local();
719719
let circuit_inputs_new_root = bigint_to_be_bytes_array::<32>(&inputs.new_root).unwrap();
720720
let inputs_json = to_json(&inputs);
721721

prover/client/src/proof_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ impl ProofClient {
655655
})?;
656656

657657
let (proof_a, proof_b, proof_c) = proof_from_json_struct(proof_json)?;
658-
let (proof_a, proof_b, proof_c) = compress_proof(&proof_a, &proof_b, &proof_c)?;
658+
let (proof_a, proof_b, proof_c) = compress_proof(&proof_a, &proof_b, &proof_c);
659659

660660
Ok(ProofResult {
661661
proof: ProofCompressed {

prover/client/src/proof_types/batch_address_append/proof_inputs.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ pub fn get_batch_address_append_circuit_inputs<const HEIGHT: usize>(
256256
next_index
257257
);
258258

259+
let mut staged_changelog = changelog.clone();
260+
let mut staged_indexed_changelog = indexed_changelog.clone();
261+
let mut staged_sparse_merkle_tree = sparse_merkle_tree.clone();
262+
let initial_changelog_len = staged_changelog.len();
263+
259264
let mut patcher = ChangelogProofPatcher::new::<HEIGHT>(&staged_changelog);
260265

261266
let is_first_batch = staged_indexed_changelog.is_empty();
@@ -399,7 +404,7 @@ pub fn get_batch_address_append_circuit_inputs<const HEIGHT: usize>(
399404
let low_element_changelog_entry = IndexedChangelogEntry {
400405
element: new_low_element_raw,
401406
proof: low_element_changelog_proof,
402-
changelog_index: staged_indexed_changelog.len(), //change_log_index,
407+
changelog_index: staged_indexed_changelog.len(),
403408
};
404409

405410
staged_indexed_changelog.push(low_element_changelog_entry);

prover/client/src/prover.rs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use tracing::info;
99

1010
use crate::{
1111
constants::{HEALTH_CHECK, SERVER_ADDRESS},
12-
errors::ProverClientError,
1312
helpers::get_project_root,
1413
};
1514

@@ -30,46 +29,6 @@ fn monitor_prover_child(mut child: Child) {
3029
});
3130
}
3231

33-
async fn wait_for_prover_health(
34-
retries: usize,
35-
timeout: Duration,
36-
child: &mut Child,
37-
) -> Result<(), String> {
38-
for attempt in 0..retries {
39-
if health_check_once(timeout) {
40-
return Ok(());
41-
}
42-
43-
match child.try_wait() {
44-
Ok(Some(status)) => {
45-
return Err(format!(
46-
"prover process exited before health check succeeded with status {status}"
47-
));
48-
}
49-
Ok(None) => {}
50-
Err(error) => {
51-
return Err(format!("failed to poll prover process status: {error}"));
52-
}
53-
}
54-
55-
if attempt + 1 < retries {
56-
sleep(timeout).await;
57-
}
58-
}
59-
60-
Err(format!(
61-
"prover health check failed after {} attempts",
62-
retries
63-
))
64-
}
65-
66-
fn monitor_prover_child(mut child: Child) {
67-
std::thread::spawn(move || match child.wait() {
68-
Ok(status) => tracing::debug!(?status, "prover launcher exited"),
69-
Err(error) => tracing::warn!(?error, "failed to wait on prover launcher"),
70-
});
71-
}
72-
7332
pub async fn spawn_prover() {
7433
if let Some(_project_root) = get_project_root() {
7534
let prover_path = {

0 commit comments

Comments
 (0)