Skip to content

Commit fc90dc0

Browse files
feat forester: (#1582)
- Removed unwraps from photon_indexer. - Added `--enable_priority_fees` boolean CLI flag (default: false). - Removed unnecessary logs that were cluttering the log journal. - Decreased the default batch_size from 60 to 50 due to photon limitations: we cannot retrieve new address proofs for lists larger than 50. - Moved `should_retry()` to the `RpcConnection` trait. - Refactored send_transaction.rs: streamlined the code, removed timeout slot checks, and added a cancel_signal that cancels thread execution when one of them receives a 6004 error (NonEligible). - Removed the unnecessary log trait from light-client.
1 parent c563955 commit fc90dc0

File tree

26 files changed

+604
-506
lines changed

26 files changed

+604
-506
lines changed

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ bb8 = "0.8.6"
8787
# Logging
8888
log = "0.4"
8989
env_logger = "0.11"
90+
tracing = "0.1.41"
91+
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
92+
tracing-appender = "0.2.3"
9093

9194
# Error handling
9295
thiserror = "2.0"

examples/anchor/counter/tests/test.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ where
226226
Some(vec![env.address_merkle_tree_pubkey]),
227227
rpc,
228228
)
229-
.await;
229+
.await
230+
.unwrap();
230231

231232
let address_merkle_context = AddressMerkleContext {
232233
address_merkle_tree_pubkey: env.address_merkle_tree_pubkey,
@@ -307,7 +308,8 @@ where
307308
None,
308309
rpc,
309310
)
310-
.await;
311+
.await
312+
.unwrap();
311313

312314
let compressed_account = LightAccountMeta::new_mut(
313315
compressed_account,
@@ -383,7 +385,8 @@ where
383385
None,
384386
rpc,
385387
)
386-
.await;
388+
.await
389+
.unwrap();
387390

388391
let compressed_account = LightAccountMeta::new_mut(
389392
compressed_account,
@@ -458,7 +461,8 @@ where
458461
None,
459462
rpc,
460463
)
461-
.await;
464+
.await
465+
.unwrap();
462466

463467
let compressed_account = LightAccountMeta::new_mut(
464468
compressed_account,

examples/anchor/memo/tests/test.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ where
187187
Some(vec![env.address_merkle_tree_pubkey]),
188188
rpc,
189189
)
190-
.await;
190+
.await
191+
.unwrap();
191192

192193
let address_merkle_context = AddressMerkleContext {
193194
address_merkle_tree_pubkey: env.address_merkle_tree_pubkey,
@@ -272,7 +273,8 @@ where
272273
None,
273274
rpc,
274275
)
275-
.await;
276+
.await
277+
.unwrap();
276278

277279
let compressed_account = LightAccountMeta::new_mut(
278280
compressed_account,
@@ -351,7 +353,8 @@ where
351353
None,
352354
rpc,
353355
)
354-
.await;
356+
.await
357+
.unwrap();
355358

356359
let compressed_account = LightAccountMeta::new_close(
357360
compressed_account,

examples/anchor/name-service-without-macros/tests/test.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ where
313313
Some(vec![env.address_merkle_tree_pubkey]),
314314
rpc,
315315
)
316-
.await;
316+
.await
317+
.unwrap();
317318

318319
let address_merkle_context = AddressMerkleContext {
319320
address_merkle_tree_pubkey: env.address_merkle_tree_pubkey,
@@ -398,7 +399,8 @@ where
398399
None,
399400
rpc,
400401
)
401-
.await;
402+
.await
403+
.unwrap();
402404

403405
let compressed_account = LightAccountMeta::new_mut(
404406
compressed_account,
@@ -476,7 +478,8 @@ where
476478
None,
477479
rpc,
478480
)
479-
.await;
481+
.await
482+
.unwrap();
480483

481484
let compressed_account = LightAccountMeta::new_close(
482485
compressed_account,

examples/anchor/token-escrow/tests/test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ pub async fn perform_escrow<R: RpcConnection, I: Indexer<R> + TestIndexerExtensi
254254
None,
255255
rpc,
256256
)
257-
.await;
257+
.await
258+
.unwrap();
258259

