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

Get block hash syscall #1014

Closed
wants to merge 90 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
ff8b778
Added cairo native flag
ElFantasma Aug 24, 2023
cf111ea
Merge branch 'main' into add_cairo_native
ElFantasma Aug 24, 2023
bcc873e
Added cairo_native as dependency
ElFantasma Aug 25, 2023
2bf66f1
Partial progress
jrchatruc Aug 25, 2023
e02401b
Progress
jrchatruc Aug 25, 2023
e89a2b9
Partial progress
jrchatruc Aug 25, 2023
db314f7
Point to newly created branch on cairo native
jrchatruc Aug 25, 2023
645d83e
Use updated version of cairo native and make test pass
entropidelic Aug 25, 2023
6fc7b6b
Run test with storage_write and storage_read with cairo native
entropidelic Aug 25, 2023
31ff7e6
Tidy up code
entropidelic Aug 28, 2023
ed17457
Start unhardcoding stuff
jrchatruc Aug 28, 2023
136fb93
Handle return values
jrchatruc Aug 28, 2023
e8e42e3
Tidy up code a little
entropidelic Aug 29, 2023
b775063
Added sierra programs cache
ElFantasma Aug 29, 2023
2726436
Add impl for emit_event and send_l1_message
entropidelic Aug 29, 2023
911cc91
Fix tests
jrchatruc Aug 29, 2023
5f0e87f
Merge branch 'main' into add_cairo_native
jrchatruc Aug 29, 2023
57dfddc
Install LLVM on CI
jrchatruc Aug 29, 2023
5db7741
Test
jrchatruc Aug 29, 2023
e192ee3
Test CI
jrchatruc Aug 29, 2023
0f5f141
Fix lint step
jrchatruc Aug 29, 2023
bda79ce
Save work in progress
entropidelic Aug 30, 2023
dd3e827
Merge remote-tracking branch 'origin/add_cairo_native' into add_cairo…
entropidelic Aug 30, 2023
ad9606c
Merge branch 'add_sierra_cache' into add_cairo_native
jrchatruc Aug 30, 2023
a7fc96e
Unhardcode calldata and entry point
jrchatruc Aug 30, 2023
5857152
Unhardcode more stuff
jrchatruc Aug 30, 2023
0e04bc7
Fix test
jrchatruc Aug 30, 2023
521e278
Add basic implementation for call_contract
entropidelic Aug 30, 2023
9653d23
Add call to get_name to integration test
jrchatruc Aug 30, 2023
621dc88
Merge remote-tracking branch 'origin/add_cairo_native' into add_cairo…
entropidelic Aug 30, 2023
576dfef
Make call_contract impl compile
entropidelic Aug 30, 2023
9f420b2
Merge remote-tracking branch 'origin/add_cairo_native' into add_cairo…
entropidelic Aug 30, 2023
a818b9a
Fix test
jrchatruc Aug 31, 2023
4440467
Pass the correct amount of builtins for every function
jrchatruc Aug 31, 2023
d7a17c3
Improve test legibility
jrchatruc Aug 31, 2023
e4eb32e
Write call_contract test skeleton
entropidelic Aug 31, 2023
08d53fe
Merge remote-tracking branch 'origin/add_cairo_native' into call-cont…
entropidelic Aug 31, 2023
75dde3b
Finish writing test, still bugs to fix
entropidelic Aug 31, 2023
5e31d7c
implement get_execution_info, make increase_allowance work
jrchatruc Aug 31, 2023
284fe9e
More debugging
entropidelic Aug 31, 2023
f21f8b0
Merge remote-tracking branch 'origin/add_cairo_native' into call-cont…
entropidelic Aug 31, 2023
3968527
Basic test for call_contract working
entropidelic Aug 31, 2023
61fd0ad
More progress on testing ERC20
jrchatruc Aug 31, 2023
94ae33a
More progress on test
jrchatruc Aug 31, 2023
dcd316a
Add caller and callee contracts
entropidelic Aug 31, 2023
1608795
Merge remote-tracking branch 'origin/add_cairo_native' into call-cont…
entropidelic Aug 31, 2023
1899c15
Fix call_contract test after merge
entropidelic Aug 31, 2023
73ced69
Fix callee address in tests
entropidelic Aug 31, 2023
af953eb
Polish some details
entropidelic Aug 31, 2023
6837839
Remove use_cairo_native from TransactionExecutionContext
entropidelic Sep 1, 2023
b7ca1f2
Write test skeleton
entropidelic Sep 1, 2023
1b0e711
Add test contracts
entropidelic Sep 1, 2023
b4bd885
Fix tests
jrchatruc Sep 1, 2023
6189a4c
Readd deleted contracts
jrchatruc Sep 1, 2023
dcd8527
Echo contract test passing
entropidelic Sep 1, 2023
394a640
Update cairo compiler to version 2.2.0
jrchatruc Sep 4, 2023
93cd160
Calling another contract with events test is passing
entropidelic Sep 4, 2023
a5aa449
Merge branch 'main' into add_cairo_native
jrchatruc Sep 4, 2023
b4d6774
Merge remote-tracking branch 'origin/add_cairo_native' into echo-cont…
entropidelic Sep 4, 2023
cb49201
Fix failing tests
entropidelic Sep 4, 2023
a4759e6
Remove internal_calls field TODO in CallInfo returned by native_execute
entropidelic Sep 4, 2023
6937c65
Add event_emitter contract
entropidelic Sep 4, 2023
549ba48
Add cairo vm execution to the erc20 test for comparison
jrchatruc Sep 4, 2023
9e3f9a9
Add simple implementation for panics in native execution
entropidelic Sep 4, 2023
75c0ad8
Add some documentation in code
entropidelic Sep 4, 2023
434865a
Assert equality between events, accessed_storage_keys and l1_l2 messa…
jrchatruc Sep 4, 2023
02f765a
Add event_emitter contract
entropidelic Sep 4, 2023
5e911f5
Merge remote-tracking branch 'origin/add_cairo_native' into handle-pa…
entropidelic Sep 4, 2023
b2a943b
Merge branch 'handle-panic-result' into add_cairo_native
entropidelic Sep 4, 2023
9845558
Remove print
entropidelic Sep 4, 2023
1661f20
Remove comments
jrchatruc Sep 5, 2023
97296d6
Move native syscall handler to its own file
jrchatruc Sep 5, 2023
a6d6ca7
Add felt decode to string when program panics
entropidelic Sep 5, 2023
e9e5773
Merge remote-tracking branch 'origin/add_cairo_native' into add_cairo…
entropidelic Sep 5, 2023
ce2fbd9
Make cairo native an optional dependency behind a feature
jrchatruc Sep 5, 2023
849a53e
Move execution result to cairo native
entropidelic Sep 5, 2023
9f5f3c6
Add a README section explaining how to setup cairo native
jrchatruc Sep 5, 2023
c506210
Merge remote-tracking branch 'origin/add_cairo_native' into add_cairo…
entropidelic Sep 5, 2023
be14167
Merge remote-tracking branch 'origin/add_cairo_native' into add_cairo…
entropidelic Sep 5, 2023
3391544
Merge branch 'main' into add_cairo_native
jrchatruc Sep 5, 2023
2442e8c
Fix some clippy issues
entropidelic Sep 5, 2023
cbf91e3
Fix test compilation
jrchatruc Sep 5, 2023
4631e5e
CI test
jrchatruc Sep 5, 2023
f6ec318
Revert "CI test"
jrchatruc Sep 5, 2023
8ab7e62
CI test
jrchatruc Sep 5, 2023
bfb6379
Test
jrchatruc Sep 5, 2023
afd98b4
Merge branch 'main' into add_cairo_native
jrchatruc Sep 5, 2023
78e8b9b
Test
jrchatruc Sep 5, 2023
5471e0d
WIP: Implementing get_block_hash syscall
toni-calvin Sep 6, 2023
f110620
Merge branch 'main' of github.com:lambdaclass/starknet_in_rust into g…
toni-calvin Sep 6, 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
41 changes: 41 additions & 0 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
]
name: Build Cairo programs
runs-on: ubuntu-22.04
env:
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -137,6 +139,8 @@ jobs:
name: Build with release profile
needs: merge-caches
runs-on: ubuntu-22.04
env:
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
Expand All @@ -146,6 +150,14 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-16 llvm-16-dev llvm-16-runtime clang-16 clang-tools-16 lld-16 libpolly-16-dev libmlir-16-dev mlir-16-tools
- name: Checkout
uses: actions/checkout@v3
- name: Fetch programs
Expand All @@ -162,6 +174,8 @@ jobs:
name: Lint with fmt and clippy
needs: merge-caches
runs-on: ubuntu-22.04
env:
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
Expand All @@ -171,6 +185,14 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-16 llvm-16-dev llvm-16-runtime clang-16 clang-tools-16 lld-16 libpolly-16-dev libmlir-16-dev mlir-16-tools
- name: Checkout
uses: actions/checkout@v3
- name: Fetch programs
Expand All @@ -188,6 +210,7 @@ jobs:
tests:
env:
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/
strategy:
fail-fast: false
matrix:
Expand All @@ -204,6 +227,14 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-16 llvm-16-dev llvm-16-runtime clang-16 clang-tools-16 lld-16 libpolly-16-dev libmlir-16-dev mlir-16-tools
- name: Checkout
uses: actions/checkout@v3

