Skip to content

Commit c673261

Browse files
authored
pyth-lazer-agent fixes, tests, ci
2 parents 9a343f7 + d6e930a commit c673261

17 files changed

+487
-158
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "pyth-lazer-agent Rust Test Suite"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
paths:
8+
- .github/workflows/ci-pyth-lazer-agent.yml
9+
- apps/pyth-lazer-agent/**
10+
11+
jobs:
12+
pyth-lazer-agent-rust-test-suite:
13+
name: pyth-lazer-agent Rust Test Suite
14+
runs-on: ubuntu-22.04
15+
defaults:
16+
run:
17+
working-directory: apps/pyth-lazer-agent
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
- uses: actions-rust-lang/setup-rust-toolchain@v1
23+
with:
24+
toolchain: 1.87.0
25+
components: clippy,rustfmt
26+
- uses: Swatinem/rust-cache@v2
27+
with:
28+
workspaces: "apps/pyth-lazer-agent -> target"
29+
- name: Format check
30+
run: cargo fmt --all -- --check
31+
if: success() || failure()
32+
- name: Clippy check
33+
run: cargo clippy --all-targets -- --deny warnings
34+
if: success() || failure()
35+
- name: test
36+
run: cargo test
37+
if: success() || failure()
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build and Push pyth-lazer-agent Image
2+
on:
3+
push:
4+
tags:
5+
- pyth-lazer-agent-v*
6+
pull_request:
7+
paths:
8+
- "apps/pyth-lazer-agent/**"
9+
workflow_dispatch:
10+
inputs:
11+
dispatch_description:
12+
description: "Dispatch description"
13+
required: true
14+
type: string
15+
permissions:
16+
contents: read
17+
id-token: write
18+
packages: write
19+
env:
20+
REGISTRY: ghcr.io
21+
IMAGE_NAME: pyth-network/pyth-lazer-agent
22+
jobs:
23+
pyth-lazer-agent-image:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set image tag to version of the git tag
28+
if: ${{ startsWith(github.ref, 'refs/tags/pyth-lazer-agent-v') }}
29+
run: |
30+
PREFIX="refs/tags/pyth-lazer-agent-"
31+
VERSION="${GITHUB_REF:${#PREFIX}}"
32+
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
33+
- name: Set image tag to the git commit hash
34+
if: ${{ !startsWith(github.ref, 'refs/tags/pyth-lazer-agent-v') }}
35+
run: |
36+
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
37+
- name: Log in to the Container registry
38+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
39+
with:
40+
registry: ${{ env.REGISTRY }}
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Extract metadata (tags, labels) for Docker
44+
id: metadata_pyth_lazer_agent
45+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
- name: Build and push server docker image
49+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
50+
with:
51+
context: .
52+
file: "./apps/pyth-lazer-agent/Dockerfile"
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: ${{ steps.metadata_pyth_lazer_agent.outputs.tags }}
55+
labels: ${{ steps.metadata_pyth_lazer_agent.outputs.labels }}
File renamed without changes.
File renamed without changes.

pyth-lazer-agent/Cargo.lock renamed to apps/pyth-lazer-agent/Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyth-lazer-agent/Cargo.toml renamed to apps/pyth-lazer-agent/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pyth-lazer-protocol = "0.7.2"
99

1010
anyhow = "1.0.98"
1111
backoff = "0.4.0"
12+
base64 = "0.22.1"
1213
bincode = { version = "2.0.1", features = ["serde"] }
1314
clap = { version = "4.5.32", features = ["derive"] }
1415
config = "0.15.11"
@@ -32,3 +33,6 @@ tokio-util = { version = "0.7.14", features = ["compat"] }
3233
tracing = "0.1.41"
3334
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "json"] }
3435
url = { version = "2.5.4", features = ["serde"] }
36+
37+
[dev-dependencies]
38+
tempfile = "3.20.0"

pyth-lazer-agent/Dockerfile renamed to apps/pyth-lazer-agent/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM rust:slim-bookworm AS builder
22

33
RUN apt update && apt install -y curl libssl-dev pkg-config build-essential && apt clean all
44

5-
ADD . /pyth-lazer-agent
5+
ADD apps/pyth-lazer-agent /pyth-lazer-agent
66
WORKDIR /pyth-lazer-agent
77

88
RUN cargo build --release
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
relayer_urls = ["ws://relayer-0.pyth-lazer.dourolabs.app/v1/transaction", "ws://relayer-0.pyth-lazer.dourolabs.app/v1/transaction"]
2-
authorization_token = "token1"
32
publish_keypair_path = "/path/to/solana/id.json"
4-
listen_address = "0.0.0.0:1776"
5-
publish_interval_duration = "0.5ms"
3+
listen_address = "0.0.0.0:8910"
4+
publish_interval_duration = "25ms"

pyth-lazer-agent/src/config.rs renamed to apps/pyth-lazer-agent/src/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ pub struct Config {
1313
pub listen_address: SocketAddr,
1414
pub relayer_urls: Vec<Url>,
1515
#[derivative(Debug = "ignore")]
16-
pub authorization_token: String,
17-
#[derivative(Debug = "ignore")]
1816
pub publish_keypair_path: PathBuf,
1917
#[serde(with = "humantime_serde", default = "default_publish_interval")]
2018
pub publish_interval_duration: Duration,

0 commit comments

Comments
 (0)