adding noop and increase cu limits ixs in openorder transactions

This commit is contained in:
Godmode Galactus 2023-05-14 23:00:59 +02:00
parent 6fc642d491
commit c4cf616eb0
No known key found for this signature in database
GPG Key ID: A04142C71ABB0DEA
8 changed files with 36 additions and 2 deletions

View File

@ -10,5 +10,11 @@
"programPath": "configure/programs/openbook_v2.so",
"programKeyPath": "configure/programs/openbook_v2-keypair.json",
"idl": ""
},
{
"noop": "noop",
"programPath": "configure/programs/spl_noop.so",
"programKeyPath": "configure/programs/spl_noop.json",
"idl": ""
}
]

View File

@ -0,0 +1 @@
[192,195,39,97,233,148,78,104,48,36,19,25,94,80,158,110,226,196,146,130,210,207,234,219,73,15,79,151,96,211,21,71,14,183,1,132,46,77,8,178,66,55,164,177,111,122,151,200,206,99,140,188,41,150,137,242,188,221,242,204,233,23,69,241]

BIN
configure/programs/spl_noop.so Executable file

Binary file not shown.

View File

@ -18,7 +18,6 @@ pub struct Bencher;
impl Bencher {
pub async fn bench<B: BenchFn>(args: Args) -> anyhow::Result<Metric> {
let futs = (0..args.threads).map(|_| {
let rpc_client = args.get_rpc_client();
let duration = args.get_duration_to_run_test();

View File

@ -5,6 +5,7 @@ mod metrics;
mod openbook;
mod solana_runtime;
mod test_registry;
mod utils;
use std::{sync::Arc, time::Duration};

View File

@ -1,6 +1,8 @@
use crate::test_registry::TestingTask;
use crate::utils::noop;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use solana_sdk::compute_budget;
use solana_sdk::hash::Hash;
use solana_sdk::{
instruction::{AccountMeta, Instruction},
@ -147,9 +149,18 @@ impl TestingTask for SimulateOpenbookV2PlaceOrder {
);
let recent_blockhash = *block_hash.read().await;
// to generate new signature each time
let noop_ix = noop::timestamp();
// to have higher compute budget limit
let cu_limits_ix =
compute_budget::ComputeBudgetInstruction::set_compute_unit_limit(
1000000,
);
let transaction = Transaction::new(
&[&user.get_keypair()],
Message::new(&[ix], Some(&user.pubkey())),
Message::new(&[noop_ix, cu_limits_ix, ix], Some(&user.pubkey())),
recent_blockhash,
);
let signature = transaction.signatures[0];

1
src/utils/mod.rs Normal file
View File

@ -0,0 +1 @@
pub mod noop;

15
src/utils/noop.rs Normal file
View File

@ -0,0 +1,15 @@
use chrono::Utc;
use solana_sdk::{instruction::Instruction, pubkey::Pubkey};
use std::str::FromStr;
pub fn instruction(data: Vec<u8>) -> Instruction {
Instruction {
program_id: Pubkey::from_str("zSZRvv8VgXtKNyw9t8fu4QKC4TL2P9DfSsvzBmBL8yn").unwrap(),
accounts: vec![],
data,
}
}
pub fn timestamp() -> Instruction {
instruction(Utc::now().timestamp_micros().to_le_bytes().into())
}