Expand All @@ -228,13 +259,23 @@ jobs:
needs: merge-caches
name: Generate and upload coverage report
runs-on: ubuntu-22.04
env:
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-16 llvm-16-dev llvm-16-runtime clang-16 clang-tools-16 lld-16 libpolly-16-dev libmlir-16-dev mlir-16-tools

- name: Set nightly as default
run: rustup default nightly
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Install dependencies, build the project and run tests from zero

on:
merge_group:
push:
branches:
- main
pull_request:
branches:
- '**'

jobs:
fresh_run:
strategy:
fail-fast: false
matrix:
include:
- os: debian-12
deps_suffix: ''
runs-on: ${{ matrix.os }}
env:
MLIR_SYS_160_PREFIX: /usr/lib/llvm-16/
name: "Make deps, build & test on fresh ${{ matrix.os }} system"
steps:
- uses: actions/checkout@v3

- name: Set RUSTUP_HOME and PATH env vars
if: matrix.os == 'debian-12'
run: |
echo "RUSTUP_HOME=/root/.cargo" >> $GITHUB_ENV
echo "PATH=${PATH}:/root/.cargo/bin" >> $GITHUB_ENV
- name: Install rust
uses: dtolnay/rust-toolchain@stable

- name: add llvm deb repository
uses: myci-actions/add-deb-repo@10
with:
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main
repo-name: llvm-repo
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install -y llvm-16 llvm-16-dev llvm-16-runtime clang-16 clang-tools-16 lld-16 libpolly-16-dev libmlir-16-dev mlir-16-tools

- name: Install pyenv
uses: "gabrielfalcao/pyenv-action@v13"

- name: Run make deps${{ matrix.deps_suffix }}
id: deps
run: make deps${{ matrix.deps_suffix }}

- name: Run make build
id: build
run: make build

- name: Run make test
id: test
env:
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
run: |
. starknet-venv/bin/activate; \
make test
- name: Check which step failed
if: failure()
run: |
if [ ${{ steps.deps.outcome }} = failure ]; then
FAILED_TARGET=deps${{ matrix.deps_suffix }}
elif [ ${{ steps.build.outcome }} = failure ]; then
FAILED_TARGET=build
else
FAILED_TARGET=test
fi
echo "FAILED_TARGET=$FAILED_TARGET" >> $GITHUB_ENV
Loading
Loading