Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main-v0.13.2 into main #908

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions .github/actions/install_rust/action.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
# Installs rust toolchain with the version defined in .github/actions/install_rust/rust_version.txt.
inputs:
components:
description: "Optional: which additional components to install."
required: false
type: string
default: ''

runs:
using: "composite"
steps:
- name: Define toolchain
run: echo "DEFAULT_TOOLCHAIN=$(cat .github/actions/install_rust/rust_version.txt)" >> $GITHUB_ENV
shell: bash

- name: install rust toolchain with given components
if: "${{ inputs.components != '' }}"
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.DEFAULT_TOOLCHAIN }}
components: ${{ inputs.components }}

- name: install rust toolchain without given components
if: "${{ inputs.components == '' }}"
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.DEFAULT_TOOLCHAIN }}
- uses: moonrepo/setup-rust@v1
8 changes: 0 additions & 8 deletions .github/workflows/blockifier_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"
- run: cargo build -p blockifier
- run: cargo test -p blockifier

Expand All @@ -54,11 +51,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust

- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust-ubuntu-20.04"

- name: Build native blockifier
run: ./build_native_in_docker.sh scripts/build_native_blockifier.sh

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/blockifier_compiled_cairo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"

# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/blockifier_post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Noelware/setup-protoc@1.1.0
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"

# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/committer_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2

- id: auth
uses: "google-github-actions/auth@v2"
Expand All @@ -63,7 +62,6 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- uses: Swatinem/rust-cache@v2

# Download the old benchmark inputs.
- id: auth
Expand Down Expand Up @@ -126,7 +124,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2

# Commit hash on pull request event would be the head commit of the branch.
- name: Get commit hash prefix for PR update
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,29 @@ jobs:
with:
version: ${{env.PROTOC_VERSION}}
- run: cargo doc --workspace -r --document-private-items --no-deps

# Run tests.
- name: "Run rustfmt and clippy"
run: scripts/rust_fmt.sh --check
- name: "Run clippy"
run: scripts/clippy.sh
- name: "Run cargo doc"
run: cargo doc --workspace -r --document-private-items --no-deps
- name: "Run taplo"
run: scripts/taplo.sh
- name: "Run cargo check"
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo check --workspace -r --all-features
- name: Run Machete (detect unused dependencies)
uses: bnjbvr/cargo-machete@main


run-workspace-tests:
runs-on: starkware-ubuntu-latest-small
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- run: cargo test -p workspace_tests

run-tests:
Expand All @@ -112,9 +128,6 @@ jobs:
fetch-depth: 0
- uses: ./.github/actions/install_rust
- uses: Noelware/setup-protoc@1.1.0
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"

# Setup pypy and link to the location expected by .cargo/config.toml.
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -222,9 +235,6 @@ jobs:

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-ubuntu-20.04"
- run: npm install -g ganache@7.4.3

# Setup pypy and link to the location expected by .cargo/config.toml.
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/papyrus_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- uses: Noelware/setup-protoc@1.1.0
with:
version: ${{env.PROTOC_VERSION}}
Expand All @@ -66,7 +65,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- uses: Noelware/setup-protoc@1.1.0
with:
version: ${{env.PROTOC_VERSION}}
Expand Down Expand Up @@ -103,7 +101,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- uses: Noelware/setup-protoc@1.1.0
with:
version: ${{env.PROTOC_VERSION}}
Expand All @@ -120,7 +117,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- uses: Noelware/setup-protoc@1.1.0

- run: |
Expand Down Expand Up @@ -197,7 +193,6 @@ jobs:
target_directory:
- 'crates/papyrus_storage/src/db/**'
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
# repeat this job 32 times. this is a random test for part of the code that may cause a corrupted database.
- run: for run in {1..32}; do cargo test -r -p papyrus_storage -- --include-ignored common_prefix_compare_with_simple_table_random; done
if: steps.changes.outputs.target_directory == 'true'
1 change: 0 additions & 1 deletion .github/workflows/papyrus_nightly-tests-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- run: sudo apt update; sudo apt -y install libclang-dev
# Install libclang-dev that is not a part of the ubuntu vm in github actions.
if: runner.os == 'Linux'
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/papyrus_nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2

- run: mkdir data

Expand All @@ -58,7 +57,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- run: npm install -g ganache@7.4.3

- run: brew install protobuf@$PROTOC_VERSION
Expand All @@ -74,7 +72,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- run: cargo build -r -p papyrus_load_test

integration-test:
Expand All @@ -83,7 +80,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- run: >
cargo test -r
--test latency_histogram
Expand All @@ -99,5 +95,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install_rust
- uses: Swatinem/rust-cache@v2
- run: for run in {1..100}; do cargo test -r -p papyrus_storage -- --include-ignored common_prefix_compare_with_simple_table_random; done
2 changes: 2 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const Configuration = {
'execution',
'fee',
'gateway',
'helm',
'infra',
'JSON-RPC',
'load_test',
'mempool_infra',
Expand Down
5 changes: 5 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
channel = "stable"
components = ["clippy", "rustc-dev", "rustfmt"]
profile = "default"
targets = ["x86_64-unknown-linux-gnu"]
6 changes: 2 additions & 4 deletions scripts/build_native_blockifier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ function clean() {

function build() {
echo "Building..."
pushd crates/native_blockifier
pypy3.9 -m venv venv
source venv/bin/activate
pypy3.9 -m venv /tmp/venv
source /tmp/venv/bin/activate
cargo build --release -p native_blockifier --features "testing" || clean
clean
popd
}

build
8 changes: 6 additions & 2 deletions scripts/install_build_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

function install_pypy() {
pushd /opt
$USE_SUDO bash -c '
$SUDO bash -c '
curl -Lo pypy3.9-v7.3.11-linux64.tar.bz2 https://downloads.python.org/pypy/pypy3.9-v7.3.11-linux64.tar.bz2
tar -xf pypy3.9-v7.3.11-linux64.tar.bz2
rm pypy3.9-v7.3.11-linux64.tar.bz2
Expand All @@ -28,9 +28,13 @@ function install_pypy() {
}

function install_rust () {
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
curl https://sh.rustup.rs -sSf | sh -s -- -y
}

if [ "$(id -u)" -ne 0 ]; then
SUDO=sudo
fi

install_pypy &
install_rust &
wait
2 changes: 1 addition & 1 deletion scripts/merge_branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

FINAL_BRANCH = "main"
MERGE_PATHS_FILE = "scripts/merge_paths.json"
FILES_TO_PRESERVE = {".github/actions/install_rust/rust_version.txt"}
FILES_TO_PRESERVE = {"rust-toolchain.toml"}


def load_merge_paths() -> Dict[str, str]:
Expand Down
21 changes: 17 additions & 4 deletions scripts/sequencer-ci.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive
ARG USERNAME=sequencer
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN apt update && apt -y install \
build-essential \
clang \
curl \
python3-dev
python3-dev \
sudo


RUN groupadd --gid $USER_GID $USERNAME && \
useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME
RUN echo "%${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/developer

USER ${USERNAME}

ENV RUSTUP_HOME=/opt/rust
ENV CARGO_HOME=/opt/rust
ENV PATH=$PATH:/opt/rust/bin
ENV RUSTUP_HOME=/var/tmp/rust
ENV CARGO_HOME=${RUSTUP_HOME}
ENV PATH=$PATH:${RUSTUP_HOME}/bin

COPY install_build_tools.sh .
RUN bash install_build_tools.sh
Loading