Skip to content

Commit

Permalink
[JIT-1156] Arg updates + Github release (solana-labs#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
esemeniuc authored Apr 13, 2023
1 parent a61d46a commit 7c8c202
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 50 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/clean_code.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Clean Code Check
on:
workflow_call:
secrets:
GHUB_TOKEN:
required: true

jobs:
clippy_and_udeps_check:
Expand All @@ -18,10 +15,8 @@ jobs:
with:
caller-workflow-name: clippy_and_udeps_check

- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GHUB_TOKEN }}
args: --all-features
- name: Clippy Check
run: cargo +nightly clippy --all-targets

- uses: actions-rs/cargo@v1
with:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
jobs:
clean_code_check:
uses: ./.github/workflows/clean_code.yaml
secrets:
GHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build_images:
needs: clean_code_check
Expand All @@ -22,7 +20,7 @@ jobs:

push_images:
needs: run_tests
uses: ./.github/workflows/push_images.yaml
uses: ./.github/workflows/push_artifacts.yaml
with:
TAG: "latest"
secrets:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
jobs:
clean_code_check:
uses: ./.github/workflows/clean_code.yaml
secrets:
GHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build_images:
needs: clean_code_check
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Push Images
name: Push Artifacts
on:
workflow_call:
secrets:
Expand All @@ -13,23 +13,38 @@ on:

jobs:
push:
name: Docker Push
name: Push Artifacts
runs-on: big-runner-1
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Build containers
run: docker compose build --progress=plain
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
ORG: jitolabs
TAG: ${{ inputs.TAG }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PWD }}

- name: Push relayer image
run: docker push jitolabs/jito-transaction-relayer:${{ inputs.TAG }}

- name: Copy artifact from container
run: |
docker run --rm --entrypoint cat jitolabs/jito-transaction-relayer:${{ inputs.TAG }} /app/jito-transaction-relayer > ./jito-transaction-relayer-x86_64-unknown-linux-gnu
ls -lh .
file ./jito-transaction-relayer-x86_64-unknown-linux-gnu
- name: Create Release with artifact
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./jito-transaction-relayer-x86_64-unknown-linux-gnu
9 changes: 4 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ jobs:
run_tests:
needs: build_images
uses: ./.github/workflows/test.yaml
secrets:
DOCKERHUB_ORG: jitolabs
with:
TAG: ${{ github.ref_name }}-${{ github.sha }}

