Skip to content

Commit

Permalink
fix: fix Dockefile
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew2003 committed Dec 6, 2024
1 parent 4a0cef3 commit 5caecf8
Show file tree
Hide file tree
Showing 37 changed files with 196 additions and 183 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,28 @@ jobs:
run: echo "PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> $GITHUB_ENV
- name: Run tests
run: cargo tarpaulin --all-features --verbose --tests --skip-clean

build-and-push:
name: Build and push docker images to docker hub
env:
PKG_NAME: irelia-public-server
PKG_NAME_WORKER: irelia-public-worker
runs-on: ubuntu-latest
needs: [cargo-check, fmt-check, test-and-coverage]
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push docker images
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ PKG_NAME }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ PKG_NAME_WORKER }}:latest
22 changes: 10 additions & 12 deletions Cargo.lock

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

23 changes: 9 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ members = [
irelia_adapter = { path = "crates/adapter" }
irelia_common = { path = "crates/common" }
irelia_core = { path = "crates/core" }
verifier = { path = "crates/temp/verifier" }
irelia_worker = { path = "crates/worker" }
verifier = { path = "crates/temp/verifier" }

anyhow = { version = "1.0.87" }
aptos-sdk = { git = "https://github.com/aptos-labs/aptos-core", branch = "mainnet" }
aptos-testcontainer = { version = "0.1.2", features = ["testing"] }
async-trait = { version = "0.1.81" }
axum = { version = "0.8.0-alpha.1" }
base64 = "0.22.1"
clap = { version = "4.5.17" }
config = { version = "0.14.0" }
deadpool-diesel = { version = "0.6.1" }
Expand All @@ -29,12 +30,10 @@ diesel_migrations = { version = "2.2.0" }
dotenv = { version = "0.15.0" }
ethers = { version = "2.0.14" }
glob = { version = "0.3.1" }
itertools = { version = "0.13.0" }
lazy_static = { version = "1.4.0" }
graphile_worker = { version = "0.8.0" }
log = { version = "0.4.22" }
num-bigint = { version = "0.4.6" }
num-traits = { version = "0.2.19" }
once_cell = { version = "1.19.0" }
openssl = { version = "0.10.66" }
opentelemetry = { version = "0.26.0" }
opentelemetry-otlp = { version = "0.26.0" }
Expand All @@ -43,35 +42,31 @@ opentelemetry_sdk = { version = "0.26.0" }
prost = { version = "0.13.2" }
rand = { version = "0.9.0-alpha.2" }
rand_core = { version = "0.5.1" }
graphile_worker = { version = "0.8.0" }
readonly = { version = "0.2.12" }
redis-async = { version = "0.17.2" }
regex = { version = "1.11.0" }
reqwest = "0.12.9"
scopeguard = { version = "1.2.0" }
serde = { version = "1.0.210", features = ["derive"] }
sqlx = { version = "*" }
serde_json = { version = "1.0.128" }
stone-cli = { git = "https://github.com/zksecurity/stone-cli.git", branch = "main"}
sqlx = { version = "*" }
stone-cli = { git = "https://github.com/zksecurity/stone-cli.git", branch = "main" }
tempfile = { version = "3.13.0" }
test-log = { version = "0.2.16" }
testcontainers-modules = { version = "0.11.3" }
thiserror = { version = "1.0.64" }
tokio = { version = "1.39.3", features = ["macros", "rt-multi-thread"] }
tonic = { version = "0.12.2" }
tokio-postgres = "0.7.12"
toml = "0.8.19"
tonic = { version = "0.12.2" }
tower-http = { version = "0.6.1" }
tracing = { version = "0.1.40" }
tracing-bunyan-formatter = { version = "0.3.9" }
tracing-opentelemetry = { version = "0.27.0" }
tracing-subscriber = { version = "0.3.18" }
url = { version = "2.4.0", features = ["serde"] }
uuid = { version = "1.10.0", features = ["v4"] }
reqwest = "0.12.9"
tokio-postgres = "0.7.12"
base64 = "0.22.1"
zip = "0.6.6"


[patch.crates-io]
merlin = { git = "https://github.com/aptos-labs/merlin" }
x25519-dalek = { git = "https://github.com/Tranduy1dol/x25519-dalek", branch = "zeroize_v1.7" }
x25519-dalek = { git = "https://github.com/Tranduy1dol/x25519-dalek", branch = "zeroize_v1.7" }
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN apt install -y build-essential libssl-dev pkg-config protobuf-compiler libcl
libudev-dev
RUN rm -rf /var/lib/apt/lists/*

COPY .stone-cli /root/.stone-cli
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
Expand All @@ -26,6 +27,7 @@ RUN mv target/${CARGO_BUILD_TARGET}/release /out

FROM debian:bookworm-slim AS public-server
WORKDIR /user
RUN apt update
RUN apt install -y libssl-dev libpq-dev

COPY crates/public/config/00-default.toml 00-default.toml
Expand All @@ -39,4 +41,4 @@ RUN apt install -y libssl-dev libpq-dev

COPY crates/worker/config/00-default.toml 00-default.toml
COPY --from=builder /out/irelia_worker /usr/local/bin/irelia_worker
ENTRYPOINT ["/usr/local/bin/irelia_worker", "--config-path=*.toml"]
ENTRYPOINT ["/usr/local/bin/irelia_worker", "--config-path=*.toml"]
18 changes: 7 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
POSTGRES_DIR="./src/adapter/src/repositories/postgres"
DATABASE_URL="postgres://postgres:[email protected]:5432/postgres"

PKG_NAME=rust-api-server
PKG_NAME_GRPC=rust-grpc-server
PKG_NAME=irelia-public-server
PKG_NAME_WORKER=irelia-public-worker
BUILD_VERSION=$(shell git describe --long)
BUILD_RELEASE=$(shell git describe --tags --abbrev=0)

Expand Down Expand Up @@ -30,17 +30,13 @@ migrate-redo:
--config-file ${POSTGRES_DIR}/diesel.toml

build:
PKG_NAME=rust-api-server
PKG_NAME_GRPC=rust-grpc-server
BUILD_VERSION=$(shell git describe --long)
BUILD_RELEASE=$(shell git describe --tags --abbrev=0)
BUILDKIT_PROGRESS=plain
DOCKER_BUILDKIT=1
docker build -t $(PKG_NAME):$(BUILD_VERSION) --target=public-prod .
docker build -t $(PKG_NAME_GRPC):$(BUILD_VERSION) --target=gpt-prod .
export BUILDKIT_PROGRESS=plain
export DOCKER_BUILDKIT=1
docker build -t $(PKG_NAME):$(BUILD_VERSION) --target=public-server .
docker build -t $(PKG_NAME_WORKER):$(BUILD_VERSION) --target=public-worker .

build-dev:
BUILDKIT_PROGRESS=plain DOCKER_BUILDKIT=1 docker build -t $(PKG_NAME):$(BUILD_VERSION) --target=public-dev .
BUILDKIT_PROGRESS=plain DOCKER_BUILDKIT=1 docker build -t $(PKG_NAME):$(BUILD_VERSION) --target=public-dev . && \
BUILDKIT_PROGRESS=plain DOCKER_BUILDKIT=1 docker build -t $(PKG_NAME_GRPC):$(BUILD_VERSION) --target=gpt-dev .

profiling-public:
Expand Down
2 changes: 1 addition & 1 deletion contracts/navori
3 changes: 1 addition & 2 deletions crates/adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ sqlx = { workspace = true, features = [
stone-cli = { workspace = true }
tempfile = { workspace = true }
test-log = { workspace = true }
testcontainers-modules = { workspace = true, features = ["postgres", "redis"] }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-opentelemetry = { workspace = true }
uuid = { version = "1.10.0", features = ["v4", "serde"] }
uuid = { workspace = true }
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::aptos_writer::contracts_caller::gps::types::verify_proof_and_register
VerifyProofAndRegisterData, VerifyProofAndRegisterDataJson,
};

pub fn extract_gps_input(main_proof: &String) -> anyhow::Result<VerifyProofAndRegisterData> {
pub fn extract_gps_input(main_proof: &str) -> anyhow::Result<VerifyProofAndRegisterData> {
let data = serde_json::from_str::<VerifyProofAndRegisterDataJson>(main_proof)?;
Ok(VerifyProofAndRegisterData::from(data))
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ pub async fn register_continuous_page_batch(
data: MemoryPageEntries,
) -> anyhow::Result<()> {
let ContinuousMemoryPage {
start_addr: _,
values: _,
z,
alpha,
prime,
values,
start_addr,
prime: _,
} = data.memory_page_entries.first().unwrap();

let z = MoveValue::U256(U256::from_str(z)?);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ use aptos_sdk::move_types::value::MoveValue;

use crate::aptos_writer::contracts_caller::verify_fri::types::fri_verify_input::FriVerifyInput;

pub fn extract_verify_fri_input(
fri_inputs: &[String],
) -> anyhow::Result<
Vec<(
FriVerifyInput,
MoveValue,
MoveValue,
MoveValue,
MoveValue,
MoveValue,
)>,
> {
type FriVerifyInputVec = Vec<(
FriVerifyInput,
MoveValue,
MoveValue,
MoveValue,
MoveValue,
MoveValue,
)>;
pub fn extract_verify_fri_input(fri_inputs: &[String]) -> anyhow::Result<FriVerifyInputVec> {
let mut res: Vec<(
FriVerifyInput,
MoveValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ pub mod merkle_verifier;
pub mod register_fact_fri;
pub mod sample_verify_fri_input;
pub mod types;
#[allow(clippy::module_inception)]
pub mod verify_fri;
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ pub mod merkle_statement;
pub mod register_fact_merkle;
pub mod sample_verify_merkle_input;
pub mod types;
#[allow(clippy::module_inception)]
pub mod verify_merkle;
13 changes: 11 additions & 2 deletions crates/adapter/src/prover/builtin_info.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
#[allow(dead_code)]
pub const OUTPUT_BUILTIN_BIT: usize = 0;
#[allow(dead_code)]
pub const PEDERSEN_BUILTIN_BIT: usize = 1;
#[allow(dead_code)]
pub const RANGE_CHECK_BUILTIN_BIT: usize = 2;
#[allow(dead_code)]
pub const ECDSA_BUILTIN_BIT: usize = 3;
#[allow(dead_code)]
pub const BITWISE_BUILTIN_BIT: usize = 4;
#[allow(dead_code)]
pub const EC_OP_BUILTIN_BIT: usize = 5;
#[allow(dead_code)]
pub const KECCAK_BUILTIN_BIT: usize = 6;
#[allow(dead_code)]
pub const POSEIDON_BUILTIN_BIT: usize = 7;

#[allow(dead_code)]
pub const N_BUILTINS: usize = 9;

#[allow(dead_code)]
pub const BOOTLOADER_LEN: usize = 728;
#[allow(dead_code)]
pub fn get_layout7_selected_builtins() -> usize {
let selected_builtins = (1 << OUTPUT_BUILTIN_BIT)
| (1 << PEDERSEN_BUILTIN_BIT)
Expand Down
1 change: 0 additions & 1 deletion crates/adapter/src/prover/oods_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use serde_json::json;
use crate::prover::default_prime;

/// Adapted from https://github.com/zksecurity/stark-evm-adapter/blob/main/src/oods_statement.rs
/// Proof for consistency check for out of domain sampling
#[derive(Serialize, Deserialize, Debug)]
pub struct FactTopology {
Expand Down
1 change: 0 additions & 1 deletion crates/adapter/src/prover/stone_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const SERIALIZED_PROOF_PATH: &str = "bootloader_serialized_proof.json";

/// This code is adapted from: https://github.com/zksecurity/stone-cli/blob/main/src/main.rs
/// Generate proof from cairo pies or cairo programs
pub struct StoneProver {
pub cairo_pie: Vec<PathBuf>,
pub layout: LayoutName,
Expand Down
2 changes: 1 addition & 1 deletion crates/adapter/src/repositories/postgres/models/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::str::FromStr;
use std::time::SystemTime;

use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
use irelia_core::entities::job::{JobEntity, JobId, CairoJobStatus};
use irelia_core::entities::job::{CairoJobStatus, JobEntity, JobId};
use uuid::Uuid;

#[derive(Debug, Queryable, Insertable, Selectable, AsChangeset, Identifiable, Clone)]
Expand Down
Loading

0 comments on commit 5caecf8

Please sign in to comment.