Skip to content

Commit

Permalink
Epoch State + CLI + Cranker (#43)
Browse files Browse the repository at this point in the history
The big one
  • Loading branch information
coachchucksol authored Jan 14, 2025
1 parent cbec8ca commit c49754d
Show file tree
Hide file tree
Showing 190 changed files with 12,455 additions and 1,132 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# placeholders for clippy and other tools
# Program IDs may not be correct
[env]
TIP_ROUTER_PROGRAM_ID = "Fv9aHCgvPQSr4jg9W8eTS6Ys1SNmh2qjyATrbsjEMaSH"
TIP_ROUTER_PROGRAM_ID = "Ap2AH3VcZGuuauEDq87uhgjNoUKcCAafc4DTyTByLMFf"
RESTAKING_PROGRAM_ID = "RestkWeAVL8fRGgzhfeoqFhsqKRchg6aa1XrcH96z4Q"
VAULT_PROGRAM_ID = "Vau1t6sLNxnzB7ZDsef8TLbPLfyZMYXH8WTNqUdm9g8"
2 changes: 1 addition & 1 deletion .cargo/programs.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TIP_ROUTER_PROGRAM_ID=Fv9aHCgvPQSr4jg9W8eTS6Ys1SNmh2qjyATrbsjEMaSH
TIP_ROUTER_PROGRAM_ID=Ap2AH3VcZGuuauEDq87uhgjNoUKcCAafc4DTyTByLMFf
RESTAKING_PROGRAM_ID=RestkWeAVL8fRGgzhfeoqFhsqKRchg6aa1XrcH96z4Q
VAULT_PROGRAM_ID=Vau1t6sLNxnzB7ZDsef8TLbPLfyZMYXH8WTNqUdm9g8
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
# - name: Generate code coverage
# run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
# env:
# TIP_ROUTER_PROGRAM_ID: Fv9aHCgvPQSr4jg9W8eTS6Ys1SNmh2qjyATrbsjEMaSH
# TIP_ROUTER_PROGRAM_ID: Ap2AH3VcZGuuauEDq87uhgjNoUKcCAafc4DTyTByLMFf
# - name: Upload coverage to Codecov
# uses: codecov/[email protected]
# with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ program_errors.json
test_errors.output
tests.output
integration_tests/tests/fixtures/jito_tip_router_program.so
notes.md

integration_tests/tests/fixtures/jito_tip_router_program-keypair.json
lcov.info
33 changes: 32 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ bytemuck = { version = "1.16.3", features = ["min_const_generics"] }
cfg-if = "1.0.0"
chrono = "0.4.38"
clap = { version = "4.5.16", features = ["derive", "env", "cargo"] }
clap-markdown = { version = "0.1.4" }
const_str_to_pubkey = "0.1.1"
dotenv = "0.15.0"
envfile = "0.2.1"
env_logger = "0.10.2"
fast-math = "0.1"
futures = "0.3.21"
getrandom = { version = "0.1.16", features = ["custom"] }
hex = "0.4.3"
home = "=0.5.9" # Custom for compatibility with rust 1.75
Expand All @@ -67,6 +70,7 @@ solana-accounts-db = { package = "solana-accounts-db", git = "https://github.com
solana-client = { package = "solana-client", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-ledger = { package = "solana-ledger", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-program = { package = "solana-program", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-transaction-status = { package = "solana-transaction-status", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-program-test = { package = "solana-program-test", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-rpc-client = { package = "solana-rpc-client", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
solana-runtime = { package = "solana-runtime", git = "https://github.com/jito-foundation/jito-solana.git", rev = "0bbcbe476c0e728907ac01135115e661c16538e5" }
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,24 @@
- NOTE: Given the current state of Cargo.lock, you must use a version of cargo-build-sbf that
has a rust toolchain higher than 1.74.0. For now, switch to the edge version to build this.
`sh -c "$(curl -sSfL https://release.anza.xyz/v2.2.0/install)"`. Another option would be to
manually set the Cargo.lock file version to 3 instead of 4 (https://github.com/coral-xyz/anchor/issues/3392#issuecomment-2508412018)
manually set the Cargo.lock file version to 3 instead of 4 (<https://github.com/coral-xyz/anchor/issues/3392#issuecomment-2508412018>)

3. Run tests: `SBF_OUT_DIR=integration_tests/tests/fixtures cargo test`
- NOTE: If you are still on the edge version of Solana CLI probably best to switch back to
`1.18.26`

## Deploy and Upgrade

- build .so file: `cargo-build-sbf`

- create a new keypair: `solana-keygen new -o target/tmp/buffer.json`

- Deploy: `solana program deploy --use-rpc --buffer target/tmp/buffer.json --with-compute-unit-price 10000 --max-sign-attempts 10000 target/deploy/jito_tip_router_program.so`

- (Pre Upgrade) Write to buffer: `solana program write-buffer --use-rpc --buffer target/tmp/buffer.json --with-compute-unit-price 10000 --max-sign-attempts 10000 target/deploy/jito_tip_router_program.so`

- Upgrade: `solana program upgrade $(solana address --keypair target/tmp/buffer.json) $(solana address --keypair target/deploy/jito_tip_router_program-keypair.json)`

- Close Buffers: `solana program close --buffers`

- Upgrade Program Size: `solana program extend $(solana address --keypair target/deploy/jito_tip_router_program-keypair.json) 100000`
Binary file added cli/.DS_Store
Binary file not shown.
18 changes: 18 additions & 0 deletions cli/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Instructions
#
# Change this file to .env and move to your current working directory
#

# Network Settings
RPC_URL=
COMMITMENT=

# Program IDs
TIP_ROUTER_PROGRAM_ID=
RESTAKING_PROGRAM_ID=
VAULT_PROGRAM_ID=
TIP_DISTRIBUTION_PROGRAM_ID=

# Optional Settings
# Path to your Solana keypair file (e.g., /home/user/.config/solana/id.json)
KEYPAIR_PATH=
4 changes: 4 additions & 0 deletions cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
.env.devnet
.env.mainnet
.DS_Store
16 changes: 16 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,34 @@ borsh = { workspace = true }
bytemuck = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true }
clap-markdown = { workspace = true }
dotenv = { workspace = true }
env_logger = { workspace = true }
futures = { workspace = true }
jito-bytemuck = { workspace = true }
jito-jsm-core = { workspace = true }
jito-restaking-client = { workspace = true }
jito-restaking-core = { workspace = true }
jito-restaking-program = { workspace = true }
jito-restaking-sdk = { workspace = true }
jito-tip-distribution-sdk = { workspace = true }
jito-tip-router-client = { workspace = true }
jito-tip-router-core = { workspace = true }
jito-tip-router-program = { workspace = true }
jito-vault-client = { workspace = true }
jito-vault-core = { workspace = true }
jito-vault-program = { workspace = true }
jito-vault-sdk = { workspace = true }
log = { workspace = true }
solana-account-decoder = { workspace = true }
solana-client = { workspace = true }
solana-metrics = { workspace = true }
solana-program = { workspace = true }
solana-rpc-client = { workspace = true }
solana-sdk = { workspace = true }
solana-transaction-status = { workspace = true }
spl-associated-token-account = { workspace = true }
spl-stake-pool = { workspace = true }
spl-token = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
Expand Down
27 changes: 27 additions & 0 deletions cli/getting_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Tip Router CLI

## Setup

Build and install the CLI

In the root of the repo:

```bash
cargo build --release
cargo install --path ./cli --bin jito-tip-router-cli --locked
```

Ensure it has been installed

```bash
jito-tip-router-cli -- create-ncn
```

## Create an NCN

<https://jito-foundation.gitbook.io/mev/mev-payment-and-distribution/on-chain-addresses>

Restaking: `RestkWeAVL8fRGgzhfeoqFhsqKRchg6aa1XrcH96z4Q`
Vault: `Vau1t6sLNxnzB7ZDsef8TLbPLfyZMYXH8WTNqUdm9g8`
JitoSOL: `Jito4APyf642JPZPx3hGc6WWJ8zPKtRbRs4P815Awbb`
Example NCN: `4Di4GNkCme2cieyokdDxS15oVPTyyZvgp21rqKReiknE`
Loading

0 comments on commit c49754d

Please sign in to comment.