Skip to content

Commit 95d40ca

Browse files
authored
refactor: move stores to crates (0xMiden#1253)
1 parent 4176ca3 commit 95d40ca

File tree

143 files changed

+1803
-1298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+1803
-1298
lines changed

.github/workflows/enforce-web-client-version-bump.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# This workflow checks if the version number in the `package.json` file of the `web-client`
2-
# package has been bumped when there are changes in the `web-client` or `web_store`
3-
# directories. If the version number has not been bumped, it fails the workflow with
4-
# an error message.
1+
# This workflow checks if the version number in the `package.json` file of the `web-client`
2+
# package has been bumped when there are changes in the `web-client` or `idxdb-store`
3+
# directories. If the version number has not been bumped, it fails the workflow with
4+
# an error message.
55

66
name: Enforce SDK Version Bump
77

@@ -68,7 +68,7 @@ jobs:
6868
steps.base.outputs.version == steps.head.outputs.version &&
6969
steps.skip.outputs.bypass != 'true'
7070
run: |
71-
echo "::error ::You modified code under web-client or web_store but did not bump the version in crates/web-client/package.json. Bump the version or add the 'bypass-sdk-version-bump' label to the PR."
71+
echo "::error ::You modified code under web-client or idxdb-store but did not bump the version in crates/web-client/package.json. Bump the version or add the 'bypass-sdk-version-bump' label to the PR."
7272
echo "::error ::Base and head version are both '${{ steps.head.outputs.version }}'."
7373
exit 1
7474

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
8282
- name: Check TSC output equals commited JS
8383
run: |
84-
cd ./crates/rust-client/src/store/web_store
84+
cd ./crates/idxdb-store/src/
8585
yarn
8686
yarn tsc --outDir ci_test_folder
8787
diff -bur js ci_test_folder

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
*.yaml
44

55
# Generated JS (codegen)
6-
crates/rust-client/src/store/web_store/js/**
6+
crates/idxdb-store/src/js/**

.typos.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Config file for typos. For more information, see: https://github.com/crate-ci/typos
22
[files]
3-
extend-exclude = ["*.d.ts", "*.json", "*.lock", "*.map", "crates/rust-client/src/store/web_store/js", "dist"]
3+
extend-exclude = ["*.d.ts", "*.json", "*.lock", "*.map", "crates/idxdb-store/src/js", "dist"]

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
### Changes
1010

1111
* [BREAKING] Incremented MSRV to 1.89.
12-
* Bumped web-client version in package.json after merging main into next.
1312
* Added support for getting specific vault and storage elements from `Store` along with their proofs ([#1164](https://github.com/0xMiden/miden-client/pull/1164)).
1413
* Modified the RPC client to avoid reconnection when setting commitment header ([#1166](https://github.com/0xMiden/miden-client/pull/1166)).
14+
* [BREAKING] Moved `SqliteStore` and `WebStore` into their own separate crates ([#1253](https://github.com/0xMiden/miden-client/pull/1253)).
1515

1616
## 0.11.3 (2025-09-08)
1717

Cargo.lock

Lines changed: 52 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ resolver = "2"
44
members = [
55
"bin/integration-tests",
66
"bin/miden-cli",
7+
"crates/idxdb-store",
78
"crates/rust-client",
9+
"crates/sqlite-store",
10+
"crates/testing/miden-client-tests",
811
"crates/testing/node-builder",
912
"crates/testing/prover",
1013
"crates/web-client",
@@ -40,7 +43,9 @@ miden-tx = { branch = "next", default-features = false, git = "https://github.co
4043

4144
# External dependencies
4245
anyhow = { default-features = false, version = "1.0" }
43-
async-trait = "0.1"
46+
async-trait = { version = "0.1" }
47+
chrono = { version = "0.4" }
48+
hex = { version = "0.4" }
4449
miette = { features = ["fancy"], version = "7.6" }
4550
rand = { version = "0.9" }
4651
serde = { features = ["derive"], version = "1.0" }

Makefile

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,29 @@ PROVER_DIR="crates/testing/prover"
1818
WEB_CLIENT_DIR=crates/web-client
1919
RUST_CLIENT_DIR=crates/rust-client
2020

21+
EXCLUDE_WASM_PACKAGES=--exclude miden-client-web --exclude miden-idxdb-store
22+
2123
# --- Linting -------------------------------------------------------------------------------------
2224

2325
.PHONY: clippy
2426
clippy: ## Run Clippy with configs. We need two separate commands because the `testing-remote-prover` cannot be built along with the rest of the workspace. This is because they use different versions of the `miden-tx` crate which aren't compatible with each other.
25-
cargo clippy --workspace --exclude miden-client-web --exclude testing-remote-prover --all-targets -- -D warnings
27+
cargo clippy --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --all-targets -- -D warnings
2628
cargo clippy --package testing-remote-prover --all-targets -- -D warnings
2729

2830
.PHONY: clippy-wasm
29-
clippy-wasm: rust-client-ts-build ## Run Clippy for the miden-client-web package
31+
clippy-wasm: rust-client-ts-build ## Run Clippy for the wasm packages (web client and idxdb store)
3032
cargo clippy --package miden-client-web --target wasm32-unknown-unknown --all-targets -- -D warnings
33+
cargo clippy --package miden-idxdb-store --target wasm32-unknown-unknown --all-targets -- -D warnings
3134

3235
.PHONY: fix
33-
fix: ## Run Fix with configs. We need two separate commands because the `testing-remote-prover` cannot be built along with the rest of the workspace. This is because they use different versions of the `miden-tx` crate which aren't compatible with each other.
34-
cargo +nightly fix --workspace --exclude miden-client-web --exclude testing-remote-prover --allow-staged --allow-dirty --all-targets
36+
fix: ## Run Fix with configs, building tests with proper features to avoid type split.
37+
cargo +nightly fix --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --features "testing std" --all-targets --allow-staged --allow-dirty
3538
cargo +nightly fix --package testing-remote-prover --all-targets --allow-staged --allow-dirty
3639

3740
.PHONY: fix-wasm
38-
fix-wasm: ## Run Fix for the miden-client-web package
41+
fix-wasm: ## Run Fix for the wasm packages (web client and idxdb store)
3942
cargo +nightly fix --package miden-client-web --target wasm32-unknown-unknown --allow-staged --allow-dirty --all-targets
43+
cargo +nightly fix --package miden-idxdb-store --target wasm32-unknown-unknown --allow-staged --allow-dirty --all-targets
4044

4145
.PHONY: format
4246
format: ## Run format using nightly toolchain
@@ -63,7 +67,7 @@ typos-check: ## Run typos to check for spelling mistakes
6367

6468
.PHONY: rust-client-ts-lint
6569
rust-client-ts-lint:
66-
cd $(RUST_CLIENT_DIR)/src/store/web_store && yarn && yarn lint
70+
cd crates/idxdb-store/src/ && yarn && yarn lint
6771

6872
# --- Documentation -------------------------------------------------------------------------------
6973

@@ -87,7 +91,7 @@ typedoc: rust-client-ts-build ## Generate web client package documentation.
8791

8892
.PHONY: test
8993
test: ## Run tests
90-
cargo nextest run --workspace --exclude miden-client-web --exclude testing-remote-prover --release --lib $(FEATURES_CLIENT)
94+
cargo nextest run --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --release --lib $(FEATURES_CLIENT)
9195

9296
.PHONY: test-docs
9397
test-docs: ## Run documentation tests
@@ -110,7 +114,7 @@ stop-node: ## Stop the testing node server
110114

111115
.PHONY: integration-test
112116
integration-test: ## Run integration tests
113-
cargo nextest run --workspace --exclude miden-client-web --exclude testing-remote-prover --release --test=integration
117+
cargo nextest run --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --release --test=integration
114118

115119
.PHONY: integration-test-web-client
116120
SHARD_PARAMETER ?= ""
@@ -127,8 +131,8 @@ integration-test-remote-prover-web-client: ## Run integration tests for the web
127131

128132
.PHONY: integration-test-full
129133
integration-test-full: ## Run the integration test binary with ignored tests included
130-
cargo nextest run --workspace --exclude miden-client-web --exclude testing-remote-prover --release --test=integration
131-
cargo nextest run --workspace --exclude miden-client-web --exclude testing-remote-prover --release --test=integration --run-ignored ignored-only -- import_genesis_accounts_can_be_used_for_transactions
134+
cargo nextest run --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --release --test=integration
135+
cargo nextest run --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --release --test=integration --run-ignored ignored-only -- import_genesis_accounts_can_be_used_for_transactions
132136

133137
.PHONY: integration-test-binary
134138
integration-test-binary: ## Run the integration tests using the standalone binary
@@ -158,25 +162,27 @@ install-tests: ## Install the tests binary
158162
# --- Building ------------------------------------------------------------------------------------
159163

160164
build: ## Build the CLI binary, client library and tests binary in release mode
161-
CODEGEN=1 cargo build --workspace --exclude miden-client-web --exclude testing-remote-prover --release --locked
165+
CODEGEN=1 cargo build --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --release --locked
162166
cargo build --package testing-remote-prover --release --locked
163167

164-
build-wasm: rust-client-ts-build ## Build the client library for wasm32
168+
build-wasm: rust-client-ts-build ## Build the wasm packages (web client and idxdb store)
165169
CODEGEN=1 cargo build --package miden-client-web --target wasm32-unknown-unknown --locked
170+
cargo build --package miden-idxdb-store --target wasm32-unknown-unknown --locked
166171

167172
.PHONY: rust-client-ts-build
168173
rust-client-ts-build:
169-
cd $(RUST_CLIENT_DIR)/src/store/web_store && yarn && yarn build
174+
cd crates/idxdb-store/src && yarn && yarn build
170175

171176
# --- Check ---------------------------------------------------------------------------------------
172177

173178
.PHONY: check
174179
check: ## Build the CLI binary and client library in release mode
175-
cargo check --workspace --exclude miden-client-web --exclude testing-remote-prover --release
180+
cargo check --workspace $(EXCLUDE_WASM_PACKAGES) --exclude testing-remote-prover --release
176181

177182
.PHONY: check-wasm
178-
check-wasm: ## Build the client library for wasm32
183+
check-wasm: ## Check the wasm packages (web client and idxdb store)
179184
cargo check --package miden-client-web --target wasm32-unknown-unknown
185+
cargo check --package miden-idxdb-store --target wasm32-unknown-unknown
180186

181187
## --- Setup --------------------------------------------------------------------------------------
182188

@@ -200,7 +206,7 @@ install-tools: ## Installs Rust + Node tools required by the Makefile
200206
# Web-related
201207
command -v yarn >/dev/null 2>&1 || npm install -g yarn
202208
yarn --cwd $(WEB_CLIENT_DIR) --silent # installs prettier, eslint, typedoc, etc.
203-
yarn --cwd $(RUST_CLIENT_DIR)/src/store/web_store --silent
209+
yarn --cwd crates/idxdb-store/src --silent
204210
yarn --silent
205211
yarn
206212
@echo "Development tools installation complete!"

bin/integration-tests/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ path = "tests/integration.rs"
1919

2020
[dependencies]
2121
# Workspace dependencies
22-
miden-client = { features = ["sqlite", "std", "testing", "tonic"], path = "../../crates/rust-client", version = "0.12" }
22+
miden-client = { features = ["std", "testing", "tonic"], path = "../../crates/rust-client", version = "0.12" }
23+
miden-client-sqlite-store = { package = "miden-client-sqlite-store", path = "../../crates/sqlite-store", version = "0.12" }
2324

2425
# External dependencies
2526
anyhow = { features = ["std"], workspace = true }

bin/integration-tests/src/tests/client.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use miden_client::transaction::{
2727
TransactionStatus,
2828
TransactionWitness,
2929
};
30+
use miden_client_sqlite_store::SqliteStore;
3031

3132
use crate::tests::config::ClientConfig;
3233

@@ -35,12 +36,12 @@ pub async fn test_client_builder_initializes_client_with_endpoint(
3536
) -> Result<()> {
3637
let (endpoint, _, store_config, auth_path) = client_config.as_parts();
3738

39+
let sqlite_store = SqliteStore::new(store_config).await?;
40+
3841
let mut client = ClientBuilder::<FilesystemKeyStore<_>>::new()
3942
.tonic_rpc_client(&endpoint, Some(10_000))
4043
.filesystem_keystore(auth_path.to_str().context("failed to convert auth path to string")?)
41-
.sqlite_store(
42-
store_config.to_str().context("failed to convert store config path to string")?,
43-
)
44+
.store(Arc::new(sqlite_store))
4445
.in_debug_mode(miden_client::DebugMode::Enabled)
4546
.build()
4647
.await?;

0 commit comments

Comments
 (0)