259260
let create_ix_inputs = CreateEscrowInstructionInputs {
260261
input_token_data: &[sdk_to_program_token_data(
@@ -422,7 +423,8 @@ pub async fn perform_withdrawal<R: RpcConnection, I: Indexer<R> + TestIndexerExt
422423
None,
423424
context,
424425
)
425-
.await;
426+
.await
427+
.unwrap();
426428

427429
let create_ix_inputs = CreateEscrowInstructionInputs {
428430
input_token_data: &[sdk_to_program_token_data(

examples/anchor/token-escrow/tests/test_compressed_pda.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ async fn create_escrow_ix<R: RpcConnection + MerkleTreeExt>(
258258
Some(vec![env.address_merkle_tree_pubkey]),
259259
context,
260260
)
261-
.await;
261+
.await
262+
.unwrap();
262263

263264
let new_address_params = NewAddressParams {
264265
seed,
@@ -482,7 +483,8 @@ pub async fn perform_withdrawal<R: RpcConnection + MerkleTreeExt>(
482483
None,
483484
rpc,
484485
)
485-
.await;
486+
.await
487+
.unwrap();
486488

487489
let create_withdrawal_ix_inputs = CreateCompressedPdaWithdrawalInstructionInputs {
488490
input_token_data: &[sdk_to_program_token_data(token_escrow.token_data.clone())],

forester/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@ borsh = { workspace = true }
3838
bs58 = "0.5.1"
3939
env_logger = { workspace = true }
4040
async-trait = { workspace = true }
41-
tracing = "0.1.41"
42-
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
43-
tracing-appender = "0.2.3"
41+
tracing = { workspace = true }
42+
tracing-subscriber = { workspace = true }
43+
tracing-appender = { workspace = true }
44+
anyhow = { workspace = true }
45+
4446
prometheus = "0.13"
4547
lazy_static = "1.4"
4648
warp = "0.3"
4749
dashmap = "6.1.0"
4850
scopeguard = "1.2.0"
49-
anyhow = { workspace = true }
5051
itertools = "0.14.0"
5152

5253
[dev-dependencies]

forester/src/cli.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ pub struct StartArgs {
6666
#[arg(long, env = "FORESTER_CU_LIMIT", default_value = "1000000")]
6767
pub cu_limit: u32,
6868

69+
#[arg(long, env = "FORESTER_ENABLE_PRIORITY_FEES", default_value = "false")]
70+
pub enable_priority_fees: bool,
71+
6972
#[arg(long, env = "FORESTER_RPC_POOL_SIZE", default_value = "98")]
7073
pub rpc_pool_size: usize,
7174

forester/src/config.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub struct TransactionConfig {
6161
pub batch_size: usize,
6262
pub max_concurrent_batches: usize,
6363
pub cu_limit: u32,
64+
pub enable_priority_fees: bool,
6465
}
6566

6667
#[derive(Debug, Clone)]
@@ -97,6 +98,7 @@ impl Default for TransactionConfig {
9798
batch_size: 1,
9899
max_concurrent_batches: 20,
99100
cu_limit: 1_000_000,
101+
enable_priority_fees: false,
100102
}
101103
}
102104
}
@@ -174,6 +176,7 @@ impl ForesterConfig {
174176
batch_size: args.transaction_batch_size,
175177
max_concurrent_batches: args.transaction_max_concurrent_batches,
176178
cu_limit: args.cu_limit,
179+
enable_priority_fees: args.enable_priority_fees,
177180
},
178181
general_config: GeneralConfig {
179182
rpc_pool_size: args.rpc_pool_size,
@@ -217,7 +220,7 @@ impl ForesterConfig {
217220
general_config: GeneralConfig {
218221
rpc_pool_size: 10,
219222
slot_update_interval_seconds: 10,
220-
tree_discovery_interval_seconds: 5,
223+
tree_discovery_interval_seconds: 60,
221224
enable_metrics: args.enable_metrics(),
222225
},
223226
registry_pubkey: Pubkey::default(),

0 commit comments

Comments
 (0)