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

Commit 2b9d94f

Browse files
Antonio Calvín Garcíaazteca1998juanbonofguthmannfannyguthmann
authored
Update contract caches (#1117)
* Remove `serde_json_pythonic`. (#1047) * Remove `serde_json_pythonic`. * Fix JSON formatter on `deprecated_contract_class.rs`. * Fix hash JSON formatter (non-ascii support). * Add unwrap reasoning comment. * Add debug logging. (#1018) * Add `tracing` and update dependencies. * Configure the example to use tracing logging (and make it work again). * Add tracing logging. * Add error logging. * Fix error logging. * Reduce the amount of spam logged. * Update `README.md`. * Fix `Makefile` dependencies. * Remove `Debug` trait dependency. * Update `Cargo.lock` after merge. * Fix warnings. * Fix formatting. --------- Co-authored-by: Esteve Soler Arderiu <esteve.soler@lambdaclass.com> * fmt and improvements * Fix skip validate (#1053) * update version * fix skip validation for invoke txs * run fmt * fix clippy suggestion * simplify a bit the execute_tx function variants * Add documentation to transaction/fee module (#889) * added comments to src/transaction/fee.rs * added return and error comments --------- Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> Co-authored-by: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> Co-authored-by: Juan Bono <juanbono94@gmail.com> * Add comments to origin/Document-transactionl1_handler module (#888) * added comments to origin/Document-transactionl1_handler-module * modified comments * Test multi syscall (#687) * create multy syscall * remove the replace syscall, it failed because the contract adress didn't match * added library call_syscall * wip * wip * wip * wip * work in progress * remove .sjon files from starknet_programs * finished implemented all the syscalls * reorder code, create one call to syscall * fix pull bug * Update tests/multi_syscall_test.rs Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * Update starknet_programs/cairo1/multi_syscall_test.cairo Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * Update starknet_programs/cairo1/contract_a.cairo Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * Update tests/multi_syscall_test.rs Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * added test syscall for deploy * make format changes * corrected make clippy error * get_caller_address and get_contract_address return a adress * failed of get_contract_address * failed of get_contract_address * wip * modify the selector entrypoint_selector to be function specific * wip * wip * wip * add input to cairo functions * coorect format problem * wip * wip * wip * remove format problem * Fix sierra class hash calculation (#886) * reproduce bug * use pythonic formatter * rename test * fix test * cargo fmt * Fail with an Err transactions whose calculated fee exceed `max_fee` (#892) * Make tx fail when actual_fee exceeds max_fee * Changed test * Formatting * Fix logic * Leave fail only without charging * Change test * Fix test broken by better fee calc * Fixed test fee * Update fee on test_deploy_account * Remove comment --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * Fix test_get_nonce_at (#910) * Fix test_get_nonce_at * Rely on another contract * fix get_sorted_events bug (#912) * fix get_sorted_events bug * fmt * fix clippy --------- Co-authored-by: Estéfano Bargas <estefano.bargas@fing.edu.uy> * Added documentations to syscalls/deprecated_syscall_handler module (#883) * added comments to file syscalls/deprecated_syscall_handler-module' * Update src/syscalls/deprecated_syscall_handler.rs Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * Update src/syscalls/deprecated_syscall_handler.rs Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> --------- Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> Co-authored-by: Juan Bono <juanbono94@gmail.com> Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * wip * Modify the tests * fixed clippy errors --------- Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> Co-authored-by: SantiagoPittella <pittellasantiago@gmail.com> Co-authored-by: Juan Bono <juanbono94@gmail.com> Co-authored-by: Estéfano Bargas <estefano.bargas@fing.edu.uy> * Parse internal calls (#915) * Added comments to core/contract_address module (#900) Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> * Add more transaction tests and fee investigation (#914) * add function for getting tx and refactor tests * improve imports * separe tests into 2 groups * fix test * add comments * format * cargo clippy * add details to every test * add fee discrepancy to test doc * cargo fmt * improve imports * added safety element --------- Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> Co-authored-by: SantiagoPittella <pittellasantiago@gmail.com> Co-authored-by: Juan Bono <juanbono94@gmail.com> Co-authored-by: Estéfano Bargas <estefano.bargas@fing.edu.uy> Co-authored-by: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> * remove transactionalstatereader as it is not needed as-is (#1054) * Fix test (or try to) * Revert "Fix test (or try to)" This reverts commit 423052f. * Implement Clone for CachedState * Fix conflict in Makefile + run clippy-fix * Remove empty line * fmt * Remove unwraps * Add clone_for_testing * Remove clones * Add cairo native (#943) * Added cairo native flag * Added cairo_native as dependency * Partial progress * Progress * Partial progress * Point to newly created branch on cairo native * Use updated version of cairo native and make test pass * Run test with storage_write and storage_read with cairo native * Tidy up code * Start unhardcoding stuff * Handle return values * Tidy up code a little * Added sierra programs cache * Add impl for emit_event and send_l1_message * Fix tests * Install LLVM on CI * Test * Test CI * Fix lint step * Save work in progress * Unhardcode calldata and entry point * Unhardcode more stuff * Fix test * Add basic implementation for call_contract * Add call to get_name to integration test * Make call_contract impl compile * Fix test * Pass the correct amount of builtins for every function * Improve test legibility * Write call_contract test skeleton * Finish writing test, still bugs to fix * implement get_execution_info, make increase_allowance work * More debugging * Basic test for call_contract working * More progress on testing ERC20 * More progress on test * Add caller and callee contracts * Fix call_contract test after merge * Fix callee address in tests * Polish some details * Remove use_cairo_native from TransactionExecutionContext * Write test skeleton * Add test contracts * Fix tests * Readd deleted contracts * Echo contract test passing * Update cairo compiler to version 2.2.0 * Calling another contract with events test is passing * Fix failing tests * Remove internal_calls field TODO in CallInfo returned by native_execute * Add event_emitter contract * Add cairo vm execution to the erc20 test for comparison * Add simple implementation for panics in native execution * Add some documentation in code * Assert equality between events, accessed_storage_keys and l1_l2 messages between native and vm runs * Add event_emitter contract * Remove print * Remove comments * Move native syscall handler to its own file * Add felt decode to string when program panics * Make cairo native an optional dependency behind a feature * Move execution result to cairo native * Add a README section explaining how to setup cairo native * Fix some clippy issues * Fix test compilation * CI test * Revert "CI test" This reverts commit 4631e5e. * CI test * Test * Test * Address comment about multiple cfgs * Remove unnecessary clone * Test * Test * Switch to special workflow for native integration tests * Fix workflow * Fix stuff after merge. * Fix clippy warnings. * Fix after merge. * Fix comments. * Fix `Makefile`. * Remove unused import. * Use transactional state. * update cairo native to llvm 17 and remove nightly requirement * update ci * upd ci * try to fix ci * use ubuntu on native * try to fix ci * not needed? * fix ci * update cairo native * fix nightly usage * try to fix ci * dont need a transactional state reader, simply clone the state reader * try to fix ci * format * fix again * fix if * values * force rebuild * make cache track cairo 2 version to trigger rebuilds * try no restore key * update readme * fix tests on ci * update cairo native commit * fix more tests on ci * fix cairo native interface * try ci without cache * setup rustup home * make param passing to cairo native not obscure * try * try again * remove large packages * remove large dirs * remove android too * polly is needed * needs sudo * fix cov * fix test for now * format * cleanup ci file * use pyenv if available * nightly not needed in readme * add .sierra as generated to gitattributes * fix gitattributes * add casm too --------- Co-authored-by: Javier Chatruc <jrchatruc@gmail.com> Co-authored-by: Mariano Nicolini <mariano.nicolini.91@gmail.com> Co-authored-by: Esteve Soler Arderiu <esteve.soler@fratilia.com> Co-authored-by: Edgar Luque <git@edgarluque.com> * add test to check cairo 2 account contract deploy panic failing properly (#1045) * add test for account contract execution with panic * clippy * update cairo native to latest revision, u128 gas, mut self (#1082) Co-authored-by: Juan Bono <juanbono94@gmail.com> * Fix `get_execution_info` syscall (#1081) * Mark read-only segments * Move call * Remove debug prints * Remove fn * Add test case * Add comment * Restore newlines * Add function comment * Fix test values * Undo changes to makefile * Undo changes to makefile * clippy * cairo-native: implement testing syscalls (#1084) * cleanup erc20 test (#1087) * Fix `get_onchain_data_segment_length` (#1085) * Fix get_onchain_data_segment_length * Update test values * Update test values * fmt --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * Check that running a declare v1 yields a higher fee than simulating it without validation (#1076) * Reorder DeployAccount::apply * Revert "Reorder DeployAccount::apply" This reverts commit 11b0c39. * Add test * Add test * clippy + fmt --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * implement display and debug trait for Address (#1080) * implement display and debug trait for Address * hexa fmt * Add recursive calls tests using `library_call` & `call_contract` syscalls (#1072) * Add recursive library call test * Add test programs * Change base changes * Add recursive test for call_contract * fmt + clippy * Add test for 100 contract calls * clippy + fmt * Update test values --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * Fix/Refactor State::count actual storage changes + Support `DeployAccount` in the RpcStateReader (#1096) * Fix get_onchain_data_segment_length * Update test values * Update test values * fmt * Fix/Refactor `State::count actual storage changes` (#1086) * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add the ability to execute `DeployAccount` transactions using the `RpcState` (#1089) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Fix bug in `From<StarknetRsContractClass> for CompiledClass` implementation (#1090) * Fix bug in CompiledClass * Add tests --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * fmt * Add test cases for `DeployAccount` with popular account contracts using RpcState (#1104) * Execute `Declare` transactions using the `RpcState` + Various fixes related to `Declare` txs (#1094) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Fix get_onchain_data_segment_length * Add StorageChangesCount struct * Update test values * Update test values * fmt * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Add test case with declare * Deserialize Declare transactions * Create blockifier Declare transaction * Fix/Refactor `State::count actual storage changes` (#1086) * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add the ability to execute `DeployAccount` transactions using the `RpcState` (#1089) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Fix bug in `From<StarknetRsContractClass> for CompiledClass` implementation (#1090) * Fix bug in CompiledClass * Add tests * fetch class hash from the next block in declare tx * Return an error if a class_hash is not declared + add tests for declare tx * Fix error msg * Add support for DeclareV0-1 in sir_tests * Make Sierra class optional in declare v2 + other changes * Add support for DeclareV2 * Uncomment test * fix * Use new_with_sierra_class_hash_and_tx_hash * use CompiledClassHash instead of CompiledClass where applicatble * Handle nonce in declare v2 + run fmt * Set casm class before counting state changes in declare v2 * Changes * Make sierra class hash non-optional * fix + clippy * Use state_reader instead of creating a state to fetch the next block s contract classes * Add removed test * Update test values --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * Execute `L1Handler` transactions using the `RpcState` (#1103) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Fix get_onchain_data_segment_length * Add StorageChangesCount struct * Update test values * Update test values * fmt * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Add test case with declare * Deserialize Declare transactions * Create blockifier Declare transaction * Fix/Refactor `State::count actual storage changes` (#1086) * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add the ability to execute `DeployAccount` transactions using the `RpcState` (#1089) * Add test case * Fix get_onchain_data_segment_length * Debug setup * Add StorageChangesCount struct * Use StorageChangesCount struct in state method * Fix implicated code * Update doc * Update test values * Rename method for consistency * Add note comment * Remove hardcoded contract address * Remove txt files * Remove dbg prints * Remove dbg prints * Format * Restore blockifier version * Restore tests * Restore newlines * Restore newlines * Remove txt file * fmt * Fix bug in `From<StarknetRsContractClass> for CompiledClass` implementation (#1090) * Fix bug in CompiledClass * Add tests * fetch class hash from the next block in declare tx * Return an error if a class_hash is not declared + add tests for declare tx * Fix error msg * Add support for DeclareV0-1 in sir_tests * Make Sierra class optional in declare v2 + other changes * Add support for DeclareV2 * Uncomment test * fix * Use new_with_sierra_class_hash_and_tx_hash * use CompiledClassHash instead of CompiledClass where applicatble * Handle nonce in declare v2 + run fmt * Set casm class before counting state changes in declare v2 * Changes * Make sierra class hash non-optional * fix + clippy * Use state_reader instead of creating a state to fetch the next block s contract classes * Add removed test * Update test values * Make validate_invocation and fee_transfer_info fields optional + add L1_HANDLER transaction RpcState * Add L1Handler to blockifier_tests::execute_tx * Add blockifier test case * Add L1Handler to sir_tests::execute_tx * Add one more test case * fmt --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * Added a usage target to makefile (#1069) * Added a usage target to makefile * Fixed typo * Implement `NativeSyscallHandler::deploy` (#1106) * wip * Minor improvements + add test * Improve make clippy * Clippy + fmt * Update error messages * Add failure flag test * Fix typo * Apply suggestions + run formatter * Add llvm setup so we can run clippy with `cairo-native` feature * Fix * Remove todo * Use a proper class_hash * Fix test assertion --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * update cairo native to use gas consumed (#1102) * update cairo native to use gas consumed * gas consumed * update native rev * fix gas consumed * remove comments * fixes --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * Fix cairo-native feature-gated code * clippy --------- Co-authored-by: MrAzteca <azteca1998@users.noreply.github.com> Co-authored-by: Esteve Soler Arderiu <esteve.soler@lambdaclass.com> Co-authored-by: juanbono <juanbono94@gmail.com> Co-authored-by: Fanny Guthmann <57538139+fguthmann@users.noreply.github.com> Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> Co-authored-by: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> Co-authored-by: SantiagoPittella <pittellasantiago@gmail.com> Co-authored-by: Estéfano Bargas <estefano.bargas@fing.edu.uy> Co-authored-by: Edgar <git@edgarluque.com> Co-authored-by: Federica <fedemoletta@hotmail.com> Co-authored-by: ElFantasma <esteban.dimitroff@lambdaclass.com> Co-authored-by: Javier Chatruc <jrchatruc@gmail.com> Co-authored-by: Mariano Nicolini <mariano.nicolini.91@gmail.com> Co-authored-by: Esteve Soler Arderiu <esteve.soler@fratilia.com> Co-authored-by: fmoletta <99273364+fmoletta@users.noreply.github.com> Co-authored-by: Iñaki Garay <igarai@gmail.com>
1 parent d265c76 commit 2b9d94f

File tree

84 files changed

+17879
-1082
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+17879
-1082
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.sierra linguist-generated
2+
*.casm linguist-generated

.github/workflows/rust-tests.yml

Lines changed: 115 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -9,240 +9,169 @@ on:
99

1010
env:
1111
CARGO_TERM_COLOR: always
12-
RUST_TOOLCHAIN: 1.70.0
13-
CAIRO_PROGRAMS_PATH: |
14-
cairo_programs/**/*.casm
15-
cairo_programs/**/*.sierra
16-
cairo_programs/**/*.json
17-
starknet_programs/**/*.casm
18-
starknet_programs/**/*.sierra
19-
starknet_programs/**/*.json
20-
!starknet_programs/raw_contract_classes/*
12+
RUST_TOOLCHAIN: '1.72.1'
2113

2214
jobs:
23-
build-programs:
24-
strategy:
25-
matrix:
26-
program-target: [
27-
compile-cairo,
28-
compile-starknet,
29-
compile-cairo-1-casm,
30-
compile-cairo-1-sierra,
31-
compile-cairo-2-casm,
32-
compile-cairo-2-sierra,
33-
]
34-
name: Build Cairo programs
35-
runs-on: ubuntu-22.04
15+
build:
16+
name: Build with release profile
17+
runs-on: ubuntu-latest
3618
steps:
3719
- name: Checkout
3820
uses: actions/checkout@v3
21+
- name: Install Rust $RUST_TOOLCHAIN
22+
uses: dtolnay/rust-toolchain@master
3923
with:
40-
fetch-depth: 0
41-
42-
- name: Fetch from cache
43-
uses: actions/cache@v3
44-
id: cache-programs
45-
with:
46-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
47-
key: ${{ matrix.program-target }}-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
48-
restore-keys: ${{ matrix.program-target }}-cache-
49-
50-
# This is not pretty, but we need `make` to see the compiled programs are
51-
# actually newer than the sources, otherwise it will try to rebuild them
52-
- name: Restore timestamps
53-
uses: chetan/git-restore-mtime-action@v1
54-
24+
toolchain: $RUST_TOOLCHAIN
25+
components: rustfmt, clippy
5526
- name: Python3 Build
56-
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }}
5727
uses: actions/setup-python@v4
5828
with:
5929
python-version: '3.9'
6030
cache: 'pip'
61-
62-
- name: Install deps
63-
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }}
64-
run: make deps
65-
66-
- name: Build programs
67-
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }}
68-
run: make -j ${{ matrix.program-target }}
69-
70-
# NOTE: used to reduce the amount of cache steps we need in later jobs
71-
# TODO: remove this cache once the workflow finishes
72-
merge-caches:
73-
name: Merge Cairo programs cache
74-
runs-on: ubuntu-22.04
75-
needs: build-programs
76-
steps:
77-
- name: Checkout
78-
uses: actions/checkout@v3
79-
80-
- name: Fetch from cache (compile-cairo)
81-
uses: actions/cache/restore@v3
82-
id: cache-programs
83-
with:
84-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
85-
key: compile-cairo-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
86-
fail-on-cache-miss: true
87-
88-
- name: Fetch from cache (compile-starknet)
89-
uses: actions/cache/restore@v3
90-
with:
91-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
92-
key: compile-starknet-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
93-
fail-on-cache-miss: true
94-
95-
- name: Fetch from cache (compile-cairo-1-casm)
96-
uses: actions/cache/restore@v3
97-
with:
98-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
99-
key: compile-cairo-1-casm-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
100-
fail-on-cache-miss: true
101-
102-
- name: Fetch from cache (compile-cairo-1-sierra)
103-
uses: actions/cache/restore@v3
104-
with:
105-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
106-
key: compile-cairo-1-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
107-
fail-on-cache-miss: true
108-
109-
- name: Fetch from cache (compile-cairo-2-casm)
110-
uses: actions/cache/restore@v3
111-
with:
112-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
113-
key: compile-cairo-2-casm-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
114-
fail-on-cache-miss: true
115-
116-
- name: Fetch from cache (compile-cairo-2-sierra)
117-
uses: actions/cache/restore@v3
118-
with:
119-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
120-
key: compile-cairo-2-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
121-
fail-on-cache-miss: true
122-
123-
- name: Fetch from cache (compile-cairo-2-sierra)
124-
uses: actions/cache/restore@v3
125-
with:
126-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
127-
key: compile-cairo-2-sierra-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
128-
fail-on-cache-miss: true
129-
130-
- name: Merge caches
131-
uses: actions/cache/save@v3
132-
with:
133-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
134-
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
135-
136-
build:
137-
name: Build with release profile
138-
needs: merge-caches
139-
runs-on: ubuntu-22.04
140-
steps:
141-
- name: Install Rust
142-
uses: dtolnay/rust-toolchain@stable
143-
with:
144-
toolchain: ${{ env.RUST_TOOLCHAIN }}
145-
components: rustfmt, clippy
14631
- uses: Swatinem/rust-cache@v2
14732
with:
14833
cache-on-failure: true
149-
- name: Checkout
150-
uses: actions/checkout@v3
151-
- name: Fetch programs
152-
uses: actions/cache/restore@v3
153-
with:
154-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
155-
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
156-
fail-on-cache-miss: true
15734

35+
- name: Install deps
36+
run: make deps
15837
- name: Build
159-
run: cargo build --release --workspace
38+
run: make build
16039

16140
lint:
16241
name: Lint with fmt and clippy
163-
needs: merge-caches
164-
runs-on: ubuntu-22.04
42+
runs-on: ubuntu-latest
43+
env:
44+
MLIR_SYS_170_PREFIX: /usr/lib/llvm-17/
45+
TABLEGEN_170_PREFIX: /usr/lib/llvm-17/
16546
steps:
166-
- name: Install Rust
167-
uses: dtolnay/rust-toolchain@stable
47+
- name: Checkout
48+
uses: actions/checkout@v3
49+
- name: Install Rust $RUST_TOOLCHAIN
50+
uses: dtolnay/rust-toolchain@master
51+
with:
52+
toolchain: $RUST_TOOLCHAIN
53+
components: rustfmt, clippy
54+
- name: Python3 Build
55+
uses: actions/setup-python@v4
16856
with:
169-
toolchain: ${{ env.RUST_TOOLCHAIN }}
170-
components: rustfmt, clippy
57+
python-version: '3.9'
58+
cache: 'pip'
17159
- uses: Swatinem/rust-cache@v2
17260
with:
17361
cache-on-failure: true
174-
- name: Checkout
175-
uses: actions/checkout@v3
176-
- name: Fetch programs
177-
uses: actions/cache/restore@v3
178-
with:
179-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
180-
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
181-
fail-on-cache-miss: true
182-
62+
- name: check and free hdd space left
63+
run: |
64+
echo "Listing 20 largest packages"
65+
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20
66+
df -h
67+
sudo apt-get update
68+
sudo apt-get remove -y '^llvm-.*'
69+
sudo apt-get remove -y 'php.*'
70+
sudo apt-get remove -y '^dotnet-.*'
71+
sudo apt-get remove -y '^temurin-.*'
72+
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel
73+
sudo apt-get autoremove -y
74+
sudo apt-get clean
75+
df -h
76+
echo "Removing large directories"
77+
# deleting 15GB
78+
sudo rm -rf /usr/share/dotnet/
79+
sudo rm -rf /usr/local/lib/android
80+
df -h
81+
- name: add llvm deb repository
82+
uses: myci-actions/add-deb-repo@10
83+
with:
84+
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main
85+
repo-name: llvm-repo
86+
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
87+
- name: Install LLVM
88+
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
89+
- name: Install deps
90+
run: make deps
18391
- name: Format
18492
run: cargo fmt --all -- --check
18593
- name: Run clippy
186-
run: cargo clippy --workspace --all-targets -- -D warnings
94+
run: make clippy
18795

18896
tests:
18997
env:
19098
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
99+
MLIR_SYS_170_PREFIX: /usr/lib/llvm-17/
100+
TABLEGEN_170_PREFIX: /usr/lib/llvm-17/
191101
strategy:
192102
fail-fast: false
193103
matrix:
194-
target: [ test-cairo-1, test-cairo-2, test-doctests ]
104+
target: [ test-cairo-1, test-cairo-2, test-doctests, test-cairo-native ]
195105
name: Run tests
196-
needs: merge-caches
197-
runs-on: ubuntu-22.04
106+
runs-on: ubuntu-latest
198107
steps:
199-
- name: Install Rust
200-
uses: dtolnay/rust-toolchain@stable
108+
- name: Checkout
109+
uses: actions/checkout@v3
110+
- name: Install Rust $RUST_TOOLCHAIN
111+
uses: dtolnay/rust-toolchain@master
112+
with:
113+
toolchain: $RUST_TOOLCHAIN
114+
components: rustfmt, clippy
115+
- name: Python3 Build
116+
uses: actions/setup-python@v4
201117
with:
202-
toolchain: ${{ env.RUST_TOOLCHAIN }}
203-
components: rustfmt, clippy
118+
python-version: '3.9'
119+
cache: 'pip'
204120
- uses: Swatinem/rust-cache@v2
205121
with:
206122
cache-on-failure: true
207-
- name: Checkout
208-
uses: actions/checkout@v3
209123

210-
- name: Fetch programs
211-
uses: actions/cache/restore@v3
212-
with:
213-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
214-
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
215-
fail-on-cache-miss: true
216-
124+
- name: Install deps
125+
run: make deps
126+
217127
- name: Install testing tools
218128
# TODO: remove `if` when nextest adds doctests support
219129
if: ${{ matrix.target != 'test-doctests' }}
220130
uses: taiki-e/install-action@v2
221131
with:
222132
tool: cargo-nextest@0.9.49
223133

134+
- name: check and free hdd space left
135+
run: |
136+
echo "Listing 20 largest packages"
137+
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20
138+
df -h
139+
sudo apt-get update
140+
sudo apt-get remove -y '^llvm-.*'
141+
sudo apt-get remove -y 'php.*'
142+
sudo apt-get remove -y '^dotnet-.*'
143+
sudo apt-get remove -y '^temurin-.*'
144+
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel
145+
sudo apt-get autoremove -y
146+
sudo apt-get clean
147+
df -h
148+
echo "Removing large directories"
149+
# deleting 15GB
150+
sudo rm -rf /usr/share/dotnet/
151+
sudo rm -rf /usr/local/lib/android
152+
df -h
153+
- name: add llvm deb repository
154+
uses: myci-actions/add-deb-repo@10
155+
with:
156+
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main
157+
repo-name: llvm-repo
158+
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
159+
- name: Install LLVM
160+
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
224161
- name: Run tests (${{ matrix.target }})
225162
run: make ${{ matrix.target }}
226163

227164
coverage:
228-
needs: merge-caches
229165
name: Generate and upload coverage report
230-
runs-on: ubuntu-22.04
166+
runs-on: ubuntu-latest
231167
steps:
232168
- name: Checkout
233169
uses: actions/checkout@v3
234-
- name: Install Rust
235-
uses: dtolnay/rust-toolchain@nightly
236-
with:
237-
toolchain: ${{ env.RUST_TOOLCHAIN }}
238-
239-
- name: Set nightly as default
240-
run: rustup default nightly
241170

242-
- name: Install testing tools
243-
uses: taiki-e/install-action@v2
171+
- name: Install Rust nightly
172+
uses: dtolnay/rust-toolchain@master
244173
with:
245-
tool: cargo-nextest@0.9.49,cargo-llvm-cov
174+
toolchain: nightly
246175

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

258-
- name: Fetch programs
259-
if: steps.restore-report.outputs.cache-hit != 'true'
260-
uses: actions/cache/restore@v3
187+
- name: Python3 Build
188+
uses: actions/setup-python@v4
261189
with:
262-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
263-
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'starknet_programs/**/*.cairo') }}
264-
fail-on-cache-miss: true
190+
python-version: '3.9'
191+
cache: 'pip'
192+
- uses: Swatinem/rust-cache@v2
193+
with:
194+
cache-on-failure: true
195+
196+
- name: Install deps
197+
run: make deps
265198

266199
- name: Generate coverage report
267200
if: steps.restore-report.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)