Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b44bc15
feat(db): add database pruning tool for historical trie data
devin-ai-integration[bot] Jun 13, 2025
e4036a3
fix: address code review feedback - remove double reference and unuse…
devin-ai-integration[bot] Jun 13, 2025
d2f742d
feat(db): add Arbitrary trait and integration tests for pruning tool
devin-ai-integration[bot] Jun 13, 2025
f24bf9a
refactor(db): use Arbitrary trait for test key generation
devin-ai-integration[bot] Jun 13, 2025
b8c2b96
wip
kariy Jun 13, 2025
960837a
wip
kariy Jun 13, 2025
4595a71
wip
kariy Jun 13, 2025
d3d27e6
wip
kariy Jun 13, 2025
25c4234
add `starknet-types-core` patch
kariy Jun 16, 2025
eacc8fa
make tests passing for now
kariy Jun 16, 2025
9e7f109
get provider
kariy Jun 16, 2025
8ab0e29
wup
kariy Jun 16, 2025
aff00e4
test: refactor db_prune tests to use TrieWriter trait and verify stat…
claude[bot] Jun 16, 2025
fdf8f44
fmt
kariy Jun 16, 2025
4df85a9
test: refactor db_prune tests to use historical state root verification
claude[bot] Jun 16, 2025
f188d1a
apply starknet-types-core patch on workspace cargo.toml
kariy Jun 17, 2025
433eabd
make test pass
kariy Jun 17, 2025
58dc3af
test fixtures
kariy Jun 17, 2025
8f1cafa
refactor module structure
kariy Jun 17, 2025
f5f4a95
fix test
kariy Jun 17, 2025
aa08985
rename
kariy Jun 17, 2025
035f25e
test: add test case for when requested blocks exceed available blocks
claude[bot] Jun 17, 2025
2172214
fmt
kariy Jun 17, 2025
e7b9245
prune changeset table in batches to avoid high memory usage
kariy Jun 17, 2025
8390ee7
feat: add progress monitoring and visualization for database pruning
claude[bot] Jun 17, 2025
4a6ce3d
fix
kariy Jun 17, 2025
cddc9e7
remove per table progress bar
kariy Jun 17, 2025
6aba6fe
remove multibar
kariy Jun 17, 2025
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
29 changes: 29 additions & 0 deletions AGENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Katana Development Guide

## Build Commands
- `cargo build` - Build the project
- `cargo test` - Run all tests
- `cargo test <test_name>` - Run a specific test
- `cargo test -p <crate_name>` - Run tests for a specific crate
- `cargo clippy` - Run linter
- `make test-artifacts` - Prepare test database and SNOS artifacts

## Code Style
- **Formatting**: Uses rustfmt with 100 char width, group imports by StdExternalCrate
- **Imports**: std → external crates → local crates, use explicit paths `use crate::module::Type`
- **Naming**: snake_case functions, constructors use `new()`, `from_*()`, `with_*()` patterns
- **Error Handling**: Use `thiserror` for custom errors, `anyhow` for general error handling, always use `Result<T>` types
- **Visibility**: Clear `pub` boundaries, comprehensive `///` docs for public APIs
- **Async**: Use `async/await` with `?` operator for error propagation
- **Types**: Use `Arc<>` for shared ownership, prefer owned types over references in function signatures

## Testing
- Test modules use `#[cfg(test)]`
- Use descriptive test names that explain the scenario being tested
- Use `rstest` for parameterized tests, `assert_matches` for pattern matching
- Run `make test-artifacts` before running tests that need database fixtures

## Architecture
- Workspace with multiple crates under `crates/` directory
- Each crate focuses on specific functionality (rpc, storage, executor, etc.)
- Use workspace dependencies for consistent versioning across crates
29 changes: 27 additions & 2 deletions Cargo.lock

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

