cli: improve deploy resume interface (#15418)
* cli: improve deploy resume interface * add docs
This commit is contained in:
@ -122,7 +122,6 @@ impl ProgramSubCommands for App<'_, '_> {
|
|||||||
.value_name("BUFFER_SIGNER")
|
.value_name("BUFFER_SIGNER")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.validator(is_valid_signer)
|
.validator(is_valid_signer)
|
||||||
.conflicts_with("program_location")
|
|
||||||
.help("Intermediate buffer account to write data to, which can be used to resume a failed deploy \
|
.help("Intermediate buffer account to write data to, which can be used to resume a failed deploy \
|
||||||
[default: random address]")
|
[default: random address]")
|
||||||
)
|
)
|
||||||
@ -695,7 +694,11 @@ fn process_program_deploy(
|
|||||||
true
|
true
|
||||||
};
|
};
|
||||||
|
|
||||||
let (program_data, program_len) = if buffer_provided {
|
let (program_data, program_len) = if let Some(program_location) = program_location {
|
||||||
|
let program_data = read_and_verify_elf(&program_location)?;
|
||||||
|
let program_len = program_data.len();
|
||||||
|
(program_data, program_len)
|
||||||
|
} else 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)?
|
||||||
@ -712,10 +715,6 @@ fn process_program_deploy(
|
|||||||
} else {
|
} else {
|
||||||
return Err("Buffer account not found, was it already consumed?".into());
|
return Err("Buffer account not found, was it already consumed?".into());
|
||||||
}
|
}
|
||||||
} else if let Some(program_location) = program_location {
|
|
||||||
let program_data = read_and_verify_elf(&program_location)?;
|
|
||||||
let program_len = program_data.len();
|
|
||||||
(program_data, program_len)
|
|
||||||
} else {
|
} else {
|
||||||
return Err("Program location required if buffer not supplied".into());
|
return Err("Program location required if buffer not supplied".into());
|
||||||
};
|
};
|
||||||
|
@ -112,6 +112,40 @@ Note that program accounts are required to be
|
|||||||
`max-len` is fixed after initial deployment, so any SOL in the program accounts
|
`max-len` is fixed after initial deployment, so any SOL in the program accounts
|
||||||
is locked up permanently.
|
is locked up permanently.
|
||||||
|
|
||||||
|
### Resuming a failed deploy
|
||||||
|
|
||||||
|
If program deployment fails, there will be a hanging intermediate buffer account
|
||||||
|
that contains a non-zero balance. In order to recoup that balance you may
|
||||||
|
resume a failed deployment by providing the same intermediate buffer to a new
|
||||||
|
call to `deploy`.
|
||||||
|
|
||||||
|
Deployment failures will print an error message specifying the seed phrase
|
||||||
|
needed to recover the generated intermediate buffer's keypair:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
=======================================================================
|
||||||
|
To resume a failed deploy, recover the ephemeral keypair file with
|
||||||
|
`solana-keygen recover` and the following 12-word seed phrase,
|
||||||
|
then pass it as the [BUFFER_SIGNER] argument to `solana deploy` or `solana write-buffer`
|
||||||
|
=======================================================================
|
||||||
|
spy axis cream equip bonus daring muffin fish noise churn broken diesel
|
||||||
|
=======================================================================
|
||||||
|
```
|
||||||
|
|
||||||
|
To recover the keypair:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ solana-keypair recover -o <KEYPAIR_PATH>
|
||||||
|
```
|
||||||
|
|
||||||
|
When asked, enter the 12-word seed phrase.
|
||||||
|
|
||||||
|
Then issue a new `deploy` command and specify the buffer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ solana program deploy --buffer <KEYPAIR_PATH> <PROGRAM_FILEPATH>
|
||||||
|
```
|
||||||
|
|
||||||
### Set a program's upgrade authority
|
### Set a program's upgrade authority
|
||||||
|
|
||||||
The program's upgrade authority must to be present to deploy a program. If no
|
The program's upgrade authority must to be present to deploy a program. If no
|
||||||
|
Reference in New Issue
Block a user