Skip to content

Commit d51463e

Browse files
authored
chore: adapt default queue size to 30k, update new deployment xtask (#1774)
1 parent 2022052 commit d51463e

File tree

8 files changed

+171
-67
lines changed

8 files changed

+171
-67
lines changed

program-libs/batched-merkle-tree/src/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ pub const TEST_DEFAULT_BATCH_SIZE: u64 = 50;
1919

2020
pub const TEST_DEFAULT_ZKP_BATCH_SIZE: u64 = 10;
2121

22-
pub const DEFAULT_BATCH_SIZE: u64 = 50000;
22+
pub const DEFAULT_BATCH_SIZE: u64 = 15000;
2323

2424
pub const DEFAULT_ZKP_BATCH_SIZE: u64 = 500;
25+
pub const DEFAULT_ADDRESS_ZKP_BATCH_SIZE: u64 = 250;
2526

2627
pub const DEFAULT_CPI_CONTEXT_ACCOUNT_SIZE: u64 = 20 * 1024 + 8;
2728

program-libs/batched-merkle-tree/src/initialize_address_tree.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ use light_merkle_tree_metadata::{
66
};
77

88
// Import feature-gated types from lib.rs
9-
use crate::AccountInfo;
109
#[cfg(not(feature = "pinocchio"))]
1110
use crate::AccountInfoTrait;
1211
use crate::{
13-
constants::{DEFAULT_BATCH_ADDRESS_TREE_HEIGHT, DEFAULT_BATCH_SIZE, DEFAULT_ZKP_BATCH_SIZE},
12+
constants::{
13+
DEFAULT_ADDRESS_ZKP_BATCH_SIZE, DEFAULT_BATCH_ADDRESS_TREE_HEIGHT, DEFAULT_BATCH_SIZE,
14+
DEFAULT_ZKP_BATCH_SIZE,
15+
},
1416
errors::BatchedMerkleTreeError,
1517
initialize_state_tree::match_circuit_size,
1618
merkle_tree::{get_merkle_tree_account_size, BatchedMerkleTreeAccount},
17-
BorshDeserialize, BorshSerialize,
19+
AccountInfo, BorshDeserialize, BorshSerialize,
1820
};
1921

2022
#[repr(C)]
@@ -42,7 +44,7 @@ impl Default for InitAddressTreeAccountsInstructionData {
4244
forester: None,
4345
bloom_filter_num_iters: 3,
4446
input_queue_batch_size: DEFAULT_BATCH_SIZE,
45-
input_queue_zkp_batch_size: DEFAULT_ZKP_BATCH_SIZE,
47+
input_queue_zkp_batch_size: DEFAULT_ADDRESS_ZKP_BATCH_SIZE,
4648
height: 40,
4749
root_history_capacity: (DEFAULT_BATCH_SIZE / DEFAULT_ZKP_BATCH_SIZE * 2) as u32,
4850
bloom_filter_capacity: DEFAULT_BATCH_SIZE * 8,

program-libs/batched-merkle-tree/src/initialize_state_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ pub fn validate_batched_tree_params(params: InitStateTreeAccountsInstructionData
238238
}
239239

240240
pub fn match_circuit_size(size: u64) -> bool {
241-
matches!(size, 10 | 100 | 500 | 1000)
241+
matches!(size, 10 | 100 | 250 | 500 | 1000)
242242
}
243243
#[cfg(feature = "test-only")]
244244
pub mod test_utils {

program-tests/system-test/tests/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,7 @@ async fn regenerate_accounts() {
16631663
let mut config = ProgramTestConfig::default_with_batched_trees(false);
16641664
config.skip_register_programs = true;
16651665
config.protocol_config = protocol_config;
1666-
let env = initialize_accounts(&mut rpc, &config, keypairs)
1666+
let env = initialize_accounts(&mut rpc, &config, &keypairs)
16671667
.await
16681668
.unwrap();
16691669
let keypairs = for_regenerate_accounts();

sdk-libs/program-test/src/accounts/initialize.rs

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use crate::{
4545
pub async fn initialize_accounts<R: RpcConnection + TestRpc>(
4646
context: &mut R,
4747
config: &ProgramTestConfig,
48-
keypairs: TestKeypairs,
48+
keypairs: &TestKeypairs,
4949
) -> Result<TestAccounts, RpcError> {
5050
let ProgramTestConfig {
5151
protocol_config,
@@ -134,38 +134,54 @@ pub async fn initialize_accounts<R: RpcConnection + TestRpc>(
134134
}
135135
let merkle_tree_pubkey = keypairs.state_merkle_tree.pubkey();
136136
let nullifier_queue_pubkey = keypairs.nullifier_queue.pubkey();
137-
create_state_merkle_tree_and_queue_account(
138-
&keypairs.governance_authority,
139-
true,
140-
context,
141-
&keypairs.state_merkle_tree,
142-
&keypairs.nullifier_queue,
143-
Some(&keypairs.cpi_context_account),
144-
None,
145-
None,
146-
1,
147-
v1_state_tree_config,
148-
v1_nullifier_queue_config,
149-
)
150-
.await?;
151-
152-
if !skip_second_v1_tree {
137+
if !config.skip_v1_trees {
153138
create_state_merkle_tree_and_queue_account(
154139
&keypairs.governance_authority,
155140
true,
156141
context,
157-
&keypairs.state_merkle_tree_2,
158-
&keypairs.nullifier_queue_2,
159-
Some(&keypairs.cpi_context_2),
142+
&keypairs.state_merkle_tree,
143+
&keypairs.nullifier_queue,
144+
Some(&keypairs.cpi_context_account),
160145
None,
161146
None,
162-
2,
147+
1,
163148
v1_state_tree_config,
164149
v1_nullifier_queue_config,
165150
)
166151
.await?;
152+
153+
if !skip_second_v1_tree {
154+
create_state_merkle_tree_and_queue_account(
155+
&keypairs.governance_authority,
156+
true,
157+
context,
158+
&keypairs.state_merkle_tree_2,
159+
&keypairs.nullifier_queue_2,
160+
Some(&keypairs.cpi_context_2),
161+
None,
162+
None,
163+
2,
164+
v1_state_tree_config,
165+
v1_nullifier_queue_config,
166+
)
167+
.await?;
168+
}
169+
170+
create_address_merkle_tree_and_queue_account(
171+
&keypairs.governance_authority,
172+
true,
173+
context,
174+
&keypairs.address_merkle_tree,
175+
&keypairs.address_merkle_tree_queue,
176+
None,
177+
None,
178+
v1_address_tree_config,
179+
v1_address_queue_config,
180+
0,
181+
)
182+
.await?;
167183
}
168-
#[cfg(feature = "devenv")]
184+
#[cfg(feature = "v2")]
169185
if let Some(v2_state_tree_config) = _v2_state_tree_config {
170186
create_batched_state_merkle_tree(
171187
&keypairs.governance_authority,
@@ -178,7 +194,7 @@ pub async fn initialize_accounts<R: RpcConnection + TestRpc>(
178194
)
179195
.await?;
180196
}
181-
#[cfg(feature = "devenv")]
197+
#[cfg(feature = "v2")]
182198
if let Some(params) = _v2_address_tree_config {
183199
create_batch_address_merkle_tree(
184200
context,
@@ -188,19 +204,6 @@ pub async fn initialize_accounts<R: RpcConnection + TestRpc>(
188204
)
189205
.await?;
190206
}
191-
create_address_merkle_tree_and_queue_account(
192-
&keypairs.governance_authority,
193-
true,
194-
context,
195-
&keypairs.address_merkle_tree,
196-
&keypairs.address_merkle_tree_queue,
197-
None,
198-
None,
199-
v1_address_tree_config,
200-
v1_address_queue_config,
201-
0,
202-
)
203-
.await?;
204207

205208
let registered_system_program_pda =
206209
get_registered_program_pda(&light_sdk::constants::PROGRAM_ID_LIGHT_SYSTEM);
@@ -291,7 +294,7 @@ pub async fn setup_accounts(
291294
initialize_accounts(
292295
&mut rpc,
293296
&ProgramTestConfig::default_with_batched_trees(false),
294-
keypairs,
297+
&keypairs,
295298
)
296299
.await
297300
}

sdk-libs/program-test/src/program_test/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub struct ProgramTestConfig {
1616
pub with_prover: bool,
1717
pub prover_config: Option<ProverConfig>,
1818
pub skip_register_programs: bool,
19+
pub skip_v1_trees: bool,
1920
pub skip_second_v1_tree: bool,
2021
pub v1_state_tree_config: StateMerkleTreeConfig,
2122
pub v1_nullifier_queue_config: NullifierQueueConfig,
@@ -112,6 +113,7 @@ impl Default for ProgramTestConfig {
112113
v2_state_tree_config: None,
113114
v2_address_tree_config: None,
114115
skip_protocol_init: false,
116+
skip_v1_trees: false,
115117
}
116118
}
117119
}

sdk-libs/program-test/src/program_test/light_program_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl LightProgramTest {
5959
airdrop_lamports(&mut context, &keypairs.forester.pubkey(), 10_000_000_000).await?;
6060

6161
if !config.skip_protocol_init {
62-
let test_accounts = initialize_accounts(&mut context, &config, keypairs).await?;
62+
let test_accounts = initialize_accounts(&mut context, &config, &keypairs).await?;
6363
let batch_size = config
6464
.v2_state_tree_config
6565
.as_ref()

0 commit comments

Comments
 (0)