Skip to content

Commit

Permalink
refactor: remove unnecessary Rust code
Browse files Browse the repository at this point in the history
Only the authority-claimer service will remain in the Node 2.0.
  • Loading branch information
gligneul committed Apr 8, 2024
1 parent 392c759 commit b8f3b51
Show file tree
Hide file tree
Showing 275 changed files with 382 additions and 21,876 deletions.
48 changes: 26 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ permissions:
contents: write

jobs:
test:
rust-test:
runs-on: ubuntu-22.04
env:
RUSTFLAGS: -D warnings -C debuginfo=0
defaults:
run:
working-directory: offchain
working-directory: cmd/authority-claimer
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -40,23 +40,19 @@ jobs:
./docker-bake.override.hcl
./docker-bake.platforms.hcl
targets: |
rollups-node-devnet
rollups-node-snapshot
project: ${{ vars.DEPOT_PROJECT }}
workdir: build
load: true

- name: 📦 Install protoc
run: sudo apt update && sudo apt install -y protobuf-compiler libprotobuf-dev

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
offchain/target/
./cmd/authority-claimer/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

Expand All @@ -83,29 +79,42 @@ jobs:
- name: Run tests
run: cargo test

- name: Generate GraphQL schema
run: ./target/debug/generate-schema
go-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Upload GraphQL schema
uses: actions/upload-artifact@v4
- uses: depot/setup-action@v1
- name: Build dependency images
uses: depot/bake-action@v1
with:
name: graphql-schema
path: offchain/schema.graphql
if-no-files-found: error
files: |
./docker-bake.hcl
./docker-bake.override.hcl
./docker-bake.platforms.hcl
targets: |
rollups-node-devnet
rollups-node-snapshot
project: ${{ vars.DEPOT_PROJECT }}
workdir: build
load: true


- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Run Go tests
working-directory: ${{ github.workspace }}
run: go test ./...

build_docker:
runs-on: ubuntu-22.04
needs:
- test
- rust-test
- go-test
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -164,14 +173,9 @@ jobs:
- name: Trim CHANGELOG.md
run: sed -e '0,/^##[^#]/d' -e '/^##[^#]/,$d' -i CHANGELOG.md

- name: Download GraphQL schema
uses: actions/download-artifact@v4
with:
name: graphql-schema

- name: Publish Github release
uses: softprops/action-gh-release@v2
with:
prerelease: true
body_path: CHANGELOG.md
files: schema.graphql
files: api/graphql/reader.graphql
7 changes: 2 additions & 5 deletions .github/workflows/rust-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: offchain
working-directory: cmd/authority-claimer

steps:
- uses: actions/checkout@v4
Expand All @@ -22,13 +22,10 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
offchain/target/
cmd/authority-claimer/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Install protoc
run: sudo apt update && sudo apt install -y protobuf-compiler libprotobuf-dev

- name: Update rust
run: rustup update

Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "grpc-interfaces"]
path = offchain/grpc-interfaces/grpc-interfaces
url = ../grpc-interfaces.git
[submodule "rollups-contracts"]
path = rollups-contracts
url = https://github.com/cartesi/rollups-contracts
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Removed

- Removed ...

## [1.4.0]

### Added

- Added verification to ensure `CARTESI_BLOCKCHAIN_ID` matches the id returned from the Ethereum node
Expand Down
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@ generate: ## Generate the file that are commited to the repo
@go mod tidy
@go generate -v ./...

.PHONY: graphql-schema
graphql-schema: ## Generate the graphql schema file
@cd offchain; cargo run --bin generate-schema
@mv offchain/schema.graphql api/graphql/reader.graphql

.PHONY: check-generate
check-generate: generate graphql-schema ## Check whether the generated files are in sync
check-generate: generate ## Check whether the generated files are in sync
@echo "Checking differences on the repository..."
@if git diff --exit-code; then \
echo "No differences found."; \
Expand Down
13 changes: 2 additions & 11 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ adduser --system --uid 102 \
cartesi
EOF


####################################################################################################
# TARGET: rollups-node-snapshot
#
Expand Down Expand Up @@ -112,7 +111,6 @@ COPY --from=snapshot-builder --chown=cartesi:cartesi ${SNAPSHOT_BUILD_PATH} ${SN
# Set dummy command.
CMD /bin/bash


####################################################################################################
# TARGET: rollups-node-devnet
#
Expand Down Expand Up @@ -243,7 +241,7 @@ EOF
#
# This stage prepares the recipe with just the external dependencies.
FROM rust-chef as rust-prepare
COPY ./offchain/ .
COPY ./cmd/authority-claimer/ .
RUN cargo chef prepare --recipe-path recipe.json

# STAGE: rust-builder
Expand All @@ -269,7 +267,7 @@ COPY --from=rust-prepare ${RUST_BUILD_PATH}/recipe.json .
RUN cargo chef cook --release --recipe-path recipe.json

# Build application.
COPY ./offchain/ .
COPY ./cmd/authority-claimer/ .
RUN cargo build --release

# STAGE: go-builder
Expand Down Expand Up @@ -327,14 +325,7 @@ COPY --from=server-manager /usr/bin/server-manager /usr/bin
# Explicitly copy each binary to avoid adding unnecessary files to the runtime image.
ARG RUST_BUILD_PATH
ARG RUST_TARGET=${RUST_BUILD_PATH}/target/release
COPY --from=rust-builder ${RUST_TARGET}/cartesi-rollups-advance-runner /usr/bin
COPY --from=rust-builder ${RUST_TARGET}/cartesi-rollups-authority-claimer /usr/bin
COPY --from=rust-builder ${RUST_TARGET}/cartesi-rollups-dispatcher /usr/bin
COPY --from=rust-builder ${RUST_TARGET}/cartesi-rollups-graphql-server /usr/bin
COPY --from=rust-builder ${RUST_TARGET}/cartesi-rollups-host-runner /usr/bin
COPY --from=rust-builder ${RUST_TARGET}/cartesi-rollups-indexer /usr/bin
COPY --from=rust-builder ${RUST_TARGET}/cartesi-rollups-inspect-server /usr/bin
COPY --from=rust-builder ${RUST_TARGET}/cartesi-rollups-state-server /usr/bin

# Copy Go binary.
ARG GO_BUILD_PATH
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions cmd/authority-claimer/.rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
edition = "2021"
max_width = 80
Loading

0 comments on commit b8f3b51

Please sign in to comment.