Skip to content

Commit

Permalink
Refactor/benchmarking (#697)
Browse files Browse the repository at this point in the history
* refactor: delete benchmarking folder

* feat: rework benchmark

* fix: fix pr comments
  • Loading branch information
Eikix authored Jan 10, 2024
1 parent 6164ee0 commit 42b2774
Show file tree
Hide file tree
Showing 26 changed files with 393 additions and 10,346 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DEPLOYER_ACCOUNT_ADDRESS=
DEPLOYER_ACCOUNT_PRIVATE_KEY=0x0288a51c164874bb6a1ca7bd1cb71823c234a86d0f7b150d70fa8f06de645396

# Kakarot Environment
KAKAROT_HTTP_RPC_ADDRESS=0.0.0.0:3030
KAKAROT_RPC_URL=127.0.0.1:3030
## check `./deployments/katana/deployments.json` after running `make devnet`
KAKAROT_ADDRESS=
PROXY_ACCOUNT_CLASS_HASH=0x105356ebf9c56df723dc6952dae0cffd8f6e0c22281cf0ee7df8ddde60281c0
Expand Down
105 changes: 0 additions & 105 deletions .github/workflows/benchmark.yml

This file was deleted.

11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ install-katana:

run-katana: install-katana
rm -fr .katana/ && mkdir .katana
katana --dump-state .katana/dump.bin & echo $$! > .katana/pid
katana --disable-fee --dump-state .katana/dump.bin & echo $$! > .katana/pid

kill-katana:
kill -2 `cat .katana/pid` && rm -fr .katana/pid
Expand All @@ -51,7 +51,12 @@ test: dump-katana
test-coverage:
cargo llvm-cov nextest --all-features --workspace --lcov --output-path lcov.info

test-examples:
hurl $(HURL_FILES)
# Make sure to have a Kakarot RPC running and the correct port set in your .env and an underlying Starknet client running.
benchmark-madara:
cd benchmarks && bun i && bun run benchmark-madara

benchmark-katana:
cd benchmarks && bun i && bun run benchmark-katana


.PHONY: devnet test
52 changes: 40 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ Here is the list of all the available environment variables:

<!-- markdownlint-disable MD013 -->

| Name | Default value | Description |
| ----------------------------- | ------------------------- | ---------------------------- |
| TARGET_RPC_URL | <http://0.0.0.0:5050/rpc> | Target Starknet RPC URL |
| RUST_LOG | Debug | Log level |
| KAKAROT_HTTP_RPC_ADDRESS | 0.0.0.0:3030 | Kakarot RPC URL |
| KAKAROT_ADDRESS | see below | Kakarot address |
| PROXY_ACCOUNT_CLASS_HASH | see below | Proxy account class hash |
| DEPLOYER_ACCOUNT_ADDRESS | N/A | Deployer Account Address |
| DEPLOYER_ACCOUNT_PRIVATE_KEY | see below | Deployer Account Private Key |
| Name | Default value | Description |
| ---------------------------- | ------------------------- | ---------------------------- |
| TARGET_RPC_URL | <http://0.0.0.0:5050/rpc> | Target Starknet RPC URL |
| RUST_LOG | Debug | Log level |
| KAKAROT_HTTP_RPC_ADDRESS | 0.0.0.0:3030 | Kakarot RPC URL |
| KAKAROT_ADDRESS | see below | Kakarot address |
| PROXY_ACCOUNT_CLASS_HASH | see below | Proxy account class hash |
| DEPLOYER_ACCOUNT_ADDRESS | N/A | Deployer Account Address |
| DEPLOYER_ACCOUNT_PRIVATE_KEY | see below | Deployer Account Private Key |

<!-- markdownlint-enable MD013 -->

Expand All @@ -220,22 +220,24 @@ Declared:

<!-- markdownlint-disable MD013 -->

| Contract | Class hash |
| ------------------------ | ----------------------------------------------------------------- |
| Proxy account class hash | 0xba8f3f34eb92f56498fdf14ecac1f19d507dcc6859fa6d85eb8545370654bd |
| Contract | Class hash |
| ------------------------ | ---------------------------------------------------------------- |
| Proxy account class hash | 0xba8f3f34eb92f56498fdf14ecac1f19d507dcc6859fa6d85eb8545370654bd |

<!-- markdownlint-enable MD013 -->

The Counter contract implementation can be found
[here](https://github.com/sayajin-labs/kakarot/blob/main/tests/integration/solidity_contracts/PlainOpcodes/Counter.sol)

### Deployer Account

The Kakarot RPC requires a funded deployer account to deploy ethereum EOAs whose on-chain smart contract don't exist, the role of
the deployer is to deploy these accounts for a smoother UX { the deployer recovers the amount spent of this deployments }

The kakarot [deploy scripts](https://github.com/kkrt-labs/kakarot/blob/9773e4d10a3c3a32fb8aa3cfbf6fdbff35d6985e/scripts/deploy_kakarot.py#L67) deploy and fund an account with the private key "0x0288a51c164874bb6a1ca7bd1cb71823c234a86d0f7b150d70fa8f06de645396" for [Katana](https://github.com/dojoengine/dojo/tree/main/crates/katana) and [Madara](https://github.com/keep-starknet-strange/madara), the address of this account can be found in the file `deployments/{network}/deployments.json` with the key `deployer_account` after running this script on [Kakarot](https://github.com/kkrt-labs/kakarot).

You can configure Kakarot RPC to run with a particular Deployer Account via the following environment variables:

- `DEPLOYER_ACCOUNT_ADDRESS`
- `DEPLOYER_ACCOUNT_PRIVATE_KEY`

Expand Down Expand Up @@ -317,6 +319,32 @@ See [LICENSE](LICENSE) for more information.

## Acknowledgements

We warmly thank all the people who made this project possible.

- [Reth](https://github.com/paradigmxyz/reth) (Rust Ethereum),
Thank you for providing open source libraries for us to reuse.
- [jsonrpsee](https://github.com/paritytech/jsonrpsee)
- Starkware and its exploration team,
thank you for helping and providing a great test environment with Madara.
- [Lambdaclass](https://github.com/lambdaclass)
- [Dojo](https://github.com/dojoengine/dojo),
thank you for providing great test utils.
- [starknet-rs](https://github.com/xJonathanLEI/starknet-rs),
thank you for a great SDK.
- All our contributors. This journey wouldn't be possible without you.

## Benchmarks

For now, Kakarot RPC provides a minimal benchmarking methodology.
You'll need [Bun](https://bun.sh/) installed locally.

- Run a Starknet node locally (Katana or Madara),
e.g. `katana --block-time 6000 --disable-fee` if you have the dojo binary locally,
or `make madara-rpc-up` for Madara.
- Deploy the Kakarot smart contract (`make deploy-kakarot`)
- Run the Kakarot RPC binary (`make run-dev`)
- Run `make benchmark-katana` or `make benchmark-madara`

## Contributors ✨

Thanks goes to these wonderful people
Expand Down
6 changes: 0 additions & 6 deletions benchmarking/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions benchmarking/.prettierignore

This file was deleted.

14 changes: 0 additions & 14 deletions benchmarking/.prettierrc.json

This file was deleted.

34 changes: 0 additions & 34 deletions benchmarking/README.md

This file was deleted.

Loading

0 comments on commit 42b2774

Please sign in to comment.