forked from starkware-libs/blockifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Comprehensive Dojo Storage Benchmarking with Katana (starkw…
…are-libs#1148) * added rust crate and dojo contract for benches * fetching fee for tx * used cli methods in benches * a simple test * dependency cleanup * partial * emit macro bench * bench get and set macros * added a list of katana prefunded accounts * new components authorization * contract cleanup * prefunded keypair system * nicer transaction sequence api * first attempt on raw api usage * new contract version * working on starknet api * estimating gas usage instead of executiong * migration of everything to the new api * exposed async api as well * removed old attempt * fixes after merge * added character struct * character init test * update benchmark * using tracing to log gas usage * logging to file * script and program for running benches * sorting tests by name * double set test * a bit cleaner api * a few more benches * more character benches * last fixes * doubled performance * cargo fmt * cargo clippy --fix * add macro_use * fix missing trait * remove unused extern crate * clippy --------- Co-authored-by: Mateusz Zając <matzayon@gmail.com>
- Loading branch information
1 parent
d7e9788
commit f4c9a4c
Showing
26 changed files
with
1,295 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ dojo.iml | |
.DS_Store | ||
.env | ||
data | ||
crates/benches/gas_usage.txt |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "benches" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
proptest = "1.3.1" | ||
reqwest = { version="0.11.18", features=["blocking", "json"] } | ||
clap_builder = "4.4.6" | ||
|
||
sozo = { path = "../sozo" } | ||
starknet.workspace = true | ||
anyhow.workspace = true | ||
hex.workspace = true | ||
lazy_static.workspace = true | ||
futures.workspace = true | ||
tokio.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# This crate is dedicated for benchmarking purposes | ||
|
||
## Quick start | ||
|
||
```bash | ||
katana | ||
bash scripts/cargo_bench.sh | ||
``` | ||
|
||
## Prerequisites | ||
|
||
- `cargo` - for test case generation and runtime | ||
- `katana` - as a local RPC server | ||
- `sozo` - for contract compilation and deployment | ||
|
||
## Requirements for running | ||
|
||
While benchmarks are running a Katana instance has to be online either remotely or locally... | ||
|
||
```bash | ||
katana | ||
``` | ||
|
||
...contracts have to be built and deployed... | ||
|
||
```bash | ||
sozo --manifest-path crates/benches/contracts/Scarb.toml build | ||
sozo --manifest-path crates/benches/contracts/Scarb.toml migrate | ||
``` | ||
|
||
...and actions authorized. | ||
|
||
```bash | ||
crates/benches/contracts/scripts/default_auth.sh | ||
``` | ||
|
||
Then tests can be run with | ||
|
||
```bash | ||
cargo test bench -- --ignored | ||
``` | ||
|
||
Benchmarks are ignored by default because they need a while to complete and need a running Katana. Their names should start with bench. | ||
|
||
## Running with compiled `sozo` | ||
|
||
While during testing release version of the tool worked better, Sozo can be run from source with | ||
|
||
```bash | ||
cargo run -r --bin sozo -- --manifest-path crates/benches/contracts/Scarb.toml build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cairo1.languageServerPath": "$HOME/.dojo/bin/dojo-language-server", | ||
"cairo1.enableLanguageServer": true, | ||
"cairo1.enableScarb": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Code generated by scarb DO NOT EDIT. | ||
version = 1 | ||
|
||
[[package]] | ||
name = "benches" | ||
version = "0.3.2" | ||
dependencies = [ | ||
"dojo", | ||
] | ||
|
||
[[package]] | ||
name = "dojo" | ||
version = "0.3.2" | ||
source = "git+https://github.com/dojoengine/dojo#0a772af3ec677705042630723c55b421f4fe084d" | ||
dependencies = [ | ||
"dojo_plugin", | ||
] | ||
|
||
[[package]] | ||
name = "dojo_plugin" | ||
version = "0.3.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
cairo-version = "2.2.0" | ||
name = "benches" | ||
version = "0.3.2" | ||
|
||
[cairo] | ||
sierra-replace-ids = true | ||
|
||
[dependencies] | ||
dojo = { git = "https://github.com/dojoengine/dojo", version = "0.3.2" } | ||
|
||
[[target.dojo]] | ||
|
||
[tool.dojo] | ||
initializer_class_hash = "0xbeef" | ||
|
||
[tool.dojo.env] | ||
rpc_url = "http://localhost:5050/" | ||
# Default account for katana with seed = 0 | ||
account_address = "0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973" | ||
private_key = "0x1800000000300000180000000000030000000000003006001800006600" |
Oops, something went wrong.