(cherry picked from commit a1b9e00c14
)
Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
@ -657,7 +657,7 @@ fn process_program_deploy(
|
|||||||
true
|
true
|
||||||
};
|
};
|
||||||
|
|
||||||
let (program_data, buffer_data_len) = if buffer_provided {
|
let (program_data, program_len) = if buffer_provided {
|
||||||
// Check supplied buffer account
|
// Check supplied buffer account
|
||||||
if let Some(account) = rpc_client
|
if let Some(account) = rpc_client
|
||||||
.get_account_with_commitment(&buffer_pubkey, config.commitment)?
|
.get_account_with_commitment(&buffer_pubkey, config.commitment)?
|
||||||
@ -676,15 +676,21 @@ fn process_program_deploy(
|
|||||||
}
|
}
|
||||||
} else if let Some(program_location) = program_location {
|
} else if let Some(program_location) = program_location {
|
||||||
let program_data = read_and_verify_elf(&program_location)?;
|
let program_data = read_and_verify_elf(&program_location)?;
|
||||||
let buffer_data_len = if let Some(len) = max_len {
|
let program_len = program_data.len();
|
||||||
len
|
(program_data, program_len)
|
||||||
} else {
|
|
||||||
program_data.len() * 2
|
|
||||||
};
|
|
||||||
(program_data, buffer_data_len)
|
|
||||||
} else {
|
} else {
|
||||||
return Err("Program location required if buffer not supplied".into());
|
return Err("Program location required if buffer not supplied".into());
|
||||||
};
|
};
|
||||||
|
let buffer_data_len = if let Some(len) = max_len {
|
||||||
|
if program_len > len {
|
||||||
|
return Err("Max length specified not large enough".into());
|
||||||
|
}
|
||||||
|
len
|
||||||
|
} else if is_final {
|
||||||
|
program_len
|
||||||
|
} else {
|
||||||
|
program_len * 2
|
||||||
|
};
|
||||||
let minimum_balance = rpc_client.get_minimum_balance_for_rent_exemption(
|
let minimum_balance = rpc_client.get_minimum_balance_for_rent_exemption(
|
||||||
UpgradeableLoaderState::programdata_len(buffer_data_len)?,
|
UpgradeableLoaderState::programdata_len(buffer_data_len)?,
|
||||||
)?;
|
)?;
|
||||||
|
Reference in New Issue
Block a user