Skip to content
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

RPC456 refactoring the code to add new calculation algo #5

Merged
merged 8 commits into from
Aug 27, 2024
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Overview

- Summary of changes

## Testing

- Testing performed to validate the changes
54 changes: 54 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
pull_request:
branches: [main]

jobs:

changes:
runs-on: ubuntu-latest
outputs:
fee-estimator: ${{ steps.filter.outputs.fee-estimator}}
steps:
- uses: actions/checkout@v3
- uses: dorny/[email protected]
id: filter
with:
filters: |
fee-estimator:
- '*/**'

fee-estimator-tests:
needs: changes
if: ${{ needs.changes.outputs.fee-estimator == 'true' }}
runs-on: ubuntu-latest
env:
RUST_TOOLCHAIN: stable
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: 'true'
RUSTC_WRAPPER: 'sccache'
ENV: 'test'
steps:
- uses: actions/checkout@v4
- name: Cleanup Apt
run: sudo find /var/lib/apt/lists/ -type 'f' -name 'archive*' -delete && sudo apt-get update
- uses: rui314/setup-mold@v1
with:
mold-version: 1.1.1
make-default: true
- name: Ensure we use Mold
run: sudo ln -s /usr/local/bin/ld.mold /usr/bin/ld.lld
- name: Install rust + caching
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: '-C link-arg=-fuse-ld=lld'
components: rustfmt, clippy
- name: Set up sccache
uses: mozilla-actions/[email protected]
- name: Clear sccache stats
run: sccache --zero-stats
- name: Run Tests
run: |
cargo test -- --nocapture

74 changes: 72 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,72 @@
.vscode/
target/
# Javascript/Typescript
node_modules/
dist/
build/
coverage/
vendor/

# Node Logs
logs
*.log
npm-debug.log*
AWSCLIV2.pkg

# Mac
**/.DS_Store

# IDEs
**/.vscode
**/.idea/

# Services
ts-services/parser-lambda/parser/test/data/local/*
ts-services/parser-lambda/parser/test/output/*
ts-services/parser-lambda/parser/playground.ts

# Secrets
ts-services/dev-api-lambda/crypto-billing/*_secrets.ts
infra/ansible/vars/**/*-secrets.yaml
infra/ansible/vars/**/*-secrets.yml
infra/ansible/photon/vars/*-secrets.yaml
infra/ansible/photon/vars/*-secrets.yml
infra/ansible/rpc/templates/bt-creds*.json

# Rust
**/target/

# CPU profiles
*.cpuprofile

# Built helm charts
infra/**/*.tgz

.gradle
.m2
bin

# Build output directies
/target
*/target
/build
*/build

# Local Redis
dump.rdb

infra/ansible/roles/Datadog.datadog
infra/ansible/photon/roles/datadog.datadog


scripts/data

# Jupyter notebooks
*.ipynb

# Personal Playground
personal_playground


# Used for local deployments of RPC operator
/rpc-operator/
**/systest/*.json
**/router-benchmarks/*.json
38 changes: 19 additions & 19 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cadence = "0.29.0"
cadence-macros = "0.29.0"
dashmap = "5.5.3"
queues = "1.1.0"
jsonrpsee = { version = "0.20.1", features = [
jsonrpsee = { version = "0.22.5", features = [
"server",
"http-client",
"macros",
Expand All @@ -38,4 +38,4 @@ yellowstone-grpc-geyser = { git = "https://github.com/helius-labs/yellowstone-gr
rand = "0.8.5"
futures = "0.3.24"
figment = { version = "0.10.6", features = ["env", "test"] }
tower = { version = "0.4.13", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }
4 changes: 1 addition & 3 deletions src/grpc_geyser.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::time::Instant;
use std::{collections::HashMap, time::Duration};

use cadence_macros::statsd_count;
use futures::{future::TryFutureExt, sink::SinkExt, stream::StreamExt};
use futures::{sink::SinkExt, stream::StreamExt};
use rand::distributions::Alphanumeric;
use rand::Rng;
use tokio::time::sleep;
Expand Down
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ use cadence::{BufferedUdpMetricSink, QueuingMetricSink, StatsdClient};
use cadence_macros::set_global_default;
use figment::{providers::Env, Figment};
use grpc_geyser::GrpcGeyserImpl;
use jsonrpsee::server::{middleware::ProxyGetRequestLayer, ServerBuilder};
use jsonrpsee::server::{RpcServiceBuilder, ServerBuilder};
use jsonrpsee::server::middleware::http::ProxyGetRequestLayer;
use priority_fee::PriorityFeeTracker;
use rpc_server::AtlasPriorityFeeEstimator;
use serde::Deserialize;
use tracing::{error, info};

mod errors;
mod grpc_consumer;
mod grpc_geyser;
mod priority_fee;
mod rpc_server;
mod slot_cache;
mod solana;
mod temp_validator;

#[derive(Debug, Deserialize, Clone)]
struct EstimatorEnv {
Expand Down Expand Up @@ -50,7 +53,8 @@ async fn main() {

let port = env.port.unwrap_or(4141);
let server = ServerBuilder::default()
.set_middleware(
.set_rpc_middleware(RpcServiceBuilder::new().layer(temp_validator::RpcValidatorLayer::new()))
.set_http_middleware(
tower::ServiceBuilder::new()
// Proxy `GET /health` requests to internal `health` method.
.layer(
Expand Down
Loading
Loading