From 0dadb6da66f39b370b32cac65ddfdeaec6c27c4c Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 9 Sep 2026 06:21:48 +0700 Subject: [PATCH 1/9] build(platform)!: adopt GroveDB 6.0.0 and the published grovedb-bincode 2.1.0 Advance GroveDB to develop 985ece65 (6.0.0) and rust-dashcore to dev 057e79cd, use rocksdb 0.25.0 from crates.io instead of the rust-rocksdb fork, and make the workspace bincode dependency an alias for the published grovedb-bincode 2.1.0 so GroveDB, rust-dashcore and Platform share one set of bincode traits without a Cargo patch. Adapt to the GroveDB API changes: batch options in Drive's grove operations, element verification aligned with the prover's right-to-left traversal, which GroveDB now checks strictly, and the new backward reference element variants rendered by the FFI and wasm SDK path element queries. BREAKING CHANGE: Rust consumers serializing Platform or Core types must use the published grovedb-bincode 2.1.0 crate; bincode trait identities now come from it. Wire encodings and the C ABI are unchanged. Co-Authored-By: Claude Fable 5.1 --- Cargo.lock | 223 +++++++++--------- Cargo.toml | 17 +- packages/rs-dpp/Cargo.toml | 4 +- packages/rs-drive-abci/Cargo.toml | 14 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 16 +- .../grove_operations/batch_delete/v0/mod.rs | 1 + .../v0/mod.rs | 1 + .../grove_operations/batch_move/v0/mod.rs | 1 + .../batch_move_items_in_path_query/v0/mod.rs | 1 + .../batch_remove_raw/v0/mod.rs | 1 + .../v0/mod.rs | 1 + .../v0/mod.rs | 1 + .../grove_batch_operations_costs/v0/mod.rs | 1 + .../grove_operations/grove_delete/v0/mod.rs | 1 + .../verify/system/verify_elements/v0/mod.rs | 4 +- packages/rs-platform-serialization/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 4 +- packages/rs-platform-wallet-ffi/Cargo.toml | 2 +- .../rs-platform-wallet-storage/Cargo.toml | 2 +- packages/rs-platform-wallet/Cargo.toml | 2 +- packages/rs-sdk-ffi/Cargo.toml | 2 +- .../src/system/queries/path_elements.rs | 69 +++++- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp2/Cargo.toml | 2 +- packages/wasm-drive-verify/Cargo.toml | 2 +- packages/wasm-sdk/src/queries/system.rs | 77 +++++- 31 files changed, 300 insertions(+), 163 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f726d3c274..fd89359e232 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -524,26 +524,6 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" -[[package]] -name = "bincode" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" -dependencies = [ - "bincode_derive", - "serde", - "unty", -] - -[[package]] -name = "bincode_derive" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09" -dependencies = [ - "virtue 0.0.18", -] - [[package]] name = "bindgen" version = "0.65.1" @@ -576,7 +556,7 @@ dependencies = [ "bitflags 2.13.0", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.13.0", "proc-macro2", "quote", "regex", @@ -1662,18 +1642,18 @@ dependencies = [ [[package]] name = "dash-network" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ - "bincode", - "bincode_derive", "cbindgen 0.29.4", + "grovedb-bincode", + "grovedb-bincode-derive", "serde", ] [[package]] name = "dash-network-seeds" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ "dash-network", ] @@ -1768,7 +1748,7 @@ dependencies = [ [[package]] name = "dash-spv" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ "async-trait", "chrono", @@ -1797,13 +1777,11 @@ dependencies = [ [[package]] name = "dashcore" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ "anyhow", "base64-compat", "bech32 0.9.1", - "bincode", - "bincode_derive", "bitvec", "blake3", "blsful", @@ -1811,6 +1789,8 @@ dependencies = [ "dashcore-private", "dashcore_hashes", "ed25519-dalek", + "grovedb-bincode", + "grovedb-bincode-derive", "hex", "hex_lit", "rustversion", @@ -1823,12 +1803,12 @@ dependencies = [ [[package]] name = "dashcore-private" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" [[package]] name = "dashcore-rpc" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ "dashcore-rpc-json", "hex", @@ -1841,10 +1821,10 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ - "bincode", "dashcore", + "grovedb-bincode", "hex", "key-wallet", "serde", @@ -1856,10 +1836,10 @@ dependencies = [ [[package]] name = "dashcore_hashes" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ - "bincode", "dashcore-private", + "grovedb-bincode", "rs-x11-hash", "serde", ] @@ -2117,7 +2097,6 @@ dependencies = [ "async-trait", "base64 0.22.1", "bech32 0.11.1", - "bincode", "bs58", "byteorder", "chrono", @@ -2132,6 +2111,7 @@ dependencies = [ "dpp-json-convertible-derive", "env_logger", "getrandom 0.2.17", + "grovedb-bincode", "grovedb-commitment-tree", "hex", "indexmap 2.14.0", @@ -2182,7 +2162,6 @@ dependencies = [ "arc-swap", "assert_matches", "base64 0.22.1", - "bincode", "bs58", "byteorder", "chrono", @@ -2192,6 +2171,7 @@ dependencies = [ "dpp", "enum-map", "grovedb", + "grovedb-bincode", "grovedb-costs", "grovedb-epoch-based-storage-flags", "grovedb-path", @@ -2224,7 +2204,6 @@ dependencies = [ "arc-swap", "assert_matches", "async-trait", - "bincode", "blake3", "bls-signatures", "chrono", @@ -2243,6 +2222,7 @@ dependencies = [ "drive-proof-verifier", "envy", "file-rotate", + "grovedb-bincode", "grovedb-commitment-tree", "grovedb-path", "grovedb-storage", @@ -2283,12 +2263,12 @@ dependencies = [ name = "drive-proof-verifier" version = "4.2.0-dev.8" dependencies = [ - "bincode", "dapi-grpc", "dash-context-provider", "derive_more 1.0.0", "dpp", "drive", + "grovedb-bincode", "hex", "indexmap 2.14.0", "platform-serialization", @@ -2925,7 +2905,7 @@ dependencies = [ [[package]] name = "git-state" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" [[package]] name = "glob" @@ -2974,13 +2954,13 @@ dependencies = [ [[package]] name = "grovedb" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "axum 0.8.9", - "bincode", - "bincode_derive", "blake3", + "grovedb-bincode", + "grovedb-bincode-derive", "grovedb-bulk-append-tree", "grovedb-commitment-tree", "grovedb-costs", @@ -3011,13 +2991,33 @@ dependencies = [ "zip-extensions", ] +[[package]] +name = "grovedb-bincode" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce912028682ecc5870a5ad609ea456b76b0bf4ec1ba1eb649400b64ff73a7782" +dependencies = [ + "grovedb-bincode-derive", + "serde", + "unty", +] + +[[package]] +name = "grovedb-bincode-derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eaff4e961dcb3e7e55c34c8c6982249036e5aaa19e55f6dab94ebcd4896b03a" +dependencies = [ + "virtue 0.0.18", +] + [[package]] name = "grovedb-bulk-append-tree" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ - "bincode", "blake3", + "grovedb-bincode", "grovedb-costs", "grovedb-dense-fixed-sized-merkle-tree", "grovedb-merkle-mountain-range", @@ -3031,8 +3031,8 @@ dependencies = [ [[package]] name = "grovedb-commitment-tree" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "blake3", "grovedb-bulk-append-tree", @@ -3048,8 +3048,8 @@ dependencies = [ [[package]] name = "grovedb-costs" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "integer-encoding", "intmap", @@ -3058,11 +3058,11 @@ dependencies = [ [[package]] name = "grovedb-dense-fixed-sized-merkle-tree" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ - "bincode", "blake3", + "grovedb-bincode", "grovedb-costs", "grovedb-query", "grovedb-storage", @@ -3072,11 +3072,11 @@ dependencies = [ [[package]] name = "grovedb-element" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ - "bincode", - "bincode_derive", + "grovedb-bincode", + "grovedb-bincode-derive", "grovedb-path", "grovedb-query", "grovedb-version", @@ -3088,8 +3088,8 @@ dependencies = [ [[package]] name = "grovedb-epoch-based-storage-flags" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "grovedb-costs", "hex", @@ -3100,15 +3100,15 @@ dependencies = [ [[package]] name = "grovedb-merk" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ - "bincode", - "bincode_derive", "blake3", "byteorder", "colored", "ed", + "grovedb-bincode", + "grovedb-bincode-derive", "grovedb-costs", "grovedb-element", "grovedb-path", @@ -3126,11 +3126,11 @@ dependencies = [ [[package]] name = "grovedb-merkle-mountain-range" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ - "bincode", "blake3", + "grovedb-bincode", "grovedb-costs", "grovedb-storage", "grovedb-version", @@ -3139,16 +3139,16 @@ dependencies = [ [[package]] name = "grovedb-path" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "hex", ] [[package]] name = "grovedb-private-document-store" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "blake3", "grovedb-bulk-append-tree", @@ -3160,12 +3160,12 @@ dependencies = [ [[package]] name = "grovedb-query" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ - "bincode", "byteorder", "ed", + "grovedb-bincode", "grovedb-costs", "grovedb-storage", "hex", @@ -3176,8 +3176,8 @@ dependencies = [ [[package]] name = "grovedb-storage" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "blake3", "grovedb-costs", @@ -3195,8 +3195,8 @@ dependencies = [ [[package]] name = "grovedb-version" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "thiserror 2.0.18", "versioned-feature-core", @@ -3204,8 +3204,8 @@ dependencies = [ [[package]] name = "grovedb-visualize" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "hex", "itertools 0.14.0", @@ -3213,8 +3213,8 @@ dependencies = [ [[package]] name = "grovedbg-types" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" dependencies = [ "serde", "serde_with 3.21.0", @@ -4137,13 +4137,11 @@ dependencies = [ [[package]] name = "key-wallet" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ "aes", "async-trait", "base58ck", - "bincode", - "bincode_derive", "bip39", "bitflags 2.13.0", "bs58", @@ -4151,6 +4149,8 @@ dependencies = [ "dashcore-private", "dashcore_hashes", "getrandom 0.2.17", + "grovedb-bincode", + "grovedb-bincode-derive", "hex", "rand 0.8.6", "scrypt", @@ -4166,7 +4166,7 @@ dependencies = [ [[package]] name = "key-wallet-ffi" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ "cbindgen 0.29.4", "dash-network", @@ -4182,11 +4182,11 @@ dependencies = [ [[package]] name = "key-wallet-manager" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=057e79cd3e1eeb29676288e9aab76b867d8e707f#057e79cd3e1eeb29676288e9aab76b867d8e707f" dependencies = [ "async-trait", - "bincode", "dashcore", + "grovedb-bincode", "key-wallet", "rayon", "serde", @@ -4276,8 +4276,9 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "librocksdb-sys" -version = "0.18.0+10.7.5" -source = "git+https://github.com/QuantumExplorer/rust-rocksdb.git?rev=52772eea7bcd214d1d07d80aa538b1d24e5015b7#52772eea7bcd214d1d07d80aa538b1d24e5015b7" +version = "0.19.0+11.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f45e86edad8e88efe97dbf384b4e48e1ff0f111eabf154c7b09d7a1e5fb573c" dependencies = [ "bindgen 0.72.1", "bzip2-sys", @@ -4285,6 +4286,7 @@ dependencies = [ "libc", "libz-sys", "lz4-sys", + "rustflags", "zstd-sys", ] @@ -5171,7 +5173,7 @@ dependencies = [ name = "platform-serialization" version = "4.2.0-dev.8" dependencies = [ - "bincode", + "grovedb-bincode", "platform-version", ] @@ -5190,9 +5192,9 @@ name = "platform-value" version = "4.2.0-dev.8" dependencies = [ "base64 0.22.1", - "bincode", "bs58", "ciborium", + "grovedb-bincode", "hex", "indexmap 2.14.0", "platform-serialization", @@ -5216,7 +5218,7 @@ dependencies = [ name = "platform-version" version = "4.2.0-dev.8" dependencies = [ - "bincode", + "grovedb-bincode", "grovedb-version", "thiserror 2.0.18", "versioned-feature-core", @@ -5277,13 +5279,13 @@ version = "4.2.0-dev.8" dependencies = [ "anyhow", "async-trait", - "bincode", "bs58", "cbindgen 0.27.0", "dash-network", "dash-sdk", "dashcore", "dpp", + "grovedb-bincode", "hex", "key-wallet", "lazy_static", @@ -5306,7 +5308,6 @@ dependencies = [ "apple-native-keyring-store", "argon2", "assert_cmd", - "bincode", "chacha20poly1305", "chrono", "clap", @@ -5317,6 +5318,7 @@ dependencies = [ "fd-lock", "filetime", "getrandom 0.2.17", + "grovedb-bincode", "hex", "humantime", "key-wallet", @@ -5582,8 +5584,8 @@ version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042" dependencies = [ - "heck 0.4.1", - "itertools 0.10.5", + "heck 0.5.0", + "itertools 0.14.0", "log", "multimap", "petgraph", @@ -5604,7 +5606,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.14.0", "proc-macro2", "quote", "syn 2.0.117", @@ -5617,7 +5619,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.14.0", "proc-macro2", "quote", "syn 2.0.117", @@ -6291,8 +6293,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.24.0" -source = "git+https://github.com/QuantumExplorer/rust-rocksdb.git?rev=52772eea7bcd214d1d07d80aa538b1d24e5015b7#52772eea7bcd214d1d07d80aa538b1d24e5015b7" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8d90add70d1d420ee487bce4a1449880a8d147451c6051b2ee5f8354553dcbf" dependencies = [ "libc", "librocksdb-sys", @@ -6422,7 +6425,6 @@ name = "rs-sdk-ffi" version = "4.2.0-dev.8" dependencies = [ "async-trait", - "bincode", "bs58", "cbindgen 0.27.0", "dash-async", @@ -6433,6 +6435,7 @@ dependencies = [ "env_logger", "envy", "getrandom 0.2.17", + "grovedb-bincode", "hex", "key-wallet", "libc", @@ -6591,6 +6594,12 @@ dependencies = [ "semver", ] +[[package]] +name = "rustflags" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a39e0e9135d7a7208ee80aa4e3e4b88f0f5ad7be92153ed70686c38a03db2e63" + [[package]] name = "rustix" version = "0.38.44" @@ -7223,8 +7232,8 @@ version = "4.2.0-dev.8" dependencies = [ "async-trait", "base64 0.22.1", - "bincode", "dpp", + "grovedb-bincode", "hex", "tracing", "zeroize", @@ -7358,9 +7367,9 @@ dependencies = [ name = "strategy-tests" version = "4.2.0-dev.8" dependencies = [ - "bincode", "dpp", "drive", + "grovedb-bincode", "hex", "platform-version", "rand 0.8.6", @@ -8737,8 +8746,8 @@ version = "4.2.0-dev.8" dependencies = [ "anyhow", "async-trait", - "bincode", "dpp", + "grovedb-bincode", "hex", "itertools 0.13.0", "js-sys", @@ -8761,9 +8770,9 @@ version = "4.2.0-dev.8" dependencies = [ "anyhow", "async-trait", - "bincode", "dpp", "dpp-json-convertible-derive", + "grovedb-bincode", "hex", "js-sys", "serde", @@ -8779,12 +8788,12 @@ name = "wasm-drive-verify" version = "4.2.0-dev.8" dependencies = [ "base64 0.22.1", - "bincode", "bs58", "ciborium", "console_error_panic_hook", "dpp", "drive", + "grovedb-bincode", "hex", "indexmap 2.14.0", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index 5fc7a2a957c..bb78be4d619 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,14 +53,15 @@ members = [ ] [workspace.dependencies] -dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" } -dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" } -dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" } -key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" } -key-wallet-ffi = { git = "https://github.com/dashpay/rust-dashcore", rev = "93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" } -key-wallet-manager = { git = "https://github.com/dashpay/rust-dashcore", rev = "93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" } -dash-network = { git = "https://github.com/dashpay/rust-dashcore", rev = "93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" } -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", rev = "93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" } +bincode = { package = "grovedb-bincode", version = "=2.1.0" } +dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "057e79cd3e1eeb29676288e9aab76b867d8e707f" } +dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "057e79cd3e1eeb29676288e9aab76b867d8e707f" } +dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "057e79cd3e1eeb29676288e9aab76b867d8e707f" } +key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "057e79cd3e1eeb29676288e9aab76b867d8e707f" } +key-wallet-ffi = { git = "https://github.com/dashpay/rust-dashcore", rev = "057e79cd3e1eeb29676288e9aab76b867d8e707f" } +key-wallet-manager = { git = "https://github.com/dashpay/rust-dashcore", rev = "057e79cd3e1eeb29676288e9aab76b867d8e707f" } +dash-network = { git = "https://github.com/dashpay/rust-dashcore", rev = "057e79cd3e1eeb29676288e9aab76b867d8e707f" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", rev = "057e79cd3e1eeb29676288e9aab76b867d8e707f" } tokio-metrics = "0.5" # Size-tuned profile for the iOS `rs-unified-sdk-ffi` staticlib, which diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index a0f6f0b6889..24b587524dd 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -47,7 +47,7 @@ jsonschema = { git = "https://github.com/dashpay/jsonschema-rs", branch = "confi ], optional = true } lazy_static = { version = "1.4" } num_enum = "0.7" -bincode = { version = "=2.0.1", features = ["serde"] } +bincode = { workspace = true, features = ["serde"] } rand = { version = "0.8.5", features = ["small_rng"] } regex = { version = "1.10.4" } serde = { version = "1.0.219", features = ["derive"] } @@ -71,7 +71,7 @@ strum = { version = "0.26", features = ["derive"] } json-schema-compatibility-validator = { path = '../rs-json-schema-compatibility-validator', optional = true } once_cell = "1.19.0" tracing = { version = "0.1.41" } -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e", optional = true } +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true } [dev-dependencies] tokio = { version = "1.40", features = ["full"] } diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 843fb9caee3..53b072580c8 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT" [dependencies] arc-swap = "1.7.0" -bincode = { version = "=2.0.1", features = ["serde"] } +bincode = { workspace = true, features = ["serde"] } ciborium = { version = "0.2.2" } chrono = "0.4.35" serde = { version = "1.0.219", features = ["derive"] } @@ -82,11 +82,11 @@ derive_more = { version = "1.0", features = ["from", "deref", "deref_mut"] } async-trait = "0.1.77" console-subscriber = { version = "0.4", optional = true } bls-signatures = { git = "https://github.com/dashpay/bls-signatures", rev = "0842b17583888e8f46c252a4ee84cdfd58e0546f", optional = true } -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" } +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } nonempty = "0.11" # Shielded-pool snapshot needs raw RocksDB SstFileWriter + ingest_external_file_cf # bindings, and blake3 for the snapshot-file checksum. -rocksdb = { git = "https://github.com/QuantumExplorer/rust-rocksdb.git", rev = "52772eea7bcd214d1d07d80aa538b1d24e5015b7" } +rocksdb = "0.25.0" blake3 = "1.5" [dev-dependencies] @@ -108,7 +108,7 @@ dpp = { path = "../rs-dpp", default-features = false, features = [ drive = { path = "../rs-drive", features = ["fixtures-and-mocks"] } drive-proof-verifier = { path = "../rs-drive-proof-verifier" } strategy-tests = { path = "../strategy-tests" } -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e", features = ["client"] } +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", features = ["client"] } assert_matches = "1.5.0" drive-abci = { path = ".", features = ["testing-config", "mocks", "shielded_test_data"] } bls-signatures = { git = "https://github.com/dashpay/bls-signatures", rev = "0842b17583888e8f46c252a4ee84cdfd58e0546f" } @@ -117,13 +117,13 @@ dash-platform-macros = { path = "../rs-dash-platform-macros" } libc = "0.2" # For tests of grovedb verify -rocksdb = { git = "https://github.com/QuantumExplorer/rust-rocksdb.git", rev = "52772eea7bcd214d1d07d80aa538b1d24e5015b7" } +rocksdb = "0.25.0" integer-encoding = { version = "4.0.0" } # For dump_only_default_and_aux_cfs_under_shielded_subtree_prefix — same # subtree-prefix algorithm grovedb uses internally. -grovedb-path = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" } -grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" } +grovedb-path = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } +grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } [features] default = ["bls-signatures"] diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index d0246c9a8eb..fe5705e4b1f 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -31,7 +31,7 @@ dpp = { path = "../rs-dpp", features = [ dash-context-provider = { path = "../rs-context-provider", features = [ "mocks", ] } -bincode = { version = "=2.0.1", features = ["serde"] } +bincode = { workspace = true, features = ["serde"] } platform-serialization-derive = { path = "../rs-platform-serialization-derive", optional = true } platform-serialization = { path = "../rs-platform-serialization" } tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v1.5.1", features = [ diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index fcbb004cc3d..6c60c2559e7 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -14,7 +14,7 @@ license = "MIT" resolver = "2" [dependencies] -bincode = { version = "=2.0.1", features = ["serde"] } +bincode = { workspace = true, features = ["serde"] } platform-version = { path = "../rs-platform-version" } # used to convert integers to bytes, needed in verifier integer-encoding = { version = "4.0.0" } @@ -52,13 +52,13 @@ enum-map = { version = "2.0.3", optional = true } intmap = { version = "3.0.1", features = ["serde"], optional = true } chrono = { version = "0.4.35", optional = true } itertools = { version = "0.13", optional = true } -grovedb = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e", optional = true, default-features = false } -grovedb-costs = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e", optional = true } -grovedb-path = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" } -grovedb-query = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" } -grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e", optional = true } -grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" } -grovedb-epoch-based-storage-flags = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" } +grovedb = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true, default-features = false } +grovedb-costs = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true } +grovedb-path = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } +grovedb-query = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } +grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true } +grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } +grovedb-epoch-based-storage-flags = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } [dev-dependencies] criterion = "0.5" diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs index a1b7680314f..545bf40c4e1 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs @@ -23,6 +23,7 @@ impl Drive { drive_version: &DriveVersion, ) -> Result<(), Error> { let options = DeleteOptions { + propagate_backward_references: false, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs index 01952b937a0..9b90ccb60cd 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs @@ -80,6 +80,7 @@ impl Drive { let current_batch_operations = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let options = DeleteOptions { + propagate_backward_references: false, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs index 3b4c7025471..fe0611c239f 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs @@ -60,6 +60,7 @@ impl Drive { // ── 2. Build the delete op ────────────────────────────────────────── let current_batch = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let delete_opts = DeleteOptions { + propagate_backward_references: false, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs index b65b3ccb69e..b8d88730cdc 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs @@ -86,6 +86,7 @@ impl Drive { let current_batch_operations = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let options = DeleteOptions { + propagate_backward_references: false, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs index 9da64b2262c..6ad8f69a6d8 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs @@ -29,6 +29,7 @@ impl Drive { let mut current_batch_operations = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let options = DeleteOptions { + propagate_backward_references: false, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs index e44000512d7..2d1b08a6c3a 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs @@ -63,6 +63,7 @@ impl Drive { let cost_context = self.grove.apply_batch_with_element_flags_update( ops.operations, Some(BatchApplyOptions { + propagate_backward_references: false, validate_insertion_does_not_override: validate, validate_insertion_does_not_override_tree: validate, disable_operation_consistency_check: !self.config.batching_consistency_verification, diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs index a736817ab8d..f1e87a64598 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs @@ -48,6 +48,7 @@ impl Drive { let cost_context = self.grove.apply_partial_batch_with_element_flags_update( ops.operations, Some(BatchApplyOptions { + propagate_backward_references: false, validate_insertion_does_not_override: validate, validate_insertion_does_not_override_tree: validate, disable_operation_consistency_check: false, diff --git a/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs index 77d8d247a5c..3d8573a61b2 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs @@ -24,6 +24,7 @@ impl Drive { AverageCaseCostsType(estimated_layer_info), ops.operations, Some(BatchApplyOptions { + propagate_backward_references: false, validate_insertion_does_not_override: validate, validate_insertion_does_not_override_tree: validate, disable_operation_consistency_check: false, diff --git a/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs index d5e0c2ab1e2..c34356d26de 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs @@ -18,6 +18,7 @@ impl Drive { drive_version: &DriveVersion, ) -> Result<(), Error> { let options = DeleteOptions { + propagate_backward_references: false, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/verify/system/verify_elements/v0/mod.rs b/packages/rs-drive/src/verify/system/verify_elements/v0/mod.rs index c03c15b4176..46dba77a198 100644 --- a/packages/rs-drive/src/verify/system/verify_elements/v0/mod.rs +++ b/packages/rs-drive/src/verify/system/verify_elements/v0/mod.rs @@ -37,7 +37,9 @@ impl Drive { keys: Vec>, platform_version: &PlatformVersion, ) -> Result<(RootHash, BTreeMap, Option>), Error> { - let mut query = Query::new(); + // Match prove_elements_v0: Query::default() emits a right-to-left proof. + // GroveDB verifies that the proof operation family matches this direction. + let mut query = Query::new_with_direction(false); query.insert_keys(keys); let path_query = PathQuery::new(path, SizedQuery::new(query, None, None)); diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 7f83bc4226e..d55316ffc6e 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -8,5 +8,5 @@ rust-version.workspace = true license = "MIT" [dependencies] -bincode = { version = "=2.0.1", features = ["serde"] } +bincode = { workspace = true, features = ["serde"] } platform-version = { path = "../rs-platform-version" } diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index fda79d9f595..73cfd8fb8a9 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -8,7 +8,7 @@ rust-version.workspace = true license = "MIT" [dependencies] -bincode = { version = "=2.0.1", features = ["serde"] } +bincode = { workspace = true, features = ["serde"] } ciborium = { version = "0.2.2", optional = true } thiserror = "2.0.12" bs58 = "0.5.1" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 363b9490c19..6ccfd107121 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -9,9 +9,9 @@ license = "MIT" [dependencies] thiserror = { version = "2.0.12" } -bincode = { version = "=2.0.1" } +bincode = { workspace = true } versioned-feature-core = "1.0.0" -grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" } +grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } [features] mock-versions = [] diff --git a/packages/rs-platform-wallet-ffi/Cargo.toml b/packages/rs-platform-wallet-ffi/Cargo.toml index 9b8f9d279b1..83cd3fbb4cd 100644 --- a/packages/rs-platform-wallet-ffi/Cargo.toml +++ b/packages/rs-platform-wallet-ffi/Cargo.toml @@ -36,7 +36,7 @@ async-trait = "0.1" # Bincode used to serialize RootExtendedPubKey / ExtendedPubKey across # FFI for watch-only restore. Same version pinned elsewhere in workspace. -bincode = { version = "=2.0.1" } +bincode = { workspace = true } # Hex used for error diagnostics that include a wallet_id. hex = "0.4" diff --git a/packages/rs-platform-wallet-storage/Cargo.toml b/packages/rs-platform-wallet-storage/Cargo.toml index 5d9fc31c24a..cd72b96ad7b 100644 --- a/packages/rs-platform-wallet-storage/Cargo.toml +++ b/packages/rs-platform-wallet-storage/Cargo.toml @@ -55,7 +55,7 @@ refinery = { version = "0.9", default-features = false, features = [ # (which derives bincode 2 `Encode`/`Decode`) and decode # `dpp::AssetLockProof` from the asset-lock blob column. Exact-pinned to # the lock-resolved version to match the crate's `=`-pin discipline. -bincode = { version = "=2.0.1", optional = true } +bincode = { workspace = true, optional = true } tempfile = { version = "3", optional = true } chrono = { version = "0.4", default-features = false, features = [ "clock", diff --git a/packages/rs-platform-wallet/Cargo.toml b/packages/rs-platform-wallet/Cargo.toml index f71439ea73d..68fc1d68fa7 100644 --- a/packages/rs-platform-wallet/Cargo.toml +++ b/packages/rs-platform-wallet/Cargo.toml @@ -61,7 +61,7 @@ zeroize = "1" log = "0.4" # Shielded pool (optional, behind `shielded` feature) -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e", optional = true } +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true } # Direct `rusqlite` access so `FileBackedShieldedStore::open_path` can set # WAL + synchronous=NORMAL pragmas before handing the connection to # `ClientPersistentCommitmentTree`. Version locked to match the rev grovedb diff --git a/packages/rs-sdk-ffi/Cargo.toml b/packages/rs-sdk-ffi/Cargo.toml index e603e523b9d..a25212abc97 100644 --- a/packages/rs-sdk-ffi/Cargo.toml +++ b/packages/rs-sdk-ffi/Cargo.toml @@ -47,7 +47,7 @@ dash-network = { workspace = true, features = ["ffi"] } # FFI and serialization serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -bincode = { version = "=2.0.1", features = ["serde"] } +bincode = { workspace = true, features = ["serde"] } # Async runtime tokio = { version = "1.41", features = ["rt-multi-thread", "macros", "sync", "time"] } diff --git a/packages/rs-sdk-ffi/src/system/queries/path_elements.rs b/packages/rs-sdk-ffi/src/system/queries/path_elements.rs index 96466024445..93eaa248b66 100644 --- a/packages/rs-sdk-ffi/src/system/queries/path_elements.rs +++ b/packages/rs-sdk-ffi/src/system/queries/path_elements.rs @@ -156,19 +156,29 @@ fn get_path_elements( /// `NonCounted` and `NotSummed` are transparent wrappers around another /// element; we render them as `non_counted()` / `not_summed()` /// so that the wrapped element's value is still visible to the caller. +/// Backward-reference metadata does not change the rendered payload; the +/// `type` field identifies the variants that support it. fn format_element_data(element: &Element) -> String { match element { - Element::Item(data, _) => hex::encode(data), + Element::Item(data, _) | Element::ItemWithBackwardsReferences(data, _, _) => { + hex::encode(data) + } Element::Reference(reference, _, _) => format!("{:?}", reference), + Element::BidirectionalReference(reference, _) => { + format!("{:?}", reference.forward_reference_path) + } Element::Tree(_, _) => "tree".to_string(), Element::SumTree(_, _, _) => "sum_tree".to_string(), - Element::SumItem(value, _) => format!("sum_item:{}", value), + Element::SumItem(value, _) | Element::SumItemWithBackwardsReferences(value, _, _) => { + format!("sum_item:{}", value) + } Element::BigSumTree(_, value, _) => format!("big_sum_tree:{}", value), Element::CountTree(_, count, _) => format!("count_tree:{}", count), Element::CountSumTree(_, count, sum, _) => { format!("count_sum_tree:{}:{}", count, sum) } - Element::ItemWithSumItem(data, sum, _) => { + Element::ItemWithSumItem(data, sum, _) + | Element::ItemWithSumItemWithBackwardsReferences(data, sum, _, _) => { format!("item_with_sum_item:{}:{}", hex::encode(data), sum) } Element::ReferenceWithSumItem(reference, _, sum, _) => { @@ -218,6 +228,16 @@ fn format_element_type(element: &Element) -> String { match element { Element::Item(_, _) => "item".to_string(), Element::Reference(_, _, _) => "reference".to_string(), + Element::BidirectionalReference(_, _) => "bidirectional_reference".to_string(), + Element::ItemWithBackwardsReferences(_, _, _) => { + "item_with_backwards_references".to_string() + } + Element::SumItemWithBackwardsReferences(_, _, _) => { + "sum_item_with_backwards_references".to_string() + } + Element::ItemWithSumItemWithBackwardsReferences(_, _, _, _) => { + "item_with_sum_item_with_backwards_references".to_string() + } Element::Tree(_, _) => "tree".to_string(), Element::SumTree(_, _, _) => "sum_tree".to_string(), Element::SumItem(_, _) => "sum_item".to_string(), @@ -257,6 +277,49 @@ fn format_element_type(element: &Element) -> String { mod tests { use super::*; use crate::test_utils::test_utils::create_mock_sdk_handle; + use dash_sdk::drive::grovedb::element::reference_path::ReferencePathType; + + #[test] + fn should_preserve_payload_rendering_for_backward_reference_variants() { + let path = ReferencePathType::SiblingReference(b"target".to_vec()); + let cases = [ + ( + Element::new_bidirectional_reference_with_options( + path.clone(), + Some(4), + true, + None, + ), + Element::Reference(path, Some(4), None), + "bidirectional_reference", + ), + ( + Element::ItemWithBackwardsReferences(vec![0, 255], Default::default(), None), + Element::Item(vec![0, 255], None), + "item_with_backwards_references", + ), + ( + Element::SumItemWithBackwardsReferences(-42, Default::default(), None), + Element::SumItem(-42, None), + "sum_item_with_backwards_references", + ), + ( + Element::ItemWithSumItemWithBackwardsReferences( + vec![0, 255], + -42, + Default::default(), + None, + ), + Element::ItemWithSumItem(vec![0, 255], -42, None), + "item_with_sum_item_with_backwards_references", + ), + ]; + + for (element, base, expected_type) in cases { + assert_eq!(format_element_data(&element), format_element_data(&base)); + assert_eq!(format_element_type(&element), expected_type); + } + } #[test] fn test_get_path_elements_null_handle() { diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 3a142158e1b..b7a246aedb5 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -18,7 +18,7 @@ drive = { path = "../rs-drive", default-features = false, features = [ ] } drive-proof-verifier = { path = "../rs-drive-proof-verifier", default-features = false } -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e", features = [ +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", features = [ "client", "sqlite", ], optional = true } diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index b95f827d797..089fae064ff 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -20,7 +20,7 @@ dpp = { path = "../rs-dpp", default-features = false, features = [ "ed25519-dalek", ] } async-trait = { version = "0.1.79" } -bincode = { version = "=2.0.1", features = ["serde"] } +bincode = { workspace = true, features = ["serde"] } base64 = { version = "0.22.1" } hex = { version = "0.4.3" } tracing = "0.1.41" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 5e7b2b71a1b..06a052a4f10 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -12,7 +12,7 @@ license = "MIT" [dependencies] tracing = "0.1.41" -bincode = { version = "=2.0.1", features = ["serde"] } +bincode = { workspace = true, features = ["serde"] } drive = { path = "../rs-drive", default-features = false, features = [ "verify", ] } diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index 859c8474525..23864d7e170 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -48,7 +48,7 @@ anyhow = { version = "1.0.75" } # required, cargo-machete false positive wasm-bindgen-futures = "0.4.58" async-trait = "0.1.59" -bincode = { version = "=2.0.1" } +bincode = { workspace = true } [package.metadata.cargo-machete] ignored = ["wasm-bindgen-futures"] diff --git a/packages/wasm-dpp2/Cargo.toml b/packages/wasm-dpp2/Cargo.toml index 7af47f47f09..b8ef276100b 100644 --- a/packages/wasm-dpp2/Cargo.toml +++ b/packages/wasm-dpp2/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib", "lib"] # TODO: Consider to use talc allocator #talc = { version = "=4.4.2", default-features = false, features = ["lock_api"] } async-trait = { version = "0.1.79" } -bincode = "=2.0.1" +bincode = { workspace = true } wasm-bindgen = { version = "=0.2.108", default-features = false, features = [ "serde-serialize", ] } diff --git a/packages/wasm-drive-verify/Cargo.toml b/packages/wasm-drive-verify/Cargo.toml index 9868a27466b..ae145a41b8f 100644 --- a/packages/wasm-drive-verify/Cargo.toml +++ b/packages/wasm-drive-verify/Cargo.toml @@ -20,7 +20,7 @@ dpp = { path = "../rs-dpp", default-features = false, features = [ "platform-value-json", ] } -bincode = { version = "=2.0.1" } +bincode = { workspace = true } wasm-bindgen = { version = "=0.2.108" } serde = { version = "1.0.193", default-features = false, features = [ "alloc", diff --git a/packages/wasm-sdk/src/queries/system.rs b/packages/wasm-sdk/src/queries/system.rs index 1051361908f..0f068698282 100644 --- a/packages/wasm-sdk/src/queries/system.rs +++ b/packages/wasm-sdk/src/queries/system.rs @@ -29,6 +29,10 @@ export type GroveElementType = | "provableCountTree" | "itemWithSumItem" | "referenceWithSumItem" + | "bidirectionalReference" + | "itemWithBackwardsReferences" + | "sumItemWithBackwardsReferences" + | "itemWithSumItemWithBackwardsReferences" | "provableCountSumTree" | "provableCountProvableSumTree" | "provableSumTree" @@ -857,8 +861,10 @@ fn set_js_property(object: &Object, property: &str, value: &JsValue) -> Result<( fn element_value_bytes(element: &Element) -> Option> { match element { - Element::Item(bytes, _) => Some(bytes.clone()), - Element::ItemWithSumItem(bytes, _, _) => Some(bytes.clone()), + Element::Item(bytes, _) + | Element::ItemWithBackwardsReferences(bytes, _, _) + | Element::ItemWithSumItem(bytes, _, _) + | Element::ItemWithSumItemWithBackwardsReferences(bytes, _, _, _) => Some(bytes.clone()), Element::NonCounted(inner) | Element::NotSummed(inner) | Element::NotCountedOrSummed(inner) => element_value_bytes(inner), @@ -868,7 +874,9 @@ fn element_value_bytes(element: &Element) -> Option> { fn element_sum(element: &Element) -> Option { match element { - Element::SumItem(sum, _) => Some(*sum as i128), + Element::SumItem(sum, _) + | Element::SumItemWithBackwardsReferences(sum, _, _) + | Element::ItemWithSumItemWithBackwardsReferences(_, sum, _, _) => Some(*sum as i128), Element::SumTree(_, sum, _) => Some(*sum as i128), Element::BigSumTree(_, sum, _) => Some(*sum), Element::CountSumTree(_, _, sum, _) => Some(*sum as i128), @@ -901,16 +909,21 @@ fn element_reference_target( ) -> (Option>>, Option) { match element { Element::Reference(reference_path, _, _) - | Element::ReferenceWithSumItem(reference_path, _, _, _) => { - match path_from_reference_path_type(reference_path.clone(), parent_path, Some(key)) { - Ok(target) => (Some(target), None), - Err(error) => { - let message = error.to_string(); - tracing::warn!("failed to resolve GroveDB reference target: {}", message); - (None, Some(message)) - } + | Element::ReferenceWithSumItem(reference_path, _, _, _) + | Element::BidirectionalReference( + dash_sdk::drive::grovedb::element::BidirectionalReference { + forward_reference_path: reference_path, + .. + }, + _, + ) => match path_from_reference_path_type(reference_path.clone(), parent_path, Some(key)) { + Ok(target) => (Some(target), None), + Err(error) => { + let message = error.to_string(); + tracing::warn!("failed to resolve GroveDB reference target: {}", message); + (None, Some(message)) } - } + }, Element::NonCounted(inner) | Element::NotSummed(inner) | Element::NotCountedOrSummed(inner) => element_reference_target(inner, parent_path, key), @@ -920,6 +933,12 @@ fn element_reference_target( fn element_type_name(element: &Element) -> &'static str { match element { + Element::BidirectionalReference(_, _) => "bidirectionalReference", + Element::ItemWithBackwardsReferences(_, _, _) => "itemWithBackwardsReferences", + Element::SumItemWithBackwardsReferences(_, _, _) => "sumItemWithBackwardsReferences", + Element::ItemWithSumItemWithBackwardsReferences(_, _, _, _) => { + "itemWithSumItemWithBackwardsReferences" + } Element::Item(_, _) => "item", Element::Reference(_, _, _) => "reference", Element::Tree(_, _) => "tree", @@ -953,6 +972,11 @@ fn element_type_name(element: &Element) -> &'static str { fn non_counted_element_type_name(element: &Element) -> &'static str { match element { + // GroveDB rejects aggregation wrappers around these variants. + Element::BidirectionalReference(_, _) + | Element::ItemWithBackwardsReferences(_, _, _) + | Element::SumItemWithBackwardsReferences(_, _, _) + | Element::ItemWithSumItemWithBackwardsReferences(_, _, _, _) => element_type_name(element), Element::Item(_, _) => "nonCountedItem", Element::Reference(_, _, _) => "nonCountedReference", Element::Tree(_, _) => "nonCountedTree", @@ -1734,6 +1758,35 @@ mod tests { use super::*; use dash_sdk::drive::grovedb::element::reference_path::ReferencePathType; + #[test] + fn should_render_bidirectional_elements_without_losing_payloads() { + let item = Element::new_item_allowing_bidirectional_references(vec![1, 2]); + let sum = Element::new_sum_item_allowing_bidirectional_references(-3); + let combined = + Element::new_item_with_sum_item_allowing_bidirectional_references(vec![4, 5], 6); + let reference = Element::new_bidirectional_reference(ReferencePathType::SiblingReference( + b"target".to_vec(), + )); + let union = typescript_element_type_union(); + for (element, name) in [ + (&item, "itemWithBackwardsReferences"), + (&sum, "sumItemWithBackwardsReferences"), + (&combined, "itemWithSumItemWithBackwardsReferences"), + (&reference, "bidirectionalReference"), + ] { + assert_eq!(element_type_name(element), name); + assert!(union.contains(&format!("\"{name}\""))); + } + assert_eq!(element_value_bytes(&item), Some(vec![1, 2])); + assert_eq!(element_sum(&sum), Some(-3)); + assert_eq!(element_value_bytes(&combined), Some(vec![4, 5])); + assert_eq!(element_sum(&combined), Some(6)); + assert_eq!( + element_reference_target(&reference, &[b"parent".to_vec()], b"source"), + (Some(vec![b"parent".to_vec(), b"target".to_vec()]), None), + ); + } + #[test] fn should_decode_raw_bytes_without_utf8_expansion() { let input = [0x80, 0xff]; From 89b9b9271351547e46fc848a82dfc81e427e9929 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 9 Sep 2026 06:21:48 +0700 Subject: [PATCH 2/9] build(docker): build rocksdb 11.8.1 for the prebuilt static library librocksdb-sys 0.19.0+11.8.1 (pulled in by rocksdb 0.25) targets the RocksDB 11 C API, which dropped the deprecated in_range callback from rocksdb_slicetransform_create. The Docker image and the librocksdb GitHub action still built RocksDB 10.4.2 and 9.9.3, so bindgen produced the six-argument signature and the rocksdb crate failed to compile against it. Build 11.8.1 in both places to match the vendored version. Co-Authored-By: Claude Fable 5.1 --- .github/actions/librocksdb/action.yaml | 4 ++-- Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/librocksdb/action.yaml b/.github/actions/librocksdb/action.yaml index 5411bbc9859..8bb32f9fae1 100644 --- a/.github/actions/librocksdb/action.yaml +++ b/.github/actions/librocksdb/action.yaml @@ -6,9 +6,9 @@ name: "librocksdb" description: "Build and install librocksdb" inputs: version: - description: RocksDB version, eg. "9.9.3" + description: RocksDB version, eg. "11.8.1" required: false - default: "9.9.3" + default: "11.8.1" force: description: Force rebuild required: false diff --git a/Dockerfile b/Dockerfile index 846150203f7..13a762334ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -306,7 +306,7 @@ ONBUILD ARG CARGO_BUILD_PROFILE=dev RUN --mount=type=secret,id=AWS < Date: Wed, 9 Sep 2026 06:21:48 +0700 Subject: [PATCH 3/9] fix(drive): verify a page's cursor document in the page's walk direction GroveDB now refuses a V1 layer proof that is read in the other op family (grovedb #863): a layer proof is emitted entirely in the family of the direction its query walks. When a document query carries a startAt or startAfter cursor, the prover merges the one-key cursor lookup into the page proof, and since grovedb's merge needs every input to walk the same way, the cursor layer is emitted in the page's orderBy direction. The verifier rebuilt that lookup as a fresh ascending single-key query, so every proved descending page with a cursor failed with InvalidProof. Read the cursor layer in the page's direction when it is verified as a subset of the page proof. The direction comes from the same query builder the prover uses and never depends on the cursor document; a single key decodes identically either way. Co-Authored-By: Claude Fable 5.1 --- .../verify_start_at_document_in_proof/v0/mod.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/v0/mod.rs b/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/v0/mod.rs index 301afe65148..d22ff197018 100644 --- a/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/v0/mod.rs +++ b/packages/rs-drive/src/verify/document/verify_start_at_document_in_proof/v0/mod.rs @@ -43,10 +43,25 @@ impl DriveDocumentQuery<'_> { self.validate_in_clause_shape(platform_version)?; let (start_at_document_path, start_at_document_key) = self.start_at_document_path_and_key(&document_id); - let path_query = PathQuery::new_single_key( + let mut path_query = PathQuery::new_single_key( start_at_document_path.clone(), start_at_document_key.clone(), ); + if is_proof_subset { + // Inside a page proof this one-key lookup is merged with the main + // query, and grovedb's merge needs every input to walk the same + // way, so the prover emits the cursor layer in the page's + // `orderBy` direction (see `construct_path_query_operations`). + // A V1 layer proof only verifies in the op family of the + // direction it is read in, so read it the same way here. A single + // key decodes identically either way; this only selects the op + // family, and the direction never depends on the cursor document. + path_query.query.query.left_to_right = self + .construct_path_query(None, platform_version)? + .query + .query + .left_to_right; + } let (root_hash, mut proved_key_values) = if is_proof_subset { GroveDb::verify_subset_query(proof, &path_query, &platform_version.drive.grove_version)? } else { From c1de4a57ce73a4ada6903c9cd8f674b51a5c2fc7 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 9 Sep 2026 06:21:48 +0700 Subject: [PATCH 4/9] test(drive-abci): verify contestant vote proofs with the requested order and cursor The proved contestant-votes helper verified every proof with a fixed ascending, unlimited query regardless of the request it had just sent. GroveDB now refuses a layer proof read in the other op family, so the descending request failed with InvalidProof. Mirror the request's order, count and cursor into the verifier query, as the SDK's proof verifier does. Co-Authored-By: Claude Fable 5.1 --- .../state_transitions/masternode_vote/mod.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs index 3707d37c101..2cb3852135d 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs @@ -3007,6 +3007,19 @@ mod tests { let index_name = "parentNameAndLabel".to_string(); + // The verifier has to walk the proof the way the request asked + // for it, as the SDK's proof verifier does when it mirrors the + // request: grovedb refuses a layer proof read in the other + // direction. + let verifier_start_at = start_at_identifier_info.as_ref().map(|info| { + let start_identifier: [u8; 32] = info + .start_identifier + .clone() + .try_into() + .expect("expected a 32 byte start identifier"); + (start_identifier, info.start_identifier_included) + }); + let query_validation_result = platform .query_contested_resource_voters_for_identity( GetContestedResourceVotersForIdentityRequest { @@ -3063,9 +3076,9 @@ mod tests { }, contestant_id: contender_id, offset: None, - limit: None, - start_at: None, - order_ascending: true, + limit: count.map(|count| count as u16), + start_at: verifier_start_at, + order_ascending, }; let (_, voters) = resolved_contested_document_vote_poll_drive_query From 6b18e24f2959b7354dc32bdc9bee6ac8ce55c93c Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 9 Sep 2026 06:21:48 +0700 Subject: [PATCH 5/9] style(drive-abci): format the keep-history delete replay test cargo fmt --check fails on v4.2-dev since #4218 landed this test unformatted. Co-Authored-By: Claude Fable 5.1 --- .../state_transitions/batch/tests/document/deletion.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs index 0c47b893b05..27bcd8a748b 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs @@ -406,8 +406,10 @@ mod deletion_tests { } #[tokio::test] - async fn test_document_delete_on_document_type_that_keeps_history_replays_protocol_version_13() { - run_document_delete_on_document_type_that_keeps_history_at_protocol_version(13, false).await; + async fn test_document_delete_on_document_type_that_keeps_history_replays_protocol_version_13() + { + run_document_delete_on_document_type_that_keeps_history_at_protocol_version(13, false) + .await; } /// Exercises an already-deployed contradictory contract at both sides of From 38eca5808e30e3721044cfe254fcecc46b788990 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 9 Sep 2026 23:37:59 +0700 Subject: [PATCH 6/9] fix(drive): keep a $id page's direction and limit when the cursor merges onto its own layer A startAt/startAfter page proof merges the one-key cursor lookup with the page query. For an index-ordered page the two live under different subtrees, so the merge synthesizes a root above both and that root is walked ascending so the cursor branch spends its reserved limit + 1 slot first; the verifier never sees that root. A $id-ordered page addresses the primary-key tree directly (a history-keeping type's cursor sits one level below it), so the merge point is the page query's own root layer. Flipping that layer ascending contradicts the descending direction the verifier reads it in, and the reserved slot makes an inclusive page return limit + 1 rows matching the page query. GroveDB 6 rejects both: "inverted op in a left-to-right walk" and "Proof returns more data than limit". When the merge lands on the page query's own layer, keep the requested direction, and reserve the extra slot only when the page's items do not already cover the cursor key. Round-trip tests page the family contract by $id in both directions with inclusive and exclusive cursors, for plain and history-keeping document types, verifying every page's proof. Co-Authored-By: Claude Fable 5.1 --- packages/rs-drive/src/query/mod.rs | 84 +++++++++++++---- packages/rs-drive/tests/query_tests.rs | 91 ++++++++++++++++++ .../rs-drive/tests/query_tests_history.rs | 92 +++++++++++++++++++ 3 files changed, 250 insertions(+), 17 deletions(-) diff --git a/packages/rs-drive/src/query/mod.rs b/packages/rs-drive/src/query/mod.rs index 27c23346f06..a5f8662d2c2 100644 --- a/packages/rs-drive/src/query/mod.rs +++ b/packages/rs-drive/src/query/mod.rs @@ -2042,23 +2042,73 @@ impl<'a> DriveDocumentQuery<'a> { &platform_version.drive.grove_version, ) .map_err(Error::from)?; - merged.query.limit = limit.map(|a| a.saturating_add(1)); - // The merged root must be walked ascending regardless of the - // page's `orderBy` direction: the `limit + 1` above reserves - // one result slot for the cursor document, and the prover - // spends the budget in root traversal order. Ascending, the - // cursor branch (key `[0]`) is visited first and takes its - // reserved slot; descending, the index branch sorts first, - // consumes the whole budget mid-timeline, and the prover then - // omits the cursor subtree's lower layer — an unverifiable - // proof (the verifier extracts the cursor document from the - // proof before rebuilding the main query). Only this - // synthesized root flips: each input's own query lands intact - // inside a subquery branch, keeping in-branch result order. - // The verifier never rebuilds the merged query — it runs the - // cursor and main queries as separate subset queries — so the - // root's direction is not client-visible. - merged.query.query.left_to_right = true; + // Where the merge lands decides how the two queries combine. An + // index-ordered page lives under its index tree while the cursor + // lookup lives under the primary-key tree, so the merge synthesizes + // a root one level above both with each query in its own branch. + // A `$id`-ordered page addresses the primary-key tree directly: the + // cursor lookup shares that path (or, for a history-keeping type, + // sits one level below it), so the merge point is the page query's + // own root layer and the merged query IS that layer. + let cursor_on_page_layer = merged.path == main_path_query.path; + // The cursor's key on that shared layer: the cursor query's own key + // when both paths coincide, otherwise the path component the cursor + // query descends through. + let cursor_key_on_page_layer: Option<&[u8]> = if !cursor_on_page_layer { + None + } else if let Some(component) = start_at_path_query.path.get(merged.path.len()) { + Some(component.as_slice()) + } else { + match start_at_path_query.query.query.items.as_slice() { + [QueryItem::Key(cursor_key)] => Some(cursor_key.as_slice()), + _ => None, + } + }; + // On a shared layer the cursor row is already one of the page's + // rows whenever the page's own items cover it (an inclusive + // `startAt` on a range, or an `in` list that names the cursor). It + // then needs no reserved slot: reserving one would make the layer + // return `limit + 1` rows matching the page query, which the + // verifier rejects as more data than its limit. + let cursor_row_in_page = cursor_key_on_page_layer.is_some_and(|cursor_key| { + main_path_query + .query + .query + .items + .iter() + .any(|item| item.contains(cursor_key)) + }); + merged.query.limit = limit.map(|a| { + if cursor_row_in_page { + a + } else { + a.saturating_add(1) + } + }); + if !cursor_on_page_layer { + // A synthesized root must be walked ascending regardless of + // the page's `orderBy` direction: the `limit + 1` above + // reserves one result slot for the cursor document, and the + // prover spends the budget in root traversal order. Ascending, + // the cursor branch (key `[0]`) is visited first and takes its + // reserved slot; descending, the index branch sorts first, + // consumes the whole budget mid-timeline, and the prover then + // omits the cursor subtree's lower layer — an unverifiable + // proof (the verifier extracts the cursor document from the + // proof before rebuilding the main query). Only this + // synthesized root flips: each input's own query lands intact + // inside a subquery branch, keeping in-branch result order. + // The verifier never rebuilds the merged query — it runs the + // cursor and main queries as separate subset queries — so the + // root's direction is not client-visible. + // + // A shared layer has no synthesized root to flip: the merged + // query IS the page query's own layer, which the verifier + // walks in the requested direction, and the cursor row sits at + // the page's boundary, so the requested direction reaches it + // first anyway. + merged.query.query.left_to_right = true; + } Ok(merged) } else { Ok(main_path_query) diff --git a/packages/rs-drive/tests/query_tests.rs b/packages/rs-drive/tests/query_tests.rs index de895e70f2e..59d47298a03 100644 --- a/packages/rs-drive/tests/query_tests.rs +++ b/packages/rs-drive/tests/query_tests.rs @@ -8167,6 +8167,97 @@ mod tests { } #[cfg(all(feature = "server", feature = "verify"))] + #[test] + fn test_proved_primary_key_cursor_pages_in_both_directions() { + // A `$id`-ordered page with a cursor merges the cursor lookup and the + // page query at the same path: the primary-key tree. The merge then has + // no synthesized root above the page query, so the document layer must + // keep the requested direction in the proof; the verifier reads both + // the cursor lookup and the page in that direction, and GroveDB refuses + // a V1 layer proof read in the other op family. + use dpp::document::DocumentV0Getters; + use dpp::prelude::Identifier; + use platform_value::string_encoding::Encoding; + + let platform_version = PlatformVersion::latest(); + let (drive, contract) = setup_family_tests(10, 73509, platform_version); + let person_document_type = contract + .document_type_for_name("person") + .expect("contract should have a person document type"); + let root_hash = drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .expect("there is always a root hash"); + + let ids_of = |results: &[Vec]| -> Vec { + results + .iter() + .map(|bytes| { + Document::from_bytes(bytes, person_document_type, platform_version) + .expect("we should be able to deserialize the document") + .id() + }) + .collect() + }; + let build = |query_value: serde_json::Value| { + let cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + DriveDocumentQuery::from_cbor( + cbor.as_slice(), + &contract, + person_document_type, + &drive.config, + platform_version, + ) + .expect("query should be built") + }; + + let (all_results, _, _) = build(json!({ + "limit": 100, + "orderBy": [["$id", "asc"]], + })) + .execute_raw_results_no_proof(&drive, None, None, platform_version) + .expect("query should be executed"); + let ascending_ids = ids_of(&all_results); + assert_eq!(ascending_ids.len(), 10); + + for (ascending, included) in [(true, true), (true, false), (false, true), (false, false)] { + let ordered: Vec = if ascending { + ascending_ids.clone() + } else { + ascending_ids.iter().rev().cloned().collect() + }; + let cursor = ordered[3]; + let expected: Vec = if included { + ordered[3..6].to_vec() + } else { + ordered[4..7].to_vec() + }; + let cursor_key = if included { "startAt" } else { "startAfter" }; + let case = format!( + "orderBy $id {} with {cursor_key}", + if ascending { "asc" } else { "desc" } + ); + + let query = build(json!({ + cursor_key: cursor.to_string(Encoding::Base58), + "limit": 3, + "orderBy": [["$id", if ascending { "asc" } else { "desc" }]], + })); + let (results, _, _) = query + .execute_raw_results_no_proof(&drive, None, None, platform_version) + .expect("query should be executed"); + assert_eq!(ids_of(&results), expected, "{case}: unproved page"); + + let (proof_root_hash, proof_results, _) = query + .execute_with_proof_only_get_elements(&drive, None, None, platform_version) + .unwrap_or_else(|e| panic!("{case}: proved page should verify: {e}")); + assert_eq!(root_hash, proof_root_hash, "{case}: proof root hash"); + assert_eq!(results, proof_results, "{case}: proved page"); + } + } + #[test] fn test_proved_desc_range_continuation_page_includes_cursor_document() { // Issue #4540: a continuation page over a non-unique diff --git a/packages/rs-drive/tests/query_tests_history.rs b/packages/rs-drive/tests/query_tests_history.rs index a92fad69c74..30a7d004f41 100644 --- a/packages/rs-drive/tests/query_tests_history.rs +++ b/packages/rs-drive/tests/query_tests_history.rs @@ -256,6 +256,98 @@ fn test_setup() { setup(10, Some(range_inserts), 73509, platform_version); } +#[cfg(feature = "server")] +#[test] +fn test_proved_primary_key_cursor_pages_over_history_in_both_directions() { + // The history-keeping twin of the primary-key cursor test in + // query_tests.rs. Here the cursor lookup lands one level below the page + // query (`.../0/` with key `[0]`), so the merge point is the page + // query's own root layer: the document-id layer must keep the requested + // direction in the proof and the cursor must not claim a second slot. + use dpp::document::DocumentV0Getters; + use dpp::platform_value::string_encoding::Encoding; + use dpp::prelude::Identifier; + use drive::query::DriveDocumentQuery; + + let platform_version = PlatformVersion::latest(); + let (drive, contract) = setup(10, None, 73509, platform_version); + let person_document_type = contract + .document_type_for_name("person") + .expect("contract should have a person document type"); + let root_hash = drive + .grove + .root_hash(None, &platform_version.drive.grove_version) + .unwrap() + .expect("there is always a root hash"); + + let ids_of = |results: &[Vec]| -> Vec { + results + .iter() + .map(|bytes| { + Document::from_bytes(bytes, person_document_type, platform_version) + .expect("we should be able to deserialize the document") + .id() + }) + .collect() + }; + let build = |query_value: serde_json::Value| { + let cbor = cbor_serializer::serializable_value_to_cbor(&query_value, None) + .expect("expected to serialize to cbor"); + DriveDocumentQuery::from_cbor( + cbor.as_slice(), + &contract, + person_document_type, + &drive.config, + platform_version, + ) + .expect("query should be built") + }; + + let (all_results, _, _) = build(json!({ + "limit": 100, + "orderBy": [["$id", "asc"]], + })) + .execute_raw_results_no_proof(&drive, None, None, platform_version) + .expect("query should be executed"); + let ascending_ids = ids_of(&all_results); + assert_eq!(ascending_ids.len(), 10); + + for (ascending, included) in [(true, true), (true, false), (false, true), (false, false)] { + let ordered: Vec = if ascending { + ascending_ids.clone() + } else { + ascending_ids.iter().rev().cloned().collect() + }; + let cursor = ordered[3]; + let expected: Vec = if included { + ordered[3..6].to_vec() + } else { + ordered[4..7].to_vec() + }; + let cursor_key = if included { "startAt" } else { "startAfter" }; + let case = format!( + "history orderBy $id {} with {cursor_key}", + if ascending { "asc" } else { "desc" } + ); + + let query = build(json!({ + cursor_key: cursor.to_string(Encoding::Base58), + "limit": 3, + "orderBy": [["$id", if ascending { "asc" } else { "desc" }]], + })); + let (results, _, _) = query + .execute_raw_results_no_proof(&drive, None, None, platform_version) + .expect("query should be executed"); + assert_eq!(ids_of(&results), expected, "{case}: unproved page"); + + let (proof_root_hash, proof_results, _) = query + .execute_with_proof_only_get_elements(&drive, None, None, platform_version) + .unwrap_or_else(|e| panic!("{case}: proved page should verify: {e}")); + assert_eq!(root_hash, proof_root_hash, "{case}: proof root hash"); + assert_eq!(results, proof_results, "{case}: proved page"); + } +} + #[cfg(feature = "server")] #[test] fn test_query_historical_first_platform_version() { From 7b596fff45d5fa09d7d93426be98f019c59df3be Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 9 Sep 2026 23:37:59 +0700 Subject: [PATCH 7/9] test(drive-abci): page proved contestant votes with cursors and limits The proved contestant-votes test only requested whole result sets, so the helper's forwarding of the request's count and cursor into the verifier query was never exercised. Add paged proved requests over the 50-voter contender: a limit smaller than the result set with inclusive and exclusive cursors in both directions, plus a short final page, each compared with the matching slice of the full ascending voter sequence. Co-Authored-By: Claude Fable 5.1 --- .../state_transitions/masternode_vote/mod.rs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs index 2cb3852135d..de0ad97a00d 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs @@ -3490,6 +3490,53 @@ mod tests { assert_eq!(voters_3, voters_3_desc); assert_eq!(voters_3.len(), 8); + + // Paged proved requests: a limit smaller than the 50 available + // voters and a cursor, inclusive and exclusive, in both + // directions. `voters_1` is the full ascending sequence, so each + // page must equal the matching slice of it, and the verifier + // must run with the request's own order, count and cursor for + // the proof to verify at all. + let cursor = |index: usize, included: bool| { + Some( + get_contested_resource_voters_for_identity_request_v0::StartAtIdentifierInfo { + start_identifier: voters_1[index].to_vec(), + start_identifier_included: included, + }, + ) + }; + let page = |count: u32, order_ascending: bool, start_at| { + get_proved_contestant_votes( + &platform, + &platform_state, + dpns_contract.as_ref(), + contender_1.id(), + "quantum", + Some(count), + order_ascending, + start_at, + platform_version, + ) + }; + + assert_eq!(page(10, true, cursor(9, true)), voters_1[9..19].to_vec()); + assert_eq!(page(10, true, cursor(9, false)), voters_1[10..20].to_vec()); + + let descending_from_40_inclusive: Vec = + voters_1[31..=40].iter().rev().copied().collect(); + assert_eq!( + page(10, false, cursor(40, true)), + descending_from_40_inclusive + ); + let descending_from_40_exclusive: Vec = + voters_1[30..=39].iter().rev().copied().collect(); + assert_eq!( + page(10, false, cursor(40, false)), + descending_from_40_exclusive + ); + + // A short final page: the limit exceeds what remains. + assert_eq!(page(10, true, cursor(45, false)), voters_1[46..50].to_vec()); } } From 6b40e11f5e7f4c559a0f4b220caa7aed8c3bc27f Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 12 Sep 2026 00:07:51 +0700 Subject: [PATCH 8/9] build(drive)!: adopt GroveDB develop f75fa362 with automatic backward references Advance the GroveDB pin from 985ece65 to develop f75fa362 (GroveDB #949, #951 and #952). GroveDB #951 replaces the per-call propagate_backward_references flag with a backward_references_policy on insert, delete, clear and batch options, defaulting to Maintain on GroveDB V4 (Platform PV14; PV13 stays on V3). Drive selects Maintain explicitly so ordinary writes keep backward-reference participants consistent without each caller predicting them, and every EstimatedLayerInformation declares may_contain_backward_references: false because Drive stores no participants, which keeps estimates byte-identical to the previous flag-less behaviour. GroveDB #949 only changes V4 recursive discovery over non-Merk descendants and needs no Drive change. Re-pin twelve PV14 processing-fee baselines in drive-abci: transitions that remove emptied index subtrees (document delete, transfer and purchase, group-action confirm) now pay for GroveDB's participant scan of those subtrees, while batch preparation through retained Merk nodes bills slightly fewer reads on DPNS create and document replace. PV13 fees are unchanged. Co-Authored-By: Claude Fable 5.1 --- Cargo.lock | 32 +++++++++---------- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 8 ++--- .../batch/tests/document/deletion.rs | 11 +++++-- .../batch/tests/document/dpns.rs | 6 ++-- .../batch/tests/document/nft.rs | 15 +++++++-- .../batch/tests/document/replacement.rs | 6 ++-- .../batch/tests/document/transfer.rs | 21 +++++++++--- .../batch/tests/token/burn/mod.rs | 6 ++-- packages/rs-drive/Cargo.toml | 14 ++++---- .../for_address_balance_update/v0/mod.rs | 3 ++ .../for_address_balance_update/v1/mod.rs | 3 ++ .../v0/mod.rs | 2 ++ .../v0/mod.rs | 3 ++ .../v1/mod.rs | 3 ++ .../v0/mod.rs | 1 + .../v0/mod.rs | 2 ++ .../v1/mod.rs | 2 ++ .../v2/mod.rs | 2 ++ .../v0/mod.rs | 2 ++ .../v1/mod.rs | 2 ++ .../v2/mod.rs | 2 ++ .../v0/mod.rs | 2 ++ .../v1/mod.rs | 2 ++ .../v0/mod.rs | 1 + .../v0/mod.rs | 3 ++ .../v0/mod.rs | 2 ++ .../v1/mod.rs | 2 ++ .../v2/mod.rs | 2 ++ .../v0/mod.rs | 2 ++ .../v1/mod.rs | 2 ++ .../v2/mod.rs | 2 ++ .../mod.rs | 4 +++ .../v0/mod.rs | 2 ++ .../v0/mod.rs | 2 ++ .../v0/mod.rs | 2 ++ .../v0/mod.rs | 2 ++ .../v0/mod.rs | 2 ++ .../for_add_group_action/v0/mod.rs | 10 ++++++ .../estimated_costs/for_add_groups/v0/mod.rs | 4 +++ .../v0/mod.rs | 1 + .../estimation_costs/for_balances/v0/mod.rs | 2 ++ .../for_identity_contract_info/v0/mod.rs | 4 +++ .../v0/mod.rs | 1 + .../v0/mod.rs | 1 + .../v0/mod.rs | 1 + .../for_keys_for_identity_id/v0/mod.rs | 4 +++ .../for_negative_credit/v0/mod.rs | 2 ++ .../v0/mod.rs | 1 + .../for_root_key_reference_tree/v0/mod.rs | 1 + .../for_update_nonce/v0/mod.rs | 3 ++ .../for_update_revision/v0/mod.rs | 3 ++ .../v0/mod.rs | 2 ++ .../v0/mod.rs | 1 + .../v0/mod.rs | 3 ++ .../v0/mod.rs | 7 ++++ .../v0/mod.rs | 5 +++ .../v0/mod.rs | 2 ++ .../v0/mod.rs | 2 ++ .../src/drive/shielded/estimated_costs.rs | 7 ++++ .../for_total_system_credits_update/v0/mod.rs | 2 ++ .../v0/mod.rs | 1 + .../v0/mod.rs | 2 ++ .../v0/mod.rs | 3 ++ .../for_token_balances/v0/mod.rs | 4 +++ .../for_token_contract_infos/v0/mod.rs | 3 ++ .../for_token_direct_selling_prices/v0/mod.rs | 3 ++ .../for_token_identity_infos/v0/mod.rs | 4 +++ .../v0/mod.rs | 3 ++ .../v0/mod.rs | 4 +++ .../for_token_status_infos/v0/mod.rs | 3 ++ .../for_token_total_supply/v0/mod.rs | 3 ++ .../v0/mod.rs | 2 ++ .../grove_operations/batch_delete/v0/mod.rs | 3 +- .../v0/mod.rs | 3 +- .../grove_operations/batch_move/v0/mod.rs | 3 +- .../batch_move_items_in_path_query/v0/mod.rs | 3 +- .../batch_remove_raw/v0/mod.rs | 3 +- .../v0/mod.rs | 3 +- .../v0/mod.rs | 3 +- .../grove_batch_operations_costs/v0/mod.rs | 3 +- .../grove_operations/grove_clear/v0/mod.rs | 2 ++ .../grove_operations/grove_delete/v0/mod.rs | 3 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-wallet/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- 86 files changed, 264 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3938f049474..ad9b2c7c3ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2957,7 +2957,7 @@ dependencies = [ [[package]] name = "grovedb" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "axum 0.8.9", "blake3", @@ -3016,7 +3016,7 @@ dependencies = [ [[package]] name = "grovedb-bulk-append-tree" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "blake3", "grovedb-bincode", @@ -3034,7 +3034,7 @@ dependencies = [ [[package]] name = "grovedb-commitment-tree" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "blake3", "grovedb-bulk-append-tree", @@ -3051,7 +3051,7 @@ dependencies = [ [[package]] name = "grovedb-costs" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "integer-encoding", "intmap", @@ -3061,7 +3061,7 @@ dependencies = [ [[package]] name = "grovedb-dense-fixed-sized-merkle-tree" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "blake3", "grovedb-bincode", @@ -3075,7 +3075,7 @@ dependencies = [ [[package]] name = "grovedb-element" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "grovedb-bincode", "grovedb-bincode-derive", @@ -3091,7 +3091,7 @@ dependencies = [ [[package]] name = "grovedb-epoch-based-storage-flags" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "grovedb-costs", "hex", @@ -3103,7 +3103,7 @@ dependencies = [ [[package]] name = "grovedb-merk" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "blake3", "byteorder", @@ -3129,7 +3129,7 @@ dependencies = [ [[package]] name = "grovedb-merkle-mountain-range" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "blake3", "grovedb-bincode", @@ -3142,7 +3142,7 @@ dependencies = [ [[package]] name = "grovedb-path" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "hex", ] @@ -3150,7 +3150,7 @@ dependencies = [ [[package]] name = "grovedb-private-document-store" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "blake3", "grovedb-bulk-append-tree", @@ -3163,7 +3163,7 @@ dependencies = [ [[package]] name = "grovedb-query" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "byteorder", "ed", @@ -3179,7 +3179,7 @@ dependencies = [ [[package]] name = "grovedb-storage" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "blake3", "grovedb-costs", @@ -3198,7 +3198,7 @@ dependencies = [ [[package]] name = "grovedb-version" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "thiserror 2.0.18", "versioned-feature-core", @@ -3207,7 +3207,7 @@ dependencies = [ [[package]] name = "grovedb-visualize" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "hex", "itertools 0.14.0", @@ -3216,7 +3216,7 @@ dependencies = [ [[package]] name = "grovedbg-types" version = "6.0.0" -source = "git+https://github.com/dashpay/grovedb?rev=985ece6574f5fc8fe80db7b304a9a701c0f4afa6#985ece6574f5fc8fe80db7b304a9a701c0f4afa6" +source = "git+https://github.com/dashpay/grovedb?rev=f75fa36230902b983d231572b6aa2c17eb72cf7d#f75fa36230902b983d231572b6aa2c17eb72cf7d" dependencies = [ "serde", "serde_with 3.21.0", diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 8fc452590ae..fff564fcc18 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -76,7 +76,7 @@ strum = { version = "0.26", features = ["derive"] } json-schema-compatibility-validator = { path = '../rs-json-schema-compatibility-validator', optional = true } once_cell = "1.19.0" tracing = { version = "0.1.41" } -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true } +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d", optional = true } [dev-dependencies] tokio = { version = "1.40", features = ["full"] } diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 53b072580c8..4804fd79ad5 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -82,7 +82,7 @@ derive_more = { version = "1.0", features = ["from", "deref", "deref_mut"] } async-trait = "0.1.77" console-subscriber = { version = "0.4", optional = true } bls-signatures = { git = "https://github.com/dashpay/bls-signatures", rev = "0842b17583888e8f46c252a4ee84cdfd58e0546f", optional = true } -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d" } nonempty = "0.11" # Shielded-pool snapshot needs raw RocksDB SstFileWriter + ingest_external_file_cf # bindings, and blake3 for the snapshot-file checksum. @@ -108,7 +108,7 @@ dpp = { path = "../rs-dpp", default-features = false, features = [ drive = { path = "../rs-drive", features = ["fixtures-and-mocks"] } drive-proof-verifier = { path = "../rs-drive-proof-verifier" } strategy-tests = { path = "../strategy-tests" } -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", features = ["client"] } +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d", features = ["client"] } assert_matches = "1.5.0" drive-abci = { path = ".", features = ["testing-config", "mocks", "shielded_test_data"] } bls-signatures = { git = "https://github.com/dashpay/bls-signatures", rev = "0842b17583888e8f46c252a4ee84cdfd58e0546f" } @@ -122,8 +122,8 @@ integer-encoding = { version = "4.0.0" } # For dump_only_default_and_aux_cfs_under_shielded_subtree_prefix — same # subtree-prefix algorithm grovedb uses internally. -grovedb-path = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } -grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } +grovedb-path = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d" } +grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d" } [features] default = ["bls-signatures"] diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs index 27bcd8a748b..dce2f49021b 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs @@ -11,8 +11,10 @@ mod deletion_tests { run_document_delete_on_document_type_that_is_mutable_and_can_be_deleted_at_protocol_version( PlatformVersion::latest().protocol_version, // v14: the deleted document carries the contract-version stamp - // (one stored byte, five estimated), shifting processing costs - 1699620, + // (one stored byte, five estimated), and GroveDB V4 maintains backward + // references by default, so the index subtrees the delete empties are + // scanned for participants before the batch removes them + 1868020, ) .await; } @@ -603,7 +605,10 @@ mod deletion_tests { async fn test_document_delete_on_document_type_that_is_not_mutable_and_can_be_deleted() { run_document_delete_on_document_type_that_is_not_mutable_and_can_be_deleted_at_protocol_version( PlatformVersion::latest().protocol_version, - 2778700, + // v14: GroveDB V4 maintains backward references by default, so the + // index subtrees this transition empties are scanned for participants + // before the batch removes them + 3407080, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs index 3ed94b01192..1a264cc8db3 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs @@ -23,7 +23,9 @@ mod dpns_tests { async fn test_dpns_contract_references_with_no_contested_unique_index() { run_dpns_contract_references_with_no_contested_unique_index_at_protocol_version( PlatformVersion::latest().protocol_version, - 6_010_380, + // v14: GroveDB V4 prepares the batch through retained Merk nodes, + // which bills slightly fewer reads than the V3 path + 6_006_380, ) .await; } @@ -34,7 +36,7 @@ mod dpns_tests { /// trigger context's add_operation never called on v0). Pinned so /// v11 chain history stays bit-for-bit reproducible. /// - /// Delta vs PV12: 6_010_380 - 5_978_080 = 32_300 credits = T1 + T2 + /// Delta at PV12 (6_010_380): 6_010_380 - 5_978_080 = 32_300 credits = T1 + T2 /// query costs across 3 subdomain creates (~10,767 per transition, /// or ~5,383 per query). #[tokio::test] diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/nft.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/nft.rs index 902a665fdcf..4a01e56e4b1 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/nft.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/nft.rs @@ -411,7 +411,10 @@ mod nft_tests { PlatformVersion::latest().protocol_version, 126440160, 2485600, - 4092360, + // v14: GroveDB V4 maintains backward references by default, so the + // index subtrees this transition empties are scanned for participants + // before the batch removes them + 4339640, ) .await; } @@ -834,7 +837,10 @@ mod nft_tests { 141238960, 2729120, 2733160, - 4357440, + // v14: GroveDB V4 maintains backward references by default, so the + // index subtrees this transition empties are scanned for participants + // before the batch removes them + 4610480, ) .await; } @@ -1414,7 +1420,10 @@ mod nft_tests { PlatformVersion::latest().protocol_version, 126440160, 2485600, - 4092360, + // v14: GroveDB V4 maintains backward references by default, so the + // index subtrees this transition empties are scanned for participants + // before the batch removes them + 4339640, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs index 5b9c07a62c0..06a0f4dcc21 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs @@ -498,8 +498,10 @@ mod replacement_tests { async fn test_document_replace_on_document_type_that_is_mutable() { run_document_replace_on_document_type_that_is_mutable_at_protocol_version( PlatformVersion::latest().protocol_version, - // v14: replaced documents carry the contract-version stamp - 1433220, + // v14: replaced documents carry the contract-version stamp, and GroveDB + // V4 prepares the batch through retained Merk nodes, which bills + // slightly fewer reads than the V3 path + 1428320, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/transfer.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/transfer.rs index e8f51ec6344..dc0a951abd4 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/transfer.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/transfer.rs @@ -213,7 +213,10 @@ mod transfer_tests { async fn test_document_transfer_on_document_type_that_is_transferable_before_creator_id() { run_document_transfer_on_document_type_that_is_transferable_before_creator_id_at_protocol_version( PlatformVersion::latest().protocol_version, - 3380960, + // v14: GroveDB V4 maintains backward references by default, so the + // index subtrees this transition empties are scanned for participants + // before the batch removes them + 3579040, ) .await; } @@ -498,8 +501,10 @@ mod transfer_tests { async fn test_document_transfer_on_document_type_that_is_transferable() { run_document_transfer_on_document_type_that_is_transferable_at_protocol_version( PlatformVersion::latest().protocol_version, - // v14: transferred documents carry the contract-version stamp - 3643860, + // v14: transferred documents carry the contract-version stamp, and + // GroveDB V4 scans the index subtrees the transfer empties for + // backward-reference participants before the batch removes them + 3841940, ) .await; } @@ -797,7 +802,10 @@ mod transfer_tests { async fn test_document_transfer_on_document_type_that_is_transferable_contract_v0() { run_document_transfer_on_document_type_that_is_transferable_contract_v0_at_protocol_version( PlatformVersion::latest().protocol_version, - 3380960, + // v14: GroveDB V4 maintains backward references by default, so the + // index subtrees this transition empties are scanned for participants + // before the batch removes them + 3579040, ) .await; } @@ -1491,7 +1499,10 @@ mod transfer_tests { async fn test_document_delete_after_transfer() { run_document_delete_after_transfer_at_protocol_version( PlatformVersion::latest().protocol_version, - 4004720, // v14: stamped documents (see transferable baseline note) + // v14: stamped documents (see transferable baseline note); GroveDB V4 + // scans the index subtrees the transfer empties for backward-reference + // participants before the batch removes them + 4252000, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs index 32d40c65338..cc7d35f33b0 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs @@ -3959,8 +3959,10 @@ mod token_burn_tests { run_token_burn_group_action_confirmer_fee_includes_transformer_reads_at_protocol_version( PlatformVersion::latest().protocol_version, // PROTOCOL_VERSION_14: +400 — genesis system documents now carry - // the contract-version stamp, shifting byte-billed subtree reads - 4_368_280, + // the contract-version stamp, shifting byte-billed subtree reads; + // +56_660: GroveDB V4 maintains backward references by default and + // scans the subtrees the confirmer removes for participants first + 4_424_940, ) .await; } diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 6c60c2559e7..bf85c7ead4c 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -52,13 +52,13 @@ enum-map = { version = "2.0.3", optional = true } intmap = { version = "3.0.1", features = ["serde"], optional = true } chrono = { version = "0.4.35", optional = true } itertools = { version = "0.13", optional = true } -grovedb = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true, default-features = false } -grovedb-costs = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true } -grovedb-path = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } -grovedb-query = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } -grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true } -grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } -grovedb-epoch-based-storage-flags = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } +grovedb = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d", optional = true, default-features = false } +grovedb-costs = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d", optional = true } +grovedb-path = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d" } +grovedb-query = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d" } +grovedb-storage = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d", optional = true } +grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d" } +grovedb-epoch-based-storage-flags = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d" } [dev-dependencies] criterion = "0.5" diff --git a/packages/rs-drive/src/drive/address_funds/estimated_costs/for_address_balance_update/v0/mod.rs b/packages/rs-drive/src/drive/address_funds/estimated_costs/for_address_balance_update/v0/mod.rs index e63ca81ff23..490f70ff5d0 100644 --- a/packages/rs-drive/src/drive/address_funds/estimated_costs/for_address_balance_update/v0/mod.rs +++ b/packages/rs-drive/src/drive/address_funds/estimated_costs/for_address_balance_update/v0/mod.rs @@ -45,6 +45,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 1, @@ -70,6 +71,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(Self::addresses_path()), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees( 1, @@ -96,6 +98,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(Self::clear_addresses_path()), EstimatedLayerInformation { tree_type: TreeType::CountSumTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( PLATFORM_ADDRESS_KEY_SIZE as u8, diff --git a/packages/rs-drive/src/drive/address_funds/estimated_costs/for_address_balance_update/v1/mod.rs b/packages/rs-drive/src/drive/address_funds/estimated_costs/for_address_balance_update/v1/mod.rs index 8d3e7339e96..533fb309c46 100644 --- a/packages/rs-drive/src/drive/address_funds/estimated_costs/for_address_balance_update/v1/mod.rs +++ b/packages/rs-drive/src/drive/address_funds/estimated_costs/for_address_balance_update/v1/mod.rs @@ -34,6 +34,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 1, @@ -58,6 +59,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(Self::addresses_path()), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees( 1, @@ -85,6 +87,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(Self::clear_addresses_path()), EstimatedLayerInformation { tree_type: TreeType::CountSumTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItemsWithSumItem( PLATFORM_ADDRESS_KEY_SIZE as u8, diff --git a/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs b/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs index efb0c2c34bb..daa079da412 100644 --- a/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs +++ b/packages/rs-drive/src/drive/asset_lock/estimation_costs/add_estimation_costs_for_adding_asset_lock/v0/mod.rs @@ -62,6 +62,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 12, // 32 + 1 + 1 / 3 @@ -85,6 +86,7 @@ impl Drive { KeyInfoPath::from_known_path(asset_lock_storage_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( 36, //The size of an outpoint diff --git a/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs b/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs index 2ea0ebc206c..511170b1d02 100644 --- a/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v0/mod.rs @@ -62,6 +62,7 @@ impl Drive { ), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, @@ -81,6 +82,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(0, true), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, @@ -104,6 +106,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(AVERAGE_NUMBER_OF_UPDATES as u32), estimated_layer_sizes: Mix { subtrees_size: None, diff --git a/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v1/mod.rs b/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v1/mod.rs index 6c3a3fd5025..33a4a79e42f 100644 --- a/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v1/mod.rs +++ b/packages/rs-drive/src/drive/contract/estimation_costs/add_estimation_costs_for_contract_insertion/v1/mod.rs @@ -97,6 +97,7 @@ impl Drive { ), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, @@ -164,6 +165,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(0, true), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, @@ -187,6 +189,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(AVERAGE_NUMBER_OF_UPDATES as u32), estimated_layer_sizes: Mix { subtrees_size: None, diff --git a/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs index f96fafe4fe3..bd87fa726b3 100644 --- a/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/internal/add_estimation_costs_for_remove_document_to_primary_storage/v0/mod.rs @@ -70,6 +70,7 @@ impl Drive { KeyInfoPath::from_known_path(primary_key_path), EstimatedLayerInformation { tree_type: primary_key_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs index 9da9dae15cf..00921b9d799 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v0/mod.rs @@ -67,6 +67,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: current_layer_tree_type, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -142,6 +143,7 @@ impl Drive { sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v1/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v1/mod.rs index 924722b934c..f7bb76a20bd 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v1/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v1/mod.rs @@ -73,6 +73,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: parent_value_tree_type, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -192,6 +193,7 @@ impl Drive { sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v2/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v2/mod.rs index a26cf2b9047..eaaf1a8124e 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v2/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_index_level_for_contract_operations/v2/mod.rs @@ -73,6 +73,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: parent_value_tree_type, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -150,6 +151,7 @@ impl Drive { sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs index ef129d79a32..6d7b452bad9 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v0/mod.rs @@ -70,6 +70,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(contract_document_type_path.clone()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -130,6 +131,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(index_path.clone()), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v1/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v1/mod.rs index d1e74ecd39a..407fa8bf41a 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v1/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v1/mod.rs @@ -71,6 +71,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(contract_document_type_path.clone()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -174,6 +175,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(index_path.clone()), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v2/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v2/mod.rs index 9ae6c9cfd5d..dc975717e99 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v2/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_indices_for_top_index_level_for_contract_operations/v2/mod.rs @@ -93,6 +93,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(contract_document_type_path.clone()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -186,6 +187,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(index_path.clone()), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs index b057e4bb4c5..ff4a1d7bf74 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v0/mod.rs @@ -88,6 +88,7 @@ impl Drive { key_info_path.clone(), EstimatedLayerInformation { tree_type: member_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, @@ -184,6 +185,7 @@ impl Drive { key_info_path.clone(), EstimatedLayerInformation { tree_type: reference_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v1/mod.rs b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v1/mod.rs index a48f9d7b02e..5987b56a75a 100644 --- a/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v1/mod.rs +++ b/packages/rs-drive/src/drive/document/delete/remove_reference_for_index_level_for_contract_operations/v1/mod.rs @@ -95,6 +95,7 @@ impl Drive { key_info_path.clone(), EstimatedLayerInformation { tree_type: member_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, @@ -208,6 +209,7 @@ impl Drive { key_info_path.clone(), EstimatedLayerInformation { tree_type: reference_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs index b8c7444e858..1beac769041 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_contested_document_to_primary_storage/v0/mod.rs @@ -78,6 +78,7 @@ impl Drive { KeyInfoPath::from_known_path(primary_key_path), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs index c7f22c9f20d..698ca2a776f 100644 --- a/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/estimation_costs/add_estimation_costs_for_add_document_to_primary_storage/v0/mod.rs @@ -87,6 +87,7 @@ impl Drive { KeyInfoPath::from_known_path(primary_key_path), EstimatedLayerInformation { tree_type: primary_key_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -147,6 +148,7 @@ impl Drive { KeyInfoPath::from_known_path(document_id_in_primary_path), EstimatedLayerInformation { tree_type: per_doc_subtree_tree_type, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(AVERAGE_NUMBER_OF_UPDATES as u32), estimated_layer_sizes: Mix { subtrees_size: None, @@ -181,6 +183,7 @@ impl Drive { KeyInfoPath::from_known_path(primary_key_path), EstimatedLayerInformation { tree_type: primary_key_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs index d663ad711d8..eb4924471d0 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v0/mod.rs @@ -108,6 +108,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: current_layer_tree_type, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -272,6 +273,7 @@ impl Drive { sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v1/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v1/mod.rs index 353264ab4bd..8cee9fd49ef 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v1/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v1/mod.rs @@ -135,6 +135,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: current_layer_tree_type, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -360,6 +361,7 @@ impl Drive { sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v2/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v2/mod.rs index 3cb13df76ee..44d809cc151 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v2/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_index_level_for_contract_operations/v2/mod.rs @@ -153,6 +153,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: current_layer_tree_type, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -273,6 +274,7 @@ impl Drive { sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs index 0e4802a0ee1..3de5737916a 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v0/mod.rs @@ -71,6 +71,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(contract_document_type_path.clone()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -218,6 +219,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(index_path.clone()), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v1/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v1/mod.rs index 57d9ef64665..8256bdcda00 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v1/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v1/mod.rs @@ -72,6 +72,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(contract_document_type_path.clone()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -225,6 +226,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(index_path.clone()), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v2/mod.rs b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v2/mod.rs index 3b23787770c..4d45e1d33e3 100644 --- a/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v2/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_indices_for_top_index_level_for_contract_operations/v2/mod.rs @@ -97,6 +97,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(contract_document_type_path.clone()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -215,6 +216,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(index_path.clone()), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert/add_preallocated_index_tree_operations/mod.rs b/packages/rs-drive/src/drive/document/insert/add_preallocated_index_tree_operations/mod.rs index a4a98b583be..a6eb7acdfe8 100644 --- a/packages/rs-drive/src/drive/document/insert/add_preallocated_index_tree_operations/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_preallocated_index_tree_operations/mod.rs @@ -185,6 +185,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(contract_document_type_path.clone()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements( referring_index_structure.sub_levels().len() as u32 + 1, ), @@ -362,6 +363,7 @@ impl Drive { path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: property_name_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( value_key_estimated_size as u8, @@ -405,6 +407,7 @@ impl Drive { path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: value_tree_type, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements( sub_level.sub_levels().len() as u32 + 1, ), @@ -477,6 +480,7 @@ impl Drive { path_info.convert_to_key_info_path(), EstimatedLayerInformation { tree_type: member_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs index c25bb65ec5e..f4f25af0d24 100644 --- a/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert/add_reference_for_index_level_for_contract_operations/v0/mod.rs @@ -193,6 +193,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: reference_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllReference( DEFAULT_HASH_SIZE_U8, @@ -474,6 +475,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: member_tree_type, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs index 9eed9dee870..dd59eff4e02 100644 --- a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_contract_operations/v0/mod.rs @@ -124,6 +124,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, @@ -188,6 +189,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(16), // very seldom would more than 16 people want the resource estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs index 1ead80bba85..87cd5babf7b 100644 --- a/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_indices_for_index_level_for_contract_operations/v0/mod.rs @@ -61,6 +61,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(sub_level_index_count + 1), estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, @@ -135,6 +136,7 @@ impl Drive { sub_level_index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( document_top_field_estimated_size as u8, diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs index 8aa6aa288ff..eaf031d4592 100644 --- a/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_reference_and_vote_subtree_to_document_operations/v0/mod.rs @@ -55,6 +55,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: Mix { // The votes don't have storage flags @@ -148,6 +149,7 @@ impl Drive { votes_path_key_info.clone().convert_to_key_info_path()?, EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, U8_SIZE_U32, None), }, diff --git a/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs b/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs index 9384becf62d..e6e38354777 100644 --- a/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/document/insert_contested/add_contested_vote_subtrees_for_non_identities_operations/v0/mod.rs @@ -44,6 +44,7 @@ impl Drive { index_path_info.clone().convert_to_key_info_path(), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(1), estimated_layer_sizes: Mix { // The votes don't have storage flags @@ -74,6 +75,7 @@ impl Drive { votes_path_key_info.clone().convert_to_key_info_path()?, EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, U8_SIZE_U32, None), }, diff --git a/packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs b/packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs index a92b45545c4..9227698a963 100644 --- a/packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/estimated_costs/for_add_group_action/v0/mod.rs @@ -81,6 +81,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 1, @@ -105,6 +106,7 @@ impl Drive { KeyInfoPath::from_known_path(group_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // We estimate that on average we need to update 10 nodes estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -114,6 +116,7 @@ impl Drive { KeyInfoPath::from_known_path(group_contract_path(contract_id.as_slice())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(2, NoSumTrees, None), }, @@ -126,6 +129,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -138,6 +142,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -152,6 +157,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: Mix { subtrees_size: Some((1, AllSumTrees, None, 1)), @@ -171,6 +177,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllItems(8, 1, None), }, @@ -185,6 +192,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -199,6 +207,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: Mix { subtrees_size: Some((1, AllSumTrees, None, 1)), @@ -218,6 +227,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllItems(8, 1, None), }, diff --git a/packages/rs-drive/src/drive/group/estimated_costs/for_add_groups/v0/mod.rs b/packages/rs-drive/src/drive/group/estimated_costs/for_add_groups/v0/mod.rs index 00923bcd538..04dacec547f 100644 --- a/packages/rs-drive/src/drive/group/estimated_costs/for_add_groups/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/estimated_costs/for_add_groups/v0/mod.rs @@ -37,6 +37,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 1, @@ -61,6 +62,7 @@ impl Drive { KeyInfoPath::from_known_path(group_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // We estimate that on average we need to update 10 nodes estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -70,6 +72,7 @@ impl Drive { KeyInfoPath::from_known_path(group_contract_path(contract_id.as_slice())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(2, NoSumTrees, None), }, @@ -83,6 +86,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_authentication_keys_security_level_in_key_reference_tree/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_authentication_keys_security_level_in_key_reference_tree/v0/mod.rs index 529b56477f6..166a4038846 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_authentication_keys_security_level_in_key_reference_tree/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_authentication_keys_security_level_in_key_reference_tree/v0/mod.rs @@ -46,6 +46,7 @@ impl Drive { //todo: revisit EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(4), //we can estimate that each security level will only have 4 keys //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: AllItems(1, KEY_REFERENCE_SIZE, None), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs index 2dc6aac1200..a52ec96dd6a 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v0/mod.rs @@ -57,6 +57,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees( 1, @@ -81,6 +82,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(balance_path_vec()), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, AVERAGE_BALANCE_SIZE, None), }, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs index 2b46bc6a0ac..332ffe7662c 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info/v0/mod.rs @@ -20,6 +20,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -30,6 +31,7 @@ impl Drive { KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -47,6 +49,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: Mix { subtrees_size: Some((1, NoSumTrees, None, 2)), // weight of 2 because 1 for keys and 1 for data contract info @@ -62,6 +65,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(identity_contract_info_root_path_vec(identity_id)), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs index 637609a51c4..acdd4e177ee 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group/v0/mod.rs @@ -21,6 +21,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: Mix { subtrees_size: Some((1, NoSumTrees, None, 1)), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_key_purpose/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_key_purpose/v0/mod.rs index 195a04d3c7c..d98825c3f2d 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_key_purpose/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_key_purpose/v0/mod.rs @@ -26,6 +26,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(5), estimated_layer_sizes: AllReference(1, KEY_REFERENCE_SIZE, None), }, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs index 069fc57bcb8..ed0550ea1d3 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_identity_contract_info_group_keys/v0/mod.rs @@ -21,6 +21,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs index ac776f1ab24..a697bf46ace 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_keys_for_identity_id/v0/mod.rs @@ -59,6 +59,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -69,6 +70,7 @@ impl Drive { KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -79,6 +81,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -90,6 +93,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(identity_key_tree_path_vec(identity_id.as_slice())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(50), //we can estimate that an identity will have amount 50 keys //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: AllItems(1, 42, Some(3)), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs index 94834edead9..da97999e333 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_negative_credit/v0/mod.rs @@ -37,6 +37,7 @@ impl Drive { KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -54,6 +55,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: Mix { diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs index 6951d86eda7..65b3b1fcd04 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_purpose_in_key_reference_tree/v0/mod.rs @@ -69,6 +69,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count, // there are //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes, diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_root_key_reference_tree/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_root_key_reference_tree/v0/mod.rs index 7d312f98fd6..aded5ef2192 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_root_key_reference_tree/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_root_key_reference_tree/v0/mod.rs @@ -35,6 +35,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(identity_query_keys_tree_path_vec(identity_id)), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(4), //we can estimate that an identity will have amount 50 keys //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs index c71e24c305a..1fe8f106843 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_nonce/v0/mod.rs @@ -41,6 +41,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -51,6 +52,7 @@ impl Drive { KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -68,6 +70,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: Mix { diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs index bb95e061311..ac0ef6713bd 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_update_revision/v0/mod.rs @@ -41,6 +41,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -51,6 +52,7 @@ impl Drive { KeyInfoPath::from_known_path(identity_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -68,6 +70,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(identity_path_vec(identity_id.as_slice())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), //We can mark these as all subtrees, because the revision will be under estimated_layer_sizes: Mix { diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs index a24e1eea04a..6245b7f6d73 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_non_unique_public_key_hash_reference/v0/mod.rs @@ -25,6 +25,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(non_unique_key_hashes_path), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_160_SIZE_U8, NoSumTrees, None), }, @@ -37,6 +38,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(non_unique_key_hashes_sub_path), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(ESTIMATED_NON_UNIQUE_KEY_DUPLICATES), estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, 0, None), }, diff --git a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs index db8a337fa48..61d6d592b0b 100644 --- a/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs +++ b/packages/rs-drive/src/drive/identity/key/insert_key_hash_identity_reference/estimation_costs/add_estimation_costs_for_insert_unique_public_key_hash_reference/v0/mod.rs @@ -19,6 +19,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(unique_key_hashes_path), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_160_SIZE_U8, diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs index 3b30884b6cb..e65b0375482 100644 --- a/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/estimation_costs/for_prefunded_specialized_balance_update/v0/mod.rs @@ -29,6 +29,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, // We are on the 3rd level estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( @@ -53,6 +54,7 @@ impl Drive { KeyInfoPath::from_known_path(prefunded_specialized_balances_path()), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, AllSumTrees, None), }, @@ -62,6 +64,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(prefunded_specialized_balances_for_voting_path_vec()), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, AVERAGE_BALANCE_SIZE, None), }, diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs index 4be4c8b9058..b47b5cc2728 100644 --- a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract/v0/mod.rs @@ -59,6 +59,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), //voting is on level 2 // We have balances in the middle which is a sum tree estimated_layer_sizes: AllSubtrees( @@ -84,6 +85,7 @@ impl Drive { KeyInfoPath::from_known_path(vote_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, // contested resource tree is a key of "c" so it should be on the top layer of the merk estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -95,6 +97,7 @@ impl Drive { KeyInfoPath::from_known_path(vote_contested_resource_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, // active poll "p", with "e" and "i" first so it should be on the second layer of the merk estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -106,6 +109,7 @@ impl Drive { KeyInfoPath::from_known_path(vote_contested_resource_active_polls_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -119,6 +123,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(document_type_count), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, @@ -138,6 +143,7 @@ impl Drive { ), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, @@ -156,6 +162,7 @@ impl Drive { ), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(1024), //Just a guess estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_INDEX_NAME_SIZE, diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs index 6ef2aa76708..8df5e3e2168 100644 --- a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded/v0/mod.rs @@ -50,6 +50,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), //voting is on level 2 // We have balances in the middle which is a sum tree estimated_layer_sizes: AllSubtrees( @@ -75,6 +76,7 @@ impl Drive { KeyInfoPath::from_known_path(vote_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, // contested resource tree is a key of "c" so it should be on the top layer of the merk estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -86,6 +88,7 @@ impl Drive { KeyInfoPath::from_known_path(vote_contested_resource_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, // active poll "p", with "e" and "i" first, so it should be on the second layer of the merk estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), @@ -97,6 +100,7 @@ impl Drive { KeyInfoPath::from_known_path(vote_contested_resource_active_polls_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -110,6 +114,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(document_type_count), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs index 0e6e4630378..f266f433972 100644 --- a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract/v0/mod.rs @@ -44,6 +44,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(0, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -54,6 +55,7 @@ impl Drive { KeyInfoPath::from_known_path(all_contracts_global_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllSubtrees( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs index 443349d04ad..eeabec5cb5a 100644 --- a/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs +++ b/packages/rs-drive/src/drive/shared/shared_estimation_costs/add_estimation_costs_for_levels_up_to_contract_document_type_excluded/v0/mod.rs @@ -63,6 +63,7 @@ impl Drive { KeyInfoPath::from_known_path(contract_root_path(contract.id_ref().as_bytes())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, storage_flags), }, @@ -72,6 +73,7 @@ impl Drive { KeyInfoPath::from_known_path(contract_documents_path(contract.id_ref().as_bytes())), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(document_type_count), estimated_layer_sizes: AllSubtrees( ESTIMATED_AVERAGE_DOCUMENT_TYPE_NAME_SIZE, diff --git a/packages/rs-drive/src/drive/shielded/estimated_costs.rs b/packages/rs-drive/src/drive/shielded/estimated_costs.rs index 859286eb24b..93d2c1b2f4b 100644 --- a/packages/rs-drive/src/drive/shielded/estimated_costs.rs +++ b/packages/rs-drive/src/drive/shielded/estimated_costs.rs @@ -40,6 +40,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 1, @@ -66,6 +67,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(vec![vec![RootTree::ShieldedBalances as u8]]), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees( 1, @@ -99,6 +101,7 @@ impl Drive { KeyInfoPath::from_known_path(shielded_credit_pool_path()), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: Mix { subtrees_size: Some(( @@ -131,6 +134,7 @@ impl Drive { KeyInfoPath::from_known_path(shielded_credit_pool_notes_path()), EstimatedLayerInformation { tree_type: TreeType::CommitmentTree(SHIELDED_NOTES_CHUNK_POWER), + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(16, false), estimated_layer_sizes: AllItems(8, AVERAGE_NOTE_VALUE_SIZE, None), }, @@ -142,6 +146,7 @@ impl Drive { KeyInfoPath::from_known_path(shielded_credit_pool_nullifiers_path()), EstimatedLayerInformation { tree_type: TreeType::ProvableCountTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(16, false), estimated_layer_sizes: AllItems(NULLIFIER_KEY_SIZE, 0, None), }, @@ -153,6 +158,7 @@ impl Drive { KeyInfoPath::from_known_path(shielded_credit_pool_anchors_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(7, false), estimated_layer_sizes: AllItems(ANCHOR_KEY_SIZE, ANCHOR_VALUE_SIZE, None), }, @@ -164,6 +170,7 @@ impl Drive { KeyInfoPath::from_known_path(shielded_credit_pool_anchors_by_height_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(7, false), estimated_layer_sizes: AllItems( ANCHOR_VALUE_SIZE as u8, diff --git a/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs b/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs index 4583aefca0d..e0c88ba11b7 100644 --- a/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs +++ b/packages/rs-drive/src/drive/system/estimation_costs/for_total_system_credits_update/v0/mod.rs @@ -34,6 +34,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), estimated_layer_sizes: AllSubtrees( 12, // about 32 + 1 + 1 / 3 @@ -58,6 +59,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(misc_path_vec()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: ApproximateElements(1), estimated_layer_sizes: AllItems(1, 8, None), }, diff --git a/packages/rs-drive/src/drive/tokens/distribution/mark_perpetual_release_as_distributed/v0/mod.rs b/packages/rs-drive/src/drive/tokens/distribution/mark_perpetual_release_as_distributed/v0/mod.rs index 2bacadcea45..b2e822e24eb 100644 --- a/packages/rs-drive/src/drive/tokens/distribution/mark_perpetual_release_as_distributed/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/distribution/mark_perpetual_release_as_distributed/v0/mod.rs @@ -45,6 +45,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(perpetual_distributions_path.clone()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count, estimated_layer_sizes: AllItems(1, 8, None), }, diff --git a/packages/rs-drive/src/drive/tokens/distribution/mark_pre_programmed_release_as_distributed/v0/mod.rs b/packages/rs-drive/src/drive/tokens/distribution/mark_pre_programmed_release_as_distributed/v0/mod.rs index 9eb4644f7a8..b54912f2184 100644 --- a/packages/rs-drive/src/drive/tokens/distribution/mark_pre_programmed_release_as_distributed/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/distribution/mark_pre_programmed_release_as_distributed/v0/mod.rs @@ -73,6 +73,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(token_distributions_root_path_vec()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), // We should be on the first level estimated_layer_sizes: AllSubtrees(U8_SIZE_U8, NoSumTrees, None), }, @@ -97,6 +98,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(pre_programmed_distributions_path.clone()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(5, false), estimated_layer_sizes: AllItems(1, 8, None), }, diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_root_token_ms_interval_distribution/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_root_token_ms_interval_distribution/v0/mod.rs index ff12c2d0141..0bff3c07497 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_root_token_ms_interval_distribution/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_root_token_ms_interval_distribution/v0/mod.rs @@ -26,6 +26,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(token_timed_distributions_path_vec()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(0, false), // 0 because ms is on top estimated_layer_sizes: AllSubtrees(U8_SIZE_U8, NoSumTrees, None), }, @@ -36,6 +37,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(token_ms_timed_distributions_path_vec()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // we can have a lot of times estimated_layer_sizes: AllSubtrees(U64_SIZE_U8, NoSumTrees, None), }, @@ -50,6 +52,7 @@ impl Drive { key, EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, // We assume a shallow sum tree for the distribution entries at a given time. estimated_layer_count: EstimatedLevel(1, false), // Each distribution entry is estimated with a fixed size. diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_balances/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_balances/v0/mod.rs index 821d7c74c63..6aa3bcd6405 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_balances/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_balances/v0/mod.rs @@ -63,6 +63,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -73,6 +74,7 @@ impl Drive { KeyInfoPath::from_known_path(tokens_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(0, false), // this should be at the top estimated_layer_sizes: AllSubtrees(1, AllBigSumTrees, None), }, @@ -82,6 +84,7 @@ impl Drive { KeyInfoPath::from_known_path(token_balances_root_path()), EstimatedLayerInformation { tree_type: TreeType::BigSumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // we can estimate 10 levels deep estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, AllSumTrees, None), }, @@ -92,6 +95,7 @@ impl Drive { KeyInfoPath::from_known_path(token_balances_path(&token_id)), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, AVERAGE_BALANCE_SIZE, None), }, diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_contract_infos/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_contract_infos/v0/mod.rs index ffe0f731029..2a0076e3882 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_contract_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_contract_infos/v0/mod.rs @@ -63,6 +63,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -73,6 +74,7 @@ impl Drive { KeyInfoPath::from_known_path(tokens_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees( 1, @@ -96,6 +98,7 @@ impl Drive { KeyInfoPath::from_known_path(token_contract_infos_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // we can estimate 10 levels deep estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, 36, None), }, diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_direct_selling_prices/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_direct_selling_prices/v0/mod.rs index efaec560a92..22013d68d79 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_direct_selling_prices/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_direct_selling_prices/v0/mod.rs @@ -63,6 +63,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -73,6 +74,7 @@ impl Drive { KeyInfoPath::from_known_path(tokens_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees( 1, @@ -96,6 +98,7 @@ impl Drive { KeyInfoPath::from_known_path(token_direct_purchase_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // we can estimate 10 levels deep estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, 8, None), }, diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_identity_infos/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_identity_infos/v0/mod.rs index d8556ea29c7..65da255811a 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_identity_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_identity_infos/v0/mod.rs @@ -30,6 +30,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -40,6 +41,7 @@ impl Drive { KeyInfoPath::from_known_path(tokens_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), // this should be at the top estimated_layer_sizes: AllSubtrees( 1, @@ -63,6 +65,7 @@ impl Drive { KeyInfoPath::from_known_path(token_identity_infos_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // we can estimate 10 levels deep estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -73,6 +76,7 @@ impl Drive { KeyInfoPath::from_known_path(token_identity_infos_path(&token_id)), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: PotentiallyAtMaxElements, estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_perpetual_distribution/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_perpetual_distribution/v0/mod.rs index bee40e512db..d7057694db5 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_perpetual_distribution/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_perpetual_distribution/v0/mod.rs @@ -31,6 +31,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(token_distributions_root_path_vec()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), estimated_layer_sizes: AllSubtrees(U8_SIZE_U8, NoSumTrees, None), }, @@ -41,6 +42,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(token_root_perpetual_distributions_path_vec()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // Estimated depth estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -54,6 +56,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees(U8_SIZE_U8, NoSumTrees, None), }, diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_pre_programmed_distribution/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_pre_programmed_distribution/v0/mod.rs index e61cb383097..115e0dd37ed 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_pre_programmed_distribution/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_pre_programmed_distribution/v0/mod.rs @@ -36,6 +36,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(token_distributions_root_path_vec()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), // We should be on the first level estimated_layer_sizes: AllSubtrees(U8_SIZE_U8, NoSumTrees, None), }, @@ -46,6 +47,7 @@ impl Drive { KeyInfoPath::from_known_owned_path(token_root_pre_programmed_distributions_path_vec()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // Just an estimate estimated_layer_sizes: AllSubtrees(DEFAULT_HASH_SIZE_U8, NoSumTrees, None), }, @@ -58,6 +60,7 @@ impl Drive { )), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, // At this level, expect as many children as there are time entries. estimated_layer_count: ApproximateElements( times.as_ref().map(|times| times.len()).unwrap_or(128) as u32, @@ -75,6 +78,7 @@ impl Drive { ), EstimatedLayerInformation { tree_type: TreeType::SumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), // probably not that many estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, U64_SIZE_U32, None), }, diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_status_infos/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_status_infos/v0/mod.rs index 7c6d9135f31..28be770c7db 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_status_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_status_infos/v0/mod.rs @@ -27,6 +27,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -37,6 +38,7 @@ impl Drive { KeyInfoPath::from_known_path(tokens_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(1, false), // this should be at the top estimated_layer_sizes: AllSubtrees( 1, @@ -60,6 +62,7 @@ impl Drive { KeyInfoPath::from_known_path(token_statuses_root_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), // we can estimate 10 levels deep estimated_layer_sizes: AllItems( DEFAULT_HASH_SIZE_U8, diff --git a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_total_supply/v0/mod.rs b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_total_supply/v0/mod.rs index ec9c05ed715..aecb1a8f562 100644 --- a/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_total_supply/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/estimated_costs/for_token_total_supply/v0/mod.rs @@ -62,6 +62,7 @@ impl Drive { KeyInfoPath::from_known_path([]), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(3, false), // 17 because we have 2 layers at 32 and two layers at 2 estimated_layer_sizes: AllSubtrees( @@ -87,6 +88,7 @@ impl Drive { KeyInfoPath::from_known_path(misc_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(2, false), estimated_layer_sizes: AllSubtrees(1, NoSumTrees, None), }, @@ -97,6 +99,7 @@ impl Drive { KeyInfoPath::from_known_path(total_tokens_root_supply_path()), EstimatedLayerInformation { tree_type: TreeType::BigSumTree, + may_contain_backward_references: false, estimated_layer_count: EstimatedLevel(10, false), estimated_layer_sizes: AllItems(DEFAULT_HASH_SIZE_U8, U64_SIZE_U32, None), }, diff --git a/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs b/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs index 5df377420f5..c5ba91c036c 100644 --- a/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs +++ b/packages/rs-drive/src/drive/votes/insert/vote_poll/add_vote_poll_end_date_query_operations/v0/mod.rs @@ -53,6 +53,7 @@ impl Drive { KeyInfoPath::from_known_path(vote_end_date_queries_tree_path()), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, // We can estimate that there is at least a vote concluding every block, and we put blocks at 6 seconds. estimated_layer_count: ApproximateElements(201_600), estimated_layer_sizes: AllSubtrees( @@ -69,6 +70,7 @@ impl Drive { ), EstimatedLayerInformation { tree_type: TreeType::NormalTree, + may_contain_backward_references: false, // We can estimate that there is 2 votes ending per block. estimated_layer_count: ApproximateElements(2), estimated_layer_sizes: AllItems( diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs index 545bf40c4e1..f3addefb87e 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs @@ -6,6 +6,7 @@ use crate::util::grove_operations::{push_drive_operation_result, BatchDeleteAppl use grovedb::batch::key_info::KeyInfo; use grovedb::batch::KeyInfoPath; use grovedb::operations::delete::DeleteOptions; +use grovedb::BackwardReferencesPolicy; use grovedb::{GroveDb, TransactionArg}; use grovedb_path::SubtreePath; use grovedb_storage::rocksdb_storage::RocksDbStorage; @@ -23,7 +24,7 @@ impl Drive { drive_version: &DriveVersion, ) -> Result<(), Error> { let options = DeleteOptions { - propagate_backward_references: false, + backward_references_policy: BackwardReferencesPolicy::Maintain, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs index 9b90ccb60cd..c6f6888ee46 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs @@ -8,6 +8,7 @@ use grovedb::batch::key_info::KeyInfo; use grovedb::batch::KeyInfoPath; use grovedb::operations::delete::DeleteOptions; use grovedb::query_result_type::QueryResultType; +use grovedb::BackwardReferencesPolicy; use grovedb::{GroveDb, PathQuery, TransactionArg}; use grovedb_storage::rocksdb_storage::RocksDbStorage; use platform_version::version::drive_versions::DriveVersion; @@ -80,7 +81,7 @@ impl Drive { let current_batch_operations = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let options = DeleteOptions { - propagate_backward_references: false, + backward_references_policy: BackwardReferencesPolicy::Maintain, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs index fe0611c239f..aec2ea9c915 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs @@ -7,6 +7,7 @@ use crate::util::grove_operations::{push_drive_operation_result, BatchMoveApplyT use grovedb::batch::key_info::KeyInfo; use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; use grovedb::operations::delete::DeleteOptions; +use grovedb::BackwardReferencesPolicy; use grovedb::{Element, GroveDb, TransactionArg}; use grovedb_epoch_based_storage_flags::StorageFlags; use grovedb_path::SubtreePath; @@ -60,7 +61,7 @@ impl Drive { // ── 2. Build the delete op ────────────────────────────────────────── let current_batch = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let delete_opts = DeleteOptions { - propagate_backward_references: false, + backward_references_policy: BackwardReferencesPolicy::Maintain, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs index b8d88730cdc..cc0895e1383 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs @@ -8,6 +8,7 @@ use grovedb::batch::key_info::KeyInfo; use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; use grovedb::operations::delete::DeleteOptions; use grovedb::query_result_type::QueryResultType; +use grovedb::BackwardReferencesPolicy; use grovedb::{GroveDb, PathQuery, TransactionArg}; use grovedb_epoch_based_storage_flags::StorageFlags; use grovedb_storage::rocksdb_storage::RocksDbStorage; @@ -86,7 +87,7 @@ impl Drive { let current_batch_operations = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let options = DeleteOptions { - propagate_backward_references: false, + backward_references_policy: BackwardReferencesPolicy::Maintain, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs index 6ad8f69a6d8..b510a9dffbd 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs @@ -9,6 +9,7 @@ use dpp::version::drive_versions::DriveVersion; use grovedb::batch::key_info::KeyInfo; use grovedb::batch::{GroveOp, KeyInfoPath}; use grovedb::operations::delete::DeleteOptions; +use grovedb::BackwardReferencesPolicy; use grovedb::{Element, GroveDb, TransactionArg}; use grovedb_path::SubtreePath; use grovedb_storage::rocksdb_storage::RocksDbStorage; @@ -29,7 +30,7 @@ impl Drive { let mut current_batch_operations = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let options = DeleteOptions { - propagate_backward_references: false, + backward_references_policy: BackwardReferencesPolicy::Maintain, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs index 2d1b08a6c3a..73f62f3e4a1 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs @@ -8,6 +8,7 @@ use crate::util::batch::GroveDbOpBatch; use crate::util::grove_operations::push_drive_operation_result; use crate::util::storage_flags::StorageFlags; use grovedb::batch::{BatchApplyOptions, QualifiedGroveDbOp}; +use grovedb::BackwardReferencesPolicy; use grovedb::TransactionArg; use platform_version::version::drive_versions::DriveVersion; @@ -63,7 +64,7 @@ impl Drive { let cost_context = self.grove.apply_batch_with_element_flags_update( ops.operations, Some(BatchApplyOptions { - propagate_backward_references: false, + backward_references_policy: BackwardReferencesPolicy::Maintain, validate_insertion_does_not_override: validate, validate_insertion_does_not_override_tree: validate, disable_operation_consistency_check: !self.config.batching_consistency_verification, diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs index f1e87a64598..9ed5c2ab884 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs @@ -8,6 +8,7 @@ use crate::util::batch::GroveDbOpBatch; use crate::util::grove_operations::push_drive_operation_result; use crate::util::storage_flags::{MergingOwnersStrategy, StorageFlags}; use grovedb::batch::{BatchApplyOptions, OpsByLevelPath, QualifiedGroveDbOp}; +use grovedb::BackwardReferencesPolicy; use grovedb::TransactionArg; use grovedb_costs::storage_cost::removal::StorageRemovedBytes::BasicStorageRemoval; use grovedb_costs::storage_cost::transition::OperationStorageTransitionType; @@ -48,7 +49,7 @@ impl Drive { let cost_context = self.grove.apply_partial_batch_with_element_flags_update( ops.operations, Some(BatchApplyOptions { - propagate_backward_references: false, + backward_references_policy: BackwardReferencesPolicy::Maintain, validate_insertion_does_not_override: validate, validate_insertion_does_not_override_tree: validate, disable_operation_consistency_check: false, diff --git a/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs index 3d8573a61b2..d663ae8c7d2 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs @@ -6,6 +6,7 @@ use crate::util::batch::GroveDbOpBatch; use crate::util::grove_operations::push_drive_operation_result; use grovedb::batch::estimated_costs::EstimatedCostsType::AverageCaseCostsType; use grovedb::batch::{BatchApplyOptions, KeyInfoPath}; +use grovedb::BackwardReferencesPolicy; use grovedb::{EstimatedLayerInformation, GroveDb}; use platform_version::version::drive_versions::DriveVersion; use std::collections::HashMap; @@ -24,7 +25,7 @@ impl Drive { AverageCaseCostsType(estimated_layer_info), ops.operations, Some(BatchApplyOptions { - propagate_backward_references: false, + backward_references_policy: BackwardReferencesPolicy::Maintain, validate_insertion_does_not_override: validate, validate_insertion_does_not_override_tree: validate, disable_operation_consistency_check: false, diff --git a/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs index 41588184c93..22986fb12d9 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs @@ -1,6 +1,7 @@ use crate::drive::Drive; use crate::error::Error; use grovedb::operations::delete::ClearOptions; +use grovedb::BackwardReferencesPolicy; use grovedb::TransactionArg; use grovedb_path::SubtreePath; use platform_version::version::drive_versions::DriveVersion; @@ -14,6 +15,7 @@ impl Drive { drive_version: &DriveVersion, ) -> Result<(), Error> { let options = ClearOptions { + backward_references_policy: BackwardReferencesPolicy::Maintain, check_for_subtrees: false, allow_deleting_subtrees: false, trying_to_clear_with_subtrees_returns_error: false, diff --git a/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs index c34356d26de..c092e87fd5b 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs @@ -3,6 +3,7 @@ use crate::error::Error; use crate::fees::op::LowLevelDriveOperation; use crate::util::grove_operations::push_drive_operation_result; use grovedb::operations::delete::DeleteOptions; +use grovedb::BackwardReferencesPolicy; use grovedb::TransactionArg; use grovedb_path::SubtreePath; use platform_version::version::drive_versions::DriveVersion; @@ -18,7 +19,7 @@ impl Drive { drive_version: &DriveVersion, ) -> Result<(), Error> { let options = DeleteOptions { - propagate_backward_references: false, + backward_references_policy: BackwardReferencesPolicy::Maintain, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 6ccfd107121..32d778eb63f 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT" thiserror = { version = "2.0.12" } bincode = { workspace = true } versioned-feature-core = "1.0.0" -grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6" } +grovedb-version = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d" } [features] mock-versions = [] diff --git a/packages/rs-platform-wallet/Cargo.toml b/packages/rs-platform-wallet/Cargo.toml index 68fc1d68fa7..7f77edbdc6a 100644 --- a/packages/rs-platform-wallet/Cargo.toml +++ b/packages/rs-platform-wallet/Cargo.toml @@ -61,7 +61,7 @@ zeroize = "1" log = "0.4" # Shielded pool (optional, behind `shielded` feature) -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", optional = true } +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d", optional = true } # Direct `rusqlite` access so `FileBackedShieldedStore::open_path` can set # WAL + synchronous=NORMAL pragmas before handing the connection to # `ClientPersistentCommitmentTree`. Version locked to match the rev grovedb diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index b7a246aedb5..ecba91a7b91 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -18,7 +18,7 @@ drive = { path = "../rs-drive", default-features = false, features = [ ] } drive-proof-verifier = { path = "../rs-drive-proof-verifier", default-features = false } -grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "985ece6574f5fc8fe80db7b304a9a701c0f4afa6", features = [ +grovedb-commitment-tree = { git = "https://github.com/dashpay/grovedb", rev = "f75fa36230902b983d231572b6aa2c17eb72cf7d", features = [ "client", "sqlite", ], optional = true } From f8217e40d49bc3f2d3b7222be9d7a334cbb9f021 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 12 Sep 2026 00:20:40 +0700 Subject: [PATCH 9/9] fix(drive): select the Skip backward-reference policy for GroveDB V4 writes Drive stores no backward-reference participants, so GroveDB's default Maintain policy had nothing to keep consistent, while its participant scans of removed index subtrees raised PV14 processing fees on document deletes, transfers and purchases by 5 to 23 percent. Skip routes every Drive write through the released V4 executor paths, which returns the twelve drive-abci PV14 fee baselines to their existing values. Flip to Maintain under a new protocol version once Drive stores participants. Co-Authored-By: Claude Fable 5.1 --- .../batch/tests/document/deletion.rs | 11 +++------- .../batch/tests/document/dpns.rs | 6 ++---- .../batch/tests/document/nft.rs | 15 +++---------- .../batch/tests/document/replacement.rs | 6 ++---- .../batch/tests/document/transfer.rs | 21 +++++-------------- .../batch/tests/token/burn/mod.rs | 6 ++---- .../grove_operations/batch_delete/v0/mod.rs | 3 ++- .../v0/mod.rs | 3 ++- .../grove_operations/batch_move/v0/mod.rs | 3 ++- .../batch_move_items_in_path_query/v0/mod.rs | 3 ++- .../batch_remove_raw/v0/mod.rs | 3 ++- .../v0/mod.rs | 3 ++- .../v0/mod.rs | 3 ++- .../grove_batch_operations_costs/v0/mod.rs | 3 ++- .../grove_operations/grove_clear/v0/mod.rs | 3 ++- .../grove_operations/grove_delete/v0/mod.rs | 3 ++- 16 files changed, 37 insertions(+), 58 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs index dce2f49021b..27bcd8a748b 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs @@ -11,10 +11,8 @@ mod deletion_tests { run_document_delete_on_document_type_that_is_mutable_and_can_be_deleted_at_protocol_version( PlatformVersion::latest().protocol_version, // v14: the deleted document carries the contract-version stamp - // (one stored byte, five estimated), and GroveDB V4 maintains backward - // references by default, so the index subtrees the delete empties are - // scanned for participants before the batch removes them - 1868020, + // (one stored byte, five estimated), shifting processing costs + 1699620, ) .await; } @@ -605,10 +603,7 @@ mod deletion_tests { async fn test_document_delete_on_document_type_that_is_not_mutable_and_can_be_deleted() { run_document_delete_on_document_type_that_is_not_mutable_and_can_be_deleted_at_protocol_version( PlatformVersion::latest().protocol_version, - // v14: GroveDB V4 maintains backward references by default, so the - // index subtrees this transition empties are scanned for participants - // before the batch removes them - 3407080, + 2778700, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs index 1a264cc8db3..3ed94b01192 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs @@ -23,9 +23,7 @@ mod dpns_tests { async fn test_dpns_contract_references_with_no_contested_unique_index() { run_dpns_contract_references_with_no_contested_unique_index_at_protocol_version( PlatformVersion::latest().protocol_version, - // v14: GroveDB V4 prepares the batch through retained Merk nodes, - // which bills slightly fewer reads than the V3 path - 6_006_380, + 6_010_380, ) .await; } @@ -36,7 +34,7 @@ mod dpns_tests { /// trigger context's add_operation never called on v0). Pinned so /// v11 chain history stays bit-for-bit reproducible. /// - /// Delta at PV12 (6_010_380): 6_010_380 - 5_978_080 = 32_300 credits = T1 + T2 + /// Delta vs PV12: 6_010_380 - 5_978_080 = 32_300 credits = T1 + T2 /// query costs across 3 subdomain creates (~10,767 per transition, /// or ~5,383 per query). #[tokio::test] diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/nft.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/nft.rs index 4a01e56e4b1..902a665fdcf 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/nft.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/nft.rs @@ -411,10 +411,7 @@ mod nft_tests { PlatformVersion::latest().protocol_version, 126440160, 2485600, - // v14: GroveDB V4 maintains backward references by default, so the - // index subtrees this transition empties are scanned for participants - // before the batch removes them - 4339640, + 4092360, ) .await; } @@ -837,10 +834,7 @@ mod nft_tests { 141238960, 2729120, 2733160, - // v14: GroveDB V4 maintains backward references by default, so the - // index subtrees this transition empties are scanned for participants - // before the batch removes them - 4610480, + 4357440, ) .await; } @@ -1420,10 +1414,7 @@ mod nft_tests { PlatformVersion::latest().protocol_version, 126440160, 2485600, - // v14: GroveDB V4 maintains backward references by default, so the - // index subtrees this transition empties are scanned for participants - // before the batch removes them - 4339640, + 4092360, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs index 06a0f4dcc21..5b9c07a62c0 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs @@ -498,10 +498,8 @@ mod replacement_tests { async fn test_document_replace_on_document_type_that_is_mutable() { run_document_replace_on_document_type_that_is_mutable_at_protocol_version( PlatformVersion::latest().protocol_version, - // v14: replaced documents carry the contract-version stamp, and GroveDB - // V4 prepares the batch through retained Merk nodes, which bills - // slightly fewer reads than the V3 path - 1428320, + // v14: replaced documents carry the contract-version stamp + 1433220, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/transfer.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/transfer.rs index dc0a951abd4..e8f51ec6344 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/transfer.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/transfer.rs @@ -213,10 +213,7 @@ mod transfer_tests { async fn test_document_transfer_on_document_type_that_is_transferable_before_creator_id() { run_document_transfer_on_document_type_that_is_transferable_before_creator_id_at_protocol_version( PlatformVersion::latest().protocol_version, - // v14: GroveDB V4 maintains backward references by default, so the - // index subtrees this transition empties are scanned for participants - // before the batch removes them - 3579040, + 3380960, ) .await; } @@ -501,10 +498,8 @@ mod transfer_tests { async fn test_document_transfer_on_document_type_that_is_transferable() { run_document_transfer_on_document_type_that_is_transferable_at_protocol_version( PlatformVersion::latest().protocol_version, - // v14: transferred documents carry the contract-version stamp, and - // GroveDB V4 scans the index subtrees the transfer empties for - // backward-reference participants before the batch removes them - 3841940, + // v14: transferred documents carry the contract-version stamp + 3643860, ) .await; } @@ -802,10 +797,7 @@ mod transfer_tests { async fn test_document_transfer_on_document_type_that_is_transferable_contract_v0() { run_document_transfer_on_document_type_that_is_transferable_contract_v0_at_protocol_version( PlatformVersion::latest().protocol_version, - // v14: GroveDB V4 maintains backward references by default, so the - // index subtrees this transition empties are scanned for participants - // before the batch removes them - 3579040, + 3380960, ) .await; } @@ -1499,10 +1491,7 @@ mod transfer_tests { async fn test_document_delete_after_transfer() { run_document_delete_after_transfer_at_protocol_version( PlatformVersion::latest().protocol_version, - // v14: stamped documents (see transferable baseline note); GroveDB V4 - // scans the index subtrees the transfer empties for backward-reference - // participants before the batch removes them - 4252000, + 4004720, // v14: stamped documents (see transferable baseline note) ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs index cc7d35f33b0..32d40c65338 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs @@ -3959,10 +3959,8 @@ mod token_burn_tests { run_token_burn_group_action_confirmer_fee_includes_transformer_reads_at_protocol_version( PlatformVersion::latest().protocol_version, // PROTOCOL_VERSION_14: +400 — genesis system documents now carry - // the contract-version stamp, shifting byte-billed subtree reads; - // +56_660: GroveDB V4 maintains backward references by default and - // scans the subtrees the confirmer removes for participants first - 4_424_940, + // the contract-version stamp, shifting byte-billed subtree reads + 4_368_280, ) .await; } diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs index f3addefb87e..70794e63e4c 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_delete/v0/mod.rs @@ -24,7 +24,8 @@ impl Drive { drive_version: &DriveVersion, ) -> Result<(), Error> { let options = DeleteOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs index c6f6888ee46..87bcd78dac2 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_delete_items_in_path_query/v0/mod.rs @@ -81,7 +81,8 @@ impl Drive { let current_batch_operations = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let options = DeleteOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs index aec2ea9c915..58d3e058bd3 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_move/v0/mod.rs @@ -61,7 +61,8 @@ impl Drive { // ── 2. Build the delete op ────────────────────────────────────────── let current_batch = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let delete_opts = DeleteOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs index cc0895e1383..09581042750 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_move_items_in_path_query/v0/mod.rs @@ -87,7 +87,8 @@ impl Drive { let current_batch_operations = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let options = DeleteOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs index b510a9dffbd..236654eef90 100644 --- a/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/batch_remove_raw/v0/mod.rs @@ -30,7 +30,8 @@ impl Drive { let mut current_batch_operations = LowLevelDriveOperation::grovedb_operations_batch(drive_operations); let options = DeleteOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true, diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs index 73f62f3e4a1..842f8a102a6 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_batch_with_add_costs/v0/mod.rs @@ -64,7 +64,8 @@ impl Drive { let cost_context = self.grove.apply_batch_with_element_flags_update( ops.operations, Some(BatchApplyOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, validate_insertion_does_not_override: validate, validate_insertion_does_not_override_tree: validate, disable_operation_consistency_check: !self.config.batching_consistency_verification, diff --git a/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs index 9ed5c2ab884..6f896a2000e 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_apply_partial_batch_with_add_costs/v0/mod.rs @@ -49,7 +49,8 @@ impl Drive { let cost_context = self.grove.apply_partial_batch_with_element_flags_update( ops.operations, Some(BatchApplyOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, validate_insertion_does_not_override: validate, validate_insertion_does_not_override_tree: validate, disable_operation_consistency_check: false, diff --git a/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs index d663ae8c7d2..df80e50103e 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_batch_operations_costs/v0/mod.rs @@ -25,7 +25,8 @@ impl Drive { AverageCaseCostsType(estimated_layer_info), ops.operations, Some(BatchApplyOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, validate_insertion_does_not_override: validate, validate_insertion_does_not_override_tree: validate, disable_operation_consistency_check: false, diff --git a/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs index 22986fb12d9..2531843378c 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_clear/v0/mod.rs @@ -15,7 +15,8 @@ impl Drive { drive_version: &DriveVersion, ) -> Result<(), Error> { let options = ClearOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, check_for_subtrees: false, allow_deleting_subtrees: false, trying_to_clear_with_subtrees_returns_error: false, diff --git a/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs index c092e87fd5b..43f2c262961 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_delete/v0/mod.rs @@ -19,7 +19,8 @@ impl Drive { drive_version: &DriveVersion, ) -> Result<(), Error> { let options = DeleteOptions { - backward_references_policy: BackwardReferencesPolicy::Maintain, + // Drive stores no backward-reference participants; Skip keeps the released V4 path. + backward_references_policy: BackwardReferencesPolicy::Skip, allow_deleting_non_empty_trees: false, deleting_non_empty_trees_returns_error: true, base_root_storage_is_free: true,