Processors to compile and send LoaderV4 CLI commands (#33228)

* Processors to compile and send LoaderV4 CLI commands

* suppress unused code warning

* clippy fixes

* redeploy program using source buffer

* unify deploy and redeploy to a single function

* clippy fixes

* fixes after testing the CLI frontend
This commit is contained in:
Pankaj Garg 2023-09-18 06:43:33 -07:00 committed by GitHub
parent 196a354093
commit 5dbc19ccbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1028 additions and 10 deletions

1
Cargo.lock generated
View File

@ -5547,6 +5547,7 @@ dependencies = [
"solana-client",
"solana-config-program",
"solana-faucet",
"solana-loader-v4-program",
"solana-logger",
"solana-program-runtime",
"solana-pubsub-client",

View File

@ -36,6 +36,7 @@ solana-cli-output = { workspace = true }
solana-client = { workspace = true }
solana-config-program = { workspace = true }
solana-faucet = { workspace = true }
solana-loader-v4-program = { workspace = true }
solana-logger = { workspace = true }
solana-program-runtime = { workspace = true }
solana-pubsub-client = { workspace = true }

View File

@ -34,6 +34,7 @@ pub mod inflation;
pub mod memo;
pub mod nonce;
pub mod program;
pub mod program_v4;
pub mod spend_utils;
pub mod stake;
pub mod test_utils;

View File

@ -1719,7 +1719,7 @@ fn process_close(
}
}
fn calculate_max_chunk_size<F>(create_msg: &F) -> usize
pub fn calculate_max_chunk_size<F>(create_msg: &F) -> usize
where
F: Fn(u32, Vec<u8>) -> Message,
{

1004
cli/src/program_v4.rs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -77,16 +77,27 @@ pub fn create_buffer(
) -> Vec<Instruction> {
vec![
system_instruction::create_account(payer_address, buffer_address, lamports, 0, &id()),
truncate_uninitialized(buffer_address, authority, new_size, recipient_address),
]
}
/// Returns the instructions required to set the length of an uninitialized program account.
/// This instruction will require the program account to also sign the transaction.
pub fn truncate_uninitialized(
program_address: &Pubkey,
authority: &Pubkey,
new_size: u32,
recipient_address: &Pubkey,
) -> Instruction {
Instruction::new_with_bincode(
id(),
&LoaderV4Instruction::Truncate { new_size },
vec![
AccountMeta::new(*buffer_address, true),
AccountMeta::new(*program_address, true),
AccountMeta::new_readonly(*authority, true),
AccountMeta::new(*recipient_address, false),
],
),
]
)
}
/// Returns the instructions required to set the length of the program account.