Skip to content

Commit aa92400

Browse files
committed
feat: readme and actions
1 parent d2d8529 commit aa92400

File tree

4 files changed

+126
-1
lines changed

4 files changed

+126
-1
lines changed

.github/workflows/ecr-cd.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Docker ECR Push
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
9+
permissions:
10+
packages: write
11+
contents: read
12+
id-token: write
13+
14+
# simplest example of using the rust-base action
15+
jobs:
16+
docker-ecr-push:
17+
uses: init4tech/actions/.github/workflows/ecr-build-and-push.yml@main
18+
with:
19+
rust-binary-name: zenith-builder-example
20+
environment: dev
21+
secrets:
22+
aws-ecr-repository: ${{ secrets.AWS_ECR_REPOSITORY }}
23+
aws-eks-cluster: ${{ secrets.AWS_EKS_CLUSTER }}
24+
aws-ecr-deployer-role-arn: ${{ secrets.AWS_ECR_DEPLOYER_ROLE_ARN }}

.github/workflows/rust-ci.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Rust CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
# simplest example of using the rust-base action
9+
jobs:
10+
rust-base:
11+
uses: init4tech/actions/.github/workflows/rust-base.yml@main

Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# syntax=docker/dockerfile:1.7-labs
2+
### STAGE 0: Create base chef image for building
3+
### cargo chef is used to speed up the build process by caching dependencies using docker
4+
FROM --platform=$TARGETPLATFORM lukemathwalker/cargo-chef:latest-rust-latest as chef
5+
6+
RUN cargo install cargo-chef
7+
8+
WORKDIR /app
9+
10+
### Stage 1: cargo chef prepare
11+
### Creates the recipe.json file which is a manifest of Cargo.toml files and
12+
### the relevant Cargo.lock file
13+
FROM chef as planner
14+
COPY --exclude=target . .
15+
RUN cargo chef prepare
16+
17+
### Stage 2: Build the project
18+
### This stage builds the deps of the project (not the code) using cargo chef cook
19+
### and then it copies the source code and builds the actual crates
20+
### this takes advantage of docker layer caching to the max
21+
FROM chef as builder
22+
COPY --from=planner /app/recipe.json recipe.json
23+
RUN apt-get update && apt-get -y upgrade && apt-get install -y gcc libclang-dev pkg-config libssl-dev
24+
RUN rustup target add x86_64-unknown-linux-gnu
25+
RUN rustup toolchain install stable-x86_64-unknown-linux-gnu
26+
27+
RUN cargo chef cook --release --target x86_64-unknown-linux-gnu --recipe-path recipe.json --bin zenith-builder-example
28+
COPY --exclude=target . .
29+
30+
RUN cargo build --release --target x86_64-unknown-linux-gnu --bin zenith-builder-example
31+
32+
# Stage 3: Final image for running in the env
33+
FROM --platform=$TARGETPLATFORM debian:bookworm-slim
34+
RUN apt-get update && apt-get -y upgrade && apt-get install -y libssl-dev ca-certificates
35+
36+
COPY --from=builder /app/target/x86_64-unknown-linux-gnu/release/zenith-builder-example /usr/local/bin/zenith-builder-example
37+
38+
ENTRYPOINT [ "/usr/local/bin/zenith-builder-example" ]

README.md

+53-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,53 @@
1-
# builder
1+
# builder
2+
3+
Our sample signet builder implementation.
4+
5+
## Development
6+
7+
This crate contains an example block builder in the Signet ecosystem.
8+
9+
### Requirements
10+
11+
- Rust 1.81.0
12+
- Cargo [Lambda](https://www.cargo-lambda.info/)
13+
- AWS CLI and credentials
14+
15+
### Environment
16+
17+
The following environment variables are exposed to configure the Builder:
18+
19+
```bash
20+
# Builder Configs
21+
HOST_CHAIN_ID="17000" # Holesky Testnet
22+
RU_CHAIN_ID="17001"
23+
HOST_RPC_URL="http://host.url.here"
24+
ZENITH_ADDRESS="ZENITH_ADDRESS_HERE"
25+
QUINCEY_URL="http://signer.url.here"
26+
BUILDER_PORT="8080"
27+
BUILDER_KEY="YOUR_BUILDER_KEY_HERE"
28+
INCOMING_TRANSACTIONS_BUFFER="10"
29+
BLOCK_CONFIRMATION_BUFFER="10"
30+
BUILDER_REWARDS_ADDRESS="BUILDER_REWARDS_ADDRESS_HERE"
31+
ROLLUP_BLOCK_GAS_LIMIT="30000000"
32+
# Transaction Pool Configs
33+
TX_POOL_URL="http://pool.url.here/" # trailing slash is required
34+
TX_POOL_POLL_INTERVAL="5" # seconds
35+
TX_POOL_CACHE_DURATION="600" # seconds
36+
```
37+
38+
## API
39+
40+
### SignRequest
41+
42+
Sign request example payload:
43+
44+
```json
45+
{
46+
"hostBlockNumber": "0x0",
47+
"hostChainId": "0x1",
48+
"ruChainId": "0x2",
49+
"gasLimit": "0x5",
50+
"ruRewardAddress": "0x0606060606060606060606060606060606060606",
51+
"contents": "0x0707070707070707070707070707070707070707070707070707070707070707"
52+
}
53+
```

0 commit comments

Comments
 (0)