Skip to content

Commit

Permalink
Merge branch 'main' into optimize-chaos-docker-build
Browse files Browse the repository at this point in the history
  • Loading branch information
renancloudwalk authored May 28, 2024
2 parents b168002 + dd874b1 commit 054428e
Show file tree
Hide file tree
Showing 47 changed files with 620 additions and 241 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
!static/
!.sqlx/
!build.rs
!proto
5 changes: 4 additions & 1 deletion .github/workflows/_setup-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Set up Just
uses: extractions/setup-just@v1

Expand All @@ -68,4 +71,4 @@ jobs:
env:
CARGO_PROFILE_RELEASE_DEBUG: 0
RUST_LOG: off
RELEASE: 1
RELEASE: 1
4 changes: 3 additions & 1 deletion .github/workflows/comment-tag-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- name: Set up Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -39,4 +42,3 @@ jobs:
run: ruby utils/slack-notifiers/comments.rb
env:
SLACK_WEBHOOK_URL: ${{ secrets.STRATUS_SLACK_WEBHOOK_URL }}

5 changes: 4 additions & 1 deletion .github/workflows/doc-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ jobs:
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Set up Just
uses: extractions/setup-just@v1

- name: Test docs
run: just test-doc
run: just test-doc
3 changes: 3 additions & 0 deletions .github/workflows/e2e-contracts-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ jobs:
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Set up Just
uses: extractions/setup-just@v1

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/e2e-contracts-rocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ jobs:
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Set up Just
uses: extractions/setup-just@v1

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/e2e-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ jobs:
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Set up Just
uses: extractions/setup-just@v1

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/int-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ jobs:
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Set up Just
uses: extractions/setup-just@v1

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/lint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ jobs:
- name: Set up Rust Nightly
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2024-01-01

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Set up Just
uses: extractions/setup-just@v1

- name: Just lint-check
run: just lint-check -2024-01-01
run: just lint-check -2024-01-01
8 changes: 5 additions & 3 deletions .github/workflows/outdated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ jobs:
uses: actions/checkout@v2

- name: Set up Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Set up Just
uses: extractions/setup-just@v1

Expand All @@ -36,4 +39,3 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.STRATUS_SLACK_WEBHOOK_URL }}
OUTDATED_TABLE_FILE_NAME: outdated.txt

5 changes: 4 additions & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ jobs:
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Set up Just
uses: extractions/setup-just@v1

- name: Unit tests
run: just test-unit
run: just test-unit
69 changes: 69 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ triehash = "=0.8.4"
jsonrpsee = { version = "=0.22.4", features = ["server", "client"] }
reqwest = { version = "=0.12.4", features = ["json"] }
tower = "=0.4.13"
tonic = "=0.11.0"
prost = "=0.12.6"

# observability
console-subscriber = "=0.2.0"
Expand Down Expand Up @@ -112,6 +114,7 @@ const-hex = "=1.10.0"
glob = "=0.3.1"
nom = "=7.1.3"
phf_codegen = "=0.11.2"
tonic-build = "=0.11.0"

# ------------------------------------------------------------------------------
# Binaries
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use nom::sequence::separated_pair;
use nom::IResult;

fn main() {
tonic_build::compile_protos("proto/raft.proto").unwrap();
// any code change
println!("cargo:rerun-if-changed=src/");
// used in signatures codegen
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile.run_with_importer
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ COPY Cargo.toml /app/Cargo.toml
COPY Cargo.lock /app/Cargo.lock
COPY .cargo .cargo
COPY config /app/config
COPY proto /app/proto

RUN apt update
RUN apt-get install -y libclang-dev cmake
RUN apt-get install -y libclang-dev cmake protobuf-compiler

ENV CARGO_PROFILE_RELEASE_DEBUG=1
ENV JSON_LOGS=1
Expand Down
6 changes: 5 additions & 1 deletion e2e/test/automine/e2e-json-rpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
sendReset,
subscribeAndGetEvent,
subscribeAndGetEventWithContract,
ONE,
} from "../helpers/rpc";

describe("JSON-RPC", () => {
Expand Down Expand Up @@ -66,7 +67,7 @@ describe("JSON-RPC", () => {
let gas = await send("eth_estimateGas", [tx]);
expect(gas).match(HEX_PATTERN, "format");

const gasDec = parseInt(gas, 16);
const gasDec = parseInt(gas, 16);
expect(gasDec).to.be.greaterThan(0).and.lessThan(1_000_000);
});
});
Expand All @@ -85,6 +86,9 @@ describe("JSON-RPC", () => {
describe("Block", () => {
it("eth_blockNumber", async function () {
(await sendExpect("eth_blockNumber")).eq(ZERO);
await sendEvmMine();
(await sendExpect("eth_blockNumber")).eq(ONE);
await sendReset();
});
it("eth_getBlockByNumber", async function () {
let block: Block = await send("eth_getBlockByNumber", [ZERO, true]);
Expand Down
20 changes: 20 additions & 0 deletions proto/raft.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package raft;

message Entry {
uint64 index = 1;
string data = 2;
}

message AppendEntriesRequest {
repeated Entry entries = 1;
}

message AppendEntriesResponse {
bool success = 1;
}

service RaftService {
rpc AppendEntries(AppendEntriesRequest) returns (AppendEntriesResponse);
}
Loading

0 comments on commit 054428e

Please sign in to comment.