Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Update contract caches #1117

Merged
merged 39 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a52849d
Remove `serde_json_pythonic`. (#1047)
azteca1998 Sep 26, 2023
a1fad26
Add debug logging. (#1018)
azteca1998 Sep 26, 2023
520fd15
fmt and improvements
juanbono Sep 28, 2023
9405592
Fix skip validate (#1053)
juanbono Sep 29, 2023
4539844
Add documentation to transaction/fee module (#889)
fguthmann Oct 2, 2023
4157830
Add comments to origin/Document-transactionl1_handler module (#888)
fguthmann Oct 5, 2023
484acb3
remove transactionalstatereader as it is not needed as-is (#1054)
edg-l Oct 5, 2023
423052f
Fix test (or try to)
fmoletta Oct 10, 2023
52a2678
Revert "Fix test (or try to)"
fmoletta Oct 10, 2023
4a4763a
Implement Clone for CachedState
fmoletta Oct 10, 2023
92e5c46
Merge branch 'main' of github.com:lambdaclass/starknet_in_rust into u…
fmoletta Oct 10, 2023
183ce20
Fix conflict in Makefile + run clippy-fix
fmoletta Oct 10, 2023
cf992c7
Remove empty line
fmoletta Oct 10, 2023
a6e8855
fmt
fmoletta Oct 10, 2023
c43eddb
Remove unwraps
fmoletta Oct 11, 2023
c8b8c02
Add clone_for_testing
fmoletta Oct 11, 2023
860ae06
Remove clones
fmoletta Oct 11, 2023
8ed7fb7
Add cairo native (#943)
ElFantasma Oct 17, 2023
351a849
add test to check cairo 2 account contract deploy panic failing prope…
edg-l Oct 18, 2023
0dda64e
update cairo native to latest revision, u128 gas, mut self (#1082)
edg-l Oct 18, 2023
fb1af3c
Fix `get_execution_info` syscall (#1081)
fmoletta Oct 18, 2023
4e9d5c0
cairo-native: implement testing syscalls (#1084)
edg-l Oct 19, 2023
6da0b77
cleanup erc20 test (#1087)
edg-l Oct 19, 2023
41d7dfa
Fix `get_onchain_data_segment_length` (#1085)
fmoletta Oct 23, 2023
2bee0c5
Check that running a declare v1 yields a higher fee than simulating i…
fmoletta Oct 23, 2023
cb7b277
implement display and debug trait for Address (#1080)
Oct 24, 2023
996a412
Add recursive calls tests using `library_call` & `call_contract` sysc…
fmoletta Oct 24, 2023
8baecd9
Fix/Refactor State::count actual storage changes + Support `DeployAcc…
fmoletta Oct 24, 2023
f641306
Merge branch 'update-contract-caches' of github.com:lambdaclass/stark…
fmoletta Oct 25, 2023
6db01fc
fmt
fmoletta Oct 25, 2023
5edd850
Add test cases for `DeployAccount` with popular account contracts usi…
fmoletta Oct 27, 2023
152a3e4
Execute `Declare` transactions using the `RpcState` + Various fixes r…
fmoletta Oct 27, 2023
4ba3de3
Execute `L1Handler` transactions using the `RpcState` (#1103)
fmoletta Oct 27, 2023
398b98f
Added a usage target to makefile (#1069)
igaray Oct 30, 2023
6925ae4
Implement `NativeSyscallHandler::deploy` (#1106)
fmoletta Oct 30, 2023
2112429
update cairo native to use gas consumed (#1102)
edg-l Oct 30, 2023
61df3a5
Fix cairo-native feature-gated code
fmoletta Oct 30, 2023
aa21aa4
Merge branch 'main' of github.com:lambdaclass/starknet_in_rust into u…
fmoletta Oct 30, 2023
5732766
clippy
fmoletta Oct 30, 2023
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.sierra linguist-generated
*.casm linguist-generated
297 changes: 115 additions & 182 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,240 +9,169 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: 1.70.0
CAIRO_PROGRAMS_PATH: |
cairo_programs/**/*.casm
cairo_programs/**/*.sierra
cairo_programs/**/*.json
starknet_programs/**/*.casm
starknet_programs/**/*.sierra
starknet_programs/**/*.json
!starknet_programs/raw_contract_classes/*
RUST_TOOLCHAIN: '1.72.1'

jobs:
build-programs:
strategy:
matrix:
program-target: [
compile-cairo,
compile-starknet,
compile-cairo-1-casm,
compile-cairo-1-sierra,
compile-cairo-2-casm,
compile-cairo-2-sierra,
]
name: Build Cairo programs
runs-on: ubuntu-22.04
build:
name: Build with release profile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust $RUST_TOOLCHAIN
uses: dtolnay/rust-toolchain@master
with:
fetch-depth: 0

- name: Fetch from cache
uses: actions/cache@v3
id: cache-programs
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: ${{ matrix.program-target }}-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
restore-keys: ${{ matrix.program-target }}-cache-

# This is not pretty, but we need `make` to see the compiled programs are
# actually newer than the sources, otherwise it will try to rebuild them
- name: Restore timestamps
uses: chetan/git-restore-mtime-action@v1

toolchain: $RUST_TOOLCHAIN
components: rustfmt, clippy
- name: Python3 Build
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }}
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'

- name: Install deps
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }}
run: make deps

- name: Build programs
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }}
run: make -j ${{ matrix.program-target }}

# NOTE: used to reduce the amount of cache steps we need in later jobs
# TODO: remove this cache once the workflow finishes
merge-caches:
name: Merge Cairo programs cache
runs-on: ubuntu-22.04
needs: build-programs
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Fetch from cache (compile-cairo)
uses: actions/cache/restore@v3
id: cache-programs
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: compile-cairo-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: Fetch from cache (compile-starknet)
uses: actions/cache/restore@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: compile-starknet-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: Fetch from cache (compile-cairo-1-casm)
uses: actions/cache/restore@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: compile-cairo-1-casm-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: Fetch from cache (compile-cairo-1-sierra)
uses: actions/cache/restore@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: compile-cairo-1-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: Fetch from cache (compile-cairo-2-casm)
uses: actions/cache/restore@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: compile-cairo-2-casm-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: Fetch from cache (compile-cairo-2-sierra)
uses: actions/cache/restore@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: compile-cairo-2-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: Fetch from cache (compile-cairo-2-sierra)
uses: actions/cache/restore@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: compile-cairo-2-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: Merge caches
uses: actions/cache/save@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}

build:
name: Build with release profile
needs: merge-caches
runs-on: ubuntu-22.04
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Checkout
uses: actions/checkout@v3
- name: Fetch programs
uses: actions/cache/restore@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: Install deps
run: make deps
- name: Build
run: cargo build --release --workspace
run: make build

lint:
name: Lint with fmt and clippy
needs: merge-caches
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
env:
MLIR_SYS_170_PREFIX: /usr/lib/llvm-17/
TABLEGEN_170_PREFIX: /usr/lib/llvm-17/
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust $RUST_TOOLCHAIN
uses: dtolnay/rust-toolchain@master
with:
toolchain: $RUST_TOOLCHAIN
components: rustfmt, clippy
- name: Python3 Build
uses: actions/setup-python@v4
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt, clippy
python-version: '3.9'
cache: 'pip'
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Checkout
uses: actions/checkout@v3
- name: Fetch programs
uses: actions/cache/restore@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: check and free hdd space left
run: |
echo "Listing 20 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20
df -h
sudo apt-get update
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^temurin-.*'
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
df -h
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-17 llvm-17-dev llvm-17-runtime clang-17 clang-tools-17 lld-17 libpolly-17-dev libmlir-17-dev mlir-17-tools
- name: Install deps
run: make deps
- name: Format
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets -- -D warnings
run: make clippy

tests:
env:
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
MLIR_SYS_170_PREFIX: /usr/lib/llvm-17/
TABLEGEN_170_PREFIX: /usr/lib/llvm-17/
strategy:
fail-fast: false
matrix:
target: [ test-cairo-1, test-cairo-2, test-doctests ]
target: [ test-cairo-1, test-cairo-2, test-doctests, test-cairo-native ]
name: Run tests
needs: merge-caches
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust $RUST_TOOLCHAIN
uses: dtolnay/rust-toolchain@master
with:
toolchain: $RUST_TOOLCHAIN
components: rustfmt, clippy
- name: Python3 Build
uses: actions/setup-python@v4
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt, clippy
python-version: '3.9'
cache: 'pip'
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Checkout
uses: actions/checkout@v3

- name: Fetch programs
uses: actions/cache/restore@v3
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true

- name: Install deps
run: make deps

- name: Install testing tools
# TODO: remove `if` when nextest adds doctests support
if: ${{ matrix.target != 'test-doctests' }}
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest@0.9.49

- name: check and free hdd space left
run: |
echo "Listing 20 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20
df -h
sudo apt-get update
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^temurin-.*'
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
df -h
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-17 llvm-17-dev llvm-17-runtime clang-17 clang-tools-17 lld-17 libpolly-17-dev libmlir-17-dev mlir-17-tools
- name: Run tests (${{ matrix.target }})
run: make ${{ matrix.target }}

coverage:
needs: merge-caches
name: Generate and upload coverage report
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Set nightly as default
run: rustup default nightly

- name: Install testing tools
uses: taiki-e/install-action@v2
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@master
with:
tool: cargo-nextest@0.9.49,cargo-llvm-cov
toolchain: nightly

- uses: Swatinem/rust-cache@v2
with:
Expand All @@ -255,13 +184,17 @@ jobs:
path: lcov.info
key: coverage-cache-${{ github.sha }}

- name: Fetch programs
if: steps.restore-report.outputs.cache-hit != 'true'
uses: actions/cache/restore@v3
- name: Python3 Build
uses: actions/setup-python@v4
with:
path: ${{ env.CAIRO_PROGRAMS_PATH }}
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
fail-on-cache-miss: true
python-version: '3.9'
cache: 'pip'
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Install deps
run: make deps

- name: Generate coverage report
if: steps.restore-report.outputs.cache-hit != 'true'
Expand Down
Loading