Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ spl-associated-token-account = "6.0.0"
spl-token = "4.0.0"
itertools = "0.13"
tokio-graceful-shutdown = "0.15"
solana-transaction-utils = { version = "0.4.0", path = "./solana-transaction-utils" }
tuktuk-sdk = { version = "0.3.5", path = "./tuktuk-sdk" }
solana-transaction-utils = { version = "0.4.2", path = "./solana-transaction-utils" }
tuktuk-sdk = { version = "0.3.6", path = "./tuktuk-sdk" }
tuktuk-program = { version = "0.3.2", path = "./tuktuk-program" }
solana-account-decoder = { version = "2.2.3" }
solana-clock = { version = "2.2.1" }
Expand Down
2 changes: 1 addition & 1 deletion solana-transaction-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "solana-transaction-utils"
version = "0.4.0"
version = "0.4.2"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
23 changes: 11 additions & 12 deletions solana-transaction-utils/src/priority_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,10 @@ pub async fn compute_budget_for_instructions<C: AsRef<RpcClient>>(

// Simulate the transaction to get the actual compute used
let simulation_result = client.as_ref().simulate_transaction(&snub_tx).await?;
if let Some(err) = simulation_result.value.err {
if simulation_result.value.err.is_some() {
info!(?simulation_result.value.logs, "simulation error");
return Err(Error::SimulatedTransactionError(err));
}
let actual_compute_used = simulation_result.value.units_consumed.unwrap_or(200000);
let actual_compute_used = simulation_result.value.units_consumed.unwrap_or(1000000);

let final_compute_budget = (actual_compute_used as f32 * compute_multiplier) as u32;
Ok((
Expand All @@ -175,11 +174,11 @@ pub async fn auto_compute_price<C: AsRef<RpcClient>>(
compute_price_instruction_for_accounts(client, &accounts).await?;

// Replace or insert compute price instruction
if let Some(pos) = instructions
.iter()
.position(|ix| ix.program_id == solana_sdk::compute_budget::id())
{
updated_instructions[pos + 1] = compute_price_ix; // Replace existing
if let Some(pos) = instructions.iter().position(|ix| {
ix.program_id == solana_sdk::compute_budget::id()
&& ix.data.first() == compute_price_ix.data.first()
}) {
updated_instructions[pos] = compute_price_ix; // Replace existing
} else {
updated_instructions.insert(1, compute_price_ix); // Insert after compute budget
}
Expand Down Expand Up @@ -239,10 +238,10 @@ pub async fn auto_compute_limit_and_price<C: AsRef<RpcClient>>(
.await?;

// Replace or insert compute budget instruction
if let Some(pos) = updated_instructions
.iter()
.position(|ix| ix.program_id == solana_sdk::compute_budget::id())
{
if let Some(pos) = updated_instructions.iter().position(|ix| {
ix.program_id == solana_sdk::compute_budget::id()
&& ix.data.first() == compute_budget_ix.data.first()
}) {
updated_instructions[pos] = compute_budget_ix; // Replace existing
} else {
updated_instructions.insert(0, compute_budget_ix); // Insert at the beginning
Expand Down
8 changes: 4 additions & 4 deletions solana-transaction-utils/src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ pub async fn create_transaction_queue<T: Send + Clone + 'static + Sync>(
let mut updated_instructions = bundle.tx.instructions.clone();
let compute_budget_ix = compute_budget_instruction(compute_units);
// Replace or insert compute budget instruction
if let Some(pos) = updated_instructions
.iter()
.position(|ix| ix.program_id == solana_sdk::compute_budget::id())
{
if let Some(pos) = updated_instructions.iter().position(|ix| {
ix.program_id == solana_sdk::compute_budget::id()
&& ix.data.first() == compute_budget_ix.data.first()
}) {
updated_instructions[pos] = compute_budget_ix; // Replace existing
} else {
updated_instructions.insert(0, compute_budget_ix); // Insert at the beginning
Expand Down
3 changes: 2 additions & 1 deletion tuktuk-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tuktuk-cli"
version = "0.2.11"
version = "0.2.12"
description = "A cli for tuktuk"
homepage.workspace = true
repository.workspace = true
Expand Down Expand Up @@ -38,3 +38,4 @@ spl-token = { workspace = true }
solana-program = { workspace = true }
itertools = { workspace = true }
bs58 = "0.5.1"
futures = { workspace = true }
Loading