You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+20-4
Original file line number
Diff line number
Diff line change
@@ -13,14 +13,14 @@ First, make sure you have the [solana tool suite](https://docs.solana.com/cli/in
13
13
installed on your machine. (The build depends on some C makefiles that are in the tool suite.)
14
14
Make sure you have installed the same solana version that is being used in [CI](.github/workflows/docker.yaml)
15
15
16
-
Then, simply run `cargo build` to compile the oracle program as a native binary, or `cargo build-bpf` to build a BPF binary
16
+
Then, simply run `cargo build` to compile the oracle program as a native binary, or `cargo build-bpf` to build a BPF binary
17
17
that can be uploaded to the blockchain. This step will produce a program binary `target/deploy/pyth_oracle.so`.
18
18
19
19
### Testing
20
20
21
-
Simply run `cargo test`. This command will run several sets of tests:
21
+
Simply run `cargo test`. This command will run several sets of tests:
22
22
23
-
- Unit tests of individual functions
23
+
- Unit tests of individual functions
24
24
- Simulated transaction tests against the BPF binary running on a solana simulator
25
25
- Exhaustive / randomized test batteries for core oracle functionality
26
26
@@ -30,6 +30,7 @@ The C tests are linked into the rust binary so they run as part of `cargo test`
30
30
You can also run `cargo test-bpf`, which runs the same tests as `cargo test`, though it's slightly slower and the UX is worse.
31
31
32
32
### pre-commit hooks
33
+
33
34
pre-commit is a tool that checks and fixes simple issues (formatting, ...) before each commit. You can install it by following [their website](https://pre-commit.com/). In order to enable checks for this repo run `pre-commit install` from command-line in the root of this repo.
34
35
35
36
The checks are also performed in the CI to ensure the code follows consistent formatting. Formatting is only currently enforced in the `program/` directory.
@@ -38,7 +39,7 @@ You might also need to install the nightly toolchain to run the formatting by ru
38
39
## pythd (off-chain client API)
39
40
40
41
> :warning: pythd is deprecated and has been replaced by [pyth-agent](https://github.com/pyth-network/pyth-agent).
41
-
> This new client is backward compatible with pythd, but more stable and configurable.
42
+
> This new client is backward compatible with pythd, but more stable and configurable.
42
43
43
44
`pythd` provides exposes a web API for interacting with the on-chain oracle program.
44
45
@@ -139,6 +140,7 @@ docker run --name pyth-dev -d \\
139
140
```
140
141
141
142
Default user in the image is `pyth` which may not have access to your directories. Assign your user id and group id to it to enable access.
143
+
142
144
```
143
145
host@host$ id $USER # Shows user_id, group_id, and group names
Finally, in docker extension inside VS Code click right and choose "Attach VS Code". If you're using a remote host in VS Code make sure to let this connection be open.
153
+
154
+
## Deployment
155
+
156
+
Oracle program upgrades are managed by the Pythian Council multisig. The steps to deploy a new version are:
157
+
158
+
1. Create a release branch from `main`. This should include binaries for both the Solana mainnet and Pythnet oracle programs (`pyth_oracle_solana.so` and `pyth_oracle_pythnet.so`).
159
+
2.[Install Solana CLI](https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-tool) if not already installed.
160
+
3. Set Solana config for the target network, e.g., devnet: `solana config set --url https://api.devnet.solana.com`.
161
+
4. Execute `solana program write-buffer <ORACLE_PROGRAM_BINARY_FILENAME>` where `<ORACLE_PROGRAM_BINARY_FILENAME>` can be `pyth_oracle_solana.so` or `pyth_oracle_pythnet.so` to obtain the buffer address.
162
+
5. Run `solana program show <ORACLE_PROGRAM_PUBKEY>` to obtain the authority of the current program.
163
+
6. Use `solana program set-buffer-authority <BUFFER_PUBKEY> --new-buffer-authority <NEW_BUFFER_AUTHORITY>` to assign the upgrade authority from the previous step to the buffer address.
164
+
7. Submit a proposal with [`xc-admin`](https://github.com/pyth-network/pyth-crosschain/tree/main/governance/xc_admin/packages/xc_admin_cli) for program upgrade using the `upgrade-program` command.
165
+
8. Verify the buffer by running `solana program dump <BUFFER> temp_file && shasum -a 256 temp_file && rm temp_file`, comparing the hash with the one from [build-bpf.sh#L35](https://github.com/pyth-network/pyth-client/blob/main/scripts/build-bpf.sh#L35).
166
+
9. Once the proposal secures enough signatures, it will be automatically relayed to the target network, upgrading the program.
0 commit comments