Skip to content

Commit cd98a81

Browse files
bloom filter constants for p=1e-12 (#1810)
1 parent 55ee3cd commit cd98a81

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ pub const DEFAULT_BATCH_SIZE: u64 = 15000;
1919
pub const DEFAULT_ZKP_BATCH_SIZE: u64 = 500;
2020
pub const DEFAULT_ADDRESS_ZKP_BATCH_SIZE: u64 = 250;
2121

22+
pub const STATE_BLOOM_FILTER_CAPACITY: u64 = 2_301_536;
23+
pub const STATE_BLOOM_FILTER_NUM_HASHES: u64 = 10;
24+
25+
pub const ADDRESS_BLOOM_FILTER_CAPACITY: u64 = 2_301_536;
26+
pub const ADDRESS_BLOOM_FILTER_NUM_HASHES: u64 = 10;
27+
2228
pub const DEFAULT_CPI_CONTEXT_ACCOUNT_SIZE: u64 = 20 * 1024 + 8;
2329

2430
pub const ADDRESS_TREE_INIT_ROOT_40: [u8; 32] = [

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ pub fn get_address_merkle_tree_account_size_from_params(
171171
pub mod test_utils {
172172
pub use super::InitAddressTreeAccountsInstructionData;
173173
use crate::constants::{
174+
ADDRESS_BLOOM_FILTER_CAPACITY, ADDRESS_BLOOM_FILTER_NUM_HASHES,
174175
DEFAULT_ADDRESS_ZKP_BATCH_SIZE, TEST_DEFAULT_BATCH_SIZE, TEST_DEFAULT_ZKP_BATCH_SIZE,
175176
};
176177

@@ -213,12 +214,12 @@ pub mod test_utils {
213214
index: 0,
214215
program_owner: None,
215216
forester: None,
216-
bloom_filter_num_iters: 3,
217-
input_queue_batch_size: 2000,
217+
bloom_filter_num_iters: ADDRESS_BLOOM_FILTER_NUM_HASHES,
218+
input_queue_batch_size: 15000,
218219
input_queue_zkp_batch_size: DEFAULT_ADDRESS_ZKP_BATCH_SIZE,
219220
height: 40,
220221
root_history_capacity: 20,
221-
bloom_filter_capacity: 20_000 * 8,
222+
bloom_filter_capacity: ADDRESS_BLOOM_FILTER_CAPACITY,
222223
network_fee: Some(5000),
223224
rollover_threshold: Some(95),
224225
close_threshold: None,

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ pub mod test_utils {
244244
pub use super::InitStateTreeAccountsInstructionData;
245245
use super::*;
246246
use crate::{
247-
constants::{TEST_DEFAULT_BATCH_SIZE, TEST_DEFAULT_ZKP_BATCH_SIZE},
247+
constants::{
248+
STATE_BLOOM_FILTER_CAPACITY, STATE_BLOOM_FILTER_NUM_HASHES, TEST_DEFAULT_BATCH_SIZE,
249+
TEST_DEFAULT_ZKP_BATCH_SIZE,
250+
},
248251
queue::{test_utils::assert_queue_inited, BatchedQueueMetadata},
249252
queue_batch_metadata::QueueBatches,
250253
};
@@ -296,14 +299,14 @@ pub mod test_utils {
296299
program_owner: None,
297300
forester: None,
298301
additional_bytes: DEFAULT_CPI_CONTEXT_ACCOUNT_SIZE,
299-
bloom_filter_num_iters: 3,
300-
input_queue_batch_size: 2000,
301-
output_queue_batch_size: 2000,
302+
bloom_filter_num_iters: STATE_BLOOM_FILTER_NUM_HASHES,
303+
input_queue_batch_size: 15000,
304+
output_queue_batch_size: 15000,
302305
input_queue_zkp_batch_size: DEFAULT_ZKP_BATCH_SIZE,
303306
output_queue_zkp_batch_size: DEFAULT_ZKP_BATCH_SIZE,
304307
height: DEFAULT_BATCH_STATE_TREE_HEIGHT,
305308
root_history_capacity: 20,
306-
bloom_filter_capacity: 20_000 * 8,
309+
bloom_filter_capacity: STATE_BLOOM_FILTER_CAPACITY,
307310
network_fee: Some(5000),
308311
rollover_threshold: Some(95),
309312
close_threshold: None,

0 commit comments

Comments
 (0)