adding prioritization fees for keeper instructions

This commit is contained in:
Godmode Galactus 2023-04-05 21:09:30 +02:00
parent c7ee5a574a
commit a953903309
No known key found for this signature in database
GPG Key ID: A04142C71ABB0DEA
4 changed files with 28 additions and 10 deletions

View File

@ -21,6 +21,7 @@ pub struct Config {
pub mango_cluster: String,
pub txs_batch_size: Option<usize>,
pub priority_fees_proba: u8,
pub keeper_prioritization: u64,
pub keeper_authority: Option<Keypair>,
pub number_of_markers_per_mm: u8,
}
@ -43,6 +44,7 @@ impl Default for Config {
priority_fees_proba: 0,
keeper_authority: None,
number_of_markers_per_mm: 5,
keeper_prioritization: 1000,
}
}
}
@ -204,6 +206,15 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
.required(false)
.help("Number of markets a market maker will trade on at a time"),
)
.arg(
Arg::with_name("keeper-prioritization-fees")
.long("keeper-prioritization-fees")
.value_name("UINT")
.min_values(0)
.takes_value(true)
.required(false)
.help("Prioritization fees set for all keeper instructions (1000 by default)")
)
}
/// Parses a clap `ArgMatches` structure into a `Config`
@ -299,5 +310,10 @@ pub fn extract_args(matches: &ArgMatches) -> Config {
.expect("can't parse number of markets per market maker"),
None => 5,
};
args.keeper_prioritization = match matches.value_of("keeper-prioritization-fees") {
Some(x) => x.parse().expect("can't parse keeper prioritization fees"),
None => 1000,
};
args
}

View File

@ -74,13 +74,18 @@ pub fn start(
"crank-tx-sender signing with keypair pk={:?}",
identity.pubkey()
);
let prioritization_fee_ix =
solana_sdk::compute_budget::ComputeBudgetInstruction::set_compute_unit_price(
prioritization_fee,
);
loop {
if exit_signal.load(Ordering::Acquire) {
break;
}
if let Ok((market, ixs)) = instruction_receiver.recv().await {
// TODO add priority fee
if let Ok((market, mut ixs)) = instruction_receiver.recv().await {
ixs.insert(0, prioritization_fee_ix.clone());
let tx = Transaction::new_signed_with_payer(
&ixs,

View File

@ -190,11 +190,6 @@ pub fn start_keepers(
}
let blockhash = blockhash.clone();
// add prioritization instruction
//let prioritization_ix = ComputeBudgetInstruction::set_compute_unit_price(10000);
//root_update_ixs.insert(0, prioritization_ix.clone());
while !exit_signal.load(Ordering::Relaxed) {
send_transaction(
tpu_manager.clone(),

View File

@ -54,9 +54,11 @@ pub async fn main() -> anyhow::Result<()> {
priority_fees_proba,
keeper_authority,
number_of_markers_per_mm,
keeper_prioritization,
..
} = &cli_config;
let number_of_markers_per_mm = *number_of_markers_per_mm;
let keeper_prioritization = *keeper_prioritization;
let transaction_save_file = transaction_save_file.clone();
let block_data_save_file = block_data_save_file.clone();
@ -110,7 +112,7 @@ pub async fn main() -> anyhow::Result<()> {
info!(
"accounts:{:?} markets:{:?} quotes_per_second:{:?} expected_tps:{:?} duration:{:?}",
account_keys_parsed.len(),
mango_group_config.perp_markets.len(),
number_of_markers_per_mm,
quotes_per_second,
account_keys_parsed.len()
* number_of_markers_per_mm as usize
@ -158,7 +160,7 @@ pub async fn main() -> anyhow::Result<()> {
keeper_authority,
quote_root_bank,
quote_node_banks,
0,
keeper_prioritization,
);
Some(jl)
} else {
@ -179,7 +181,7 @@ pub async fn main() -> anyhow::Result<()> {
tpu_manager.clone(),
mango_group_config,
id,
0,
keeper_prioritization,
);
let warmup_duration = Duration::from_secs(10);