Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
address review comments
  • Loading branch information
norwnd committed Dec 7, 2023
commit a22965706fd4d569b07409b161d2cdc5874d1ea1
36 changes: 13 additions & 23 deletions docs/src/cli/deploy-a-program.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ If the program id is not specified on the command line the tools will first look
for a keypair file matching the `<PROGRAM_FILEPATH>`, or internally generate a
new keypair.

You can typically find a matching program keypair file is in the same directory
as the program's shared object, and named <PROGRAM_NAME>-keypair.json. Matching
program keypairs are generated automatically by the program build tools:
A matching program keypair file is in the same directory as the program's shared
object, and named <PROGRAM_NAME>-keypair.json. Matching program keypairs are
generated automatically by the program build tools:

```bash
./path-to-program/program.so
Expand Down Expand Up @@ -109,11 +109,6 @@ to become (plus some wiggle room).
solana program deploy --max-len 200000 <PROGRAM_FILEPATH>
```

Note that program accounts are required to be
[rent-exempt](developing/programming-model/accounts.md#rent-exemption), and the
`max-len` **cannot be changed** after initial deployment, yet any SOL in the program accounts
is locked up permanently and cannot be reclaimed.

### Resuming a failed deploy

If program deployment fails, there will be a hanging intermediate buffer account
Expand Down Expand Up @@ -232,15 +227,10 @@ Or after deployment and specifying the current authority:
solana program set-upgrade-authority <PROGRAM_ADDRESS> --upgrade-authority <UPGRADE_AUTHORITY_SIGNER> --new-upgrade-authority <NEW_UPGRADE_AUTHORITY>
```

In case you want to set "new upgrade authority" to a signer that you only have a pubkey of (meaning, you don't have access
to its private key) - which is useful for things like [upgrading program using offline signer as authority](deploy-a-program.md#upgrading-program-using-offline-signer-as-authority) -
you need to use `--skip-new-upgrade-authority-signer-check` option to inform `solana program set-upgrade-authority`
command of your intentions (because otherwise it assumes you have access to that singer's private key and checks for
that, to ensure you don't accidentally supply "new upgrade authority" you don't have control over):

```bash
solana program set-upgrade-authority <PROGRAM_ADDRESS> --new-upgrade-authority <NEW_UPGRADE_AUTHORITY> --skip-new-upgrade-authority-signer-check
```
By default, `set-upgrade-authority` requires a signature from the new authority. This behavior prevents a
developer from giving upgrade authority to a key that they do not have access to. The
`--skip-new-upgrade-authority-signer-check` option relaxes the signer check. This can be useful for situations
where the new upgrade authority is an offline signer or a multisig.

### Immutable programs

Expand Down Expand Up @@ -268,7 +258,7 @@ solana program dump <ACCOUNT_ADDRESS> <OUTPUT_FILEPATH>
The dumped file will be in the same as what was deployed, so in the case of a
shared object (the program binary `.so`), the dumped file will be a fully functional shared object. Note
that the `dump` command dumps the entire data space, which means the output file
might have trailing zeros after the shared object's data up to `max_len`.
will have trailing zeros after the shared object's data up to `max_len`.
Sometimes it is useful to dump and compare a program to ensure it matches a
known program binary. The dumped file can be zero-truncated, hashed,
and compared to the hash of the original program file.
Expand All @@ -285,14 +275,13 @@ $ sha256sum extended.so dump.so
Instead of deploying directly to the program account, the program can be written
to an intermediary buffer account. Intermediary accounts can be useful for things
like multi-entity governed programs where the governing members fist verify the
intermediary buffer contents and then vote to allow an upgrade using it, or for
[deploying programs with offline signer authority](#deploying-program-with-offline-signer-authority).
intermediary buffer contents and then vote to allow an upgrade using it.

```bash
solana program write-buffer <PROGRAM_FILEPATH>
```

Buffer accounts support different authorities (including offline signer and program account signer):
Buffer accounts support authorities like program accounts:

```bash
solana program set-buffer-authority <BUFFER_ADDRESS> --new-buffer-authority <NEW_BUFFER_AUTHORITY>
Expand All @@ -308,7 +297,8 @@ the program:
solana program deploy --program-id <PROGRAM_ADDRESS> --buffer <BUFFER_ADDRESS>
```

Note, the buffer's authority must match the program's upgrade authority. Also, upon successful deploy
buffer accounts contents are copied into program accounts and are erased from blockchain.
Note, the buffer's authority must match the program's upgrade authority.
During deployment, the buffer account's contents are copied into the program-data account and
the buffer account is set to zero. The lamports from the buffer account are refunded to a spill account.

Buffers also support `show` and `dump` just like programs do.