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

Implement Comprehensive Dojo Storage Benchmarking with Katana #1148

Merged
merged 41 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4c72195
added rust crate and dojo contract for benches
Oct 11, 2023
db3640a
fetching fee for tx
Oct 11, 2023
a1c4d1c
used cli methods in benches
Oct 13, 2023
1ab125c
a simple test
Oct 14, 2023
6ea59ba
dependency cleanup
Oct 14, 2023
ec35ee4
partial
Oct 18, 2023
ae64e6e
emit macro bench
Oct 25, 2023
c5582be
bench get and set macros
Oct 25, 2023
72d9343
added a list of katana prefunded accounts
Oct 25, 2023
5d1f796
new components authorization
Oct 26, 2023
e9ee427
contract cleanup
Oct 26, 2023
669261f
prefunded keypair system
Oct 26, 2023
91171c2
nicer transaction sequence api
Oct 26, 2023
088892f
first attempt on raw api usage
Oct 26, 2023
82fdaf5
new contract version
Oct 27, 2023
45d31f6
working on starknet api
Oct 27, 2023
be6b2da
estimating gas usage instead of executiong
Oct 28, 2023
2f7b046
migration of everything to the new api
Oct 28, 2023
1e474d3
exposed async api as well
Oct 28, 2023
d94f21f
removed old attempt
Oct 31, 2023
16deff6
fixes after merge
Oct 31, 2023
4594a07
added character struct
Oct 31, 2023
e690d68
character init test
Nov 1, 2023
abb05f7
update benchmark
Nov 1, 2023
aa9b032
using tracing to log gas usage
Nov 1, 2023
50516bc
logging to file
Nov 1, 2023
e9b7005
script and program for running benches
Nov 2, 2023
05204fb
sorting tests by name
Nov 2, 2023
0235cbe
double set test
Nov 2, 2023
23aeaed
a bit cleaner api
Nov 2, 2023
02a1b73
a few more benches
Nov 2, 2023
41241f6
more character benches
Nov 3, 2023
a62df4f
last fixes
Nov 3, 2023
07a4145
doubled performance
Nov 3, 2023
1b7d989
cargo fmt
neotheprogramist Nov 3, 2023
5fda277
cargo clippy --fix
neotheprogramist Nov 3, 2023
296ca58
add macro_use
neotheprogramist Nov 3, 2023
0ab04fb
fix missing trait
neotheprogramist Nov 3, 2023
acea943
remove unused extern crate
neotheprogramist Nov 3, 2023
590d690
clippy
neotheprogramist Nov 3, 2023
e620674
Merge branch 'dojoengine:main' into 24-4-complex-benchmark
neotheprogramist Nov 27, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dojo.iml
.DS_Store
.env
data
crates/benches/gas_usage.txt
144 changes: 144 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ members = [
"crates/sozo",
"crates/torii/client",
"crates/torii/server",
"crates/benches",
]

[workspace.package]
Expand Down
19 changes: 19 additions & 0 deletions crates/benches/Cargo.toml
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
51 changes: 51 additions & 0 deletions crates/benches/README.md
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
```
5 changes: 5 additions & 0 deletions crates/benches/contracts/.vscode/settings.json
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
}
21 changes: 21 additions & 0 deletions crates/benches/contracts/Scarb.lock
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"
21 changes: 21 additions & 0 deletions crates/benches/contracts/Scarb.toml
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"
Loading
Loading