From d7143ccb48cc1569ae5132e8533416bdf5cfa8b4 Mon Sep 17 00:00:00 2001 From: lklimek <842586+lklimek@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:53:53 +0100 Subject: [PATCH 01/12] build!: optimize for x86-64-v3 cpu microarchitecture (Haswell+) (#2374) --- .cargo/config-release.toml | 5 ++++- .cargo/config.toml | 19 ++++++++++++++++- Dockerfile | 35 +++++++++++++++++++++++-------- packages/rs-drive-abci/Cargo.toml | 4 ++++ 4 files changed, 52 insertions(+), 11 deletions(-) diff --git a/.cargo/config-release.toml b/.cargo/config-release.toml index faab5e6c572..fa2932fecbe 100644 --- a/.cargo/config-release.toml +++ b/.cargo/config-release.toml @@ -5,7 +5,10 @@ rustflags = ["-C", "target-feature=-crt-static"] [target.x86_64-unknown-linux-musl] -rustflags = ["-C", "target-feature=-crt-static"] +rustflags = ["-C", "target-feature=-crt-static", "-C", "target-cpu=x86-64-v3"] + +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "target-feature=-crt-static", "-C", "target-cpu=x86-64-v3"] [target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" diff --git a/.cargo/config.toml b/.cargo/config.toml index 18bc8e4064b..307582b0ad0 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -4,7 +4,24 @@ rustflags = ["-C", "target-feature=-crt-static", "--cfg", "tokio_unstable"] [target.x86_64-unknown-linux-musl] -rustflags = ["-C", "target-feature=-crt-static", "--cfg", "tokio_unstable"] +rustflags = [ + "-C", + "target-feature=-crt-static", + "--cfg", + "tokio_unstable", + "-C", + "target-cpu=x86-64", +] + +[target.x86_64-unknown-linux-gnu] +rustflags = [ + "-C", + "target-feature=-crt-static", + "--cfg", + "tokio_unstable", + "-C", + "target-cpu=x86-64", +] [target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" diff --git a/Dockerfile b/Dockerfile index 5c8ac67655e..5b2ff5882a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -114,9 +114,28 @@ RUN TOOLCHAIN_VERSION="$(grep channel rust-toolchain.toml | awk '{print $3}' | t ONBUILD ENV HOME=/root ONBUILD ENV CARGO_HOME=$HOME/.cargo -# Configure Rust toolchain +ONBUILD ARG CARGO_BUILD_PROFILE=dev + +# Configure Rust toolchain and C / C++ compiler +RUN <> /root/env +echo 'source $HOME/.cargo/env' >> /root/env + +# Enable gcc / g++ optimizations +if [[ "$TARGETARCH" == "amd64" ]] ; then + if [[ "${CARGO_BUILD_PROFILE}" == "release" ]] ; then + echo "export CFLAGS=-march=x86-64-v3" >> /root/env + echo "export CXXFLAGS=-march=x86-64-v3" >> /root/env + echo "export PORTABLE=x86-64-v3" >> /root/env + else + echo "export CFLAGS=-march=x86-64" >> /root/env + echo "export CXXFLAGS=-march=x86-64" >> /root/env + echo "export PORTABLE=x86-64" >> /root/env + fi +else + echo "export PORTABLE=1" >> /root/env +fi +EOS # Install protoc - protobuf compiler # The one shipped with Alpine does not work @@ -258,14 +277,15 @@ WORKDIR /tmp/rocksdb # sccache -s # EOS +# Select whether we want dev or release +# This variable will be also visibe in next stages +ONBUILD ARG CARGO_BUILD_PROFILE=dev + RUN --mount=type=secret,id=AWS < Date: Tue, 14 Jan 2025 19:12:20 +0700 Subject: [PATCH 02/12] fix(drive): more than one key was returned when expecting only one result (#2421) --- .../src/abci/handler/check_tx.rs | 3 +- .../identity_credit_withdrawal/transformer.rs | 63 +++++++++++++++++++ .../v0/transformer.rs | 4 +- 3 files changed, 67 insertions(+), 3 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/handler/check_tx.rs b/packages/rs-drive-abci/src/abci/handler/check_tx.rs index bcad2ba2b42..f087bcb5d84 100644 --- a/packages/rs-drive-abci/src/abci/handler/check_tx.rs +++ b/packages/rs-drive-abci/src/abci/handler/check_tx.rs @@ -151,10 +151,11 @@ where let handler_error = HandlerError::Internal(error.to_string()); if tracing::enabled!(tracing::Level::ERROR) { - let st_hash = hex::encode(hash_single(tx)); + let st_hash = hex::encode(hash_single(&tx)); tracing::error!( ?error, + st = hex::encode(tx), st_hash, check_tx_mode = r#type, "Failed to check state transition ({}): {}", diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/transformer.rs index 5f619841bb8..ac46cd5fda7 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/transformer.rs @@ -42,3 +42,66 @@ impl IdentityCreditWithdrawalTransitionAction { } } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::util::test_helpers::setup::setup_drive_with_initial_state_structure; + use dpp::identity::accessors::IdentityGettersV0; + use dpp::identity::{Identity, IdentityPublicKey}; + use dpp::state_transition::identity_credit_withdrawal_transition::v1::IdentityCreditWithdrawalTransitionV1; + + #[test] + fn test_try_from_identity_credit_withdrawal_without_address_and_multiple_transfer_keys() { + let drive = setup_drive_with_initial_state_structure(None); + + let platform_version = PlatformVersion::latest(); + + let mut identity = Identity::random_identity(1, Some(64), &platform_version) + .expect("create random identity"); + + let (transfer_key1, _) = + IdentityPublicKey::random_masternode_transfer_key(2, Some(64), &platform_version) + .expect("create random masternode transfer key"); + let (transfer_key2, _) = + IdentityPublicKey::random_masternode_transfer_key(3, Some(64), &platform_version) + .expect("create random masternode transfer key"); + + identity.add_public_keys([transfer_key1, transfer_key2]); + + let identity_id = identity.id(); + + drive + .add_new_identity( + identity, + true, + &BlockInfo::default(), + true, + None, + platform_version, + ) + .expect("create new identity"); + + let transition = + IdentityCreditWithdrawalTransition::V1(IdentityCreditWithdrawalTransitionV1 { + identity_id, + nonce: 0, + amount: 0, + core_fee_per_byte: 0, + pooling: Default::default(), + output_script: None, + user_fee_increase: 0, + signature_public_key_id: 0, + signature: Default::default(), + }); + + IdentityCreditWithdrawalTransitionAction::try_from_identity_credit_withdrawal( + &drive, + None, + &transition, + &BlockInfo::default(), + platform_version, + ) + .expect("create action"); + } +} diff --git a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/transformer.rs b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/transformer.rs index e2c443d9ab7..bf4f38b651a 100644 --- a/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/transformer.rs +++ b/packages/rs-drive/src/state_transition_action/identity/identity_credit_withdrawal/v0/transformer.rs @@ -93,7 +93,7 @@ impl IdentityCreditWithdrawalTransitionActionV0 { let key_request = IdentityKeysRequest { identity_id: identity_credit_withdrawal.identity_id.to_buffer(), request_type: KeyRequestType::RecentWithdrawalKeys, - limit: None, + limit: Some(1), offset: None, }; let key: Option = @@ -177,7 +177,7 @@ impl IdentityCreditWithdrawalTransitionActionV0 { let withdrawal_document = DocumentV0 { id: document_id, owner_id: identity_credit_withdrawal.identity_id, - properties: document_data.into_btree_string_map().unwrap(), + properties: document_data.into_btree_string_map()?, revision: Some(1), created_at: Some(block_info.time_ms), updated_at: Some(block_info.time_ms), From e94b7bb3ef1c316dc3043635cc017796aae1ad6d Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Tue, 14 Jan 2025 19:23:46 +0700 Subject: [PATCH 03/12] fix(drive-abci): document purchase on mutable document from different epoch had issue (#2420) --- .github/actions/librocksdb/action.yaml | 4 +- Cargo.lock | 523 ++++------ Dockerfile | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- .../state_transitions/documents_batch/mod.rs | 916 +++++++++++++++++- ...ame-direct-purchase-documents-mutable.json | 134 +++ packages/rs-drive/Cargo.toml | 16 +- .../v0/mod.rs | 8 +- .../rs-drive/src/util/grove_operations/mod.rs | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- 11 files changed, 1282 insertions(+), 329 deletions(-) create mode 100644 packages/rs-drive-abci/tests/supporting_files/contract/crypto-card-game/crypto-card-game-direct-purchase-documents-mutable.json diff --git a/.github/actions/librocksdb/action.yaml b/.github/actions/librocksdb/action.yaml index 217e2745eb8..c35e8459233 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. "8.10.2" + description: RocksDB version, eg. "9.9.3" required: false - default: "8.10.2" + default: "9.9.3" force: description: Force rebuild required: false diff --git a/Cargo.lock b/Cargo.lock index 597cdf552d5..85b0b43826e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -213,7 +213,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -224,7 +224,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -304,7 +304,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -407,7 +407,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.75", + "syn 2.0.96", "which", ] @@ -428,7 +428,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -438,7 +438,7 @@ source = "git+https://github.com/dashpay/rs-bip37-bloom-filter?branch=develop#35 dependencies = [ "bitvec", "murmur3", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -506,7 +506,7 @@ dependencies = [ "arrayvec", "cc", "cfg-if", - "constant_time_eq 0.3.1", + "constant_time_eq", ] [[package]] @@ -560,7 +560,7 @@ dependencies = [ "sha2", "sha3", "subtle", - "thiserror", + "thiserror 1.0.64", "uint-zigzag", "vsss-rs", "zeroize", @@ -616,7 +616,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", "syn_derive", ] @@ -756,7 +756,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -862,7 +862,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -879,12 +879,11 @@ checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "colored" -version = "2.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" dependencies = [ - "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -941,24 +940,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - [[package]] name = "constant_time_eq" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - [[package]] name = "core-foundation" version = "0.9.4" @@ -993,6 +980,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32fast" version = "1.4.2" @@ -1125,7 +1127,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -1151,7 +1153,7 @@ dependencies = [ "dapi-grpc", "heck 0.5.0", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -1175,7 +1177,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -1186,7 +1188,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -1206,7 +1208,7 @@ dependencies = [ "dapi-grpc-macros", "dashcore-rpc", "data-contracts", - "derive_more 1.0.0", + "derive_more", "dotenvy", "dpp", "drive", @@ -1222,7 +1224,7 @@ dependencies = [ "serde", "serde_json", "test-case", - "thiserror", + "thiserror 1.0.64", "tokio", "tokio-test", "tokio-util", @@ -1304,7 +1306,7 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -1318,11 +1320,17 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror", + "thiserror 1.0.64", "wallet-utils-contract", "withdrawals-contract", ] +[[package]] +name = "deflate64" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" + [[package]] name = "delegate" version = "0.13.0" @@ -1331,7 +1339,7 @@ checksum = "5060bb0febb73fa907273f8a7ed17ab4bf831d585eac835b28ec24a1e2460956" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -1362,20 +1370,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", -] - -[[package]] -name = "derive_more" -version = "0.99.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -1395,7 +1390,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", "unicode-xid", ] @@ -1424,7 +1419,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -1446,7 +1441,7 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -1464,7 +1459,7 @@ dependencies = [ "ciborium 0.2.0", "dashcore", "data-contracts", - "derive_more 1.0.0", + "derive_more", "dpp", "env_logger 0.11.5", "getrandom", @@ -1495,7 +1490,7 @@ dependencies = [ "sha2", "strum", "test-case", - "thiserror", + "thiserror 1.0.64", "tokio", ] @@ -1512,7 +1507,7 @@ dependencies = [ "chrono", "ciborium 0.2.0", "criterion", - "derive_more 1.0.0", + "derive_more", "dpp", "enum-map", "grovedb", @@ -1536,7 +1531,7 @@ dependencies = [ "serde_json", "sqlparser", "tempfile", - "thiserror", + "thiserror 1.0.64", "tracing", ] @@ -1558,7 +1553,7 @@ dependencies = [ "dapi-grpc", "dashcore-rpc", "delegate", - "derive_more 1.0.0", + "derive_more", "dotenvy", "dpp", "drive", @@ -1587,7 +1582,7 @@ dependencies = [ "strategy-tests", "tempfile", "tenderdash-abci", - "thiserror", + "thiserror 1.0.64", "tokio", "tokio-util", "tracing", @@ -1601,7 +1596,7 @@ version = "1.8.0-dev.2" dependencies = [ "bincode", "dapi-grpc", - "derive_more 1.0.0", + "derive_more", "dpp", "drive", "hex", @@ -1611,7 +1606,7 @@ dependencies = [ "serde", "serde_json", "tenderdash-abci", - "thiserror", + "thiserror 1.0.64", "tracing", ] @@ -1622,7 +1617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9c8d6ea916fadcd87e3d1ff4802b696d717c83519b47e76f267ab77e536dd5a" dependencies = [ "ed-derive", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -1728,7 +1723,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -1813,28 +1808,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - [[package]] name = "fancy-regex" version = "0.13.0" @@ -1859,7 +1832,7 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -2034,7 +2007,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -2140,15 +2113,13 @@ dependencies = [ [[package]] name = "grovedb" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d91e8f87926c834c7338d0c69a48816c043e0cddf0062a8a567483db2fb1e24" +checksum = "ebf36cc41af86d8ccb8b7f64fd15006cd83ec979c49cd2ad30628bf855c54d7d" dependencies = [ "axum", "bincode", - "bitvec", "blake3", - "derive_more 0.99.18", "grovedb-costs", "grovedb-merk", "grovedb-path", @@ -2161,12 +2132,11 @@ dependencies = [ "indexmap 2.7.0", "integer-encoding", "intmap", - "itertools 0.12.1", - "nohash-hasher", + "itertools 0.14.0", "reqwest", "sha2", "tempfile", - "thiserror", + "thiserror 2.0.11", "tokio", "tokio-util", "tower-http", @@ -2175,40 +2145,38 @@ dependencies = [ [[package]] name = "grovedb-costs" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360f7c8d3b20beafcbf3cde8754bbcfd201ae2a30ec7594a4b9678fd2fa3c7a8" +checksum = "9cc526a58bdca58cb86340632081e27264e3557a73608cf29f6738ad9bfab316" dependencies = [ "integer-encoding", "intmap", - "thiserror", + "thiserror 2.0.11", ] [[package]] name = "grovedb-epoch-based-storage-flags" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acec1b6962d99d7b079c0fd1532cd3a2c83a3d659ffd9fcf02edda4599334bb4" +checksum = "abd5f01eb50ff57b2c24e856377684d42dacdbd04de7c0189bf2e0e0cd109692" dependencies = [ "grovedb-costs", "hex", "integer-encoding", "intmap", - "thiserror", + "thiserror 2.0.11", ] [[package]] name = "grovedb-merk" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72057865f239fdd24f92eaa8668acc0d618da168f330546577a62eda1701210e" +checksum = "0ce3b133a76e9935f3a57e08598769849d79df582244e1ac99509177e23c2605" dependencies = [ "bincode", "blake3", - "byteorder", "colored", "ed", - "failure", "grovedb-costs", "grovedb-path", "grovedb-storage", @@ -2219,21 +2187,20 @@ dependencies = [ "integer-encoding", "num_cpus", "rand", - "thiserror", - "time", + "thiserror 2.0.11", ] [[package]] name = "grovedb-path" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d96cc6106e5ca88e548d66f130b877b664da78be226dfdba555fc210f8508f4" +checksum = "67dc8bc00b9be473f7b25670d1422daadd706c9b09ed6aa5cf2caf8722a487ac" [[package]] name = "grovedb-storage" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1c9b59bc9fa7123b8485f87f88a886dd109e7aff5f34a29a3812cb64eb897ff" +checksum = "905cff776de89b9ee1e96979861e254b0912170b35d89678ad782f487a22a2e3" dependencies = [ "blake3", "grovedb-costs", @@ -2246,34 +2213,34 @@ dependencies = [ "rocksdb", "strum", "tempfile", - "thiserror", + "thiserror 2.0.11", ] [[package]] name = "grovedb-version" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4be0c1a1ef97068fe93212e7b6f349e0b44a9fc90063c8c28e110cfb8c2fcb2" +checksum = "a987e051c8c9cf8fa381b29b243d4951f8c1f24f9c90ceed52afca3ac460986c" dependencies = [ - "thiserror", + "thiserror 2.0.11", "versioned-feature-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grovedb-visualize" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5865f4335eb99644512a7d80d6b1698ba1099a8268fdfd3ffb1a3a32dcb4af28" +checksum = "56eee6f57d324505611de0042af2b6b9933235e704a1a6542ff7ba5b5c56f64e" dependencies = [ "hex", - "itertools 0.12.1", + "itertools 0.14.0", ] [[package]] name = "grovedbg-types" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921b9a29facf9d3f0de667cd1da083a34695ede9e7bfacd74bb5bd29f8f7c178" +checksum = "7cfa37a90579ba2c71e074d6047c1dcfc19caa458fbcefd4e8e31a02f6a9fe38" dependencies = [ "serde", "serde_with 3.9.0", @@ -2690,9 +2657,9 @@ checksum = "0d762194228a2f1c11063e46e32e5acb96e66e906382b9eb5441f2e0504bbd5a" [[package]] name = "intmap" -version = "2.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee87fd093563344074bacf24faa0bb0227fb6969fb223e922db798516de924d6" +checksum = "615970152acd1ae5f372f98eae7fab7ea63d4ee022cf655cf7079883bde9c3ee" dependencies = [ "serde", ] @@ -2756,6 +2723,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -2789,7 +2765,7 @@ checksum = "ec9ad60d674508f3ca8f380a928cfe7b096bc729c4e2dbfe3852bc45da3ab30b" dependencies = [ "serde", "serde_json", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -2801,7 +2777,7 @@ dependencies = [ "json-schema-compatibility-validator", "once_cell", "serde_json", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -2882,19 +2858,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] name = "librocksdb-sys" -version = "0.16.0+8.10.0" +version = "0.17.1+9.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c" +checksum = "2b7869a512ae9982f4d46ba482c2a304f1efd80c6412a3d4bf57bb79a619679f" dependencies = [ "bindgen 0.69.4", "bzip2-sys", "cc", - "glob", "libc", "libz-sys", "lz4-sys", @@ -2965,6 +2940,16 @@ dependencies = [ "libc", ] +[[package]] +name = "lzma-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" +dependencies = [ + "byteorder", + "crc", +] + [[package]] name = "masternode-reward-shares-contract" version = "1.8.0-dev.2" @@ -2972,7 +2957,7 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -3033,7 +3018,7 @@ dependencies = [ "metrics", "metrics-util", "quanta", - "thiserror", + "thiserror 1.0.64", "tokio", "tracing", ] @@ -3127,7 +3112,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -3149,7 +3134,7 @@ dependencies = [ "rustc_version", "smallvec", "tagptr", - "thiserror", + "thiserror 1.0.64", "triomphe", "uuid", ] @@ -3279,7 +3264,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -3372,7 +3357,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -3419,7 +3404,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -3481,18 +3466,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", -] - -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core", - "subtle", + "windows-targets", ] [[package]] @@ -3503,14 +3477,12 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest", "hmac", - "password-hash", - "sha2", ] [[package]] @@ -3552,7 +3524,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -3597,7 +3569,7 @@ version = "1.8.0-dev.2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", "virtue 0.0.17", ] @@ -3618,7 +3590,7 @@ dependencies = [ "regex", "serde", "serde_json", - "thiserror", + "thiserror 1.0.64", "treediff", ] @@ -3627,7 +3599,7 @@ name = "platform-value-convertible" version = "1.8.0-dev.2" dependencies = [ "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -3637,7 +3609,7 @@ dependencies = [ "bincode", "grovedb-version", "once_cell", - "thiserror", + "thiserror 1.0.64", "versioned-feature-core 1.0.0 (git+https://github.com/dashpay/versioned-feature-core)", ] @@ -3647,7 +3619,7 @@ version = "1.8.0-dev.2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -3742,7 +3714,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -3789,9 +3761,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -3823,7 +3795,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.75", + "syn 2.0.96", "tempfile", ] @@ -3837,7 +3809,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -4128,9 +4100,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bd13e55d6d7b8cd0ea569161127567cd587676c99f4472f779a0279aa60a7a7" +checksum = "26ec73b20525cb235bad420f911473b69f9fe27cc856c5461bccd7e4af037f43" dependencies = [ "libc", "librocksdb-sys", @@ -4151,7 +4123,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "thiserror", + "thiserror 1.0.64", "tokio", "tracing", ] @@ -4432,7 +4404,7 @@ checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -4466,7 +4438,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -4533,7 +4505,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -4545,7 +4517,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -4764,7 +4736,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -4795,9 +4767,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.75" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", @@ -4813,7 +4785,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -4831,18 +4803,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", -] - [[package]] name = "system-configuration" version = "0.6.1" @@ -4901,7 +4861,7 @@ dependencies = [ "semver", "serde_json", "tenderdash-proto", - "thiserror", + "thiserror 1.0.64", "tokio", "tokio-util", "tracing", @@ -4917,7 +4877,7 @@ source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.2.1%2B1.3.0#a dependencies = [ "bytes", "chrono", - "derive_more 1.0.0", + "derive_more", "flex-error", "num-derive", "num-traits", @@ -4941,7 +4901,7 @@ dependencies = [ "tonic-build", "ureq", "walkdir", - "zip 2.2.0", + "zip", ] [[package]] @@ -4977,7 +4937,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -4988,7 +4948,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", "test-case-core", ] @@ -4998,7 +4958,16 @@ version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.64", +] + +[[package]] +name = "thiserror" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +dependencies = [ + "thiserror-impl 2.0.11", ] [[package]] @@ -5009,7 +4978,18 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", ] [[package]] @@ -5134,7 +5114,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -5296,7 +5276,7 @@ dependencies = [ "prost-build", "prost-types", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -5373,7 +5353,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -5627,7 +5607,7 @@ dependencies = [ "platform-value", "platform-version", "serde_json", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -5666,7 +5646,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", "wasm-bindgen-shared", ] @@ -5701,7 +5681,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5729,7 +5709,7 @@ dependencies = [ "serde", "serde-wasm-bindgen", "serde_json", - "thiserror", + "thiserror 1.0.64", "wasm-bindgen", "wasm-bindgen-futures", "wasm-logger", @@ -5815,7 +5795,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -5826,7 +5806,7 @@ checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" dependencies = [ "windows-result", "windows-strings", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -5835,7 +5815,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -5845,16 +5825,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ "windows-result", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -5863,7 +5834,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -5872,22 +5843,7 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] @@ -5896,46 +5852,28 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -5948,48 +5886,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -6024,7 +5938,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", - "thiserror", + "thiserror 1.0.64", ] [[package]] @@ -6071,7 +5985,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.96", ] [[package]] @@ -6098,27 +6012,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", -] - -[[package]] -name = "zip" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" -dependencies = [ - "aes", - "byteorder", - "bzip2", - "constant_time_eq 0.1.5", - "crc32fast", - "crossbeam-utils", - "flate2", - "hmac", - "pbkdf2", - "sha1", - "time", - "zstd", + "syn 2.0.96", ] [[package]] @@ -6127,24 +6021,36 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" dependencies = [ + "aes", "arbitrary", + "bzip2", + "constant_time_eq", "crc32fast", "crossbeam-utils", + "deflate64", "displaydoc", "flate2", + "hmac", "indexmap 2.7.0", + "lzma-rs", "memchr", - "thiserror", + "pbkdf2", + "rand", + "sha1", + "thiserror 1.0.64", + "time", + "zeroize", "zopfli", + "zstd", ] [[package]] name = "zip-extensions" -version = "0.6.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecf62554c4ff96bce01a7ef123d160c3ffe9180638820f8b4d545c65b221b8c" +checksum = "386508a00aae1d8218b9252a41f59bba739ccee3f8e420bb90bcb1c30d960d4a" dependencies = [ - "zip 0.6.6", + "zip", ] [[package]] @@ -6163,20 +6069,19 @@ dependencies = [ [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Dockerfile b/Dockerfile index 671b488fff4..0050ed916a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -260,7 +260,7 @@ WORKDIR /tmp/rocksdb RUN --mount=type=secret,id=AWS <, Error>>()?; + .collect::, Error>>()?; // We need to update the current layer to only have 1 element that we want to delete let mut last_layer_information = layer_map - .remove((key_info_path.len() - 1) as u64) + .remove((key_info_path.len() - 1) as u16) .ok_or(Error::Fee(FeeError::CorruptedEstimatedLayerInfoMissing( "last layer info missing".to_owned(), )))?; last_layer_information.estimated_layer_sizes = element_estimated_sizes; - layer_map.insert((key_info_path.len() - 1) as u64, last_layer_information); + layer_map.insert((key_info_path.len() - 1) as u16, last_layer_information); Ok(BatchDeleteUpTreeApplyType::StatelessBatchDelete { estimated_layer_info: layer_map, }) diff --git a/packages/rs-drive/src/util/grove_operations/mod.rs b/packages/rs-drive/src/util/grove_operations/mod.rs index 41736ed442e..8178d007b2d 100644 --- a/packages/rs-drive/src/util/grove_operations/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/mod.rs @@ -221,7 +221,7 @@ pub enum BatchDeleteUpTreeApplyType { /// Stateless batch delete StatelessBatchDelete { /// The estimated layer info - estimated_layer_info: IntMap, + estimated_layer_info: IntMap, }, /// Stateful batch delete StatefulBatchDelete { diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index a05504d9ecb..a4b36bd6a73 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT" thiserror = { version = "1.0.63" } bincode = { version = "2.0.0-rc.3" } versioned-feature-core = { git = "https://github.com/dashpay/versioned-feature-core", version = "1.0.0" } -grovedb-version = { version = "2.1.0" } +grovedb-version = { version = "2.2.1" } once_cell = "1.19.0" [features] diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 23256c4b41c..2dfca6efdf3 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -46,4 +46,4 @@ platform-version = { path = "../rs-platform-version", features = [ ] } # For tests of grovedb verify -rocksdb = { version = "0.22.0" } +rocksdb = { version = "0.23.0" } From 6a0aedeca61421a58946f25c46662893c3977ff8 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Tue, 14 Jan 2025 21:42:59 +0700 Subject: [PATCH 04/12] chore: fix test suite configuration script (#2402) --- scripts/configure_test_suite_network.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/configure_test_suite_network.sh b/scripts/configure_test_suite_network.sh index 498e9d2d03e..b84e0286afa 100755 --- a/scripts/configure_test_suite_network.sh +++ b/scripts/configure_test_suite_network.sh @@ -57,16 +57,15 @@ MASTERNODE_OWNER_MASTER_PRIVATE_KEY=$(yq .hp_masternodes."$MASTERNODE_NAME".owne if [[ "$NETWORK_STRING" == "devnet"* ]]; then NETWORK=devnet - INSIGHT_URL="http://insight.${NETWORK_STRING#devnet-}.networks.dash.org:3001/insight-api/sync" CERT_FLAG=":self-signed" ST_EXECUTION_INTERVAL=5000 else NETWORK=testnet - INSIGHT_URL="https://testnet-insight.dashevo.org/insight-api/sync" CERT_FLAG="" ST_EXECUTION_INTERVAL=15000 fi -SKIP_SYNC_BEFORE_HEIGHT=4800 # $(curl -s $INSIGHT_URL | jq '.height - 200') +INSIGHT_URL="http://insight.${NETWORK_STRING#devnet-}.networks.dash.org:3001/insight-api/sync" +SKIP_SYNC_BEFORE_HEIGHT=$(curl -s $INSIGHT_URL | jq '.height - 200') # check variables are not empty if [ -z "$FAUCET_ADDRESS" ] || \ From 94dcbb289fdf7f1331dbc9437825d48a9d4bca1d Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Wed, 15 Jan 2025 05:51:45 +0700 Subject: [PATCH 05/12] chore(drive): increase withdrawal limits to 2000 Dash per day (#2287) --- .../withdrawal/daily_withdrawal_limit/mod.rs | 2 + .../daily_withdrawal_limit/v1/mod.rs | 8 ++ .../engine/run_block_proposal/v0/mod.rs | 4 + .../v0/mod.rs | 16 ++- packages/rs-drive-abci/src/rpc/core.rs | 5 - .../dpp_versions/dpp_method_versions/mod.rs | 1 + .../dpp_versions/dpp_method_versions/v2.rs | 5 + .../drive_abci_method_versions/mod.rs | 1 + .../drive_abci_method_versions/v5.rs | 124 ++++++++++++++++++ .../rs-platform-version/src/version/mod.rs | 5 +- .../src/version/protocol_version.rs | 4 +- .../rs-platform-version/src/version/v8.rs | 68 ++++++++++ 12 files changed, 230 insertions(+), 13 deletions(-) create mode 100644 packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v1/mod.rs create mode 100644 packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v2.rs create mode 100644 packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs create mode 100644 packages/rs-platform-version/src/version/v8.rs diff --git a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs index b1cd0a477db..997bd422621 100644 --- a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs +++ b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/mod.rs @@ -4,6 +4,7 @@ use crate::ProtocolError; use platform_version::version::PlatformVersion; mod v0; +mod v1; pub fn daily_withdrawal_limit( total_credits_in_platform: Credits, @@ -11,6 +12,7 @@ pub fn daily_withdrawal_limit( ) -> Result { match platform_version.dpp.methods.daily_withdrawal_limit { 0 => Ok(daily_withdrawal_limit_v0(total_credits_in_platform)), + 1 => Ok(v1::daily_withdrawal_limit_v1()), v => Err(ProtocolError::UnknownVersionError(format!( "Unknown daily_withdrawal_limit version {v}" ))), diff --git a/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v1/mod.rs b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v1/mod.rs new file mode 100644 index 00000000000..56112338a6d --- /dev/null +++ b/packages/rs-dpp/src/withdrawal/daily_withdrawal_limit/v1/mod.rs @@ -0,0 +1,8 @@ +use crate::fee::Credits; + +/// Set constant withdrawal daily limit to 2000 Dash +/// that corresponds to the limit in Core v22. +pub const fn daily_withdrawal_limit_v1() -> Credits { + // 2000 Dash + 200_000_000_000_000 +} diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 4cef4a48bca..6eb4fd82bb3 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -270,6 +270,10 @@ where })?; // This is a system error // Rebroadcast expired withdrawals if they exist + // We do that before we mark withdrawals as expired + // to rebroadcast them on the next block but not the same + // one + // TODO: It must be also only on core height change self.rebroadcast_expired_withdrawal_documents( &block_info, last_committed_platform_state, diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs index 1f6cacbc2bf..c8f8dda8e5a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/append_signatures_and_broadcast_withdrawal_transactions/v0/mod.rs @@ -1,10 +1,7 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::rpc::core::{ - CoreRPCLike, CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED, CORE_RPC_ERROR_ASSET_UNLOCK_NO_ACTIVE_QUORUM, - CORE_RPC_TX_ALREADY_IN_CHAIN, -}; +use crate::rpc::core::{CoreRPCLike, CORE_RPC_TX_ALREADY_IN_CHAIN}; use dashcore_rpc::jsonrpc; use dashcore_rpc::Error as CoreRPCError; use dpp::dashcore::bls_sig_utils::BLSSignature; @@ -18,6 +15,14 @@ use std::path::Path; use std::time::{SystemTime, UNIX_EPOCH}; use tenderdash_abci::proto::types::VoteExtension; +// This error is returned when Core can't find a quorum for the asset unlock transaction in Core 21 +const CORE_RPC_ERROR_ASSET_UNLOCK_NO_ACTIVE_QUORUM: &str = "bad-assetunlock-not-active-quorum"; + +// This error replaced the previous since Core 22 to make it more verbose +const CORE_RPC_ERROR_ASSET_UNLOCK_TOO_OLD_QUORUM: &str = "bad-assetunlock-too-old-quorum"; + +const CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED: &str = "bad-assetunlock-too-late"; + impl Platform where C: CoreRPCLike, @@ -90,7 +95,8 @@ where } Err(CoreRPCError::JsonRpc(jsonrpc::error::Error::Rpc(e))) if e.message == CORE_RPC_ERROR_ASSET_UNLOCK_NO_ACTIVE_QUORUM - || e.message == CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED => + || e.message == CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED + || e.message == CORE_RPC_ERROR_ASSET_UNLOCK_TOO_OLD_QUORUM => { tracing::debug!( tx_id = transaction.txid().to_string(), diff --git a/packages/rs-drive-abci/src/rpc/core.rs b/packages/rs-drive-abci/src/rpc/core.rs index a16f0341dc6..91ded6f6fe3 100644 --- a/packages/rs-drive-abci/src/rpc/core.rs +++ b/packages/rs-drive-abci/src/rpc/core.rs @@ -152,11 +152,6 @@ pub const CORE_RPC_INVALID_ADDRESS_OR_KEY: i32 = -5; /// Invalid, missing or duplicate parameter pub const CORE_RPC_INVALID_PARAMETER: i32 = -8; -/// Asset Unlock consensus error "bad-assetunlock-not-active-quorum" -pub const CORE_RPC_ERROR_ASSET_UNLOCK_NO_ACTIVE_QUORUM: &str = "bad-assetunlock-not-active-quorum"; -/// Asset Unlock consensus error "bad-assetunlock-not-active-quorum" -pub const CORE_RPC_ERROR_ASSET_UNLOCK_EXPIRED: &str = "bad-assetunlock-too-late"; - macro_rules! retry { ($action:expr) => {{ /// Maximum number of retry attempts diff --git a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs index a39362f90ec..e541023efc6 100644 --- a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs +++ b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/mod.rs @@ -1,6 +1,7 @@ use versioned_feature_core::FeatureVersion; pub mod v1; +pub mod v2; #[derive(Clone, Debug, Default)] pub struct DPPMethodVersions { diff --git a/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v2.rs b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v2.rs new file mode 100644 index 00000000000..d15ed3eaaf2 --- /dev/null +++ b/packages/rs-platform-version/src/version/dpp_versions/dpp_method_versions/v2.rs @@ -0,0 +1,5 @@ +use crate::version::dpp_versions::dpp_method_versions::DPPMethodVersions; +pub const DPP_METHOD_VERSIONS_V2: DPPMethodVersions = DPPMethodVersions { + epoch_core_reward_credits_for_distribution: 0, + daily_withdrawal_limit: 1, +}; diff --git a/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/mod.rs b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/mod.rs index 48caab4b3ca..8d671176f41 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/mod.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/mod.rs @@ -4,6 +4,7 @@ pub mod v1; pub mod v2; pub mod v3; pub mod v4; +pub mod v5; #[derive(Clone, Debug, Default)] pub struct DriveAbciMethodVersions { diff --git a/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs new file mode 100644 index 00000000000..900c0c153b9 --- /dev/null +++ b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs @@ -0,0 +1,124 @@ +use crate::version::drive_abci_versions::drive_abci_method_versions::{ + DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, + DriveAbciBlockStartMethodVersions, DriveAbciCoreBasedUpdatesMethodVersions, + DriveAbciCoreChainLockMethodVersionsAndConstants, DriveAbciCoreInstantSendLockMethodVersions, + DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, + DriveAbciFeePoolInwardsDistributionMethodVersions, + DriveAbciFeePoolOutwardsDistributionMethodVersions, + DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, + DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, + DriveAbciPlatformStateStorageMethodVersions, DriveAbciProtocolUpgradeMethodVersions, + DriveAbciStateTransitionProcessingMethodVersions, DriveAbciVotingMethodVersions, +}; + +pub const DRIVE_ABCI_METHOD_VERSIONS_V5: DriveAbciMethodVersions = DriveAbciMethodVersions { + engine: DriveAbciEngineMethodVersions { + init_chain: 0, + check_tx: 0, + run_block_proposal: 0, + finalize_block_proposal: 0, + consensus_params_update: 1, + }, + initialization: DriveAbciInitializationMethodVersions { + initial_core_height_and_time: 0, + create_genesis_state: 0, + }, + core_based_updates: DriveAbciCoreBasedUpdatesMethodVersions { + update_core_info: 0, + update_masternode_list: 0, + update_quorum_info: 0, + masternode_updates: DriveAbciMasternodeIdentitiesUpdatesMethodVersions { + get_voter_identity_key: 0, + get_operator_identity_keys: 0, + get_owner_identity_withdrawal_key: 0, + get_owner_identity_owner_key: 0, + get_voter_identifier_from_masternode_list_item: 0, + get_operator_identifier_from_masternode_list_item: 0, + create_operator_identity: 0, + create_owner_identity: 1, + create_voter_identity: 0, + disable_identity_keys: 0, + update_masternode_identities: 0, + update_operator_identity: 0, + update_owner_withdrawal_address: 1, + update_voter_identity: 0, + }, + }, + protocol_upgrade: DriveAbciProtocolUpgradeMethodVersions { + check_for_desired_protocol_upgrade: 1, + upgrade_protocol_version_on_epoch_change: 0, + perform_events_on_first_block_of_protocol_change: Some(0), + protocol_version_upgrade_percentage_needed: 67, + }, + block_fee_processing: DriveAbciBlockFeeProcessingMethodVersions { + add_process_epoch_change_operations: 0, + process_block_fees: 0, + }, + core_chain_lock: DriveAbciCoreChainLockMethodVersionsAndConstants { + choose_quorum: 0, + verify_chain_lock: 0, + verify_chain_lock_locally: 0, + verify_chain_lock_through_core: 0, + make_sure_core_is_synced_to_chain_lock: 0, + recent_block_count_amount: 2, + }, + core_instant_send_lock: DriveAbciCoreInstantSendLockMethodVersions { + verify_recent_signature_locally: 0, + }, + fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { + add_distribute_block_fees_into_pools_operations: 0, + add_distribute_storage_fee_to_epochs_operations: 0, + }, + fee_pool_outwards_distribution: DriveAbciFeePoolOutwardsDistributionMethodVersions { + add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations: 0, + add_epoch_pool_to_proposers_payout_operations: 0, + find_oldest_epoch_needing_payment: 0, + fetch_reward_shares_list_for_masternode: 0, + }, + withdrawals: DriveAbciIdentityCreditWithdrawalMethodVersions { + build_untied_withdrawal_transactions_from_documents: 0, + dequeue_and_build_unsigned_withdrawal_transactions: 0, + fetch_transactions_block_inclusion_status: 0, + // We changed `pool_withdrawals_into_transactions_queue` to v1 in order to add pool + // withdrawals on any validator quorums. v0 allowed us to pool only on the first two + // quorums as workaround for Core v21 bug. + pool_withdrawals_into_transactions_queue: 1, + update_broadcasted_withdrawal_statuses: 0, + rebroadcast_expired_withdrawal_documents: 0, + append_signatures_and_broadcast_withdrawal_transactions: 0, + cleanup_expired_locks_of_withdrawal_amounts: 0, + }, + voting: DriveAbciVotingMethodVersions { + keep_record_of_finished_contested_resource_vote_poll: 0, + clean_up_after_vote_poll_end: 0, + clean_up_after_contested_resources_vote_poll_end: 0, + check_for_ended_vote_polls: 0, + tally_votes_for_contested_document_resource_vote_poll: 0, + award_document_to_winner: 0, + delay_vote_poll: 0, + run_dao_platform_events: 0, + remove_votes_for_removed_masternodes: 0, + }, + state_transition_processing: DriveAbciStateTransitionProcessingMethodVersions { + execute_event: 0, + process_raw_state_transitions: 0, + decode_raw_state_transitions: 0, + validate_fees_of_event: 0, + }, + epoch: DriveAbciEpochMethodVersions { + gather_epoch_info: 0, + get_genesis_time: 0, + }, + block_start: DriveAbciBlockStartMethodVersions { + clear_drive_block_cache: 0, + }, + block_end: DriveAbciBlockEndMethodVersions { + update_state_cache: 0, + update_drive_cache: 0, + validator_set_update: 2, + }, + platform_state_storage: DriveAbciPlatformStateStorageMethodVersions { + fetch_platform_state: 0, + store_platform_state: 0, + }, +}; diff --git a/packages/rs-platform-version/src/version/mod.rs b/packages/rs-platform-version/src/version/mod.rs index b143a1daf15..430317100c4 100644 --- a/packages/rs-platform-version/src/version/mod.rs +++ b/packages/rs-platform-version/src/version/mod.rs @@ -1,5 +1,5 @@ mod protocol_version; -use crate::version::v7::PROTOCOL_VERSION_7; +use crate::version::v8::PROTOCOL_VERSION_8; pub use protocol_version::*; mod consensus_versions; @@ -19,8 +19,9 @@ pub mod v4; pub mod v5; pub mod v6; pub mod v7; +pub mod v8; pub type ProtocolVersion = u32; -pub const LATEST_VERSION: ProtocolVersion = PROTOCOL_VERSION_7; +pub const LATEST_VERSION: ProtocolVersion = PROTOCOL_VERSION_8; pub const INITIAL_PROTOCOL_VERSION: ProtocolVersion = 1; diff --git a/packages/rs-platform-version/src/version/protocol_version.rs b/packages/rs-platform-version/src/version/protocol_version.rs index d793384c729..520ceef97ad 100644 --- a/packages/rs-platform-version/src/version/protocol_version.rs +++ b/packages/rs-platform-version/src/version/protocol_version.rs @@ -22,6 +22,7 @@ use crate::version::v4::PLATFORM_V4; use crate::version::v5::PLATFORM_V5; use crate::version::v6::PLATFORM_V6; use crate::version::v7::PLATFORM_V7; +use crate::version::v8::PLATFORM_V8; use crate::version::ProtocolVersion; pub use versioned_feature_core::*; @@ -45,6 +46,7 @@ pub const PLATFORM_VERSIONS: &[PlatformVersion] = &[ PLATFORM_V5, PLATFORM_V6, PLATFORM_V7, + PLATFORM_V8, ]; #[cfg(feature = "mock-versions")] @@ -53,7 +55,7 @@ pub static PLATFORM_TEST_VERSIONS: OnceLock> = OnceLock::ne #[cfg(feature = "mock-versions")] const DEFAULT_PLATFORM_TEST_VERSIONS: &[PlatformVersion] = &[TEST_PLATFORM_V2, TEST_PLATFORM_V3]; -pub const LATEST_PLATFORM_VERSION: &PlatformVersion = &PLATFORM_V7; +pub const LATEST_PLATFORM_VERSION: &PlatformVersion = &PLATFORM_V8; pub const DESIRED_PLATFORM_VERSION: &PlatformVersion = LATEST_PLATFORM_VERSION; diff --git a/packages/rs-platform-version/src/version/v8.rs b/packages/rs-platform-version/src/version/v8.rs new file mode 100644 index 00000000000..437b2f3ecbb --- /dev/null +++ b/packages/rs-platform-version/src/version/v8.rs @@ -0,0 +1,68 @@ +use crate::version::consensus_versions::ConsensusVersions; +use crate::version::dpp_versions::dpp_asset_lock_versions::v1::DPP_ASSET_LOCK_VERSIONS_V1; +use crate::version::dpp_versions::dpp_contract_versions::v1::CONTRACT_VERSIONS_V1; +use crate::version::dpp_versions::dpp_costs_versions::v1::DPP_COSTS_VERSIONS_V1; +use crate::version::dpp_versions::dpp_document_versions::v1::DOCUMENT_VERSIONS_V1; +use crate::version::dpp_versions::dpp_factory_versions::v1::DPP_FACTORY_VERSIONS_V1; +use crate::version::dpp_versions::dpp_identity_versions::v1::IDENTITY_VERSIONS_V1; +use crate::version::dpp_versions::dpp_method_versions::v2::DPP_METHOD_VERSIONS_V2; +use crate::version::dpp_versions::dpp_state_transition_conversion_versions::v2::STATE_TRANSITION_CONVERSION_VERSIONS_V2; +use crate::version::dpp_versions::dpp_state_transition_method_versions::v1::STATE_TRANSITION_METHOD_VERSIONS_V1; +use crate::version::dpp_versions::dpp_state_transition_serialization_versions::v1::STATE_TRANSITION_SERIALIZATION_VERSIONS_V1; +use crate::version::dpp_versions::dpp_state_transition_versions::v2::STATE_TRANSITION_VERSIONS_V2; +use crate::version::dpp_versions::dpp_validation_versions::v2::DPP_VALIDATION_VERSIONS_V2; +use crate::version::dpp_versions::dpp_voting_versions::v2::VOTING_VERSION_V2; +use crate::version::dpp_versions::DPPVersion; +use crate::version::drive_abci_versions::drive_abci_method_versions::v5::DRIVE_ABCI_METHOD_VERSIONS_V5; +use crate::version::drive_abci_versions::drive_abci_query_versions::v1::DRIVE_ABCI_QUERY_VERSIONS_V1; +use crate::version::drive_abci_versions::drive_abci_structure_versions::v1::DRIVE_ABCI_STRUCTURE_VERSIONS_V1; +use crate::version::drive_abci_versions::drive_abci_validation_versions::v5::DRIVE_ABCI_VALIDATION_VERSIONS_V5; +use crate::version::drive_abci_versions::drive_abci_withdrawal_constants::v2::DRIVE_ABCI_WITHDRAWAL_CONSTANTS_V2; +use crate::version::drive_abci_versions::DriveAbciVersion; +use crate::version::drive_versions::v2::DRIVE_VERSION_V2; +use crate::version::fee::v1::FEE_VERSION1; +use crate::version::protocol_version::PlatformVersion; +use crate::version::system_data_contract_versions::v1::SYSTEM_DATA_CONTRACT_VERSIONS_V1; +use crate::version::system_limits::v1::SYSTEM_LIMITS_V1; +use crate::version::ProtocolVersion; + +pub const PROTOCOL_VERSION_8: ProtocolVersion = 8; + +/// This version contains some fixes for withdrawals and nfts. +pub const PLATFORM_V8: PlatformVersion = PlatformVersion { + protocol_version: PROTOCOL_VERSION_8, + drive: DRIVE_VERSION_V2, + drive_abci: DriveAbciVersion { + structs: DRIVE_ABCI_STRUCTURE_VERSIONS_V1, + // We changed `pool_withdrawals_into_transactions_queue` to v1 in order to add pool + // withdrawals on any validator quorums. v0 allowed us to pool only on the first two + // quorums as workaround for Core v21 bug. + methods: DRIVE_ABCI_METHOD_VERSIONS_V5, + validation_and_processing: DRIVE_ABCI_VALIDATION_VERSIONS_V5, + withdrawal_constants: DRIVE_ABCI_WITHDRAWAL_CONSTANTS_V2, + query: DRIVE_ABCI_QUERY_VERSIONS_V1, + }, + dpp: DPPVersion { + costs: DPP_COSTS_VERSIONS_V1, + validation: DPP_VALIDATION_VERSIONS_V2, + state_transition_serialization_versions: STATE_TRANSITION_SERIALIZATION_VERSIONS_V1, + state_transition_conversion_versions: STATE_TRANSITION_CONVERSION_VERSIONS_V2, + state_transition_method_versions: STATE_TRANSITION_METHOD_VERSIONS_V1, + state_transitions: STATE_TRANSITION_VERSIONS_V2, + contract_versions: CONTRACT_VERSIONS_V1, + document_versions: DOCUMENT_VERSIONS_V1, + identity_versions: IDENTITY_VERSIONS_V1, + voting_versions: VOTING_VERSION_V2, + asset_lock_versions: DPP_ASSET_LOCK_VERSIONS_V1, + // We changed `daily_withdrawal_limit` to v1 to increase daily withdrawal limit + // to 2000 Dash. + methods: DPP_METHOD_VERSIONS_V2, + factory_versions: DPP_FACTORY_VERSIONS_V1, + }, + system_data_contracts: SYSTEM_DATA_CONTRACT_VERSIONS_V1, + fee_version: FEE_VERSION1, + system_limits: SYSTEM_LIMITS_V1, + consensus: ConsensusVersions { + tenderdash_consensus_version: 1, + }, +}; From c6feb5b4dc1263cfdd8bd87010ecfa98e2e95e55 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 15 Jan 2025 18:57:49 +0700 Subject: [PATCH 06/12] feat(platform)!: distribute prefunded specialized balances after vote (#2422) Co-authored-by: Ivan Shumkov --- .../v0/mod.rs | 154 ++- .../check_for_ended_vote_polls/v0/mod.rs | 1 + .../mod.rs | 12 +- .../v0/mod.rs | 58 +- .../v1/mod.rs | 88 ++ .../clean_up_after_vote_polls_end/mod.rs | 3 + .../clean_up_after_vote_polls_end/v0/mod.rs | 3 + .../balance/v0/mod.rs | 2 +- .../strategy_tests/upgrade_fork_tests.rs | 4 +- .../tests/strategy_tests/voting_tests.rs | 1166 ++++++++++++++++- .../mod.rs | 56 + .../v0/mod.rs | 60 + .../mod.rs | 4 +- .../v0/mod.rs | 4 +- .../epochs/credit_distribution_pools/mod.rs | 1 + packages/rs-drive/src/drive/mod.rs | 5 +- .../mod.rs | 10 +- .../v1/mod.rs | 91 ++ .../mod.rs | 8 + .../v1/mod.rs | 91 ++ .../mod.rs | 53 + .../v0/mod.rs | 52 + .../mod.rs | 60 + .../v0/mod.rs | 85 ++ .../prefunded_specialized_balances/mod.rs | 11 +- packages/rs-drive/src/fees/mod.rs | 1 + packages/rs-drive/src/lib.rs | 3 +- .../grove_get_raw_optional/v0/mod.rs | 2 +- packages/rs-platform-value/src/inner_value.rs | 2 +- .../drive_abci_method_versions/v5.rs | 2 +- .../drive_credit_pool_method_versions/mod.rs | 1 + .../drive_credit_pool_method_versions/v1.rs | 1 + .../src/version/drive_versions/mod.rs | 2 + .../src/version/drive_versions/v1.rs | 1 + .../src/version/drive_versions/v2.rs | 1 + .../src/version/drive_versions/v3.rs | 101 ++ .../src/version/mocks/v2_test.rs | 1 + .../rs-platform-version/src/version/v8.rs | 5 +- 38 files changed, 2163 insertions(+), 42 deletions(-) create mode 100644 packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v1/mod.rs create mode 100644 packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/add_epoch_processing_credits_for_distribution_operation/mod.rs create mode 100644 packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/add_epoch_processing_credits_for_distribution_operation/v0/mod.rs create mode 100644 packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/v1/mod.rs create mode 100644 packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/v1/mod.rs create mode 100644 packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance/mod.rs create mode 100644 packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance/v0/mod.rs create mode 100644 packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance_operations/mod.rs create mode 100644 packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance_operations/v0/mod.rs create mode 100644 packages/rs-platform-version/src/version/drive_versions/v3.rs diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs index d36250ea3e7..27a10ad10c7 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs @@ -1,3 +1,4 @@ +use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; @@ -5,9 +6,13 @@ use crate::platform_types::platform_state::PlatformState; use dpp::block::block_info::BlockInfo; use dpp::dashcore::hashes::Hash; use dpp::data_contracts::SystemDataContract; +use dpp::fee::Credits; +use dpp::platform_value::Identifier; +use dpp::serialization::PlatformDeserializable; use dpp::system_data_contracts::load_system_data_contract; use dpp::version::PlatformVersion; use dpp::version::ProtocolVersion; +use dpp::voting::vote_polls::VotePoll; use drive::drive::identity::key::fetch::{ IdentityKeysRequest, KeyIDIdentityPublicKeyPairBTreeMap, KeyRequestType, }; @@ -15,7 +20,15 @@ use drive::drive::identity::withdrawals::paths::{ get_withdrawal_root_path, WITHDRAWAL_TRANSACTIONS_BROADCASTED_KEY, WITHDRAWAL_TRANSACTIONS_SUM_AMOUNT_TREE_KEY, }; -use drive::grovedb::{Element, Transaction}; +use drive::drive::prefunded_specialized_balances::{ + prefunded_specialized_balances_for_voting_path, + prefunded_specialized_balances_for_voting_path_vec, +}; +use drive::drive::votes::paths::vote_end_date_queries_tree_path_vec; +use drive::grovedb::{Element, PathQuery, Query, QueryItem, SizedQuery, Transaction}; +use drive::query::QueryResultType; +use std::collections::HashSet; +use std::ops::RangeFull; impl Platform { /// Executes protocol-specific events on the first block after a protocol version change. @@ -58,6 +71,20 @@ impl Platform { self.transition_to_version_6(block_info, transaction, platform_version)?; } + if previous_protocol_version < 8 && platform_version.protocol_version >= 8 { + self.transition_to_version_8(block_info, transaction, platform_version) + .or_else(|e| { + tracing::error!( + error = ?e, + "Error while transitioning to version 8: {e}" + ); + + // We ignore this transition errors because it's not changing the state stucture + // and not critical for the system + Ok::<(), Error>(()) + })?; + } + Ok(()) } @@ -86,6 +113,131 @@ impl Platform { Ok(()) } + /// When transitioning to version 8 we need to empty some specialized balances + fn transition_to_version_8( + &self, + block_info: &BlockInfo, + transaction: &Transaction, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + // Let's start by getting all the specialized balances that exist + let path_holding_specialized_balances = + prefunded_specialized_balances_for_voting_path_vec(); + let path_query = PathQuery::new_single_query_item( + path_holding_specialized_balances, + QueryItem::RangeFull(RangeFull), + ); + let all_specialized_balances_still_around: HashSet<_> = self + .drive + .grove_get_path_query( + &path_query, + Some(transaction), + QueryResultType::QueryKeyElementPairResultType, + &mut vec![], + &platform_version.drive, + )? + .0 + .to_keys() + .into_iter() + .map(Identifier::try_from) + .collect::, dpp::platform_value::Error>>()?; + + let path = vote_end_date_queries_tree_path_vec(); + + let mut query = Query::new_with_direction(true); + + query.insert_all(); + + let mut sub_query = Query::new(); + + sub_query.insert_all(); + + query.default_subquery_branch.subquery = Some(sub_query.into()); + + let current_votes_path_query = PathQuery { + path, + query: SizedQuery { + query, + limit: Some(30000), //Just a high number that shouldn't break the system + offset: None, + }, + }; + + let (query_result_elements, _) = self.drive.grove_get_path_query( + ¤t_votes_path_query, + Some(transaction), + QueryResultType::QueryElementResultType, + &mut vec![], + &platform_version.drive, + )?; + + let active_specialized_balances = query_result_elements + .to_elements() + .into_iter() + .map(|element| { + let contested_document_resource_vote_poll_bytes = element + .into_item_bytes() + .map_err(drive::error::Error::GroveDB)?; + let vote_poll = + VotePoll::deserialize_from_bytes(&contested_document_resource_vote_poll_bytes)?; + match vote_poll { + VotePoll::ContestedDocumentResourceVotePoll(contested) => { + contested.specialized_balance_id().map_err(Error::Protocol) + } + } + }) + .collect::, Error>>()?; + + // let's get the non-active ones + let non_active_specialized_balances = + all_specialized_balances_still_around.difference(&active_specialized_balances); + + let mut total_credits_to_add_to_processing: Credits = 0; + + let mut operations = vec![]; + + for specialized_balance_id in non_active_specialized_balances { + let (credits, mut empty_specialized_balance_operation) = + self.drive.empty_prefunded_specialized_balance_operations( + *specialized_balance_id, + false, + &mut None, + Some(transaction), + platform_version, + )?; + operations.append(&mut empty_specialized_balance_operation); + total_credits_to_add_to_processing = total_credits_to_add_to_processing + .checked_add(credits) + .ok_or(Error::Execution(ExecutionError::Overflow( + "Credits from specialized balances are overflowing", + )))?; + } + + if total_credits_to_add_to_processing > 0 { + operations.push( + self.drive + .add_epoch_processing_credits_for_distribution_operation( + &block_info.epoch, + total_credits_to_add_to_processing, + Some(transaction), + platform_version, + )?, + ); + } + + if !operations.is_empty() { + self.drive.apply_batch_low_level_drive_operations( + None, + Some(transaction), + operations, + &mut vec![], + &platform_version.drive, + )?; + } + + Ok(()) + } + /// Initializes an empty sum tree for withdrawal transactions required for protocol version 4. /// /// This function is called during the transition to protocol version 4 to set up diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/v0/mod.rs index 426888de5da..a7175c4c7db 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/check_for_ended_vote_polls/v0/mod.rs @@ -310,6 +310,7 @@ where // This means removing it and also removing all current votes if !vote_polls_with_info.is_empty() { self.clean_up_after_vote_polls_end( + block_info, &vote_polls_with_info, clean_up_testnet_corrupted_reference_issue, transaction, diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/mod.rs index 1c13190a5a4..d3cdd55fa2c 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/mod.rs @@ -2,6 +2,7 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; use dpp::identifier::Identifier; use dpp::prelude::TimestampMillis; use dpp::version::PlatformVersion; @@ -11,6 +12,7 @@ use drive::grovedb::TransactionArg; use std::collections::BTreeMap; mod v0; +mod v1; impl Platform where @@ -19,6 +21,7 @@ where /// Checks for ended vote polls pub(in crate::execution) fn clean_up_after_contested_resources_vote_polls_end( &self, + block_info: &BlockInfo, vote_polls: Vec<( &ContestedDocumentResourceVotePollWithContractInfo, &TimestampMillis, @@ -40,9 +43,16 @@ where transaction, platform_version, ), + 1 => self.clean_up_after_contested_resources_vote_polls_end_v1( + block_info, + vote_polls, + clean_up_testnet_corrupted_reference_issue, + transaction, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "clean_up_after_contested_resources_vote_polls_end".to_string(), - known_versions: vec![0], + known_versions: vec![0, 1], received: version, })), } diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v0/mod.rs index f444ed1e61f..3dc1777acfd 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v0/mod.rs @@ -8,6 +8,7 @@ use dpp::version::PlatformVersion; use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; use dpp::ProtocolError; use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::fees::op::LowLevelDriveOperation; use drive::grovedb::TransactionArg; use std::collections::BTreeMap; @@ -28,12 +29,43 @@ where transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result<(), Error> { + let operations = self.clean_up_after_contested_resources_vote_polls_end_operations_v0( + vote_polls.as_slice(), + clean_up_testnet_corrupted_reference_issue, + transaction, + platform_version, + )?; + if !operations.is_empty() { + self.drive.apply_batch_low_level_drive_operations( + None, + transaction, + operations, + &mut vec![], + &platform_version.drive, + )?; + } + + Ok(()) + } + /// Checks for ended vote polls + #[inline(always)] + pub(super) fn clean_up_after_contested_resources_vote_polls_end_operations_v0( + &self, + vote_polls: &[( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )], + clean_up_testnet_corrupted_reference_issue: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { let mut operations = vec![]; // We remove the end date query self.drive .remove_contested_resource_vote_poll_end_date_query_operations( - vote_polls.as_slice(), + vote_polls, &mut operations, transaction, platform_version, @@ -42,7 +74,7 @@ where // We remove the votes from under the contenders votes received self.drive .remove_contested_resource_vote_poll_votes_operations( - vote_polls.as_slice(), + vote_polls, true, &mut operations, transaction, @@ -52,7 +84,7 @@ where // We remove the documents that contenders have self.drive .remove_contested_resource_vote_poll_documents_operations( - vote_polls.as_slice(), + vote_polls, clean_up_testnet_corrupted_reference_issue, &mut operations, transaction, @@ -62,7 +94,7 @@ where // We remove the contenders self.drive .remove_contested_resource_vote_poll_contenders_operations( - vote_polls.as_slice(), + vote_polls, &mut operations, transaction, platform_version, @@ -81,7 +113,7 @@ where let mut identity_to_vote_ids_map: BTreeMap<&Identifier, Vec<&Identifier>> = BTreeMap::new(); - for (vote_poll, _, voters_for_contender) in &vote_polls { + for (vote_poll, _, voters_for_contender) in vote_polls { let vote_id = vote_poll_ids .iter() .find_map(|(vp, vid)| if vp == vote_poll { Some(vid) } else { None }) @@ -113,7 +145,7 @@ where if clean_up_testnet_corrupted_reference_issue { self.drive.remove_contested_resource_info_operations( - vote_polls.as_slice(), + vote_polls, &mut operations, transaction, platform_version, @@ -121,23 +153,13 @@ where // We remove the last index self.drive .remove_contested_resource_top_level_index_operations( - vote_polls.as_slice(), + vote_polls, &mut operations, transaction, platform_version, )?; } - if !operations.is_empty() { - self.drive.apply_batch_low_level_drive_operations( - None, - transaction, - operations, - &mut vec![], - &platform_version.drive, - )?; - } - - Ok(()) + Ok(operations) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v1/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v1/mod.rs new file mode 100644 index 00000000000..9fd22acf087 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_contested_resources_vote_polls_end/v1/mod.rs @@ -0,0 +1,88 @@ +use crate::error::execution::ExecutionError; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; +use dpp::fee::Credits; +use dpp::identifier::Identifier; +use dpp::prelude::TimestampMillis; +use dpp::version::PlatformVersion; +use dpp::voting::vote_choices::resource_vote_choice::ResourceVoteChoice; +use drive::drive::votes::resolved::vote_polls::contested_document_resource_vote_poll::ContestedDocumentResourceVotePollWithContractInfo; +use drive::grovedb::TransactionArg; +use std::collections::BTreeMap; + +impl Platform +where + C: CoreRPCLike, +{ + /// Checks for ended vote polls + #[inline(always)] + pub(super) fn clean_up_after_contested_resources_vote_polls_end_v1( + &self, + block_info: &BlockInfo, + vote_polls: Vec<( + &ContestedDocumentResourceVotePollWithContractInfo, + &TimestampMillis, + &BTreeMap>, + )>, + clean_up_testnet_corrupted_reference_issue: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let mut operations = self.clean_up_after_contested_resources_vote_polls_end_operations_v0( + vote_polls.as_slice(), + clean_up_testnet_corrupted_reference_issue, + transaction, + platform_version, + )?; + + // We also need to clean out the specialized balances + + let mut total_credits_to_add_to_processing: Credits = 0; + + for specialized_balance_id in vote_polls + .iter() + .map(|(vote_poll, _, _)| vote_poll.specialized_balance_id()) + { + let (credits, mut empty_specialized_balance_operation) = + self.drive.empty_prefunded_specialized_balance_operations( + specialized_balance_id?, + false, + &mut None, + transaction, + platform_version, + )?; + operations.append(&mut empty_specialized_balance_operation); + total_credits_to_add_to_processing = total_credits_to_add_to_processing + .checked_add(credits) + .ok_or(Error::Execution(ExecutionError::Overflow( + "Credits from specialized balances are overflowing", + )))?; + } + + if total_credits_to_add_to_processing > 0 { + operations.push( + self.drive + .add_epoch_processing_credits_for_distribution_operation( + &block_info.epoch, + total_credits_to_add_to_processing, + transaction, + platform_version, + )?, + ); + } + + if !operations.is_empty() { + self.drive.apply_batch_low_level_drive_operations( + None, + transaction, + operations, + &mut vec![], + &platform_version.drive, + )?; + } + + Ok(()) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/mod.rs index 2852effd323..6580b030998 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/mod.rs @@ -2,6 +2,7 @@ use crate::error::execution::ExecutionError; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; use dpp::prelude::TimestampMillis; use dpp::version::PlatformVersion; use drive::drive::votes::resolved::vote_polls::ResolvedVotePollWithVotes; @@ -17,6 +18,7 @@ where /// Checks for ended vote polls pub(in crate::execution) fn clean_up_after_vote_polls_end( &self, + block_info: &BlockInfo, vote_polls: &BTreeMap>, clean_up_testnet_corrupted_reference_issue: bool, transaction: TransactionArg, @@ -29,6 +31,7 @@ where .clean_up_after_vote_poll_end { 0 => self.clean_up_after_vote_polls_end_v0( + block_info, vote_polls, clean_up_testnet_corrupted_reference_issue, transaction, diff --git a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/v0/mod.rs index a5b0d75a3b5..81d8b84157b 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/voting/clean_up_after_vote_polls_end/v0/mod.rs @@ -1,6 +1,7 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; +use dpp::block::block_info::BlockInfo; use dpp::identifier::Identifier; use dpp::prelude::TimestampMillis; use dpp::version::PlatformVersion; @@ -18,6 +19,7 @@ where #[inline(always)] pub(super) fn clean_up_after_vote_polls_end_v0( &self, + block_info: &BlockInfo, vote_polls: &BTreeMap>, clean_up_testnet_corrupted_reference_issue: bool, transaction: TransactionArg, @@ -44,6 +46,7 @@ where if !contested_polls.is_empty() { // Call the function to clean up contested document resource vote polls self.clean_up_after_contested_resources_vote_polls_end( + block_info, contested_polls, clean_up_testnet_corrupted_reference_issue, transaction, diff --git a/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/v0/mod.rs b/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/v0/mod.rs index fed648c116a..410a9021959 100644 --- a/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/prefunded_specialized_balances/balance/v0/mod.rs @@ -50,7 +50,7 @@ impl Platform { let Some(balance) = maybe_balance else { return Ok(ValidationResult::new_with_error(QueryError::NotFound( - "No Identity found".to_string(), + "No Specialized balance found".to_string(), ))); }; diff --git a/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs index 554394956be..6cc875c18fc 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs @@ -783,7 +783,7 @@ mod tests { chain_lock: ChainLockConfig::default_100_67(), instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { - verify_sum_trees: true, + verify_sum_trees: false, //faster without this epoch_time_length_s: 1576800, ..Default::default() }, @@ -1369,7 +1369,7 @@ mod tests { chain_lock: ChainLockConfig::default_100_67(), instant_lock: InstantLockConfig::default_100_67(), execution: ExecutionConfig { - verify_sum_trees: true, + verify_sum_trees: false, epoch_time_length_s: 1576800, ..Default::default() }, diff --git a/packages/rs-drive-abci/tests/strategy_tests/voting_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/voting_tests.rs index 83834520c0c..3547f94c805 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/voting_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/voting_tests.rs @@ -1,7 +1,7 @@ #[cfg(test)] mod tests { use crate::execution::{continue_chain_for_strategy, run_chain_for_strategy}; - use crate::strategy::{ChainExecutionOutcome, ChainExecutionParameters, NetworkStrategy, StrategyRandomness}; + use crate::strategy::{ChainExecutionOutcome, ChainExecutionParameters, NetworkStrategy, StrategyRandomness, UpgradingInfo}; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::random_document::{ DocumentFieldFillSize, DocumentFieldFillType, @@ -9,7 +9,7 @@ mod tests { use dpp::identity::accessors::IdentityGettersV0; use dpp::identity::Identity; use dpp::platform_value::Value; - use drive_abci::config::{ChainLockConfig, ExecutionConfig, InstantLockConfig, PlatformConfig, PlatformTestConfig}; + use drive_abci::config::{ChainLockConfig, ExecutionConfig, InstantLockConfig, PlatformConfig, PlatformTestConfig, ValidatorSetConfig}; use drive_abci::test::helpers::setup::TestPlatformBuilder; use platform_version::version::PlatformVersion; use rand::prelude::StdRng; @@ -23,6 +23,7 @@ mod tests { use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::{get_contested_resource_vote_state_response_v0, GetContestedResourceVoteStateResponseV0}; use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::get_contested_resource_vote_state_response_v0::FinishedVoteInfo; use dapi_grpc::platform::v0::get_contested_resource_vote_state_response::get_contested_resource_vote_state_response_v0::finished_vote_info::FinishedVoteOutcome; + use dpp::block::epoch::Epoch; use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; use dpp::dash_to_duffs; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; @@ -1322,7 +1323,7 @@ mod tests { } #[test] - fn run_chain_with_voting_on_conflicting_index_distribution_after_won_by_identity() { + fn run_chain_with_voting_after_won_by_identity_no_specialized_funds_distribution() { // In this test we try to insert two state transitions with the same unique index // We use the DPNS contract, and we insert two documents both with the same "name" // This is a common scenario we should see quite often @@ -1341,9 +1342,10 @@ mod tests { }; let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) + .with_initial_protocol_version(7) .build_with_mock_rpc(); - let platform_version = PlatformVersion::latest(); + let platform_version = PlatformVersion::get(7).unwrap(); let mut rng = StdRng::seed_from_u64(567); @@ -1708,5 +1710,1161 @@ mod tests { finished_at_epoch: 1 }) ); + + // not let's see how much is in processing pools + + let processing_fees = platform + .drive + .get_epoch_processing_credits_for_distribution( + &Epoch::new(1).unwrap(), + None, + platform_version, + ) + .expect("expected to get processing fees made in epoch"); + + // A vote costs 10_000_000 + // Hence we did 5 votes in this epoch + assert_eq!(processing_fees, 50_000_000); + } + + #[test] + fn run_chain_with_voting_after_won_by_identity_with_specialized_funds_distribution() { + // In this test we try to insert two state transitions with the same unique index + // We use the DPNS contract, and we insert two documents both with the same "name" + // This is a common scenario we should see quite often + let config = PlatformConfig { + testing_configs: PlatformTestConfig::default_minimal_verifications(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + + ..Default::default() + }, + block_spacing_ms: 3000, + ..Default::default() + }; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let platform_version = PlatformVersion::latest(); + + let mut rng = StdRng::seed_from_u64(567); + + let mut simple_signer = SimpleSigner::default(); + + let (identity1, keys1) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys1); + + let (identity2, keys2) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys2); + + let start_identities: Vec<(Identity, Option)> = + create_state_transitions_for_identities( + vec![identity1, identity2], + &(dash_to_duffs!(1)..=dash_to_duffs!(1)), + &simple_signer, + &mut rng, + platform_version, + ) + .into_iter() + .map(|(identity, transition)| (identity, Some(transition))) + .collect(); + + let dpns_contract = platform + .drive + .cache + .system_data_contracts + .load_dpns() + .as_ref() + .clone(); + + let document_type = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type") + .to_owned_document_type(); + + let identity1_id = start_identities.first().unwrap().0.id(); + let identity2_id = start_identities.last().unwrap().0.id(); + let document_op_1 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([("identity", Value::from(identity1_id))]).into(), + ), + ]), + Some(start_identities.first().unwrap().0.id()), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let document_op_2 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([( + "identity", + Value::from(start_identities.last().unwrap().0.id()), + )]) + .into(), + ), + ]), + Some(start_identities.last().unwrap().0.id()), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![ + Operation { + op_type: OperationType::Document(document_op_1), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_op_2), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities { + hard_coded: start_identities, + ..Default::default() + }, + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: Some(simple_signer), + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let mut voting_signer = Some(SimpleSigner::default()); + + // On the first block we only have identities and contracts + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + state_transition_results_per_block, + .. + } = run_chain_for_strategy( + &mut platform, + 2, + strategy.clone(), + config.clone(), + 15, + &mut voting_signer, + ); + + let platform = abci_app.platform; + + let platform_state = platform.state.load(); + + let state_transitions_block_2 = state_transition_results_per_block + .get(&2) + .expect("expected to get block 2"); + + let first_document_insert_result = &state_transitions_block_2 + .first() + .as_ref() + .expect("expected a document insert") + .1; + assert_eq!(first_document_insert_result.code, 0); + + let second_document_insert_result = &state_transitions_block_2 + .get(1) + .as_ref() + .expect("expected a document insert") + .1; + + assert_eq!(second_document_insert_result.code, 0); // we expect the second to also be insertable as they are both contested + + let block_start = platform_state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + let day_in_ms = 1000 * 60 * 60 * 24; + let config = PlatformConfig { + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + + ..Default::default() + }, + block_spacing_ms: day_in_ms, + ..Default::default() + }; + + let outcome = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 16, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + current_identities: Vec::new(), + }, + NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![Operation { + op_type: OperationType::ResourceVote(ResourceVoteOp { + resolved_vote_poll: ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::OwnedDataContract( + dpns_contract.clone(), + ), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec!["dash".into(), "quantum".into()], + }, + action: VoteAction { + vote_choices_with_weights: vec![ + (ResourceVoteChoice::Abstain, 1), + (ResourceVoteChoice::Lock, 1), + (ResourceVoteChoice::TowardsIdentity(identity1_id), 2), + (ResourceVoteChoice::TowardsIdentity(identity2_id), 10), + ], + }, + }), + frequency: Frequency { + times_per_block_range: 1..3, + chance_per_block: None, + }, + }], + start_identities: StartIdentities::default(), + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: voting_signer, + }, + total_hpmns: 100, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: None, + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }, + config.clone(), + StrategyRandomness::SeedEntropy(9), + ); + + let platform = outcome.abci_app.platform; + + // Now let's run a query for the vote totals + + let config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), config) + .expect("expected to encode the word dash"); + + let quantum_encoded = bincode::encode_to_vec(Value::Text("quantum".to_string()), config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: document_type.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), quantum_encoded.clone()], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: true, + start_at_identifier_info: None, + count: None, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + abstain_vote_tally, + lock_vote_tally, + finished_vote_info, + }, + ), + ) = result + else { + panic!("expected contenders") + }; + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.identifier, identity2_id.to_vec()); + + assert_eq!(second_contender.identifier, identity1_id.to_vec()); + + // All vote counts are weighted, so for evonodes, these are in multiples of 4 + + // 19 votes were cast + + assert_eq!(first_contender.vote_count, Some(60)); + + assert_eq!(second_contender.vote_count, Some(4)); + + assert_eq!(lock_vote_tally, Some(4)); + + assert_eq!(abstain_vote_tally, Some(8)); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: FinishedVoteOutcome::TowardsIdentity.into(), + won_by_identity_id: Some(identity2_id.to_vec()), + finished_at_block_height: 17, + finished_at_core_block_height: 1, + finished_at_block_time_ms: 1682303986000, + finished_at_epoch: 1 + }) + ); + + // not let's see how much is in processing pools + + let processing_fees = platform + .drive + .get_epoch_processing_credits_for_distribution( + &Epoch::new(1).unwrap(), + None, + platform_version, + ) + .expect("expected to get processing fees made in epoch"); + + // A vote costs 10_000_000 + // We did 5 votes in this epoch, + // We had 39_810_000_000 left over, which is only the cost of 19 votes + // So we basically have 39_810_000_000 + 50_000_000 + assert_eq!(processing_fees, 39_860_000_000); + } + + #[test] + fn run_chain_with_voting_after_won_by_identity_no_specialized_funds_distribution_until_version_8( + ) { + // In this test the goal is to verify that when we hit version 8 that the specialized balances + // that hadn't been properly distributed are distributed. + let config = PlatformConfig { + validator_set: ValidatorSetConfig { + quorum_size: 10, + ..Default::default() + }, + testing_configs: PlatformTestConfig::default_minimal_verifications(), + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + + ..Default::default() + }, + block_spacing_ms: 3000, + ..Default::default() + }; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .with_initial_protocol_version(7) + .build_with_mock_rpc(); + + let platform_version = PlatformVersion::get(7).unwrap(); + + let mut rng = StdRng::seed_from_u64(567); + + let mut simple_signer = SimpleSigner::default(); + + let (identity1, keys1) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys1); + + let (identity2, keys2) = + Identity::random_identity_with_main_keys_with_private_key::>( + 2, + &mut rng, + platform_version, + ) + .unwrap(); + + simple_signer.add_keys(keys2); + + let start_identities: Vec<(Identity, Option)> = + create_state_transitions_for_identities( + vec![identity1, identity2], + &(dash_to_duffs!(1)..=dash_to_duffs!(1)), + &simple_signer, + &mut rng, + platform_version, + ) + .into_iter() + .map(|(identity, transition)| (identity, Some(transition))) + .collect(); + + let dpns_contract = platform + .drive + .cache + .system_data_contracts + .load_dpns() + .as_ref() + .clone(); + + let document_type = dpns_contract + .document_type_for_name("domain") + .expect("expected a profile document type") + .to_owned_document_type(); + + let identity1_id = start_identities.first().unwrap().0.id(); + let identity2_id = start_identities.last().unwrap().0.id(); + let document_op_1 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([("identity", Value::from(identity1_id))]).into(), + ), + ]), + Some(identity1_id), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let document_op_2 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "quantum".into()), + ("normalizedLabel".into(), "quantum".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([( + "identity", + Value::from(start_identities.last().unwrap().0.id()), + )]) + .into(), + ), + ]), + Some(identity2_id), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let strategy = NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![ + Operation { + op_type: OperationType::Document(document_op_1), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_op_2), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities { + hard_coded: start_identities, + ..Default::default() + }, + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: Some(simple_signer.clone()), + }, + total_hpmns: 20, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: Some(UpgradingInfo { + current_protocol_version: 7, + proposed_protocol_versions_with_weight: vec![(7, 1)], + upgrade_three_quarters_life: 0.2, + }), + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }; + + let mut voting_signer = Some(SimpleSigner::default()); + + // On the first block we only have identities and contracts + let ChainExecutionOutcome { + abci_app, + identities, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + state_transition_results_per_block, + .. + } = run_chain_for_strategy( + &mut platform, + 2, + strategy.clone(), + config.clone(), + 15, + &mut voting_signer, + ); + + let platform = abci_app.platform; + + let platform_state = platform.state.load(); + + let state_transitions_block_2 = state_transition_results_per_block + .get(&2) + .expect("expected to get block 2"); + + let first_document_insert_result = &state_transitions_block_2 + .first() + .as_ref() + .expect("expected a document insert") + .1; + assert_eq!(first_document_insert_result.code, 0); + + let second_document_insert_result = &state_transitions_block_2 + .get(1) + .as_ref() + .expect("expected a document insert") + .1; + + assert_eq!(second_document_insert_result.code, 0); // we expect the second to also be insertable as they are both contested + + let block_start = platform_state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + let day_in_ms = 1000 * 60 * 60 * 24; + let config = PlatformConfig { + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + + ..Default::default() + }, + block_spacing_ms: day_in_ms, + ..Default::default() + }; + + // On the first block we only have identities and contracts + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + .. + } = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 16, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions: Some(current_proposer_versions.clone()), + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + current_identities: Vec::new(), + }, + NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![Operation { + op_type: OperationType::ResourceVote(ResourceVoteOp { + resolved_vote_poll: ContestedDocumentResourceVotePollWithContractInfo { + contract: DataContractOwnedResolvedInfo::OwnedDataContract( + dpns_contract.clone(), + ), + document_type_name: "domain".to_string(), + index_name: "parentNameAndLabel".to_string(), + index_values: vec!["dash".into(), "quantum".into()], + }, + action: VoteAction { + vote_choices_with_weights: vec![ + (ResourceVoteChoice::Abstain, 1), + (ResourceVoteChoice::Lock, 1), + (ResourceVoteChoice::TowardsIdentity(identity1_id), 2), + (ResourceVoteChoice::TowardsIdentity(identity2_id), 10), + ], + }, + }), + frequency: Frequency { + times_per_block_range: 1..3, + chance_per_block: None, + }, + }], + start_identities: StartIdentities::default(), + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: voting_signer, + }, + total_hpmns: 20, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: Some(UpgradingInfo { + current_protocol_version: 7, + proposed_protocol_versions_with_weight: vec![(7, 1)], + upgrade_three_quarters_life: 0.2, + }), + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: true, + ..Default::default() + }, + config.clone(), + StrategyRandomness::SeedEntropy(9), + ); + + let platform = abci_app.platform; + + // Now let's run a query for the vote totals + + let bincode_config = bincode::config::standard() + .with_big_endian() + .with_no_limit(); + + let dash_encoded = bincode::encode_to_vec(Value::Text("dash".to_string()), bincode_config) + .expect("expected to encode the word dash"); + + let quantum_encoded = + bincode::encode_to_vec(Value::Text("quantum".to_string()), bincode_config) + .expect("expected to encode the word quantum"); + + let index_name = "parentNameAndLabel".to_string(); + + let query_validation_result = platform + .query_contested_resource_vote_state( + GetContestedResourceVoteStateRequest { + version: Some(get_contested_resource_vote_state_request::Version::V0( + GetContestedResourceVoteStateRequestV0 { + contract_id: dpns_contract.id().to_vec(), + document_type_name: document_type.name().clone(), + index_name: index_name.clone(), + index_values: vec![dash_encoded.clone(), quantum_encoded.clone()], + result_type: ResultType::DocumentsAndVoteTally as i32, + allow_include_locked_and_abstaining_vote_tally: true, + start_at_identifier_info: None, + count: None, + prove: false, + }, + )), + }, + &platform_state, + platform_version, + ) + .expect("expected to execute query") + .into_data() + .expect("expected query to be valid"); + + let get_contested_resource_vote_state_response::Version::V0( + GetContestedResourceVoteStateResponseV0 { + metadata: _, + result, + }, + ) = query_validation_result.version.expect("expected a version"); + + let Some( + get_contested_resource_vote_state_response_v0::Result::ContestedResourceContenders( + get_contested_resource_vote_state_response_v0::ContestedResourceContenders { + contenders, + abstain_vote_tally, + lock_vote_tally, + finished_vote_info, + }, + ), + ) = result + else { + panic!("expected contenders") + }; + + assert_eq!(contenders.len(), 2); + + let first_contender = contenders.first().unwrap(); + + let second_contender = contenders.last().unwrap(); + + assert_eq!(first_contender.identifier, identity2_id.to_vec()); + + assert_eq!(second_contender.identifier, identity1_id.to_vec()); + + // All vote counts are weighted, so for evonodes, these are in multiples of 4 + + assert_eq!( + ( + first_contender.vote_count, + second_contender.vote_count, + lock_vote_tally, + abstain_vote_tally + ), + (Some(64), Some(8), Some(0), Some(0)) + ); + + assert_eq!( + finished_vote_info, + Some(FinishedVoteInfo { + finished_vote_outcome: FinishedVoteOutcome::TowardsIdentity.into(), + won_by_identity_id: Some(identity2_id.to_vec()), + finished_at_block_height: 17, + finished_at_core_block_height: 1, + finished_at_block_time_ms: 1682303986000, + finished_at_epoch: 1 + }) + ); + + // not let's see how much is in processing pools + + let processing_fees = platform + .drive + .get_epoch_processing_credits_for_distribution( + &Epoch::new(1).unwrap(), + None, + platform_version, + ) + .expect("expected to get processing fees made in epoch"); + + // A vote costs 10_000_000 + // Hence we did 4 votes in this epoch + assert_eq!(processing_fees, 40_000_000); + + // Now let's upgrade to version 8 + + let platform = abci_app.platform; + + let platform_state = platform.state.load(); + + let block_start = platform_state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + + let ten_hours_in_ms = 1000 * 60 * 60 * 10; + let config = PlatformConfig { + chain_lock: ChainLockConfig::default_100_67(), + instant_lock: InstantLockConfig::default_100_67(), + execution: ExecutionConfig { + //we disable document triggers because we are using dpns and dpns needs a preorder + use_document_triggers: false, + + ..Default::default() + }, + block_spacing_ms: ten_hours_in_ms, + ..Default::default() + }; + + // We go 45 blocks later + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + .. + } = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 45, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions: None, + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + current_identities: Vec::new(), + }, + NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![], + start_identities: StartIdentities::default(), + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: None, + }, + total_hpmns: 20, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: Some(UpgradingInfo { + current_protocol_version: 8, + proposed_protocol_versions_with_weight: vec![(8, 1)], + upgrade_three_quarters_life: 0.1, + }), + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: false, + ..Default::default() + }, + config.clone(), + StrategyRandomness::SeedEntropy(9203), + ); + + let platform = abci_app.platform; + + let platform_state = platform.state.load(); + + let mut block_start = platform_state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .height + + 1; + + // We need to create a few more contests + + let document_op_1 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "sam".into()), + ("normalizedLabel".into(), "sam".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ("parentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([("identity", Value::from(identity1_id))]).into(), + ), + ]), + Some(identity1_id), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let document_op_2 = DocumentOp { + contract: dpns_contract.clone(), + action: DocumentAction::DocumentActionInsertSpecific( + BTreeMap::from([ + ("label".into(), "sam".into()), + ("normalizedLabel".into(), "sam".into()), + ("normalizedParentDomainName".into(), "dash".into()), + ("parentDomainName".into(), "dash".into()), + ( + "records".into(), + BTreeMap::from([("identity", Value::from(identity2_id))]).into(), + ), + ]), + Some(identity2_id), + DocumentFieldFillType::FillIfNotRequired, + DocumentFieldFillSize::AnyDocumentFillSize, + ), + document_type: document_type.clone(), + }; + + let ChainExecutionOutcome { + abci_app, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + end_time_ms, + identity_nonce_counter, + identity_contract_nonce_counter, + .. + } = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 1, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions: None, + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + current_identities: identities, + }, + NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![ + Operation { + op_type: OperationType::Document(document_op_1), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + Operation { + op_type: OperationType::Document(document_op_2), + frequency: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + }, + ], + start_identities: StartIdentities::default(), + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: Some(simple_signer), + }, + total_hpmns: 20, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: Some(UpgradingInfo { + current_protocol_version: 8, + proposed_protocol_versions_with_weight: vec![(8, 1)], + upgrade_three_quarters_life: 0.1, + }), + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: false, + ..Default::default() + }, + config.clone(), + StrategyRandomness::SeedEntropy(9203), + ); + + block_start += 1; + + // We go 14 blocks later till version 8 is active + let outcome = continue_chain_for_strategy( + abci_app, + ChainExecutionParameters { + block_start, + core_height_start: 1, + block_count: 14, + proposers, + validator_quorums, + current_validator_quorum_hash, + instant_lock_quorums, + current_proposer_versions: None, + current_identity_nonce_counter: identity_nonce_counter, + current_identity_contract_nonce_counter: identity_contract_nonce_counter, + current_votes: BTreeMap::default(), + start_time_ms: 1681094380000, + current_time_ms: end_time_ms, + current_identities: Vec::new(), + }, + NetworkStrategy { + strategy: Strategy { + start_contracts: vec![], + operations: vec![], + start_identities: StartIdentities::default(), + identity_inserts: Default::default(), + + identity_contract_nonce_gaps: None, + signer: None, + }, + total_hpmns: 20, + extra_normal_mns: 0, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + upgrading_info: Some(UpgradingInfo { + current_protocol_version: 8, + proposed_protocol_versions_with_weight: vec![(8, 1)], + upgrade_three_quarters_life: 0.1, + }), + + proposer_strategy: Default::default(), + rotate_quorums: false, + failure_testing: None, + query_testing: None, + verify_state_transition_results: false, + ..Default::default() + }, + config.clone(), + StrategyRandomness::SeedEntropy(9203), + ); + + let platform = outcome.abci_app.platform; + platform + .drive + .fetch_versions_with_counter(None, &platform_version.drive) + .expect("expected to get versions"); + + let state = platform.state.load(); + assert_eq!( + state + .last_committed_block_info() + .as_ref() + .unwrap() + .basic_info() + .epoch + .index, + 4 + ); + assert_eq!(state.current_protocol_version_in_consensus(), 8); + + let processing_fees = platform + .drive + .get_epoch_processing_credits_for_distribution( + &Epoch::new(4).unwrap(), + None, + platform_version, + ) + .expect("expected to get processing fees made in epoch"); + + // A vote costs 10_000_000 + // There were 23 votes total so that means that there would have been 39_780_000_000 left over + // We see that there is 39_780_000_000 to distribute + assert_eq!(processing_fees, 39_780_000_000); } } diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/add_epoch_processing_credits_for_distribution_operation/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/add_epoch_processing_credits_for_distribution_operation/mod.rs new file mode 100644 index 00000000000..51d7d325873 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/add_epoch_processing_credits_for_distribution_operation/mod.rs @@ -0,0 +1,56 @@ +mod v0; + +use grovedb::TransactionArg; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::block::epoch::Epoch; +use dpp::fee::Credits; + +use crate::fees::op::LowLevelDriveOperation; +use dpp::version::PlatformVersion; + +impl Drive { + /// Adds to the amount of processing fees to be distributed for the Epoch. + /// + /// # Arguments + /// + /// * `epoch_tree` - A reference to the Epoch. + /// * `amount` - The amount to add. + /// * `transaction` - A TransactionArg instance. + /// * `platform_version` - A PlatformVersion instance representing the version of the drive. + /// + /// # Returns + /// + /// A Result containing either the processing fee for the epoch, if found, + /// or an Error if something goes wrong. + pub fn add_epoch_processing_credits_for_distribution_operation( + &self, + epoch: &Epoch, + amount: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .credit_pools + .epochs + .add_epoch_processing_credits_for_distribution_operation + { + 0 => self.add_epoch_processing_credits_for_distribution_operation_v0( + epoch, + amount, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_epoch_processing_credits_for_distribution_operation".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/add_epoch_processing_credits_for_distribution_operation/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/add_epoch_processing_credits_for_distribution_operation/v0/mod.rs new file mode 100644 index 00000000000..f163236b475 --- /dev/null +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/add_epoch_processing_credits_for_distribution_operation/v0/mod.rs @@ -0,0 +1,60 @@ +use grovedb::{Element, TransactionArg}; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use crate::drive::credit_pools::epochs::epoch_key_constants; +use crate::drive::credit_pools::epochs::paths::EpochProposers; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::grove_operations::DirectQueryType; +use dpp::block::epoch::Epoch; +use dpp::fee::Credits; +use dpp::ProtocolError; +use platform_version::version::PlatformVersion; + +impl Drive { + /// Gets the amount of processing fees to be distributed for the Epoch and adds to it. + pub(super) fn add_epoch_processing_credits_for_distribution_operation_v0( + &self, + epoch: &Epoch, + amount: Credits, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let epoch_tree_path = epoch.get_path(); + let element = self.grove_get_raw_optional( + (&epoch_tree_path).into(), + epoch_key_constants::KEY_POOL_PROCESSING_FEES.as_slice(), + DirectQueryType::StatefulDirectQuery, + transaction, + &mut vec![], + &platform_version.drive, + )?; + + let existing_value = match element { + None => 0, + Some(Element::SumItem(existing_value, _)) => existing_value, + _ => { + return Err(Error::Drive(DriveError::UnexpectedElementType( + "epochs processing fee must be an item", + ))) + } + }; + + if amount > i64::MAX as u64 { + return Err(Error::Protocol(ProtocolError::Overflow( + "adding over i64::Max to processing fee pool", + ))); + } + + let updated_value = existing_value + .checked_add(amount as i64) + .ok_or(ProtocolError::Overflow("overflow when adding to sum item"))?; + Ok(LowLevelDriveOperation::insert_for_known_path_key_element( + epoch_tree_path.iter().map(|a| a.to_vec()).collect(), + epoch_key_constants::KEY_POOL_PROCESSING_FEES.to_vec(), + Element::new_sum_item(updated_value), + )) + } +} diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/mod.rs index 8e790b846bf..db40e29f00b 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/mod.rs @@ -26,7 +26,7 @@ impl Drive { /// or an Error if something goes wrong. pub fn get_epoch_processing_credits_for_distribution( &self, - epoch_tree: &Epoch, + epoch: &Epoch, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { @@ -38,7 +38,7 @@ impl Drive { .get_epoch_processing_credits_for_distribution { 0 => self.get_epoch_processing_credits_for_distribution_v0( - epoch_tree, + epoch, transaction, platform_version, ), diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/v0/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/v0/mod.rs index 05782b23b2b..ae0265d3930 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/v0/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/get_epoch_processing_credits_for_distribution/v0/mod.rs @@ -15,14 +15,14 @@ impl Drive { /// Gets the amount of processing fees to be distributed for the Epoch. pub(super) fn get_epoch_processing_credits_for_distribution_v0( &self, - epoch_tree: &Epoch, + epoch: &Epoch, transaction: TransactionArg, platform_version: &PlatformVersion, ) -> Result { let element = self .grove .get( - &epoch_tree.get_path(), + &epoch.get_path(), epoch_key_constants::KEY_POOL_PROCESSING_FEES.as_slice(), transaction, &platform_version.drive.grove_version, diff --git a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/mod.rs b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/mod.rs index f0a061ce024..2096f129060 100644 --- a/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/mod.rs +++ b/packages/rs-drive/src/drive/credit_pools/epochs/credit_distribution_pools/mod.rs @@ -3,6 +3,7 @@ //! This module implements functions in Drive to distribute fees for a given Epoch. //! +mod add_epoch_processing_credits_for_distribution_operation; mod get_epoch_fee_multiplier; mod get_epoch_processing_credits_for_distribution; mod get_epoch_storage_credits_for_distribution; diff --git a/packages/rs-drive/src/drive/mod.rs b/packages/rs-drive/src/drive/mod.rs index fc28c49647a..e54d5445a2d 100644 --- a/packages/rs-drive/src/drive/mod.rs +++ b/packages/rs-drive/src/drive/mod.rs @@ -42,7 +42,10 @@ pub mod system; mod asset_lock; #[cfg(feature = "server")] mod platform_state; -pub(crate) mod prefunded_specialized_balances; + +/// Prefunded specialized balances module +#[cfg(any(feature = "server", feature = "verify"))] +pub mod prefunded_specialized_balances; /// Vote module #[cfg(any(feature = "server", feature = "verify"))] diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/mod.rs index 18fd27d1039..4a02d9e9c67 100644 --- a/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/mod.rs +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/mod.rs @@ -1,4 +1,5 @@ mod v0; +mod v1; use crate::drive::Drive; use crate::error::drive::DriveError; @@ -50,9 +51,16 @@ impl Drive { transaction, platform_version, ), + 1 => self.add_prefunded_specialized_balance_operations_v1( + specialized_balance_id, + amount, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "add_prefunded_specialized_balance_operations".to_string(), - known_versions: vec![0], + known_versions: vec![0, 1], received: version, })), } diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/v1/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/v1/mod.rs new file mode 100644 index 00000000000..6a462649495 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/add_prefunded_specialized_balance_operations/v1/mod.rs @@ -0,0 +1,91 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::grove_operations::DirectQueryType; + +use crate::drive::prefunded_specialized_balances::{ + prefunded_specialized_balances_for_voting_path, + prefunded_specialized_balances_for_voting_path_vec, +}; +use crate::error::identity::IdentityError; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use dpp::balances::credits::MAX_CREDITS; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// The operations to add to the specialized balance + #[inline(always)] + pub(super) fn add_prefunded_specialized_balance_operations_v1( + &self, + specialized_balance_id: Identifier, + amount: u64, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut drive_operations = vec![]; + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_prefunded_specialized_balance_update( + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + let direct_query_type = if estimated_costs_only_with_layer_info.is_none() { + DirectQueryType::StatefulDirectQuery + } else { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums: true, + query_target: QueryTargetValue(8), + } + }; + + let path_holding_specialized_balances = prefunded_specialized_balances_for_voting_path(); + let previous_credits_in_specialized_balance = self + .grove_get_raw_value_u64_from_encoded_var_vec( + (&path_holding_specialized_balances).into(), + specialized_balance_id.as_slice(), + direct_query_type, + transaction, + &mut drive_operations, + &platform_version.drive, + )?; + let had_previous_balance = previous_credits_in_specialized_balance.is_some(); + let new_total = previous_credits_in_specialized_balance + .unwrap_or_default() + .checked_add(amount) + .ok_or(Error::Drive(DriveError::CriticalCorruptedState( + "trying to add an amount that would overflow credits", + )))?; + // while i64::MAX could potentially work, best to avoid it. + if new_total >= MAX_CREDITS { + return Err(Error::Identity(IdentityError::CriticalBalanceOverflow( + "trying to set prefunded specialized balance to over max credits amount (i64::MAX)", + ))); + }; + let path_holding_total_credits_vec = prefunded_specialized_balances_for_voting_path_vec(); + let op = if had_previous_balance { + QualifiedGroveDbOp::replace_op( + path_holding_total_credits_vec, + specialized_balance_id.to_vec(), + Element::new_sum_item(new_total as i64), + ) + } else { + QualifiedGroveDbOp::insert_or_replace_op( + path_holding_total_credits_vec, + specialized_balance_id.to_vec(), + Element::new_sum_item(new_total as i64), + ) + }; + drive_operations.push(GroveOperation(op)); + Ok(drive_operations) + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/mod.rs index d294ec90872..aef16a0cb53 100644 --- a/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/mod.rs +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/mod.rs @@ -1,4 +1,5 @@ mod v0; +mod v1; use crate::drive::Drive; use crate::error::drive::DriveError; @@ -50,6 +51,13 @@ impl Drive { transaction, platform_version, ), + 1 => self.deduct_from_prefunded_specialized_balance_operations_v1( + specialized_balance_id, + amount, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), version => Err(Error::Drive(DriveError::UnknownVersionMismatch { method: "deduct_from_prefunded_specialized_balance_operations".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/v1/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/v1/mod.rs new file mode 100644 index 00000000000..4bf03c848ff --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/deduct_from_prefunded_specialized_balance_operations/v1/mod.rs @@ -0,0 +1,91 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::grove_operations::DirectQueryType; + +use crate::drive::prefunded_specialized_balances::{ + prefunded_specialized_balances_for_voting_path, + prefunded_specialized_balances_for_voting_path_vec, +}; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; +use grovedb::{Element, EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// The operations to add to the specialized balance + #[inline(always)] + pub(super) fn deduct_from_prefunded_specialized_balance_operations_v1( + &self, + specialized_balance_id: Identifier, + amount: u64, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut drive_operations = vec![]; + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_prefunded_specialized_balance_update( + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + + let direct_query_type = if estimated_costs_only_with_layer_info.is_none() { + DirectQueryType::StatefulDirectQuery + } else { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums: true, + query_target: QueryTargetValue(8), + } + }; + + let path_holding_specialized_balances = prefunded_specialized_balances_for_voting_path(); + let previous_credits_in_specialized_balance = match self + .grove_get_raw_value_u64_from_encoded_var_vec( + (&path_holding_specialized_balances).into(), + specialized_balance_id.as_slice(), + direct_query_type, + transaction, + &mut drive_operations, + &platform_version.drive, + )? { + None => { + if estimated_costs_only_with_layer_info.is_none() { + return + Err(Error::Drive( + DriveError::PrefundedSpecializedBalanceDoesNotExist(format!( + "trying to deduct from a prefunded specialized balance {} that does not exist", + specialized_balance_id + )), + )); + } else { + i64::MAX as u64 + } + } + Some(value) => value, + }; + let new_total = previous_credits_in_specialized_balance + .checked_sub(amount) + .ok_or(Error::Drive( + DriveError::PrefundedSpecializedBalanceNotEnough( + previous_credits_in_specialized_balance, + amount, + ), + ))?; + let path_holding_total_credits_vec = prefunded_specialized_balances_for_voting_path_vec(); + let replace_op = QualifiedGroveDbOp::replace_op( + path_holding_total_credits_vec, + specialized_balance_id.to_vec(), + Element::new_sum_item(new_total as i64), + ); + drive_operations.push(GroveOperation(replace_op)); + Ok(drive_operations) + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance/mod.rs new file mode 100644 index 00000000000..acf43841664 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance/mod.rs @@ -0,0 +1,53 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; + +use dpp::fee::Credits; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Empties from a prefunded specialized balance the entire left over balance + /// + /// # Arguments + /// + /// * `transaction` - A `TransactionArg` object representing the transaction to be used for adding to the system credits. + /// * `platform_version` - A `PlatformVersion` object specifying the version of Platform. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of Platform is unknown. + pub fn empty_prefunded_specialized_balance( + &self, + specialized_balance_id: Identifier, + error_if_does_not_exist: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .empty_prefunded_specialized_balance + { + 0 => self.empty_prefunded_specialized_balance_v0( + specialized_balance_id, + error_if_does_not_exist, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "empty_prefunded_specialized_balance".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance/v0/mod.rs new file mode 100644 index 00000000000..4e46151f5f3 --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance/v0/mod.rs @@ -0,0 +1,52 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; + +use dpp::fee::Credits; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::TransactionArg; + +impl Drive { + /// Empties the prefunded specialized balance + /// + /// # Arguments + /// + /// * `transaction` - A `TransactionArg` object representing the transaction to be used for adding to the system credits. + /// * `platform_version` - A `PlatformVersion` object specifying the version of Platform. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of Platform is unknown. + #[inline(always)] + pub(super) fn empty_prefunded_specialized_balance_v0( + &self, + specialized_balance_id: Identifier, + error_if_does_not_exist: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let mut drive_operations = vec![]; + let (credits, batch_operations) = self.empty_prefunded_specialized_balance_operations( + specialized_balance_id, + error_if_does_not_exist, + &mut None, + transaction, + platform_version, + )?; + let grove_db_operations = + LowLevelDriveOperation::grovedb_operations_batch(&batch_operations); + self.grove_apply_batch_with_add_costs( + grove_db_operations, + false, + transaction, + &mut drive_operations, + &platform_version.drive, + )?; + Ok(credits) + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance_operations/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance_operations/mod.rs new file mode 100644 index 00000000000..d7562fac85c --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance_operations/mod.rs @@ -0,0 +1,60 @@ +mod v0; + +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use grovedb::batch::KeyInfoPath; +use std::collections::HashMap; + +use crate::fees::op::LowLevelDriveOperation; +use dpp::fee::Credits; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::{EstimatedLayerInformation, TransactionArg}; + +impl Drive { + /// The operation Deducts from a prefunded specialized balance it's entire amount + /// + /// # Arguments + /// + /// * `transaction` - A `TransactionArg` object representing the transaction to be used for adding to the system credits. + /// * `platform_version` - A `PlatformVersion` object specifying the version of Platform. + /// + /// # Returns + /// + /// * `Result<(), Error>` - If successful, returns `Ok(())`. If an error occurs during the operation, returns an `Error`. + /// + /// # Errors + /// + /// This function will return an error if the version of Platform is unknown. + pub fn empty_prefunded_specialized_balance_operations( + &self, + specialized_balance_id: Identifier, + error_if_does_not_exist: bool, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Credits, Vec), Error> { + match platform_version + .drive + .methods + .prefunded_specialized_balances + .empty_prefunded_specialized_balance + { + 0 => self.empty_prefunded_specialized_balance_operations_v0( + specialized_balance_id, + error_if_does_not_exist, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "empty_prefunded_specialized_balance_operations".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance_operations/v0/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance_operations/v0/mod.rs new file mode 100644 index 00000000000..c7f6b2049de --- /dev/null +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/empty_prefunded_specialized_balance_operations/v0/mod.rs @@ -0,0 +1,85 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::fees::op::LowLevelDriveOperation::GroveOperation; +use crate::util::grove_operations::DirectQueryType; + +use crate::drive::prefunded_specialized_balances::{ + prefunded_specialized_balances_for_voting_path, + prefunded_specialized_balances_for_voting_path_vec, +}; +use crate::util::grove_operations::QueryTarget::QueryTargetValue; +use dpp::fee::Credits; +use dpp::identifier::Identifier; +use dpp::version::PlatformVersion; +use grovedb::batch::{KeyInfoPath, QualifiedGroveDbOp}; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +impl Drive { + /// The operations to add to the specialized balance + #[inline(always)] + pub(super) fn empty_prefunded_specialized_balance_operations_v0( + &self, + specialized_balance_id: Identifier, + error_if_does_not_exist: bool, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result<(Credits, Vec), Error> { + let mut drive_operations = vec![]; + if let Some(estimated_costs_only_with_layer_info) = estimated_costs_only_with_layer_info { + Self::add_estimation_costs_for_prefunded_specialized_balance_update( + estimated_costs_only_with_layer_info, + &platform_version.drive, + )?; + } + let direct_query_type = if estimated_costs_only_with_layer_info.is_none() { + DirectQueryType::StatefulDirectQuery + } else { + DirectQueryType::StatelessDirectQuery { + in_tree_using_sums: true, + query_target: QueryTargetValue(8), + } + }; + + let path_holding_specialized_balances = prefunded_specialized_balances_for_voting_path(); + let previous_credits_in_specialized_balance = match self + .grove_get_raw_value_u64_from_encoded_var_vec( + (&path_holding_specialized_balances).into(), + specialized_balance_id.as_slice(), + direct_query_type, + transaction, + &mut drive_operations, + &platform_version.drive, + )? { + None => { + if estimated_costs_only_with_layer_info.is_none() { + return if error_if_does_not_exist { + Err(Error::Drive( + DriveError::PrefundedSpecializedBalanceDoesNotExist(format!( + "trying to deduct from a prefunded specialized balance {} that does not exist", + specialized_balance_id + )), + )) + } else { + Ok((0, drive_operations)) + }; + } else { + 0 + } + } + Some(value) => value, + }; + let path_holding_total_credits_vec = prefunded_specialized_balances_for_voting_path_vec(); + let delete_op = QualifiedGroveDbOp::delete_op( + path_holding_total_credits_vec, + specialized_balance_id.to_vec(), + ); + drive_operations.push(GroveOperation(delete_op)); + Ok((previous_credits_in_specialized_balance, drive_operations)) + } +} diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs index 215ac249341..ea5656188c2 100644 --- a/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs @@ -7,6 +7,10 @@ mod deduct_from_prefunded_specialized_balance; #[cfg(feature = "server")] mod deduct_from_prefunded_specialized_balance_operations; #[cfg(feature = "server")] +mod empty_prefunded_specialized_balance; +#[cfg(feature = "server")] +mod empty_prefunded_specialized_balance_operations; +#[cfg(feature = "server")] mod estimation_costs; #[cfg(feature = "server")] mod fetch; @@ -20,17 +24,18 @@ use crate::util::batch::grovedb_op_batch::GroveDbOpBatchV0Methods; #[cfg(feature = "server")] use crate::util::batch::GroveDbOpBatch; +/// The key for prefunded balances for voting pub const PREFUNDED_BALANCES_FOR_VOTING: u8 = 128; /// prefunded specialized balances for voting -pub(crate) fn prefunded_specialized_balances_path() -> [&'static [u8]; 1] { +pub fn prefunded_specialized_balances_path() -> [&'static [u8]; 1] { [Into::<&[u8; 1]>::into( RootTree::PreFundedSpecializedBalances, )] } /// prefunded specialized balances for voting -pub(crate) fn prefunded_specialized_balances_for_voting_path() -> [&'static [u8]; 2] { +pub fn prefunded_specialized_balances_for_voting_path() -> [&'static [u8]; 2] { [ Into::<&[u8; 1]>::into(RootTree::PreFundedSpecializedBalances), &[PREFUNDED_BALANCES_FOR_VOTING], @@ -38,7 +43,7 @@ pub(crate) fn prefunded_specialized_balances_for_voting_path() -> [&'static [u8] } /// prefunded specialized balances for voting vector -pub(crate) fn prefunded_specialized_balances_for_voting_path_vec() -> Vec> { +pub fn prefunded_specialized_balances_for_voting_path_vec() -> Vec> { vec![ Into::<&[u8; 1]>::into(RootTree::PreFundedSpecializedBalances).to_vec(), vec![PREFUNDED_BALANCES_FOR_VOTING], diff --git a/packages/rs-drive/src/fees/mod.rs b/packages/rs-drive/src/fees/mod.rs index 96e7c996aca..c240c54f0c9 100644 --- a/packages/rs-drive/src/fees/mod.rs +++ b/packages/rs-drive/src/fees/mod.rs @@ -2,6 +2,7 @@ use crate::error::fee::FeeError; use crate::error::Error; mod calculate_fee; +/// Operations pub mod op; /// Get overflow error diff --git a/packages/rs-drive/src/lib.rs b/packages/rs-drive/src/lib.rs index a11e8e74bd3..a13845e0fcd 100644 --- a/packages/rs-drive/src/lib.rs +++ b/packages/rs-drive/src/lib.rs @@ -41,8 +41,9 @@ pub use grovedb_storage; pub mod cache; #[cfg(any(feature = "server", feature = "verify"))] pub mod config; +/// Fees module #[cfg(feature = "server")] -mod fees; +pub mod fees; #[cfg(feature = "server")] mod open; #[cfg(feature = "server")] diff --git a/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs index 9b9a5be3bbb..9c8f567fa9a 100644 --- a/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs +++ b/packages/rs-drive/src/util/grove_operations/grove_get_raw_optional/v0/mod.rs @@ -13,7 +13,7 @@ use platform_version::version::drive_versions::DriveVersion; impl Drive { /// grove_get_raw basically means that there are no reference hops, this only matters /// when calculating worst case costs - pub(crate) fn grove_get_raw_optional_v0>( + pub(super) fn grove_get_raw_optional_v0>( &self, path: SubtreePath<'_, B>, key: &[u8], diff --git a/packages/rs-platform-value/src/inner_value.rs b/packages/rs-platform-value/src/inner_value.rs index c92828e91c0..d8606bd478b 100644 --- a/packages/rs-platform-value/src/inner_value.rs +++ b/packages/rs-platform-value/src/inner_value.rs @@ -361,7 +361,7 @@ impl Value { Self::inner_array_mut_ref(map, key) } - pub fn get_array_slice<'a>(&'a self, key: &'a str) -> Result<&[Value], Error> { + pub fn get_array_slice<'a>(&'a self, key: &'a str) -> Result<&'a [Value], Error> { let map = self.to_map()?; Self::inner_array_slice(map, key) } diff --git a/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs index 900c0c153b9..19303e4347e 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs @@ -91,7 +91,7 @@ pub const DRIVE_ABCI_METHOD_VERSIONS_V5: DriveAbciMethodVersions = DriveAbciMeth voting: DriveAbciVotingMethodVersions { keep_record_of_finished_contested_resource_vote_poll: 0, clean_up_after_vote_poll_end: 0, - clean_up_after_contested_resources_vote_poll_end: 0, + clean_up_after_contested_resources_vote_poll_end: 1, check_for_ended_vote_polls: 0, tally_votes_for_contested_document_resource_vote_poll: 0, award_document_to_winner: 0, diff --git a/packages/rs-platform-version/src/version/drive_versions/drive_credit_pool_method_versions/mod.rs b/packages/rs-platform-version/src/version/drive_versions/drive_credit_pool_method_versions/mod.rs index 0d116b4104a..4e60e2c417d 100644 --- a/packages/rs-platform-version/src/version/drive_versions/drive_credit_pool_method_versions/mod.rs +++ b/packages/rs-platform-version/src/version/drive_versions/drive_credit_pool_method_versions/mod.rs @@ -28,6 +28,7 @@ pub struct DriveCreditPoolEpochsMethodVersions { pub get_epochs_proposer_block_count: FeatureVersion, pub add_update_pending_epoch_refunds_operations: FeatureVersion, pub is_epochs_proposers_tree_empty: FeatureVersion, + pub add_epoch_processing_credits_for_distribution_operation: FeatureVersion, } #[derive(Clone, Debug, Default)] diff --git a/packages/rs-platform-version/src/version/drive_versions/drive_credit_pool_method_versions/v1.rs b/packages/rs-platform-version/src/version/drive_versions/drive_credit_pool_method_versions/v1.rs index 43117298860..7c2252edfb8 100644 --- a/packages/rs-platform-version/src/version/drive_versions/drive_credit_pool_method_versions/v1.rs +++ b/packages/rs-platform-version/src/version/drive_versions/drive_credit_pool_method_versions/v1.rs @@ -25,6 +25,7 @@ pub const CREDIT_POOL_METHOD_VERSIONS_V1: DriveCreditPoolMethodVersions = get_epochs_proposer_block_count: 0, add_update_pending_epoch_refunds_operations: 0, is_epochs_proposers_tree_empty: 0, + add_epoch_processing_credits_for_distribution_operation: 0, }, pending_epoch_refunds: DriveCreditPoolPendingEpochRefundsMethodVersions { add_delete_pending_epoch_refunds_except_specified: 0, diff --git a/packages/rs-platform-version/src/version/drive_versions/mod.rs b/packages/rs-platform-version/src/version/drive_versions/mod.rs index b8c3fae487d..262ac9407a3 100644 --- a/packages/rs-platform-version/src/version/drive_versions/mod.rs +++ b/packages/rs-platform-version/src/version/drive_versions/mod.rs @@ -21,6 +21,7 @@ pub mod drive_verify_method_versions; pub mod drive_vote_method_versions; pub mod v1; pub mod v2; +pub mod v3; #[derive(Clone, Debug, Default)] pub struct DriveVersion { @@ -85,6 +86,7 @@ pub struct DrivePrefundedSpecializedMethodVersions { pub deduct_from_prefunded_specialized_balance: FeatureVersion, pub deduct_from_prefunded_specialized_balance_operations: FeatureVersion, pub estimated_cost_for_prefunded_specialized_balance_update: FeatureVersion, + pub empty_prefunded_specialized_balance: FeatureVersion, } #[derive(Clone, Debug, Default)] diff --git a/packages/rs-platform-version/src/version/drive_versions/v1.rs b/packages/rs-platform-version/src/version/drive_versions/v1.rs index bbe1a12746f..3ba9dc974f7 100644 --- a/packages/rs-platform-version/src/version/drive_versions/v1.rs +++ b/packages/rs-platform-version/src/version/drive_versions/v1.rs @@ -93,6 +93,7 @@ pub const DRIVE_VERSION_V1: DriveVersion = DriveVersion { deduct_from_prefunded_specialized_balance: 0, deduct_from_prefunded_specialized_balance_operations: 0, estimated_cost_for_prefunded_specialized_balance_update: 0, + empty_prefunded_specialized_balance: 0, }, }, grove_methods: DRIVE_GROVE_METHOD_VERSIONS_V1, diff --git a/packages/rs-platform-version/src/version/drive_versions/v2.rs b/packages/rs-platform-version/src/version/drive_versions/v2.rs index 5747bc732be..0881f6ca55e 100644 --- a/packages/rs-platform-version/src/version/drive_versions/v2.rs +++ b/packages/rs-platform-version/src/version/drive_versions/v2.rs @@ -93,6 +93,7 @@ pub const DRIVE_VERSION_V2: DriveVersion = DriveVersion { deduct_from_prefunded_specialized_balance: 0, deduct_from_prefunded_specialized_balance_operations: 0, estimated_cost_for_prefunded_specialized_balance_update: 0, + empty_prefunded_specialized_balance: 0, }, }, grove_methods: DRIVE_GROVE_METHOD_VERSIONS_V1, diff --git a/packages/rs-platform-version/src/version/drive_versions/v3.rs b/packages/rs-platform-version/src/version/drive_versions/v3.rs new file mode 100644 index 00000000000..2f3efb37299 --- /dev/null +++ b/packages/rs-platform-version/src/version/drive_versions/v3.rs @@ -0,0 +1,101 @@ +use crate::version::drive_versions::drive_contract_method_versions::v1::DRIVE_CONTRACT_METHOD_VERSIONS_V1; +use crate::version::drive_versions::drive_credit_pool_method_versions::v1::CREDIT_POOL_METHOD_VERSIONS_V1; +use crate::version::drive_versions::drive_document_method_versions::v1::DRIVE_DOCUMENT_METHOD_VERSIONS_V1; +use crate::version::drive_versions::drive_grove_method_versions::v1::DRIVE_GROVE_METHOD_VERSIONS_V1; +use crate::version::drive_versions::drive_identity_method_versions::v1::DRIVE_IDENTITY_METHOD_VERSIONS_V1; +use crate::version::drive_versions::drive_state_transition_method_versions::v1::DRIVE_STATE_TRANSITION_METHOD_VERSIONS_V1; +use crate::version::drive_versions::drive_structure_version::v1::DRIVE_STRUCTURE_V1; +use crate::version::drive_versions::drive_verify_method_versions::v1::DRIVE_VERIFY_METHOD_VERSIONS_V1; +use crate::version::drive_versions::drive_vote_method_versions::v2::DRIVE_VOTE_METHOD_VERSIONS_V2; +use crate::version::drive_versions::{ + DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, + DriveEstimatedCostsMethodVersions, DriveFeesMethodVersions, DriveFetchMethodVersions, + DriveInitializationMethodVersions, DriveMethodVersions, DriveOperationsMethodVersion, + DrivePlatformStateMethodVersions, DrivePlatformSystemMethodVersions, + DrivePrefundedSpecializedMethodVersions, DriveProtocolUpgradeVersions, + DriveProveMethodVersions, DriveSystemEstimationCostsMethodVersions, DriveVersion, +}; +use grovedb_version::version::v1::GROVE_V1; + +pub const DRIVE_VERSION_V3: DriveVersion = DriveVersion { + structure: DRIVE_STRUCTURE_V1, + methods: DriveMethodVersions { + initialization: DriveInitializationMethodVersions { + create_initial_state_structure: 0, + }, + credit_pools: CREDIT_POOL_METHOD_VERSIONS_V1, + protocol_upgrade: DriveProtocolUpgradeVersions { + clear_version_information: 0, + fetch_versions_with_counter: 0, + fetch_proved_versions_with_counter: 0, + fetch_validator_version_votes: 0, + fetch_proved_validator_version_votes: 0, + remove_validators_proposed_app_versions: 0, + update_validator_proposed_app_version: 0, + }, + prove: DriveProveMethodVersions { + prove_elements: 0, + prove_multiple_state_transition_results: 0, + }, + balances: DriveBalancesMethodVersions { + add_to_system_credits: 0, + add_to_system_credits_operations: 0, + remove_from_system_credits: 0, + remove_from_system_credits_operations: 0, + calculate_total_credits_balance: 0, + }, + document: DRIVE_DOCUMENT_METHOD_VERSIONS_V1, + vote: DRIVE_VOTE_METHOD_VERSIONS_V2, + contract: DRIVE_CONTRACT_METHOD_VERSIONS_V1, + fees: DriveFeesMethodVersions { calculate_fee: 0 }, + estimated_costs: DriveEstimatedCostsMethodVersions { + add_estimation_costs_for_levels_up_to_contract: 0, + add_estimation_costs_for_levels_up_to_contract_document_type_excluded: 0, + add_estimation_costs_for_contested_document_tree_levels_up_to_contract: 0, + add_estimation_costs_for_contested_document_tree_levels_up_to_contract_document_type_excluded: 0, + }, + asset_lock: DriveAssetLockMethodVersions { + add_asset_lock_outpoint: 0, + add_estimation_costs_for_adding_asset_lock: 0, + fetch_asset_lock_outpoint_info: 0, + }, + verify: DRIVE_VERIFY_METHOD_VERSIONS_V1, + identity: DRIVE_IDENTITY_METHOD_VERSIONS_V1, + platform_system: DrivePlatformSystemMethodVersions { + estimation_costs: DriveSystemEstimationCostsMethodVersions { + for_total_system_credits_update: 0, + }, + }, + operations: DriveOperationsMethodVersion { + rollback_transaction: 0, + drop_cache: 0, + commit_transaction: 0, + apply_partial_batch_low_level_drive_operations: 0, + apply_partial_batch_grovedb_operations: 0, + apply_batch_low_level_drive_operations: 0, + apply_batch_grovedb_operations: 0, + }, + state_transitions: DRIVE_STATE_TRANSITION_METHOD_VERSIONS_V1, + batch_operations: DriveBatchOperationsMethodVersion { + convert_drive_operations_to_grove_operations: 0, + apply_drive_operations: 0, + }, + platform_state: DrivePlatformStateMethodVersions { + fetch_platform_state_bytes: 0, + store_platform_state_bytes: 0, + }, + fetch: DriveFetchMethodVersions { fetch_elements: 0 }, + prefunded_specialized_balances: DrivePrefundedSpecializedMethodVersions { + fetch_single: 0, + prove_single: 0, + add_prefunded_specialized_balance: 0, + add_prefunded_specialized_balance_operations: 1, //changed in v3 + deduct_from_prefunded_specialized_balance: 1, //changed in v3 + deduct_from_prefunded_specialized_balance_operations: 0, + estimated_cost_for_prefunded_specialized_balance_update: 0, + empty_prefunded_specialized_balance: 0, + }, + }, + grove_methods: DRIVE_GROVE_METHOD_VERSIONS_V1, + grove_version: GROVE_V1, +}; diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index 931ef19b974..e1371648ff3 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -127,6 +127,7 @@ pub const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { deduct_from_prefunded_specialized_balance: 0, deduct_from_prefunded_specialized_balance_operations: 0, estimated_cost_for_prefunded_specialized_balance_update: 0, + empty_prefunded_specialized_balance: 0, }, }, grove_methods: DRIVE_GROVE_METHOD_VERSIONS_V1, diff --git a/packages/rs-platform-version/src/version/v8.rs b/packages/rs-platform-version/src/version/v8.rs index 437b2f3ecbb..7e866062157 100644 --- a/packages/rs-platform-version/src/version/v8.rs +++ b/packages/rs-platform-version/src/version/v8.rs @@ -19,7 +19,7 @@ use crate::version::drive_abci_versions::drive_abci_structure_versions::v1::DRIV use crate::version::drive_abci_versions::drive_abci_validation_versions::v5::DRIVE_ABCI_VALIDATION_VERSIONS_V5; use crate::version::drive_abci_versions::drive_abci_withdrawal_constants::v2::DRIVE_ABCI_WITHDRAWAL_CONSTANTS_V2; use crate::version::drive_abci_versions::DriveAbciVersion; -use crate::version::drive_versions::v2::DRIVE_VERSION_V2; +use crate::version::drive_versions::v3::DRIVE_VERSION_V3; use crate::version::fee::v1::FEE_VERSION1; use crate::version::protocol_version::PlatformVersion; use crate::version::system_data_contract_versions::v1::SYSTEM_DATA_CONTRACT_VERSIONS_V1; @@ -31,7 +31,8 @@ pub const PROTOCOL_VERSION_8: ProtocolVersion = 8; /// This version contains some fixes for withdrawals and nfts. pub const PLATFORM_V8: PlatformVersion = PlatformVersion { protocol_version: PROTOCOL_VERSION_8, - drive: DRIVE_VERSION_V2, + //changed to V3 because of an error in add_prefunded_specialized_balance_operations + drive: DRIVE_VERSION_V3, drive_abci: DriveAbciVersion { structs: DRIVE_ABCI_STRUCTURE_VERSIONS_V1, // We changed `pool_withdrawals_into_transactions_queue` to v1 in order to add pool From ad5f604375188bc753ed2695f7a59ce0e9d35945 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Wed, 15 Jan 2025 22:14:13 +0700 Subject: [PATCH 07/12] chore: update bls library (#2424) --- Cargo.lock | 74 ++++++------------------------- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- 5 files changed, 18 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85b0b43826e..c2b00fc26b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -541,12 +541,11 @@ dependencies = [ [[package]] name = "blsful" -version = "3.0.0-pre6" +version = "3.0.0-pre8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9de4566ea9f21109f6b3f11551b591ff22683ff47c3a30d97e2feb23257427" +checksum = "384e5e9866cb7f830f06a6633ba998697d5a826e99e8c78376deaadd33cda7be" dependencies = [ "anyhow", - "arrayref", "blstrs_plus", "hex", "hkdf", @@ -560,7 +559,7 @@ dependencies = [ "sha2", "sha3", "subtle", - "thiserror 1.0.64", + "thiserror 2.0.11", "uint-zigzag", "vsss-rs", "zeroize", @@ -1235,8 +1234,8 @@ dependencies = [ [[package]] name = "dashcore" -version = "0.34.0" -source = "git+https://github.com/dashpay/rust-dashcore?tag=0.34.0#4c61ab617ca9f86f84484607014a7e8e0baba960" +version = "0.35.0" +source = "git+https://github.com/dashpay/rust-dashcore?tag=v0.35.0#521a76bfd7eaa90d2d89dc576808ec5772544f07" dependencies = [ "anyhow", "bech32", @@ -1258,16 +1257,14 @@ dependencies = [ [[package]] name = "dashcore-private" version = "0.1.0" -source = "git+https://github.com/dashpay/rust-dashcore?tag=0.34.0#4c61ab617ca9f86f84484607014a7e8e0baba960" +source = "git+https://github.com/dashpay/rust-dashcore?tag=v0.35.0#521a76bfd7eaa90d2d89dc576808ec5772544f07" [[package]] name = "dashcore-rpc" -version = "0.15.13" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.13#88dfef0dc04cbe8f4b0d24e9aabfae8ca126c74a" +version = "0.16.0" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.16.0#099e871a64bbff1faf9c1d56014b612a1da1f3e0" dependencies = [ - "dashcore-private", "dashcore-rpc-json", - "env_logger 0.10.2", "hex", "jsonrpc", "log", @@ -1277,8 +1274,8 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" -version = "0.15.13" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.15.13#88dfef0dc04cbe8f4b0d24e9aabfae8ca126c74a" +version = "0.16.0" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?tag=v0.16.0#099e871a64bbff1faf9c1d56014b612a1da1f3e0" dependencies = [ "bincode", "dashcore", @@ -1292,7 +1289,7 @@ dependencies = [ [[package]] name = "dashcore_hashes" version = "0.14.0" -source = "git+https://github.com/dashpay/rust-dashcore?tag=0.34.0#4c61ab617ca9f86f84484607014a7e8e0baba960" +source = "git+https://github.com/dashpay/rust-dashcore?tag=v0.35.0#521a76bfd7eaa90d2d89dc576808ec5772544f07" dependencies = [ "dashcore-private", "secp256k1", @@ -1461,7 +1458,7 @@ dependencies = [ "data-contracts", "derive_more", "dpp", - "env_logger 0.11.5", + "env_logger", "getrandom", "hex", "indexmap 2.7.0", @@ -1736,19 +1733,6 @@ dependencies = [ "regex", ] -[[package]] -name = "env_logger" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.11.5" @@ -4904,15 +4888,6 @@ dependencies = [ "zip", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - [[package]] name = "termtree" version = "0.4.1" @@ -4992,26 +4967,6 @@ dependencies = [ "syn 2.0.96", ] -[[package]] -name = "thiserror-impl-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "thiserror-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" -dependencies = [ - "thiserror-impl-no-std", -] - [[package]] name = "thread_local" version = "1.1.8" @@ -5572,9 +5527,9 @@ checksum = "7302ac74a033bf17b6e609ceec0f891ca9200d502d31f02dc7908d3d98767c9d" [[package]] name = "vsss-rs" -version = "5.0.0-rc1" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9860fb75908021ae4cc125917c9763134f7f236a716d181ed644627783230c5d" +checksum = "fec4ebcc5594130c31b49594d55c0583fe80621f252f570b222ca4845cafd3cf" dependencies = [ "crypto-bigint", "elliptic-curve", @@ -5586,7 +5541,6 @@ dependencies = [ "serde", "sha3", "subtle", - "thiserror-no-std", "zeroize", ] diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index c3363198eb7..2b0784a2545 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -28,7 +28,7 @@ dashcore = { git = "https://github.com/dashpay/rust-dashcore", features = [ "rand", "signer", "serde", -], default-features = false, tag = "0.34.0" } +], default-features = false, tag = "v0.35.0" } env_logger = { version = "0.11" } getrandom = { version = "0.2", features = ["js"] } hex = { version = "0.4" } diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 0f75efef71d..34b0bf05ec0 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -28,7 +28,7 @@ rand = "0.8.5" tempfile = "3.3.0" hex = "0.4.3" indexmap = { version = "2.2.6", features = ["serde"] } -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.13" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.16.0" } dpp = { path = "../rs-dpp", features = ["abci"] } simple-signer = { path = "../simple-signer" } rust_decimal = "1.2.5" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 86da12f24ef..9e74dd6b20b 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -36,7 +36,7 @@ envy = { version = "0.4.2", optional = true } futures = { version = "0.3.30" } derive_more = { version = "1.0", features = ["from"] } # dashcore-rpc is only needed for core rpc; TODO remove once we have correct core rpc impl -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.13" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.16.0" } lru = { version = "0.12.5", optional = true } bip37-bloom-filter = { git = "https://github.com/dashpay/rs-bip37-bloom-filter", branch = "develop" } zeroize = { version = "1.8", features = ["derive"] } diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index ed99f9add46..02110719e61 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -8,6 +8,6 @@ rust-version.workspace = true [dependencies] bincode = { version = "2.0.0-rc.3", features = ["serde"] } -dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.15.13" } +dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore-rpc", tag = "v0.16.0" } dpp = { path = "../rs-dpp", features = ["abci"] } base64 = { version = "0.22.1" } From 2abce8ec578fb3a18d66f858adf14825cef3786e Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Wed, 15 Jan 2025 22:51:58 +0700 Subject: [PATCH 08/12] chore(release): update changelog and bump version to 1.8.0-rc.1 (#2423) --- CHANGELOG.md | 30 +++++++++++ Cargo.lock | 52 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/check-features/Cargo.toml | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- .../configs/getConfigFileMigrationsFactory.js | 4 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wallet-utils-contract/Cargo.toml | 2 +- packages/wallet-utils-contract/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 47 files changed, 102 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ee9d21099e..00ac232a839 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,33 @@ +## [1.8.0-rc.1](https://github.com/dashpay/platform/compare/v1.8.0-dev.2...v1.8.0-rc.1) (2025-01-15) + + +### Features + +* **platform:** distribute prefunded specialized balances after vote ([#2422](https://github.com/dashpay/platform/issues/2422)) + + +### Bug Fixes + +* **drive-abci:** document purchase on mutable document from different epoch had issue ([#2420](https://github.com/dashpay/platform/issues/2420)) +* **drive:** more than one key was returned when expecting only one result ([#2421](https://github.com/dashpay/platform/issues/2421)) +* **sdk:** failed to deserialize consensus error ([#2410](https://github.com/dashpay/platform/issues/2410)) +* try DriveDocumentQuery from DocumentQuery start field ([#2407](https://github.com/dashpay/platform/issues/2407)) + + +### Tests + +* unify identity versioned cost coverage ([#2416](https://github.com/dashpay/platform/issues/2416)) + + +### Miscellaneous Chores + +* **drive:** increase withdrawal limits to 2000 Dash per day ([#2287](https://github.com/dashpay/platform/issues/2287)) +* fix test suite configuration script ([#2402](https://github.com/dashpay/platform/issues/2402)) +* resolve NPM audit warnings ([#2417](https://github.com/dashpay/platform/issues/2417)) +* update bls library ([#2424](https://github.com/dashpay/platform/issues/2424)) + + + ## [1.8.0-dev.2](https://github.com/dashpay/platform/compare/v1.8.0-dev.1...v1.8.0-dev.2) (2024-12-19) ### âš  BREAKING CHANGES diff --git a/Cargo.lock b/Cargo.lock index c2b00fc26b9..a588acbf54e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -738,7 +738,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "check-features" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "toml", ] @@ -1131,7 +1131,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "dapi-grpc-macros", "futures-core", @@ -1147,7 +1147,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "dapi-grpc", "heck 0.5.0", @@ -1192,7 +1192,7 @@ dependencies = [ [[package]] name = "dash-sdk" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "arc-swap", "assert_matches", @@ -1298,7 +1298,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "platform-value", "platform-version", @@ -1308,7 +1308,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1433,7 +1433,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "platform-value", "platform-version", @@ -1443,7 +1443,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "anyhow", "assert_matches", @@ -1493,7 +1493,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "arc-swap", "assert_matches", @@ -1534,7 +1534,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "arc-swap", "assert_matches", @@ -1589,7 +1589,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "bincode", "dapi-grpc", @@ -1811,7 +1811,7 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "feature-flags-contract" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "platform-value", "platform-version", @@ -2754,7 +2754,7 @@ dependencies = [ [[package]] name = "json-schema-compatibility-validator" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "assert_matches", "json-patch", @@ -2936,7 +2936,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "platform-value", "platform-version", @@ -3541,7 +3541,7 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platform-serialization" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "bincode", "platform-version", @@ -3549,7 +3549,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "proc-macro2", "quote", @@ -3559,7 +3559,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "base64 0.22.1", "bincode", @@ -3580,7 +3580,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "quote", "syn 2.0.96", @@ -3588,7 +3588,7 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "bincode", "grovedb-version", @@ -3599,7 +3599,7 @@ dependencies = [ [[package]] name = "platform-versioning" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "proc-macro2", "quote", @@ -4094,7 +4094,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "backon", "chrono", @@ -4593,7 +4593,7 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "simple-signer" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "base64 0.22.1", "bincode", @@ -4678,7 +4678,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "bincode", "dpp", @@ -5556,7 +5556,7 @@ dependencies = [ [[package]] name = "wallet-utils-contract" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "platform-value", "platform-version", @@ -5648,7 +5648,7 @@ checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-dpp" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "anyhow", "async-trait", @@ -5884,7 +5884,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" dependencies = [ "num_enum 0.5.11", "platform-value", diff --git a/package.json b/package.json index 4d74e98d1a7..a4a11a91164 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index b5925ae9248..6050f4dd3e8 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/check-features/Cargo.toml b/packages/check-features/Cargo.toml index 0b75ac6c3b8..52cebe32949 100644 --- a/packages/check-features/Cargo.toml +++ b/packages/check-features/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "check-features" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 60b818489e1..122ada7a6a0 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index e730e735d68..1209ea02e09 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 3eb0e558340..a122eb8324b 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 961a3cdae24..6ea41bcd3c5 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "2.8.0-dev.2", + "version": "2.8.0-rc.1", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index 5bfe0315dc0..6f65fd9c38d 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -1061,8 +1061,8 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) .forEach(([, options]) => { delete options.core.miner.mediantime; - options.platform.drive.abci.docker.image = 'dashpay/drive:1-dev'; - options.platform.dapi.api.docker.image = 'dashpay/dapi:1-dev'; + options.platform.drive.abci.docker.image = 'dashpay/drive:1-rc'; + options.platform.dapi.api.docker.image = 'dashpay/dapi:1-rc'; }); return configFile; }, diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 928879233d8..5a179d4f74a 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index fabade48fb5..8165d10b3f5 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index e54510126bc..36f043919bb 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 0079f0e3672..74e1cc394ad 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 93e3dc7d0ec..8de2fc7d61d 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index abc11934a5d..2b5183a1c31 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index 995ab1bbd5d..2ff7a253f6d 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 8034532d576..650839eb5fb 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index f6e303f37e3..91323b6a917 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index e59d6e1b8d9..f81136bad18 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.8.0-dev.2", + "version": "4.8.0-rc.1", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 01b892024e2..ac6976a0f60 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index dbb66560a62..a68d4a61b27 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 82f5b0abe06..8f7b7c5294b 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index c67709fe4de..6f7dc1d0bcb 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 0f741d4b754..12e612527ab 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 01189894c72..fbdf3401ea4 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 2b0784a2545..d3024f2dbcf 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 34b0bf05ec0..02a85a12d99 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 2b04a1e7aae..4748129cdec 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index da02aaca8fa..be09837073b 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-json-schema-compatibility-validator/Cargo.toml b/packages/rs-json-schema-compatibility-validator/Cargo.toml index da8066ee7b4..996a4d63e6d 100644 --- a/packages/rs-json-schema-compatibility-validator/Cargo.toml +++ b/packages/rs-json-schema-compatibility-validator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "json-schema-compatibility-validator" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true authors = ["Ivan Shumkov "] diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index 3ac635e68e2..b41eb6abce0 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 27720a7545f..0fe3b1cf952 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index e856dc2e780..7e0dbeb440a 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index a6a21119dc2..5d7148f8e77 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index a4b36bd6a73..b86b5a1c8a1 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Versioning library for Platform" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index fd6f6ebdb38..f5129248911 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 9e74dd6b20b..038b0a98723 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dash-sdk" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 02110719e61..f3983c68938 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 2dfca6efdf3..b290a249a21 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index eb82b5d6b17..9a5f1aa4809 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.8.0-dev.2", + "version": "8.8.0-rc.1", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wallet-utils-contract/Cargo.toml b/packages/wallet-utils-contract/Cargo.toml index fa65debf47c..696f19dee77 100644 --- a/packages/wallet-utils-contract/Cargo.toml +++ b/packages/wallet-utils-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wallet-utils-contract" description = "Wallet data contract schema and tools" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/wallet-utils-contract/package.json b/packages/wallet-utils-contract/package.json index 269b166081f..60e9c04b36b 100644 --- a/packages/wallet-utils-contract/package.json +++ b/packages/wallet-utils-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-utils-contract", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "A contract and helper scripts for Wallet DApp", "scripts": { "lint": "eslint .", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index 40ce329f2ce..b7215e97d36 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index f40d49bfaaf..52ea6232a0b 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 888a9a642ad..f28d90b2344 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.8.0-dev.2" +version = "1.8.0-rc.1" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 76b2893da05..817c14f64e1 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.8.0-dev.2", + "version": "1.8.0-rc.1", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From 410eb09f8fe67a6da204313527d2f3615c5667ce Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Thu, 16 Jan 2025 06:31:26 +0700 Subject: [PATCH 09/12] fix(drive-abci): rebroadcasting should not only take first 2 quorums too (#2425) --- .../drive_abci_versions/drive_abci_method_versions/v5.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs index 19303e4347e..8b9e7b1eae7 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_method_versions/v5.rs @@ -84,7 +84,8 @@ pub const DRIVE_ABCI_METHOD_VERSIONS_V5: DriveAbciMethodVersions = DriveAbciMeth // quorums as workaround for Core v21 bug. pool_withdrawals_into_transactions_queue: 1, update_broadcasted_withdrawal_statuses: 0, - rebroadcast_expired_withdrawal_documents: 0, + // Rebroadcasting should also no longer use the first two quorums only + rebroadcast_expired_withdrawal_documents: 1, append_signatures_and_broadcast_withdrawal_transactions: 0, cleanup_expired_locks_of_withdrawal_amounts: 0, }, From 59bf0af642f8dd2daed53e5994fd0a04e2ca1a42 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Thu, 16 Jan 2025 13:10:39 +0700 Subject: [PATCH 10/12] chore(release): bump to v1.8.0-rc.2 (#2426) --- Cargo.lock | 52 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/check-features/Cargo.toml | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wallet-utils-contract/Cargo.toml | 2 +- packages/wallet-utils-contract/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 45 files changed, 70 insertions(+), 70 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a588acbf54e..e3f0fe93d7a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -738,7 +738,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "check-features" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "toml", ] @@ -1131,7 +1131,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "dapi-grpc-macros", "futures-core", @@ -1147,7 +1147,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "dapi-grpc", "heck 0.5.0", @@ -1192,7 +1192,7 @@ dependencies = [ [[package]] name = "dash-sdk" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "arc-swap", "assert_matches", @@ -1298,7 +1298,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "platform-value", "platform-version", @@ -1308,7 +1308,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1433,7 +1433,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "platform-value", "platform-version", @@ -1443,7 +1443,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "anyhow", "assert_matches", @@ -1493,7 +1493,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "arc-swap", "assert_matches", @@ -1534,7 +1534,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "arc-swap", "assert_matches", @@ -1589,7 +1589,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "bincode", "dapi-grpc", @@ -1811,7 +1811,7 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "feature-flags-contract" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "platform-value", "platform-version", @@ -2754,7 +2754,7 @@ dependencies = [ [[package]] name = "json-schema-compatibility-validator" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "assert_matches", "json-patch", @@ -2936,7 +2936,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "platform-value", "platform-version", @@ -3541,7 +3541,7 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platform-serialization" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "bincode", "platform-version", @@ -3549,7 +3549,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "proc-macro2", "quote", @@ -3559,7 +3559,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "base64 0.22.1", "bincode", @@ -3580,7 +3580,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "quote", "syn 2.0.96", @@ -3588,7 +3588,7 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "bincode", "grovedb-version", @@ -3599,7 +3599,7 @@ dependencies = [ [[package]] name = "platform-versioning" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "proc-macro2", "quote", @@ -4094,7 +4094,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "backon", "chrono", @@ -4593,7 +4593,7 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "simple-signer" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "base64 0.22.1", "bincode", @@ -4678,7 +4678,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "bincode", "dpp", @@ -5556,7 +5556,7 @@ dependencies = [ [[package]] name = "wallet-utils-contract" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "platform-value", "platform-version", @@ -5648,7 +5648,7 @@ checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-dpp" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "anyhow", "async-trait", @@ -5884,7 +5884,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" dependencies = [ "num_enum 0.5.11", "platform-value", diff --git a/package.json b/package.json index a4a11a91164..4e8f3efa734 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 6050f4dd3e8..b2c8d1a1ef5 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/check-features/Cargo.toml b/packages/check-features/Cargo.toml index 52cebe32949..d6801b63e17 100644 --- a/packages/check-features/Cargo.toml +++ b/packages/check-features/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "check-features" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 122ada7a6a0..082050a99eb 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 1209ea02e09..7068df8a650 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index a122eb8324b..2965a9ee829 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 6ea41bcd3c5..272b3026a03 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "2.8.0-rc.1", + "version": "2.8.0-rc.2", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 5a179d4f74a..c7444f1405e 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 8165d10b3f5..3bc98b5d004 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 36f043919bb..9f9347a9d66 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 74e1cc394ad..e9ad5401a61 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 8de2fc7d61d..b94a10c2d0b 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index 2b5183a1c31..a987b5eee63 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index 2ff7a253f6d..b7952b870aa 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 650839eb5fb..85e0bbef793 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 91323b6a917..ecf8dd049f9 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index f81136bad18..d51f640d50e 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.8.0-rc.1", + "version": "4.8.0-rc.2", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index ac6976a0f60..6273a6626b4 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index a68d4a61b27..0c312a7cf24 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 8f7b7c5294b..b748e157937 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 6f7dc1d0bcb..87b7234e492 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 12e612527ab..31d899730c2 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index fbdf3401ea4..46c59107041 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index d3024f2dbcf..caa157a21c8 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 02a85a12d99..f0f91618cfd 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 4748129cdec..1487d8053c3 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index be09837073b..46e32521d98 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-json-schema-compatibility-validator/Cargo.toml b/packages/rs-json-schema-compatibility-validator/Cargo.toml index 996a4d63e6d..123e01df912 100644 --- a/packages/rs-json-schema-compatibility-validator/Cargo.toml +++ b/packages/rs-json-schema-compatibility-validator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "json-schema-compatibility-validator" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true authors = ["Ivan Shumkov "] diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index b41eb6abce0..72fdb7b2877 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 0fe3b1cf952..dc16741b064 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index 7e0dbeb440a..b013b300606 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 5d7148f8e77..2df553abad3 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index b86b5a1c8a1..1364598fc1e 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Versioning library for Platform" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index f5129248911..dfd172cac55 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 038b0a98723..f5e448dea7c 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dash-sdk" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index f3983c68938..70f17e3bca7 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index b290a249a21..e61ec6ed258 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index 9a5f1aa4809..a3811d6dead 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.8.0-rc.1", + "version": "8.8.0-rc.2", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wallet-utils-contract/Cargo.toml b/packages/wallet-utils-contract/Cargo.toml index 696f19dee77..98675422d17 100644 --- a/packages/wallet-utils-contract/Cargo.toml +++ b/packages/wallet-utils-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wallet-utils-contract" description = "Wallet data contract schema and tools" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/wallet-utils-contract/package.json b/packages/wallet-utils-contract/package.json index 60e9c04b36b..a9ad547327f 100644 --- a/packages/wallet-utils-contract/package.json +++ b/packages/wallet-utils-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-utils-contract", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "A contract and helper scripts for Wallet DApp", "scripts": { "lint": "eslint .", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index b7215e97d36..92305236f38 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 52ea6232a0b..83a725b3237 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index f28d90b2344..77a0d8428c2 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.8.0-rc.1" +version = "1.8.0-rc.2" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 817c14f64e1..99195b4977c 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.8.0-rc.1", + "version": "1.8.0-rc.2", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From e4e156c864400e81c2407eac30715b50d8040c28 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Thu, 16 Jan 2025 18:11:57 +0700 Subject: [PATCH 11/12] chore(release): update change log and release v1.8.0 (#2427) Co-authored-by: Ivan Shumkov --- CHANGELOG.md | 59 +++++++++++++++++++ Cargo.lock | 52 ++++++++-------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/check-features/Cargo.toml | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- .../configs/getConfigFileMigrationsFactory.js | 4 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wallet-utils-contract/Cargo.toml | 2 +- packages/wallet-utils-contract/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 47 files changed, 131 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00ac232a839..2151c906422 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,62 @@ +## [1.8.0](https://github.com/dashpay/platform/compare/v1.7.1...v1.8.0) (2025-01-16) + + +### Features + +* **platform:** distribute prefunded specialized balances after vote ([#2422](https://github.com/dashpay/platform/issues/2422)) +* **platform:** using new rust based bls library ([#2424](https://github.com/dashpay/platform/issues/2424)) + + +### Bug Fixes + +* **drive-abci:** document purchase on mutable document from different epoch had issue ([#2420](https://github.com/dashpay/platform/issues/2420)) +* **drive:** more than one key was returned when expecting only one result ([#2421](https://github.com/dashpay/platform/issues/2421)) +* **sdk:** failed to deserialize consensus error ([#2410](https://github.com/dashpay/platform/issues/2410)) +* try DriveDocumentQuery from DocumentQuery start field ([#2407](https://github.com/dashpay/platform/issues/2407)) +* **drive-abci** rebroadcasting should not only take first 2 quorums too ([#2425](https://github.com/dashpay/platform/issues/2425)) +* **dashmate:** local network starting issues ([#2394](https://github.com/dashpay/platform/issues/2394)) +* **dashmate:** some group commands fail with mtime not found ([#2400](https://github.com/dashpay/platform/issues/2400)) +* emergency hard fork to fix masternode voting ([#2397](https://github.com/dashpay/platform/issues/2397)) + + +### Tests + +* unify identity versioned cost coverage ([#2416](https://github.com/dashpay/platform/issues/2416)) +* **sdk:** generate test vectors using testnet ([#2381](https://github.com/dashpay/platform/issues/2381)) + + +### Miscellaneous Chores + +* **drive:** increase withdrawal limits to 2000 Dash per day ([#2287](https://github.com/dashpay/platform/issues/2287)) +* fix test suite configuration script ([#2402](https://github.com/dashpay/platform/issues/2402)) +* resolve NPM audit warnings ([#2417](https://github.com/dashpay/platform/issues/2417)) +* remove deprecated check_network_version.sh ([#2084](https://github.com/dashpay/platform/issues/2084)) +* update bls library ([#2424](https://github.com/dashpay/platform/issues/2424)) + + +### Code Refactoring + +* **platform:** replace bls library ([#2257](https://github.com/dashpay/platform/issues/2257)) +* **dpp:** using deprecated param to init wasm module ([#2399](https://github.com/dashpay/platform/issues/2399)) + + +### Performance Improvements + +* **dpp:** reduce JS binding size by 3x ([#2396](https://github.com/dashpay/platform/issues/2396)) + + +### Continuous Integration + +* fix artifact upload issue on release build ([#2389](https://github.com/dashpay/platform/issues/2389)) + + +### Build System + +* bump wasm-bindgen to 0.2.99 ([#2395](https://github.com/dashpay/platform/issues/2395)) +* update rust to 1.83 ([#2393](https://github.com/dashpay/platform/issues/2393)) + + + ## [1.8.0-rc.1](https://github.com/dashpay/platform/compare/v1.8.0-dev.2...v1.8.0-rc.1) (2025-01-15) diff --git a/Cargo.lock b/Cargo.lock index e3f0fe93d7a..e8c68108b7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -738,7 +738,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "check-features" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "toml", ] @@ -1131,7 +1131,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "dapi-grpc-macros", "futures-core", @@ -1147,7 +1147,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "dapi-grpc", "heck 0.5.0", @@ -1192,7 +1192,7 @@ dependencies = [ [[package]] name = "dash-sdk" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "arc-swap", "assert_matches", @@ -1298,7 +1298,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "platform-value", "platform-version", @@ -1308,7 +1308,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1433,7 +1433,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "platform-value", "platform-version", @@ -1443,7 +1443,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "anyhow", "assert_matches", @@ -1493,7 +1493,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "arc-swap", "assert_matches", @@ -1534,7 +1534,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "arc-swap", "assert_matches", @@ -1589,7 +1589,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "bincode", "dapi-grpc", @@ -1811,7 +1811,7 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "feature-flags-contract" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "platform-value", "platform-version", @@ -2754,7 +2754,7 @@ dependencies = [ [[package]] name = "json-schema-compatibility-validator" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "assert_matches", "json-patch", @@ -2936,7 +2936,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "platform-value", "platform-version", @@ -3541,7 +3541,7 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platform-serialization" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "bincode", "platform-version", @@ -3549,7 +3549,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "proc-macro2", "quote", @@ -3559,7 +3559,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "base64 0.22.1", "bincode", @@ -3580,7 +3580,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "quote", "syn 2.0.96", @@ -3588,7 +3588,7 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "bincode", "grovedb-version", @@ -3599,7 +3599,7 @@ dependencies = [ [[package]] name = "platform-versioning" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "proc-macro2", "quote", @@ -4094,7 +4094,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "backon", "chrono", @@ -4593,7 +4593,7 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "simple-signer" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "base64 0.22.1", "bincode", @@ -4678,7 +4678,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "bincode", "dpp", @@ -5556,7 +5556,7 @@ dependencies = [ [[package]] name = "wallet-utils-contract" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "platform-value", "platform-version", @@ -5648,7 +5648,7 @@ checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-dpp" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "anyhow", "async-trait", @@ -5884,7 +5884,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.8.0-rc.2" +version = "1.8.0" dependencies = [ "num_enum 0.5.11", "platform-value", diff --git a/package.json b/package.json index 4e8f3efa734..c8df6e9b6b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.8.0-rc.2", + "version": "1.8.0", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index b2c8d1a1ef5..9c7c851e6b5 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/check-features/Cargo.toml b/packages/check-features/Cargo.toml index d6801b63e17..c4dd095d520 100644 --- a/packages/check-features/Cargo.toml +++ b/packages/check-features/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "check-features" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 082050a99eb..2b4fe8e531e 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.8.0-rc.2" +version = "1.8.0" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 7068df8a650..6b6a1e52dee 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 2965a9ee829..f780aad4c9d 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 272b3026a03..1467f6105bf 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "2.8.0-rc.2", + "version": "2.8.0", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index 6f65fd9c38d..6b9092ab005 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -1061,8 +1061,8 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) .forEach(([, options]) => { delete options.core.miner.mediantime; - options.platform.drive.abci.docker.image = 'dashpay/drive:1-rc'; - options.platform.dapi.api.docker.image = 'dashpay/dapi:1-rc'; + options.platform.drive.abci.docker.image = 'dashpay/drive:1'; + options.platform.dapi.api.docker.image = 'dashpay/dapi:1'; }); return configFile; }, diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index c7444f1405e..3ec7a34376c 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 3bc98b5d004..2ce75ff3744 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 9f9347a9d66..23edcde9785 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index e9ad5401a61..c226a1fdf09 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index b94a10c2d0b..1cd1af6a603 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index a987b5eee63..8dd27f9ec56 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index b7952b870aa..a9828c88ba2 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 85e0bbef793..31d66de8150 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index ecf8dd049f9..6a77fb52223 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index d51f640d50e..77e085fb9cb 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.8.0-rc.2", + "version": "4.8.0", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 6273a6626b4..5f05d07dc70 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 0c312a7cf24..760b45e4c36 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index b748e157937..f88c304bec1 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 87b7234e492..26ee6056c45 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 31d899730c2..f48715b6dd6 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 46c59107041..32c2bddba39 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index caa157a21c8..ec555a11d18 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index f0f91618cfd..2060d6fa6c9 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.8.0-rc.2" +version = "1.8.0" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 1487d8053c3..00082eed054 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 46e32521d98..6bc09663429 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.8.0-rc.2" +version = "1.8.0" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-json-schema-compatibility-validator/Cargo.toml b/packages/rs-json-schema-compatibility-validator/Cargo.toml index 123e01df912..a4211f6d181 100644 --- a/packages/rs-json-schema-compatibility-validator/Cargo.toml +++ b/packages/rs-json-schema-compatibility-validator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "json-schema-compatibility-validator" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true authors = ["Ivan Shumkov "] diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index 72fdb7b2877..ea275283925 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index dc16741b064..6a4e6f586c6 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index b013b300606..dacf12b51f8 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 2df553abad3..c8781a258f5 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 1364598fc1e..308329b22a8 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Versioning library for Platform" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index dfd172cac55..e2c02f7e96d 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index f5e448dea7c..ca37b832e56 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dash-sdk" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 70f17e3bca7..f6a91dc988d 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index e61ec6ed258..f7fa7e815ce 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.8.0-rc.2" +version = "1.8.0" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index a3811d6dead..77f762556f2 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.8.0-rc.2", + "version": "8.8.0", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wallet-utils-contract/Cargo.toml b/packages/wallet-utils-contract/Cargo.toml index 98675422d17..8cf721548c1 100644 --- a/packages/wallet-utils-contract/Cargo.toml +++ b/packages/wallet-utils-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wallet-utils-contract" description = "Wallet data contract schema and tools" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/wallet-utils-contract/package.json b/packages/wallet-utils-contract/package.json index a9ad547327f..c2bab2523db 100644 --- a/packages/wallet-utils-contract/package.json +++ b/packages/wallet-utils-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-utils-contract", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "A contract and helper scripts for Wallet DApp", "scripts": { "lint": "eslint .", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index 92305236f38..d7575a859ce 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 83a725b3237..26db1957ae5 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 77a0d8428c2..bb4b612765e 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.8.0-rc.2" +version = "1.8.0" edition = "2021" rust-version.workspace = true license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 99195b4977c..5e9d1ac2e66 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.8.0-rc.2", + "version": "1.8.0", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From cd1527d3ea54a7bcf0d51a036cd453859050c35b Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Fri, 17 Jan 2025 19:39:37 +0700 Subject: [PATCH 12/12] fix(dpp)!: wrapping overflow issue (#2430) --- .../methods/estimated_size/v0/mod.rs | 35 +++- .../document_type/methods/max_size/v0/mod.rs | 32 ++- .../document_type/methods/mod.rs | 4 +- .../document_type/property/mod.rs | 195 ++++++++++-------- .../v0/mod.rs | 2 +- .../v0/mod.rs | 2 +- .../v0/mod.rs | 2 +- .../v0/mod.rs | 2 +- .../v0/mod.rs | 2 +- .../v0/mod.rs | 2 +- .../util/object_size_info/document_info.rs | 21 +- 11 files changed, 182 insertions(+), 117 deletions(-) diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/estimated_size/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/estimated_size/v0/mod.rs index fcb8bfb81ad..55e6065f9ea 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/estimated_size/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/estimated_size/v0/mod.rs @@ -1,19 +1,32 @@ use crate::data_contract::document_type::v0::DocumentTypeV0; - +use crate::ProtocolError; +use platform_version::version::PlatformVersion; // If another document type (like V1) ever were to exist we would need to implement estimated_size_v0 again impl DocumentTypeV0 { /// The estimated size uses the middle ceil size of all attributes - pub(in crate::data_contract::document_type) fn estimated_size_v0(&self) -> u16 { - let mut iter = self - .flattened_properties - .iter() - .filter_map(|(_, document_property)| { - document_property.property_type.middle_byte_size_ceil() - }); - let first = Some(iter.next().unwrap_or_default()); + pub(in crate::data_contract::document_type) fn estimated_size_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result { + let mut total_size = 0u16; + + for (_, document_property) in self.flattened_properties.iter() { + // This call now returns a Result, ProtocolError>. + let maybe_size = document_property + .property_type + .middle_byte_size_ceil(platform_version)?; + + if let Some(size) = maybe_size { + total_size = match total_size.checked_add(size) { + Some(new_total) => new_total, + None => { + return Ok(u16::MAX); + } + }; + } + } - iter.fold(first, |acc, item| acc.and_then(|acc| acc.checked_add(item))) - .unwrap_or(u16::MAX) + Ok(total_size) } } diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/max_size/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/max_size/v0/mod.rs index ce8ffbd4394..346a7b5cf98 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/max_size/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/max_size/v0/mod.rs @@ -1,16 +1,30 @@ use crate::data_contract::document_type::v0::DocumentTypeV0; - +use crate::ProtocolError; +use platform_version::version::PlatformVersion; // If another document type (like V1) ever were to exist we would need to implement max_size_v0 again impl DocumentTypeV0 { - pub(in crate::data_contract::document_type) fn max_size_v0(&self) -> u16 { - let mut iter = self - .flattened_properties - .iter() - .filter_map(|(_, document_property)| document_property.property_type.max_byte_size()); - let first = Some(iter.next().unwrap_or_default()); + pub(in crate::data_contract::document_type) fn max_size_v0( + &self, + platform_version: &PlatformVersion, + ) -> Result { + let mut total_size = 0u16; + + for (_, document_property) in self.flattened_properties.iter() { + let maybe_size = document_property + .property_type + .max_byte_size(platform_version)?; + + if let Some(size) = maybe_size { + total_size = match total_size.checked_add(size) { + Some(new_total) => new_total, + None => { + return Ok(u16::MAX); + } + }; + } + } - iter.fold(first, |acc, item| acc.and_then(|acc| acc.checked_add(item))) - .unwrap_or(u16::MAX) + Ok(total_size) } } diff --git a/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs b/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs index 1c05a453046..d158336994f 100644 --- a/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/methods/mod.rs @@ -222,7 +222,7 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { .methods .max_size { - 0 => Ok(self.max_size_v0()), + 0 => self.max_size_v0(platform_version), version => Err(ProtocolError::UnknownVersionMismatch { method: "max_size".to_string(), known_versions: vec![0], @@ -239,7 +239,7 @@ impl DocumentTypeV0Methods for DocumentTypeV0 { .methods .estimated_size { - 0 => Ok(self.estimated_size_v0()), + 0 => self.estimated_size_v0(platform_version), version => Err(ProtocolError::UnknownVersionMismatch { method: "estimated_size".to_string(), known_versions: vec![0], diff --git a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs index 927fb561a1a..393fb89980f 100644 --- a/packages/rs-dpp/src/data_contract/document_type/property/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/property/mod.rs @@ -12,6 +12,7 @@ use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use indexmap::IndexMap; use integer_encoding::{VarInt, VarIntReader}; use platform_value::{Identifier, Value}; +use platform_version::version::PlatformVersion; use rand::distributions::{Alphanumeric, Standard}; use rand::rngs::StdRng; use rand::Rng; @@ -159,69 +160,93 @@ impl DocumentPropertyType { } } - pub fn min_byte_size(&self) -> Option { + pub fn min_byte_size( + &self, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { match self { - DocumentPropertyType::U128 => Some(16), - DocumentPropertyType::I128 => Some(16), - DocumentPropertyType::U64 => Some(8), - DocumentPropertyType::I64 => Some(8), - DocumentPropertyType::U32 => Some(4), - DocumentPropertyType::I32 => Some(4), - DocumentPropertyType::U16 => Some(2), - DocumentPropertyType::I16 => Some(2), - DocumentPropertyType::U8 => Some(1), - DocumentPropertyType::I8 => Some(1), - DocumentPropertyType::F64 => Some(8), + DocumentPropertyType::U128 => Ok(Some(16)), + DocumentPropertyType::I128 => Ok(Some(16)), + DocumentPropertyType::U64 => Ok(Some(8)), + DocumentPropertyType::I64 => Ok(Some(8)), + DocumentPropertyType::U32 => Ok(Some(4)), + DocumentPropertyType::I32 => Ok(Some(4)), + DocumentPropertyType::U16 => Ok(Some(2)), + DocumentPropertyType::I16 => Ok(Some(2)), + DocumentPropertyType::U8 => Ok(Some(1)), + DocumentPropertyType::I8 => Ok(Some(1)), + DocumentPropertyType::F64 => Ok(Some(8)), DocumentPropertyType::String(sizes) => match sizes.min_length { - None => Some(0), - Some(size) => Some(size * 4), + None => Ok(Some(0)), + Some(size) => { + if platform_version.protocol_version > 8 { + match size.checked_mul(4) { + Some(mul) => Ok(Some(mul)), + None => Err(ProtocolError::Overflow("min_byte_size overflow")), + } + } else { + Ok(Some(size.wrapping_mul(4))) + } + } }, DocumentPropertyType::ByteArray(sizes) => match sizes.min_size { - None => Some(0), - Some(size) => Some(size), + None => Ok(Some(0)), + Some(size) => Ok(Some(size)), }, - DocumentPropertyType::Boolean => Some(1), - DocumentPropertyType::Date => Some(8), + DocumentPropertyType::Boolean => Ok(Some(1)), + DocumentPropertyType::Date => Ok(Some(8)), DocumentPropertyType::Object(sub_fields) => sub_fields .iter() - .map(|(_, sub_field)| sub_field.property_type.min_byte_size()) + .map(|(_, sub_field)| sub_field.property_type.min_byte_size(platform_version)) .sum(), - DocumentPropertyType::Array(_) => None, - DocumentPropertyType::VariableTypeArray(_) => None, - DocumentPropertyType::Identifier => Some(32), + DocumentPropertyType::Array(_) => Ok(None), + DocumentPropertyType::VariableTypeArray(_) => Ok(None), + DocumentPropertyType::Identifier => Ok(Some(32)), } } - pub fn max_byte_size(&self) -> Option { + pub fn max_byte_size( + &self, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { match self { - DocumentPropertyType::U128 => Some(16), - DocumentPropertyType::I128 => Some(16), - DocumentPropertyType::U64 => Some(8), - DocumentPropertyType::I64 => Some(8), - DocumentPropertyType::U32 => Some(4), - DocumentPropertyType::I32 => Some(4), - DocumentPropertyType::U16 => Some(2), - DocumentPropertyType::I16 => Some(2), - DocumentPropertyType::U8 => Some(1), - DocumentPropertyType::I8 => Some(1), - DocumentPropertyType::F64 => Some(8), + DocumentPropertyType::U128 => Ok(Some(16)), + DocumentPropertyType::I128 => Ok(Some(16)), + DocumentPropertyType::U64 => Ok(Some(8)), + DocumentPropertyType::I64 => Ok(Some(8)), + DocumentPropertyType::U32 => Ok(Some(4)), + DocumentPropertyType::I32 => Ok(Some(4)), + DocumentPropertyType::U16 => Ok(Some(2)), + DocumentPropertyType::I16 => Ok(Some(2)), + DocumentPropertyType::U8 => Ok(Some(1)), + DocumentPropertyType::I8 => Ok(Some(1)), + DocumentPropertyType::F64 => Ok(Some(8)), DocumentPropertyType::String(sizes) => match sizes.max_length { - None => Some(u16::MAX), - Some(size) => Some(size * 4), + None => Ok(Some(u16::MAX)), + Some(size) => { + if platform_version.protocol_version > 8 { + match size.checked_mul(4) { + Some(mul) => Ok(Some(mul)), + None => Err(ProtocolError::Overflow("max_byte_size overflow")), + } + } else { + Ok(Some(size.wrapping_mul(4))) + } + } }, DocumentPropertyType::ByteArray(sizes) => match sizes.max_size { - None => Some(u16::MAX), - Some(size) => Some(size), + None => Ok(Some(u16::MAX)), + Some(size) => Ok(Some(size)), }, - DocumentPropertyType::Boolean => Some(1), - DocumentPropertyType::Date => Some(8), + DocumentPropertyType::Boolean => Ok(Some(1)), + DocumentPropertyType::Date => Ok(Some(8)), DocumentPropertyType::Object(sub_fields) => sub_fields .iter() - .map(|(_, sub_field)| sub_field.property_type.max_byte_size()) + .map(|(_, sub_field)| sub_field.property_type.max_byte_size(platform_version)) .sum(), - DocumentPropertyType::Array(_) => None, - DocumentPropertyType::VariableTypeArray(_) => None, - DocumentPropertyType::Identifier => Some(32), + DocumentPropertyType::Array(_) => Ok(None), + DocumentPropertyType::VariableTypeArray(_) => Ok(None), + DocumentPropertyType::Identifier => Ok(Some(32)), } } @@ -259,60 +284,66 @@ impl DocumentPropertyType { } /// The middle size rounded down halfway between min and max size - pub fn middle_size(&self) -> Option { - match self { - DocumentPropertyType::Array(_) | DocumentPropertyType::VariableTypeArray(_) => { - return None - } - _ => {} + pub fn middle_size(&self, platform_version: &PlatformVersion) -> Option { + let min_size = self.min_size()?; + let max_size = self.max_size()?; + if platform_version.protocol_version > 8 { + Some(((min_size as u32 + max_size as u32) / 2) as u16) + } else { + Some(min_size.wrapping_add(max_size) / 2) } - let min_size = self.min_size().unwrap(); - let max_size = self.max_size().unwrap(); - Some((min_size + max_size) / 2) } /// The middle size rounded up halfway between min and max size - pub fn middle_size_ceil(&self) -> Option { - match self { - DocumentPropertyType::Array(_) | DocumentPropertyType::VariableTypeArray(_) => { - return None - } - _ => {} + pub fn middle_size_ceil(&self, platform_version: &PlatformVersion) -> Option { + let min_size = self.min_size()?; + let max_size = self.max_size()?; + if platform_version.protocol_version > 8 { + Some(((min_size as u32 + max_size as u32 + 1) / 2) as u16) + } else { + Some(min_size.wrapping_add(max_size).wrapping_add(1) / 2) } - let min_size = self.min_size().unwrap(); - let max_size = self.max_size().unwrap(); - Some((min_size + max_size + 1) / 2) } /// The middle size rounded down halfway between min and max byte size - pub fn middle_byte_size(&self) -> Option { - match self { - DocumentPropertyType::Array(_) | DocumentPropertyType::VariableTypeArray(_) => { - return None - } - _ => {} + pub fn middle_byte_size( + &self, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + let Some(min_size) = self.min_byte_size(platform_version)? else { + return Ok(None); + }; + let Some(max_size) = self.max_byte_size(platform_version)? else { + return Ok(None); + }; + if platform_version.protocol_version > 8 { + Ok(Some(((min_size as u32 + max_size as u32) / 2) as u16)) + } else { + Ok(Some(min_size.wrapping_add(max_size) / 2)) } - let min_size = self.min_byte_size().unwrap(); - let max_size = self.max_byte_size().unwrap(); - Some((min_size + max_size) / 2) } /// The middle size rounded up halfway between min and max byte size - pub fn middle_byte_size_ceil(&self) -> Option { - match self { - DocumentPropertyType::Array(_) | DocumentPropertyType::VariableTypeArray(_) => { - return None - } - _ => {} + pub fn middle_byte_size_ceil( + &self, + platform_version: &PlatformVersion, + ) -> Result, ProtocolError> { + let Some(min_size) = self.min_byte_size(platform_version)? else { + return Ok(None); + }; + let Some(max_size) = self.max_byte_size(platform_version)? else { + return Ok(None); + }; + if platform_version.protocol_version > 8 { + Ok(Some(((min_size as u32 + max_size as u32 + 1) / 2) as u16)) + } else { + Ok(Some(min_size.wrapping_add(max_size).wrapping_add(1) / 2)) } - let min_size = self.min_byte_size().unwrap() as u32; - let max_size = self.max_byte_size().unwrap() as u32; - Some(((min_size + max_size + 1) / 2) as u16) } pub fn random_size(&self, rng: &mut StdRng) -> u16 { - let min_size = self.min_size().unwrap(); - let max_size = self.max_size().unwrap(); + let min_size = self.min_size().unwrap_or_default(); + let max_size = self.max_size().unwrap_or_default(); rng.gen_range(min_size..=max_size) } 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 6ad033a0f41..f0ce3394b8b 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 @@ -105,7 +105,7 @@ impl Drive { let document_top_field_estimated_size = document_and_contract_info .owned_document_info .document_info - .get_estimated_size_for_document_type(name, document_type)?; + .get_estimated_size_for_document_type(name, document_type, platform_version)?; if document_top_field_estimated_size > u8::MAX as u16 { return Err(Error::Fee(FeeError::Overflow( 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 332e9214519..c8ad3727088 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 @@ -107,7 +107,7 @@ impl Drive { let document_top_field_estimated_size = document_and_contract_info .owned_document_info .document_info - .get_estimated_size_for_document_type(name, document_type)?; + .get_estimated_size_for_document_type(name, document_type, platform_version)?; if document_top_field_estimated_size > u8::MAX as u16 { return Err(Error::Fee(FeeError::Overflow( 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 2725cc80b1c..918b8497424 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 @@ -125,7 +125,7 @@ impl Drive { let document_top_field_estimated_size = document_and_contract_info .owned_document_info .document_info - .get_estimated_size_for_document_type(name, document_type)?; + .get_estimated_size_for_document_type(name, document_type, platform_version)?; if document_top_field_estimated_size > u8::MAX as u16 { return Err(Error::Fee(FeeError::Overflow( 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 c21146a1832..54e347ab4a5 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 @@ -134,7 +134,7 @@ impl Drive { let document_top_field_estimated_size = document_and_contract_info .owned_document_info .document_info - .get_estimated_size_for_document_type(name, document_type)?; + .get_estimated_size_for_document_type(name, document_type, platform_version)?; if document_top_field_estimated_size > u8::MAX as u16 { return Err(Error::Fee(FeeError::Overflow( 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 1881419fdd2..1d5dbad0b79 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 @@ -111,7 +111,7 @@ impl Drive { let document_top_field_estimated_size = document_and_contract_info .owned_document_info .document_info - .get_estimated_size_for_document_type(name, document_type)?; + .get_estimated_size_for_document_type(name, document_type, platform_version)?; if document_top_field_estimated_size > u8::MAX as u16 { return Err(Error::Fee(FeeError::Overflow( 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 a989dd3997b..f48e5e46c01 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 @@ -123,7 +123,7 @@ impl Drive { let document_top_field_estimated_size = document_and_contract_info .owned_document_info .document_info - .get_estimated_size_for_document_type(name, document_type)?; + .get_estimated_size_for_document_type(name, document_type, platform_version)?; if document_top_field_estimated_size > u8::MAX as u16 { return Err(Error::Fee(FeeError::Overflow( diff --git a/packages/rs-drive/src/util/object_size_info/document_info.rs b/packages/rs-drive/src/util/object_size_info/document_info.rs index e2ad23c4f5a..e671b293a88 100644 --- a/packages/rs-drive/src/util/object_size_info/document_info.rs +++ b/packages/rs-drive/src/util/object_size_info/document_info.rs @@ -48,6 +48,7 @@ pub trait DocumentInfoV0Methods { &self, key_path: &str, document_type: DocumentTypeRef, + platform_version: &PlatformVersion, ) -> Result; /// Gets the raw path for the given document type fn get_raw_for_document_type( @@ -111,6 +112,7 @@ impl<'a> DocumentInfoV0Methods for DocumentInfo<'a> { &self, key_path: &str, document_type: DocumentTypeRef, + platform_version: &PlatformVersion, ) -> Result { match key_path { "$ownerId" | "$id" => Ok(DEFAULT_HASH_SIZE_U16), @@ -128,11 +130,14 @@ impl<'a> DocumentInfoV0Methods for DocumentInfo<'a> { key_path ))) })?; - let estimated_size = property.property_type.middle_byte_size_ceil().ok_or({ - Error::Drive(DriveError::CorruptedCodeExecution( - "document type must have a max size", - )) - })?; + let estimated_size = property + .property_type + .middle_byte_size_ceil(platform_version)? + .ok_or({ + Error::Drive(DriveError::CorruptedCodeExecution( + "document type must have a max size", + )) + })?; Ok(estimated_size) } } @@ -217,8 +222,10 @@ impl<'a> DocumentInfoV0Methods for DocumentInfo<'a> { )) })?; - let estimated_middle_size = - property.property_type.middle_byte_size_ceil().ok_or({ + let estimated_middle_size = property + .property_type + .middle_byte_size_ceil(platform_version)? + .ok_or({ Error::Drive(DriveError::CorruptedCodeExecution( "document type must have a max size", ))