push_images:
needs: run_tests
uses: ./.github/workflows/push_images.yaml
uses: ./.github/workflows/push_artifacts.yaml
with:
TAG: ${{ github.ref_name }}-${{ github.sha }}
secrets:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_PWD: ${{ secrets.DOCKERHUB_PWD }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ COPY . .
RUN --mount=type=cache,mode=0777,target=/home/root/app/target \
--mount=type=cache,mode=0777,target=/usr/local/cargo/registry \
--mount=type=cache,mode=0777,target=/usr/local/cargo/git \
RUSTFLAGS="-C target-cpu=native" cargo build --release && cp target/release/jito-* ./
RUSTFLAGS="-C target-cpu=x86-64-v3" cargo build --release && cp target/release/jito-* ./

FROM debian:bullseye-slim as jito-transaction-relayer
RUN apt-get -qq update && apt-get -qq -y install ca-certificates libssl1.1 && rm -rf /var/lib/apt/lists/*
Expand Down
18 changes: 3 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# jito-relayer
Transaction Relayer
Jito Relayer acts as a transaction processing unit (TPU) proxy.
It filters and verifies transactions for multiple authenticated validators on a separate server to ensure validators can devote resources to executing transactions.

# Setup

```bash
git submodule update --init --recursive
cargo b --release
```

## Generate RSA keys:
One needs to generate RSA keys for JWT key generation and verification. To do that, use the following scripts:
```bash
OUTPUT_DIR=
openssl genrsa --out $OUTPUT_DIR/private.pem
openssl rsa --in $OUTPUT_DIR/private.pem --pubout --out $OUTPUT_DIR/public.pem
```
See https://jito-foundation.gitbook.io/mev/jito-relayer/running-a-relayer for setup and usage instructions.
42 changes: 27 additions & 15 deletions transaction-relayer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{
collections::HashSet,
fs,
net::{IpAddr, Ipv4Addr, SocketAddr},
path::PathBuf,
str::FromStr,
sync::{
atomic::{AtomicBool, Ordering},
Expand Down Expand Up @@ -118,17 +119,19 @@ struct Args {
#[arg(long, env, default_value_t = 200)]
packet_delay_ms: u32,

/// Block engine address
/// Address for Jito Block Engine.
/// See https://jito-labs.gitbook.io/mev/searcher-resources/block-engine#connection-details
#[arg(long, env)]
block_engine_url: String,

/// Authentication service address of the block-engine. Keypairs are authenticated against the block engine
/// Manual override for authentication service address of the block-engine.
/// Defaults to `--block-engine-url`
#[arg(long, env)]
block_engine_auth_service_url: String,
block_engine_auth_service_url: Option<String>,

/// Keypair path
/// Path to keypair file used to authenticate with the backend.
#[arg(long, env)]
keypair_path: String,
keypair_path: PathBuf,

/// Validators allowed to authenticate and connect to the relayer, comma separated.
/// If null then all validators on the leader schedule shall be permitted.
Expand All @@ -137,11 +140,11 @@ struct Args {

/// The private key used to sign tokens by this server.
#[arg(long, env)]
signing_key_pem_path: String,
signing_key_pem_path: PathBuf,

/// The public key used to verify tokens by this and other services.
#[arg(long, env)]
verifying_key_pem_path: String,
verifying_key_pem_path: PathBuf,

/// Specifies how long access_tokens are valid for, expressed in seconds.
#[arg(long, env, default_value_t = 1_800)]
Expand All @@ -163,13 +166,13 @@ struct Args {
#[arg(long, env, default_value_t = 10)]
missing_slot_unhealthy_secs: u64,

/// Solana cluster name (mainnet-beta, testnet, devnet, ...)
/// DEPRECATED. Solana cluster name (mainnet-beta, testnet, devnet, ...)
#[arg(long, env)]
cluster: String,
cluster: Option<String>,

/// Region (amsterdam, dallas, frankfurt, ...)
/// DEPRECATED. Region (amsterdam, dallas, frankfurt, ...)
#[arg(long, env)]
region: String,
region: Option<String>,

/// Accounts of interest cache TTL. Note this must play nicely with the refresh period that
/// block engine uses to send full updates.
Expand Down Expand Up @@ -224,6 +227,14 @@ fn main() {
let args: Args = Args::parse();
info!("args: {:?}", args);

// Warn about deprecated args
if args.cluster.is_some() {
warn!("--cluster arg is deprecated and may be removed in the next release.")
}
if args.region.is_some() {
warn!("--region arg is deprecated and may be removed in the next release.")
}

let public_ip = if args.public_ip.is_some() {
args.public_ip.unwrap()
} else {
Expand Down Expand Up @@ -310,8 +321,9 @@ fn main() {
&exit,
);
let block_engine_forwarder = BlockEngineRelayerHandler::new(
args.block_engine_url,
args.block_engine_auth_service_url,
args.block_engine_url.clone(),
args.block_engine_auth_service_url
.unwrap_or(args.block_engine_url),
block_engine_receiver,
keypair,
exit.clone(),
Expand Down Expand Up @@ -344,7 +356,7 @@ fn main() {

let priv_key = fs::read(&args.signing_key_pem_path).unwrap_or_else(|_| {
panic!(
"Failed to read signing key file: {}",
"Failed to read signing key file: {:?}",
&args.verifying_key_pem_path
)
});
Expand All @@ -355,7 +367,7 @@ fn main() {

let key = fs::read(&args.verifying_key_pem_path).unwrap_or_else(|_| {
panic!(
"Failed to read verifying key file: {}",
"Failed to read verifying key file: {:?}",
&args.verifying_key_pem_path
)
});
Expand Down

0 comments on commit 7c8c202

Please sign in to comment.