17 changes: 12 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ cairo-lang-starknet-classes = "2.11.2"
cairo-lang-utils = "2.11.2"
# Some types that we used from cairo-vm implements the `Arbitrary` trait,
# only under the `test_utils` feature. So we expose through this feature.
cairo-vm = { version = "1.0.2", features = [ "test_utils" ] }
anyhow = "1.0.89"
arbitrary = { version = "1.3.2", features = [ "derive" ] }
assert_fs = "1.1"
Expand All @@ -109,6 +108,7 @@ async-trait = "0.1.82"
auto_impl = "1.2.0"
base64 = "0.21.2"
bigdecimal = "0.4.1"
cairo-vm = { version = "1.0.2", features = [ "test_utils" ] }
camino = { version = "1.1.2", features = [ "serde1" ] }
chrono = { version = "0.4.24", features = [ "serde" ] }
clap = { version = "4.5.16", features = [ "derive", "env" ] }
Expand Down Expand Up @@ -194,13 +194,13 @@ tonic-build = "0.11"
tonic-reflection = "0.11"
tonic-web = "0.11"
# WASM-compatible gRPC deps
criterion = "0.5.1"
pprof = { version = "0.13.0", features = [ "criterion", "flamegraph" ] }
slot = { git = "https://github.com/cartridge-gg/slot", rev = "1298a30" }
tonic-web-wasm-client = "0.6.0"
wasm-prost = { version = "0.13", package = "prost" }
wasm-tonic = { version = "0.12", default-features = false, features = [ "codegen", "gzip", "prost" ], package = "tonic" }
wasm-tonic-build = { version = "0.12", default-features = false, features = [ "prost" ], package = "tonic-build" }
criterion = "0.5.1"
pprof = { version = "0.13.0", features = [ "criterion", "flamegraph" ] }
slot = { git = "https://github.com/cartridge-gg/slot", rev = "1298a30" }
# alloy core
alloy-primitives = { version = "0.8", default-features = false }
alloy-sol-types = { version = "0.8", default-features = false }
Expand All @@ -213,10 +213,10 @@ alloy-rpc-types-eth = { version = "0.4", default-features = false }
alloy-signer = { version = "0.4", default-features = false }
alloy-transport = { version = "0.4", default-features = false }

bitvec = "1.0.1"
starknet = "0.14.0"
starknet-crypto = "0.7.1"
starknet-types-core = { version = "0.1.8", features = [ "arbitrary", "hash" ] }
bitvec = "1.0.1"
# macro
proc-macro2 = "1.0"
quote = "1.0"
Expand All @@ -238,3 +238,10 @@ opentelemetry-stackdriver = { version = "0.27.0", features = [ "propagator" ] }
# alloy
# macro
blockifier = { git = "https://github.com/dojoengine/sequencer", rev = "5d737b9c9", default-features = false }

[patch.crates-io]
# NOTE: remove this patch once this PR is merged <https://github.com/starknet-io/types-rs/pull/132>
#
# This patch fixes an issue where we're unable to correctly evaluate the accurate size
# for constructing `Felt` from unstructured data (Arbitrary).
starknet-types-core = { git = "https://github.com/kariy/types-rs", rev = "0f6ae31" }
8 changes: 7 additions & 1 deletion bin/katana/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version.workspace = true
[dependencies]
katana-chain-spec.workspace = true
katana-cli.workspace = true
katana-db.workspace = true
katana-db = { workspace = true, features = [ "arbitrary" ] }
katana-primitives.workspace = true
katana-rpc-types.workspace = true
katana-utils.workspace = true
Expand All @@ -22,6 +22,7 @@ clap.workspace = true
clap_complete.workspace = true
comfy-table = "7.1.1"
const_format = "0.2.33"
indicatif = "0.17.8"
inquire = "0.7.5"
piltover = { git = "https://github.com/keep-starknet-strange/piltover.git", rev = "45263e8" }
rand.workspace = true
Expand All @@ -39,9 +40,14 @@ vergen = { version = "9.0.0", features = [ "build", "cargo", "emit_and_set" ] }
vergen-gitcl = { version = "1.0.0", features = [ "build", "cargo", "rustc", "si" ] }

[dev-dependencies]
katana-provider.workspace = true

arbitrary.workspace = true
assert_matches.workspace = true
proptest = "1.0"
rstest.workspace = true
starknet.workspace = true
tempfile.workspace = true

[features]
default = [ "cartridge", "init-slot", "jemalloc", "katana-cli/explorer" ]
Expand Down
173 changes: 0 additions & 173 deletions bin/katana/src/cli/db.rs

This file was deleted.

Loading
Loading