Skip to content

Commit 15ad0f0

Browse files
fix: remove skip preflight from cli (otter-sec#2492)
--------- Co-authored-by: acheron <acheroncrypto@gmail.com>
1 parent c4ae8f0 commit 15ad0f0

2 files changed

Lines changed: 7 additions & 31 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The minor version will be incremented upon a breaking change and the patch versi
2222
- ts: Narrowed `AccountClient` type to it's appropriate account type ([#2440](https://github.com/coral-xyz/anchor/pull/2440))
2323
- lang: Fix inability to use identifiers `program_id`, `accounts`, `ix_data`, `remaining_accounts` in instruction arguments ([#2464](https://github.com/coral-xyz/anchor/pull/2464))
2424
- cli: Fix incorrect `metadata.address` generation in IDL after deploying with a custom keypair ([#2485](https://github.com/coral-xyz/anchor/pull/2485))
25+
- cli: IDL commands no longer hang when the payer doesn't have funds to pay for the transaction fee ([#2492](https://github.com/coral-xyz/anchor/pull/2492))
2526

2627
### Breaking
2728

cli/src/lib.rs

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use semver::{Version, VersionReq};
2020
use serde::{Deserialize, Serialize};
2121
use serde_json::{json, Map, Value as JsonValue};
2222
use solana_client::rpc_client::RpcClient;
23-
use solana_client::rpc_config::RpcSendTransactionConfig;
2423
use solana_program::instruction::{AccountMeta, Instruction};
2524
use solana_sdk::account_utils::StateMut;
2625
use solana_sdk::bpf_loader;
@@ -1931,13 +1930,9 @@ fn idl_set_buffer(cfg_override: &ConfigOverride, program_id: Pubkey, buffer: Pub
19311930
);
19321931

19331932
// Send the transaction.
1934-
client.send_and_confirm_transaction_with_spinner_and_config(
1933+
client.send_and_confirm_transaction_with_spinner_and_commitment(
19351934
&tx,
19361935
CommitmentConfig::confirmed(),
1937-
RpcSendTransactionConfig {
1938-
skip_preflight: true,
1939-
..RpcSendTransactionConfig::default()
1940-
},
19411936
)?;
19421937

19431938
Ok(())
@@ -2020,13 +2015,9 @@ fn idl_set_authority(
20202015
&[&keypair],
20212016
latest_hash,
20222017
);
2023-
client.send_and_confirm_transaction_with_spinner_and_config(
2018+
client.send_and_confirm_transaction_with_spinner_and_commitment(
20242019
&tx,
20252020
CommitmentConfig::confirmed(),
2026-
RpcSendTransactionConfig {
2027-
skip_preflight: true,
2028-
..RpcSendTransactionConfig::default()
2029-
},
20302021
)?;
20312022

20322023
println!("Authority update complete.");
@@ -2077,13 +2068,9 @@ fn idl_close_account(cfg: &Config, program_id: &Pubkey, idl_address: Pubkey) ->
20772068
&[&keypair],
20782069
latest_hash,
20792070
);
2080-
client.send_and_confirm_transaction_with_spinner_and_config(
2071+
client.send_and_confirm_transaction_with_spinner_and_commitment(
20812072
&tx,
20822073
CommitmentConfig::confirmed(),
2083-
RpcSendTransactionConfig {
2084-
skip_preflight: true,
2085-
..RpcSendTransactionConfig::default()
2086-
},
20872074
)?;
20882075

20892076
Ok(())
@@ -2141,13 +2128,9 @@ fn idl_write(cfg: &Config, program_id: &Pubkey, idl: &Idl, idl_address: Pubkey)
21412128
&[&keypair],
21422129
latest_hash,
21432130
);
2144-
client.send_and_confirm_transaction_with_spinner_and_config(
2131+
client.send_and_confirm_transaction_with_spinner_and_commitment(
21452132
&tx,
21462133
CommitmentConfig::confirmed(),
2147-
RpcSendTransactionConfig {
2148-
skip_preflight: true,
2149-
..RpcSendTransactionConfig::default()
2150-
},
21512134
)?;
21522135
offset += MAX_WRITE_SIZE;
21532136
}
@@ -3175,13 +3158,9 @@ fn create_idl_account(
31753158
&[&keypair],
31763159
latest_hash,
31773160
);
3178-
client.send_and_confirm_transaction_with_spinner_and_config(
3161+
client.send_and_confirm_transaction_with_spinner_and_commitment(
31793162
&tx,
31803163
CommitmentConfig::finalized(),
3181-
RpcSendTransactionConfig {
3182-
skip_preflight: true,
3183-
..RpcSendTransactionConfig::default()
3184-
},
31853164
)?;
31863165
}
31873166

@@ -3243,13 +3222,9 @@ fn create_idl_buffer(
32433222
);
32443223

32453224
// Send the transaction.
3246-
client.send_and_confirm_transaction_with_spinner_and_config(
3225+
client.send_and_confirm_transaction_with_spinner_and_commitment(
32473226
&tx,
32483227
CommitmentConfig::confirmed(),
3249-
RpcSendTransactionConfig {
3250-
skip_preflight: true,
3251-
..RpcSendTransactionConfig::default()
3252-
},
32533228
)?;
32543229

32553230
Ok(buffer.pubkey())

0 commit comments

Comments
 (0)