Skip to content

pyth-lazer-agent fixes, tests, ci #2787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
37 changes: 37 additions & 0 deletions .github/workflows/ci-pyth-lazer-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "pyth-lazer-agent Rust Test Suite"
on:
push:
branches:
- main
pull_request:
paths:
- .github/workflows/ci-pyth-lazer-agent.yml
- apps/pyth-lazer-agent/**

jobs:
pyth-lazer-agent-rust-test-suite:
name: pyth-lazer-agent Rust Test Suite
runs-on: ubuntu-22.04
defaults:
run:
working-directory: apps/pyth-lazer-agent
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.87.0
components: clippy,rustfmt
- uses: Swatinem/rust-cache@v2
with:
workspaces: "apps/pyth-lazer-agent -> target"
- name: Format check
run: cargo fmt --all -- --check
if: success() || failure()
- name: Clippy check
run: cargo clippy --all-targets -- --deny warnings
if: success() || failure()
- name: test
run: cargo test
if: success() || failure()
55 changes: 55 additions & 0 deletions .github/workflows/docker-pyth-lazer-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and Push pyth-lazer-agent Image
on:
push:
tags:
- pyth-lazer-agent-v*
pull_request:
paths:
- "apps/pyth-lazer-agent/**"
workflow_dispatch:
inputs:
dispatch_description:
description: "Dispatch description"
required: true
type: string
permissions:
contents: read
id-token: write
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: pyth-network/pyth-lazer-agent
jobs:
pyth-lazer-agent-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set image tag to version of the git tag
if: ${{ startsWith(github.ref, 'refs/tags/pyth-lazer-agent-v') }}
run: |
PREFIX="refs/tags/pyth-lazer-agent-"
VERSION="${GITHUB_REF:${#PREFIX}}"
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
- name: Set image tag to the git commit hash
if: ${{ !startsWith(github.ref, 'refs/tags/pyth-lazer-agent-v') }}
run: |
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: metadata_pyth_lazer_agent
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push server docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: "./apps/pyth-lazer-agent/Dockerfile"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metadata_pyth_lazer_agent.outputs.tags }}
labels: ${{ steps.metadata_pyth_lazer_agent.outputs.labels }}
File renamed without changes.
File renamed without changes.

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

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pyth-lazer-protocol = "0.7.2"

anyhow = "1.0.98"
backoff = "0.4.0"
base64 = "0.22.1"
bincode = { version = "2.0.1", features = ["serde"] }
clap = { version = "4.5.32", features = ["derive"] }
config = "0.15.11"
Expand All @@ -32,3 +33,6 @@ tokio-util = { version = "0.7.14", features = ["compat"] }
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "json"] }
url = { version = "2.5.4", features = ["serde"] }

[dev-dependencies]
tempfile = "3.20.0"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM rust:slim-bookworm AS builder

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

ADD . /pyth-lazer-agent
ADD apps/pyth-lazer-agent /pyth-lazer-agent
WORKDIR /pyth-lazer-agent

RUN cargo build --release
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
relayer_urls = ["ws://relayer-0.pyth-lazer.dourolabs.app/v1/transaction", "ws://relayer-0.pyth-lazer.dourolabs.app/v1/transaction"]
authorization_token = "token1"
publish_keypair_path = "/path/to/solana/id.json"
listen_address = "0.0.0.0:1776"
publish_interval_duration = "0.5ms"
listen_address = "0.0.0.0:8910"
publish_interval_duration = "25ms"
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ pub struct Config {
pub listen_address: SocketAddr,
pub relayer_urls: Vec<Url>,
#[derivative(Debug = "ignore")]
pub authorization_token: String,
#[derivative(Debug = "ignore")]
pub publish_keypair_path: PathBuf,
#[serde(with = "humantime_serde", default = "default_publish_interval")]
pub publish_interval_duration: Duration,
Expand Down
Loading