-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
748 additions
and
1,131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
syntax = "proto3"; | ||
package vm_runtime; | ||
package vm; | ||
|
||
service VmRuntime { | ||
rpc Create(CreateRequest) returns (CreateResponse); | ||
rpc Execute(ExecuteRequest) returns (ExecuteResponse); | ||
service VM { | ||
rpc NewProject(NewProjectRequest) returns (NewProjectResponse); | ||
rpc ExecuteTask(ExecuteTaskRequest) returns (ExecuteTaskResponse); | ||
} | ||
|
||
message CreateRequest { | ||
message NewProjectRequest { | ||
uint64 projectID = 1; | ||
string content = 2; | ||
string expParam = 3; | ||
string projectVersion = 2; | ||
bytes binary = 3; | ||
bytes metadata = 4; | ||
} | ||
|
||
message CreateResponse { | ||
} | ||
|
||
message ExecuteRequest { | ||
message NewProjectResponse {} | ||
|
||
message ExecuteTaskRequest { | ||
uint64 projectID = 1; | ||
uint64 taskID = 2; | ||
string clientID = 3; | ||
string sequencerSignature = 4; | ||
repeated string datas = 5; | ||
string projectVersion = 2; | ||
bytes taskID = 3; | ||
repeated bytes payloads = 4; | ||
} | ||
|
||
message ExecuteResponse { | ||
message ExecuteTaskResponse { | ||
bytes result = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
DATABASE_URL=postgres://test_user:[email protected]:5432/test?sslmode=disable | ||
CHAIN_ENDPOINT = "https://babel-api.mainnet.iotex.io" | ||
VERIFY_CONTRACT = "0x79F3872E3e69B696d7ebFAF12691130EfA12291e" | ||
BONSAI_URL = "https://api.bonsai.xyz" | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
# Use the official Rust image as the base image | ||
FROM rust:1.79.0 AS builder | ||
|
||
RUN update-ca-certificates | ||
|
||
RUN apt update | ||
RUN apt install -y curl libpq-dev libssl-dev libpq-dev librust-openssl-dev librust-openssl-sys-dev | ||
RUN apt -y install libpq5 | ||
RUN apt update && apt install -y libprotobuf-dev protobuf-compiler | ||
|
||
RUN cargo install diesel_cli --no-default-features --features postgres --version 2.1.0 | ||
# Set the working directory inside the container | ||
WORKDIR /usr/src/app | ||
|
||
RUN curl -L https://foundry.paradigm.xyz | bash | ||
RUN /root/.foundry/bin/foundryup | ||
RUN cp /root/.foundry/bin/* /usr/bin/ | ||
RUN apt update && apt install -y libprotobuf-dev protobuf-compiler | ||
|
||
WORKDIR /rust/src | ||
COPY ./ ./ | ||
# Copy the Cargo.toml and Cargo.lock files | ||
# COPY Cargo.toml Cargo.lock ./ | ||
|
||
RUN export CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
RUN export RUST_BACKTRACE=1 | ||
# Copy the source code | ||
COPY ./risc0-server ./risc0-server | ||
COPY ./rust-grpc ./rust-grpc | ||
COPY ./proto ./proto | ||
|
||
# Build the project | ||
RUN cd risc0-server && cargo build --release | ||
|
||
# Use a minimal base image for the final stage | ||
FROM debian:bullseye-slim | ||
|
||
|
||
FROM wangweixiaohao2944/risc0serverbase:v1.0.0 | ||
# Install ca-certificates without cache | ||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /risc0server/ | ||
|
||
# Copy the compiled binary from the builder stage | ||
COPY --from=builder /usr/src/app/risc0-server/target/release/risc0-server /usr/local/bin/risc0-server | ||
|
||
COPY --from=builder /rust/src/risc0-server/target/release/risc0-server ./ | ||
COPY ./risc0-server/Cargo.toml /risc0server/ | ||
COPY ./risc0-server/diesel.toml /risc0server/ | ||
COPY ./risc0-server/verify_contract_abi.json /risc0server/ | ||
# Expose the port that the server will run on | ||
EXPOSE 4001 | ||
|
||
CMD ["/risc0server/risc0-server"] | ||
# Set the entrypoint to the compiled binary | ||
CMD ["risc0-server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,7 @@ | ||
|
||
|
||
integration_test_depends_stop: | ||
@docker stop postgres_test || true && docker container rm postgres_test || true | ||
|
||
.PHONY: integration_test_depends | ||
integration_test_depends: integration_test_depends_stop postgres_test risc0_depends | ||
|
||
.PHONY: postgres_test | ||
postgres_test: | ||
docker run --name postgres_test \ | ||
-e POSTGRES_USER=test_user \ | ||
-e POSTGRES_PASSWORD=test_passwd \ | ||
-e POSTGRES_DB=test \ | ||
-p 15432:5432 \ | ||
-d postgres:14 | ||
|
||
.PHONY: risc0_depends | ||
risc0_depends: | ||
cargo install cargo-binstall | ||
echo yes | cargo binstall cargo-risczero | ||
cargo risczero install | ||
|
||
integration_test: integration_test_depends | ||
@cd risc0-server/ && cargo test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
# risc0-server | ||
|
||
## setup | ||
### install diesel | ||
|
||
``` shell | ||
cargo install diesel_cli --no-default-features --features postgres | ||
``` | ||
|
||
|
||
### build release | ||
|
||
|
@@ -16,22 +12,9 @@ cargo build --release | |
### configure database | ||
modify `.env` file | ||
|
||
``` shell | ||
DATABASE_URL=postgres://test_user:[email protected]:5432/test?sslmode=disable | ||
``` | ||
|
||
### migrate database | ||
|
||
``` shell | ||
diesel setup | ||
|
||
diesel migration generate risc0-server | ||
|
||
diesel migration run | ||
``` | ||
|
||
|
||
### run risc0 rpc sever | ||
|
||
``` shell | ||
./target/release/risc0server | ||
./target/release/risc0-server | ||
``` |
This file was deleted.
Oops, something went wrong.
Empty file.
3 changes: 0 additions & 3 deletions
3
risc0-server/migrations/2024-03-28-110112_risc0-server/down.sql
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
risc0-server/migrations/2024-03-28-110112_risc0-server/up.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub mod prove; | ||
pub mod prover; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.