From bd280fadd11d40fda92ef056f64a3e480b2f1604 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Mon, 14 Sep 2026 14:39:22 +0000 Subject: [PATCH 1/4] test(bincode): pin pre-bump wire bytes for persisted blobs Commit byte fixtures written by crates.io bincode 2.0.1 (platform pin 63cf57f4) for QualifiedIdentity (every PrivateKeyData variant and PrivateKeyTarget, voter/operator identities, contract bounds, a WalletDerivationPath with all ChildNumber kinds), ContestedName, TokenConfiguration (with a perpetual DistributionFunction), StoredSeedEnvelope and WalletMeta (serde path). All values are synthetic. Each guard decodes its fixture through the production reader, compares the value, re-encodes byte-for-byte and checks that the fixture tells the standard and legacy encodings apart. This is the executable guard for the upcoming grovedb-bincode switch. Derive PartialEq on ContestedName and Contestant for the comparison. Co-Authored-By: Claude Opus 5 --- src/context/contract_token_db.rs | 81 ++++++ src/model/contested_name.rs | 86 +++++- src/model/qualified_identity/mod.rs | 267 ++++++++++++++++++ src/model/wallet/meta.rs | 39 +++ src/model/wallet/seed_envelope.rs | 40 +++ .../bincode_pre_bump/contested_name.bin | Bin 0 -> 441 bytes .../bincode_pre_bump/qualified_identity.bin | Bin 0 -> 1336 bytes .../bincode_pre_bump/stored_seed_envelope.bin | Bin 0 -> 205 bytes .../bincode_pre_bump/token_configuration.bin | Bin 0 -> 216 bytes .../fixtures/bincode_pre_bump/wallet_meta.bin | Bin 0 -> 124 bytes 10 files changed, 511 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/bincode_pre_bump/contested_name.bin create mode 100644 tests/fixtures/bincode_pre_bump/qualified_identity.bin create mode 100644 tests/fixtures/bincode_pre_bump/stored_seed_envelope.bin create mode 100644 tests/fixtures/bincode_pre_bump/token_configuration.bin create mode 100644 tests/fixtures/bincode_pre_bump/wallet_meta.bin diff --git a/src/context/contract_token_db.rs b/src/context/contract_token_db.rs index 45f28137e..93abb3778 100644 --- a/src/context/contract_token_db.rs +++ b/src/context/contract_token_db.rs @@ -1183,3 +1183,84 @@ mod tests { ); } } + +/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the +/// `grovedb-bincode` fork. The fixture was written by `bincode 2.0.1` before +/// the switch and must never be regenerated. +#[cfg(test)] +mod bincode_pre_bump_fixture_tests { + use super::*; + use dash_sdk::dpp::data_contract::associated_token::token_configuration::v0::TokenConfigurationV0; + use dash_sdk::dpp::data_contract::associated_token::token_configuration_convention::TokenConfigurationConvention; + use dash_sdk::dpp::data_contract::associated_token::token_configuration_localization::TokenConfigurationLocalization; + use dash_sdk::dpp::data_contract::associated_token::token_configuration_localization::v0::TokenConfigurationLocalizationV0; + use dash_sdk::dpp::data_contract::associated_token::token_distribution_rules::TokenDistributionRules; + use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::TokenPerpetualDistribution; + use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::distribution_function::DistributionFunction; + use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::distribution_recipient::TokenDistributionRecipient; + use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::reward_distribution_type::RewardDistributionType; + use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::v0::TokenPerpetualDistributionV0; + + const FIXTURE: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/tests/fixtures/bincode_pre_bump/token_configuration.bin" + )); + + /// The most-restrictive preset (the shape DET's token builder starts from) + /// plus a localization and a perpetual distribution carrying a + /// multi-field `DistributionFunction`, whose upstream `Decode` impl was + /// rewritten across the platform bump. + fn sample() -> TokenConfiguration { + let mut v0 = TokenConfigurationV0::default_most_restrictive(); + let TokenConfigurationConvention::V0(ref mut conventions) = v0.conventions; + conventions.decimals = 6; + conventions.localizations.insert( + "en".to_string(), + TokenConfigurationLocalization::V0(TokenConfigurationLocalizationV0 { + should_capitalize: true, + singular_form: "Fixture".to_string(), + plural_form: "Fixtures".to_string(), + }), + ); + v0.base_supply = 1_000_000; + v0.max_supply = Some(9_000_000); + v0.start_as_paused = true; + let TokenDistributionRules::V0(ref mut rules) = v0.distribution_rules; + rules.perpetual_distribution = Some(TokenPerpetualDistribution::V0( + TokenPerpetualDistributionV0 { + distribution_type: RewardDistributionType::EpochBasedDistribution { + interval: 7, + function: DistributionFunction::Linear { + a: -3, + d: 10, + start_step: Some(2), + starting_amount: 500, + min_value: Some(10), + max_value: Some(1_000), + }, + }, + distribution_recipient: TokenDistributionRecipient::Identity(Identifier::from( + [0x71; 32], + )), + }, + )); + rules.new_tokens_destination_identity = Some(Identifier::from([0x72; 32])); + TokenConfiguration::V0(v0) + } + + /// Decodes through the production reader (`decode_token_config`) and + /// re-encodes with the same config `insert_token` writes with. + #[test] + fn pre_bump_bytes_decode_and_reencode_identically() { + let decoded = decode_token_config(FIXTURE).expect("decode pre-bump fixture"); + let (_, consumed): (TokenConfiguration, usize) = + bincode::decode_from_slice(FIXTURE, config::standard()).expect("decode"); + assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); + assert_eq!(decoded, sample(), "decoded value drifted"); + let reencoded = bincode::encode_to_vec(&decoded, config::standard()).expect("encode"); + assert_eq!(reencoded, FIXTURE, "re-encoded bytes drifted"); + // Sensitivity: the byte comparison tells encodings apart. + let legacy = bincode::encode_to_vec(sample(), config::legacy()).expect("encode legacy"); + assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); + } +} diff --git a/src/model/contested_name.rs b/src/model/contested_name.rs index 893dcde65..be6129f3d 100644 --- a/src/model/contested_name.rs +++ b/src/model/contested_name.rs @@ -25,7 +25,7 @@ impl ContestState { } } -#[derive(Debug, Encode, Decode, Clone)] +#[derive(Debug, Encode, Decode, Clone, PartialEq)] pub struct ContestedName { pub normalized_contested_name: String, pub contestants: Option>, @@ -210,7 +210,7 @@ pub struct MasternodeContestSummary { pub has_scheduled_vote: bool, } -#[derive(Debug, Encode, Decode, Clone)] +#[derive(Debug, Encode, Decode, Clone, PartialEq)] pub struct Contestant { pub id: Identifier, pub name: String, @@ -484,3 +484,85 @@ mod tests { assert!(sanitized.chars().all(|character| character == 'é')); } } + +/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the +/// `grovedb-bincode` fork (and its forked derive macros). The fixture was +/// written by `bincode 2.0.1` before the switch and must never be regenerated. +#[cfg(test)] +mod bincode_pre_bump_fixture_tests { + use super::*; + + const FIXTURE: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/tests/fixtures/bincode_pre_bump/contested_name.bin" + )); + + /// Covers every field kind the derive emits: `Identifier` (upstream + /// type), nested `Vec`/`Option`, a data-carrying enum variant, and a + /// `BTreeMap` keyed by a tuple with `ResourceVoteChoice` values. + fn sample() -> ContestedName { + let alice = Identifier::from([0x51; 32]); + let bob = Identifier::from([0x52; 32]); + let voter = Identifier::from([0x53; 32]); + let mut my_votes = BTreeMap::new(); + my_votes.insert( + (voter, PrivateKeyTarget::PrivateKeyOnVoterIdentity, 2), + ResourceVoteChoice::TowardsIdentity(alice), + ); + my_votes.insert( + (voter, PrivateKeyTarget::PrivateKeyOnMainIdentity, 0), + ResourceVoteChoice::Abstain, + ); + my_votes.insert( + (bob, PrivateKeyTarget::PrivateKeyOnOperatorIdentity, 1), + ResourceVoteChoice::Lock, + ); + ContestedName { + normalized_contested_name: "fixture-name".to_string(), + contestants: Some(vec![ + Contestant { + id: alice, + name: "Fixture-Name".to_string(), + info: "first contender".to_string(), + votes: 17, + created_at: Some(1_700_000_000_000), + created_at_block_height: Some(123_456), + created_at_core_block_height: Some(987_654), + document_id: Identifier::from([0x61; 32]), + }, + Contestant { + id: bob, + name: "fixture-name".to_string(), + info: String::new(), + votes: 0, + created_at: None, + created_at_block_height: None, + created_at_core_block_height: None, + document_id: Identifier::from([0x62; 32]), + }, + ]), + locked_votes: Some(3), + abstain_votes: Some(5), + awarded_to: Some(alice), + end_time: Some(1_700_000_600_000), + state: ContestState::WonBy(alice), + last_updated: Some(1_700_000_300_000), + my_votes, + } + } + + #[test] + fn pre_bump_bytes_decode_and_reencode_identically() { + let cfg = bincode::config::standard(); + let (decoded, consumed): (ContestedName, usize) = + bincode::decode_from_slice(FIXTURE, cfg).expect("decode pre-bump fixture"); + assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); + assert_eq!(decoded, sample(), "decoded value drifted"); + let reencoded = bincode::encode_to_vec(&decoded, cfg).expect("encode"); + assert_eq!(reencoded, FIXTURE, "re-encoded bytes drifted"); + // Sensitivity: the byte comparison tells encodings apart. + let legacy = + bincode::encode_to_vec(sample(), bincode::config::legacy()).expect("encode legacy"); + assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); + } +} diff --git a/src/model/qualified_identity/mod.rs b/src/model/qualified_identity/mod.rs index 550d973fb..f0e5f57af 100644 --- a/src/model/qualified_identity/mod.rs +++ b/src/model/qualified_identity/mod.rs @@ -2629,3 +2629,270 @@ mod decode_limit_tests { assert_eq!(decoded, payload); } } + +/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the +/// `grovedb-bincode` fork (and its forked derive macros). The fixture was +/// written by `bincode 2.0.1` before the switch and must never be regenerated. +#[cfg(test)] +mod bincode_pre_bump_fixture_tests { + use super::*; + use crate::model::qualified_identity::encrypted_key_storage::{ + PrivateKeyData, WalletDerivationPath, + }; + use dash_sdk::dpp::identity::identity_public_key::contract_bounds::ContractBounds; + use dash_sdk::dpp::identity::identity_public_key::v0::IdentityPublicKeyV0; + use dash_sdk::dpp::identity::v0::IdentityV0; + use dash_sdk::dpp::identity::{KeyType, Purpose, SecurityLevel}; + use dash_sdk::dpp::key_wallet::bip32::{ChildNumber, DerivationPath}; + use dash_sdk::dpp::platform_value::BinaryData; + use dash_sdk::platform::{Identifier, IdentityPublicKey}; + + const FIXTURE: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/tests/fixtures/bincode_pre_bump/qualified_identity.bin" + )); + + #[allow(clippy::too_many_arguments)] + fn key( + id: KeyID, + purpose: Purpose, + security_level: SecurityLevel, + key_type: KeyType, + contract_bounds: Option, + read_only: bool, + data: Vec, + disabled_at: Option, + ) -> IdentityPublicKey { + IdentityPublicKey::V0(IdentityPublicKeyV0 { + id, + purpose, + security_level, + contract_bounds, + key_type, + read_only, + data: BinaryData::new(data), + disabled_at, + }) + } + + fn identity(id: [u8; 32], keys: &[IdentityPublicKey], balance: u64, revision: u64) -> Identity { + Identity::V0(IdentityV0 { + id: Identifier::from(id), + public_keys: keys.iter().map(|k| (k.id(), k.clone())).collect(), + balance, + revision, + }) + } + + /// A DIP-9-shaped path plus one of each 256-bit child kind, so every + /// `ChildNumber` discriminant of the manual `WalletDerivationPath` codec + /// is pinned. + fn wallet_path(seed_hash_byte: u8) -> WalletDerivationPath { + WalletDerivationPath { + wallet_seed_hash: [seed_hash_byte; 32], + derivation_path: DerivationPath::from(vec![ + ChildNumber::Hardened { index: 9 }, + ChildNumber::Hardened { index: 1 }, + ChildNumber::Hardened { index: 5 }, + ChildNumber::Normal { index: 0 }, + ChildNumber::Normal256 { index: [0x0A; 32] }, + ChildNumber::Hardened256 { index: [0x0B; 32] }, + ]), + } + } + + /// Synthetic masternode identity — byte patterns only, no real keys. + /// Holds every `PrivateKeyData` variant, every `PrivateKeyTarget`, + /// voter + operator identities, contract bounds, a disabled key and a + /// wallet-linked public key. + fn sample() -> QualifiedIdentity { + let master = key( + 0, + Purpose::AUTHENTICATION, + SecurityLevel::MASTER, + KeyType::ECDSA_SECP256K1, + None, + false, + [vec![0x02], vec![0x21; 32]].concat(), + None, + ); + let bounded = key( + 1, + Purpose::AUTHENTICATION, + SecurityLevel::HIGH, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContractDocumentType { + id: Identifier::from([0x31; 32]), + document_type_name: "note".to_string(), + }), + true, + [vec![0x03], vec![0x22; 32]].concat(), + Some(1_700_000_000_000), + ); + let medium = key( + 2, + Purpose::AUTHENTICATION, + SecurityLevel::MEDIUM, + KeyType::ECDSA_SECP256K1, + Some(ContractBounds::SingleContract { + id: Identifier::from([0x32; 32]), + }), + false, + [vec![0x02], vec![0x23; 32]].concat(), + None, + ); + let transfer = key( + 3, + Purpose::TRANSFER, + SecurityLevel::CRITICAL, + KeyType::ECDSA_HASH160, + None, + false, + vec![0x24; 20], + None, + ); + let vaulted = key( + 4, + Purpose::OWNER, + SecurityLevel::CRITICAL, + KeyType::ECDSA_HASH160, + None, + false, + vec![0x25; 20], + None, + ); + let voting = key( + 0, + Purpose::VOTING, + SecurityLevel::HIGH, + KeyType::ECDSA_HASH160, + None, + false, + vec![0x26; 20], + None, + ); + let operator = key( + 0, + Purpose::SYSTEM, + SecurityLevel::CRITICAL, + KeyType::BLS12_381, + None, + false, + vec![0x27; 48], + None, + ); + + let main_identity = identity( + [0xB1; 32], + &[ + master.clone(), + bounded.clone(), + medium.clone(), + transfer.clone(), + vaulted.clone(), + ], + 123_456_789, + 4, + ); + let voter_identity = identity([0xB2; 32], std::slice::from_ref(&voting), 0, 0); + let operator_identity = identity([0xB3; 32], std::slice::from_ref(&operator), 7, 1); + + let mut private_keys = BTreeMap::new(); + private_keys.insert( + (PrivateKeyTarget::PrivateKeyOnMainIdentity, master.id()), + ( + QualifiedIdentityPublicKey::from(master), + PrivateKeyData::Clear([0x11; 32]), + ), + ); + private_keys.insert( + (PrivateKeyTarget::PrivateKeyOnMainIdentity, bounded.id()), + ( + QualifiedIdentityPublicKey::from(bounded), + PrivateKeyData::Encrypted(vec![0x12; 48]), + ), + ); + private_keys.insert( + (PrivateKeyTarget::PrivateKeyOnMainIdentity, medium.id()), + ( + QualifiedIdentityPublicKey::from(medium), + PrivateKeyData::AlwaysClear([0x13; 32]), + ), + ); + private_keys.insert( + (PrivateKeyTarget::PrivateKeyOnMainIdentity, transfer.id()), + ( + QualifiedIdentityPublicKey { + identity_public_key: transfer, + in_wallet_at_derivation_path: Some(wallet_path(0x14)), + }, + PrivateKeyData::AtWalletDerivationPath(wallet_path(0x14)), + ), + ); + private_keys.insert( + (PrivateKeyTarget::PrivateKeyOnMainIdentity, vaulted.id()), + ( + QualifiedIdentityPublicKey::from(vaulted), + PrivateKeyData::InVault, + ), + ); + private_keys.insert( + (PrivateKeyTarget::PrivateKeyOnVoterIdentity, voting.id()), + ( + QualifiedIdentityPublicKey::from(voting.clone()), + PrivateKeyData::Clear([0x15; 32]), + ), + ); + private_keys.insert( + ( + PrivateKeyTarget::PrivateKeyOnOperatorIdentity, + operator.id(), + ), + ( + QualifiedIdentityPublicKey::from(operator.clone()), + PrivateKeyData::InVault, + ), + ); + + QualifiedIdentity { + identity: main_identity, + associated_voter_identity: Some((voter_identity, voting)), + associated_operator_identity: Some((operator_identity, operator)), + associated_owner_key_id: Some(4), + identity_type: IdentityType::Masternode, + alias: Some("fixture-masternode".to_string()), + private_keys: KeyStorage::from(private_keys), + dpns_names: vec![DPNSNameInfo { + name: "fixture".to_string(), + acquired_at: 1_700_000_000_000, + }], + // Everything below is not encoded; these are the values `decode` + // reconstructs, so a decoded fixture compares equal field-for-field. + associated_wallets: BTreeMap::new(), + secret_access: None, + wallet_index: None, + top_ups: BTreeMap::new(), + status: IdentityStatus::Unknown, + network: Network::Mainnet, + } + } + + /// Decodes through the production entry point (`from_bytes`, with the + /// identity-blob decode limit) and re-encodes through `to_bytes`. The + /// manual `PartialEq` skips runtime-only fields, so the byte comparison + /// is what pins every encoded field. + #[test] + fn pre_bump_bytes_decode_and_reencode_identically() { + let decoded = QualifiedIdentity::from_bytes(FIXTURE).expect("decode pre-bump fixture"); + let (_, consumed): (QualifiedIdentity, usize) = + bincode::decode_from_slice(FIXTURE, identity_blob_decode_config()) + .expect("decode pre-bump fixture under the limit config"); + assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); + assert_eq!(decoded, sample(), "decoded value drifted"); + assert_eq!(decoded.to_bytes(), FIXTURE, "re-encoded bytes drifted"); + // Sensitivity: the byte comparison tells encodings apart. + let legacy = + bincode::encode_to_vec(sample(), bincode::config::legacy()).expect("encode legacy"); + assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); + } +} diff --git a/src/model/wallet/meta.rs b/src/model/wallet/meta.rs index 6c8e9e8c7..e29ecc6a5 100644 --- a/src/model/wallet/meta.rs +++ b/src/model/wallet/meta.rs @@ -277,3 +277,42 @@ mod tests { assert_no_leak_bytes(&rendered, &secret, "WalletMeta sidecar blob"); } } + +/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the +/// `grovedb-bincode` fork. The fixture was written by `bincode 2.0.1` before +/// the switch and must never be regenerated. +#[cfg(test)] +mod bincode_pre_bump_fixture_tests { + use super::*; + + const FIXTURE: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/tests/fixtures/bincode_pre_bump/wallet_meta.bin" + )); + + fn sample() -> WalletMeta { + WalletMeta { + alias: "fixture wallet".to_string(), + is_main: true, + core_wallet_name: Some("fixture-core".to_string()), + xpub_encoded: (0..78u8).rev().collect(), + uses_password: true, + password_hint: Some("fixture hint".to_string()), + } + } + + #[test] + fn pre_bump_bytes_decode_and_reencode_identically() { + let cfg = bincode::config::standard(); + let (decoded, consumed): (WalletMeta, usize) = + bincode::serde::decode_from_slice(FIXTURE, cfg).expect("decode pre-bump fixture"); + assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); + assert_eq!(decoded, sample(), "decoded value drifted"); + let reencoded = bincode::serde::encode_to_vec(&decoded, cfg).expect("encode"); + assert_eq!(reencoded, FIXTURE, "re-encoded bytes drifted"); + // Sensitivity: the byte comparison tells encodings apart. + let legacy = bincode::serde::encode_to_vec(sample(), bincode::config::legacy()) + .expect("encode legacy"); + assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); + } +} diff --git a/src/model/wallet/seed_envelope.rs b/src/model/wallet/seed_envelope.rs index 7d5eaeb71..883c0bbb4 100644 --- a/src/model/wallet/seed_envelope.rs +++ b/src/model/wallet/seed_envelope.rs @@ -148,3 +148,43 @@ mod tests { assert_zeroize_on_drop(&decoded.encrypted_seed); } } + +/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the +/// `grovedb-bincode` fork. The fixture was written by `bincode 2.0.1` before +/// the switch and must never be regenerated. +#[cfg(test)] +mod bincode_pre_bump_fixture_tests { + use super::*; + + const FIXTURE: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/tests/fixtures/bincode_pre_bump/stored_seed_envelope.bin" + )); + + /// Synthetic envelope — byte patterns only, no real seed material. + fn sample() -> StoredSeedEnvelope { + StoredSeedEnvelope { + encrypted_seed: Zeroizing::new(vec![0xA5; 80]), + salt: vec![0x5A; 16], + nonce: vec![0x3C; 12], + password_hint: Some("fixture hint".to_string()), + uses_password: true, + xpub_encoded: (0..78u8).collect(), + } + } + + #[test] + fn pre_bump_bytes_decode_and_reencode_identically() { + let cfg = bincode::config::standard(); + let (decoded, consumed): (StoredSeedEnvelope, usize) = + bincode::serde::decode_from_slice(FIXTURE, cfg).expect("decode pre-bump fixture"); + assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); + assert_eq!(decoded, sample(), "decoded value drifted"); + let reencoded = bincode::serde::encode_to_vec(&decoded, cfg).expect("encode"); + assert_eq!(reencoded, FIXTURE, "re-encoded bytes drifted"); + // Sensitivity: the byte comparison tells encodings apart. + let legacy = bincode::serde::encode_to_vec(sample(), bincode::config::legacy()) + .expect("encode legacy"); + assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); + } +} diff --git a/tests/fixtures/bincode_pre_bump/contested_name.bin b/tests/fixtures/bincode_pre_bump/contested_name.bin new file mode 100644 index 0000000000000000000000000000000000000000..c77650ebdc5cf9fefd847ad576d9a1fb9ed5cec2 GIT binary patch literal 441 zcmd-{%d99VElSnROUzAWWC|nzc-)}M{ea5((=v;SOB9mx^GZ_lQc{Zq8UHe5JU!pd z$iTq($KeqpkYp3$XGkOff(QT}WG6C!KoSAK$jr#fNWdq7jDHXGzXLm#nXu9azh6R> Z5^!q}6C+bF0RRjg0xE(TnHUJU2>@{Dk7xh@ literal 0 HcmV?d00001 diff --git a/tests/fixtures/bincode_pre_bump/qualified_identity.bin b/tests/fixtures/bincode_pre_bump/qualified_identity.bin new file mode 100644 index 0000000000000000000000000000000000000000..13eb781550a44f78c8cf785eefbaa9907cf29a38 GIT binary patch literal 1336 zcmcK4L2AN47zN<>W=2EXm1%N-u~t`tdL37VrnHMHXaw)zX|MrK|KqaOn!6Eh1d8#@Ol7dHqnoxOvjle3Gfo4bdn Im$#2E01SFfUH||9 literal 0 HcmV?d00001 diff --git a/tests/fixtures/bincode_pre_bump/token_configuration.bin b/tests/fixtures/bincode_pre_bump/token_configuration.bin new file mode 100644 index 0000000000000000000000000000000000000000..b83d8a93e7fdabd1d29d36eee3a23c1fcc31b05c GIT binary patch literal 216 zcmZQzU}Q?oV_;-=%d99VElTBp(#32HVDQJmiJyV-k3&c&0|O%zKx7yg8JO5vSh*OP det%(PFQ`}X= Date: Mon, 14 Sep 2026 14:56:25 +0000 Subject: [PATCH 2/4] chore(deps)!: bump dashpay/platform to v4.2-dev 01d94479 Move dash-sdk, rs-sdk-trusted-context-provider, platform-wallet and platform-wallet-storage from 63cf57f4 to 01d94479 (4.2.0-dev.10). Transitively: rust-dashcore e4208c90, GroveDB 6.0.0, grovedb-bincode 2.1.0. - Alias bincode to grovedb-bincode =2.1.0: upstream dpp, platform-value and dashcore implement its Encode/Decode traits. On the ordinary paths DET uses, its wire format matches bincode 2.0.1. The pre-bump fixtures confirm it, so no migration is needed. - Use the untrusted dpp decoders (#4625) for pasted state transitions and contracts, and for saved contracts. - Pass the active PlatformVersion to rewards_in_interval_with_explanation (#4645). - Map PlatformWalletError::ShieldedIdentityDebitPending, ShieldedRecoveryCorrupted and ShieldedRecoveryKeysRequired (#4708) to dedicated TaskError variants with fixed, actionable messages. The upstream reason is never shown to the user. Identity-flow bucketing names them explicitly as Other. - Leave TODOs for the contested DPNS fee label (PV14) and the devnet protocol seed. - Add docs/ai-design/2026-09-14-platform-4.2-dev-bump/upgrade-notes.md. BREAKING CHANGE: new TaskError variants; the bincode dependency is now the grovedb-bincode package. Co-Authored-By: Claude Opus 5 --- Cargo.lock | 317 ++++++++++-------- Cargo.toml | 32 +- .../upgrade-notes.md | 126 +++++++ src/backend_task/error.rs | 103 ++++++ ..._claimed_perpetual_distribution_rewards.rs | 2 + src/context/contract_token_db.rs | 8 +- src/context/mod.rs | 1 + src/ui/identity/register_dpns_name_screen.rs | 1 + src/ui/tools/contract_visualizer_screen.rs | 6 +- src/ui/tools/transition_visualizer_screen.rs | 7 +- src/wallet_backend/mod.rs | 99 ++++++ 11 files changed, 534 insertions(+), 168 deletions(-) create mode 100644 docs/ai-design/2026-09-14-platform-4.2-dev-bump/upgrade-notes.md diff --git a/Cargo.lock b/Cargo.lock index 8c6c2a5eb..e8a985242 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1876,8 +1876,8 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "dash-platform-macros", "futures-core", @@ -1978,8 +1978,8 @@ dependencies = [ [[package]] name = "dash-async" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "futures", "thiserror 2.0.18", @@ -1990,8 +1990,8 @@ dependencies = [ [[package]] name = "dash-context-provider" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "dash-async", "dpp", @@ -2012,7 +2012,6 @@ dependencies = [ "async-trait", "axum", "base64 0.22.1", - "bincode 2.0.1", "bip39", "bitflags 2.13.0", "cbc", @@ -2035,6 +2034,7 @@ dependencies = [ "enum-iterator", "envy", "futures", + "grovedb-bincode", "grovestark", "hex", "humantime", @@ -2082,26 +2082,26 @@ dependencies = [ [[package]] name = "dash-network" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" dependencies = [ - "bincode 2.0.1", - "bincode_derive", "cbindgen", + "grovedb-bincode", + "grovedb-bincode-derive", "serde", ] [[package]] name = "dash-network-seeds" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" dependencies = [ "dash-network", ] [[package]] name = "dash-platform-macros" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "heck", "quote", @@ -2110,8 +2110,8 @@ dependencies = [ [[package]] name = "dash-platform-queries" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "dapi-grpc", "dash-context-provider", @@ -2128,8 +2128,8 @@ dependencies = [ [[package]] name = "dash-sdk" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "arc-swap", "async-trait", @@ -2168,7 +2168,7 @@ dependencies = [ [[package]] name = "dash-spv" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" dependencies = [ "async-trait", "chrono", @@ -2197,13 +2197,11 @@ dependencies = [ [[package]] name = "dashcore" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" dependencies = [ "anyhow", "base64-compat", "bech32 0.9.1", - "bincode 2.0.1", - "bincode_derive", "bitvec", "blake3", "blsful", @@ -2211,6 +2209,8 @@ dependencies = [ "dashcore-private", "dashcore_hashes", "ed25519-dalek", + "grovedb-bincode", + "grovedb-bincode-derive", "hex", "hex_lit", "rustversion", @@ -2223,12 +2223,12 @@ dependencies = [ [[package]] name = "dashcore-private" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" [[package]] name = "dashcore-rpc" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" dependencies = [ "dashcore-rpc-json", "hex", @@ -2241,10 +2241,10 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" dependencies = [ - "bincode 2.0.1", "dashcore", + "grovedb-bincode", "hex", "key-wallet", "serde", @@ -2256,18 +2256,18 @@ dependencies = [ [[package]] name = "dashcore_hashes" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" dependencies = [ - "bincode 2.0.1", "dashcore-private", + "grovedb-bincode", "rs-x11-hash", "serde", ] [[package]] name = "dashpay-contract" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "platform-value", "platform-version", @@ -2277,8 +2277,8 @@ dependencies = [ [[package]] name = "data-contracts" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "dashpay-contract", "document-history-contract", @@ -2545,8 +2545,8 @@ dependencies = [ [[package]] name = "document-history-contract" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "platform-value", "platform-version", @@ -2574,8 +2574,8 @@ checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" [[package]] name = "dpns-contract" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "platform-value", "platform-version", @@ -2585,14 +2585,13 @@ dependencies = [ [[package]] name = "dpp" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "anyhow", "async-trait", "base64 0.22.1", "bech32 0.11.1", - "bincode 2.0.1", "bs58", "byteorder", "chrono", @@ -2606,6 +2605,7 @@ dependencies = [ "dpp-json-convertible-derive", "env_logger", "getrandom 0.2.17", + "grovedb-bincode", "grovedb-commitment-tree", "hex", "indexmap 2.14.0", @@ -2614,6 +2614,7 @@ dependencies = [ "key-wallet", "key-wallet-manager", "lazy_static", + "libm", "nohash-hasher", "num_enum 0.7.6", "once_cell", @@ -2635,8 +2636,8 @@ dependencies = [ [[package]] name = "dpp-json-convertible-derive" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "proc-macro2", "quote", @@ -2645,19 +2646,19 @@ dependencies = [ [[package]] name = "drive" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ - "bincode 2.0.1", "byteorder", "derive_more 1.0.0", "dpp", - "grovedb 5.0.1", - "grovedb-costs 5.0.1", + "grovedb 6.0.0", + "grovedb-bincode", + "grovedb-costs 6.0.0", "grovedb-epoch-based-storage-flags", - "grovedb-path 5.0.1", + "grovedb-path 6.0.0", "grovedb-query", - "grovedb-version 5.0.1", + "grovedb-version 6.0.0", "hex", "indexmap 2.14.0", "integer-encoding", @@ -2671,15 +2672,15 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ - "bincode 2.0.1", "dapi-grpc", "dash-context-provider", "derive_more 1.0.0", "dpp", "drive", + "grovedb-bincode", "hex", "indexmap 2.14.0", "platform-serialization", @@ -3695,7 +3696,7 @@ dependencies = [ [[package]] name = "git-state" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" [[package]] name = "gl_generator" @@ -3892,39 +3893,59 @@ dependencies = [ [[package]] name = "grovedb" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ - "bincode 2.0.1", - "bincode_derive", "blake3", + "grovedb-bincode", + "grovedb-bincode-derive", "grovedb-bulk-append-tree", - "grovedb-costs 5.0.1", + "grovedb-costs 6.0.0", "grovedb-dense-fixed-sized-merkle-tree", - "grovedb-element 5.0.1", - "grovedb-merk 5.0.1", + "grovedb-element 6.0.0", + "grovedb-merk 6.0.0", "grovedb-merkle-mountain-range", - "grovedb-path 5.0.1", + "grovedb-path 6.0.0", "grovedb-query", - "grovedb-version 5.0.1", + "grovedb-version 6.0.0", "hex", "indexmap 2.14.0", "integer-encoding", "thiserror 2.0.18", ] +[[package]] +name = "grovedb-bincode" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce912028682ecc5870a5ad609ea456b76b0bf4ec1ba1eb649400b64ff73a7782" +dependencies = [ + "grovedb-bincode-derive", + "serde", + "unty", +] + +[[package]] +name = "grovedb-bincode-derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eaff4e961dcb3e7e55c34c8c6982249036e5aaa19e55f6dab94ebcd4896b03a" +dependencies = [ + "virtue 0.0.18", +] + [[package]] name = "grovedb-bulk-append-tree" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ - "bincode 2.0.1", "blake3", - "grovedb-costs 5.0.1", + "grovedb-bincode", + "grovedb-costs 6.0.0", "grovedb-dense-fixed-sized-merkle-tree", "grovedb-merkle-mountain-range", "grovedb-query", - "grovedb-version 5.0.1", + "grovedb-version 6.0.0", "hex", "integer-encoding", "thiserror 2.0.18", @@ -3932,13 +3953,13 @@ dependencies = [ [[package]] name = "grovedb-commitment-tree" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ "blake3", "grovedb-bulk-append-tree", - "grovedb-costs 5.0.1", - "grovedb-version 5.0.1", + "grovedb-costs 6.0.0", + "grovedb-version 6.0.0", "incrementalmerkletree", "orchard", "rusqlite", @@ -3958,8 +3979,8 @@ dependencies = [ [[package]] name = "grovedb-costs" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ "integer-encoding", "intmap", @@ -3968,14 +3989,14 @@ dependencies = [ [[package]] name = "grovedb-dense-fixed-sized-merkle-tree" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ - "bincode 2.0.1", "blake3", - "grovedb-costs 5.0.1", + "grovedb-bincode", + "grovedb-costs 6.0.0", "grovedb-query", - "grovedb-version 5.0.1", + "grovedb-version 6.0.0", "thiserror 2.0.18", ] @@ -3995,14 +4016,14 @@ dependencies = [ [[package]] name = "grovedb-element" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ - "bincode 2.0.1", - "bincode_derive", - "grovedb-path 5.0.1", + "grovedb-bincode", + "grovedb-bincode-derive", + "grovedb-path 6.0.0", "grovedb-query", - "grovedb-version 5.0.1", + "grovedb-version 6.0.0", "hex", "integer-encoding", "thiserror 2.0.18", @@ -4010,10 +4031,10 @@ dependencies = [ [[package]] name = "grovedb-epoch-based-storage-flags" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ - "grovedb-costs 5.0.1", + "grovedb-costs 6.0.0", "hex", "integer-encoding", "intmap", @@ -4043,20 +4064,20 @@ dependencies = [ [[package]] name = "grovedb-merk" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ - "bincode 2.0.1", - "bincode_derive", "blake3", "byteorder", "ed", - "grovedb-costs 5.0.1", - "grovedb-element 5.0.1", - "grovedb-path 5.0.1", + "grovedb-bincode", + "grovedb-bincode-derive", + "grovedb-costs 6.0.0", + "grovedb-element 6.0.0", + "grovedb-path 6.0.0", "grovedb-query", - "grovedb-version 5.0.1", - "grovedb-visualize 5.0.1", + "grovedb-version 6.0.0", + "grovedb-visualize 6.0.0", "hex", "indexmap 2.14.0", "integer-encoding", @@ -4065,13 +4086,13 @@ dependencies = [ [[package]] name = "grovedb-merkle-mountain-range" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ - "bincode 2.0.1", "blake3", - "grovedb-costs 5.0.1", - "grovedb-version 5.0.1", + "grovedb-bincode", + "grovedb-costs 6.0.0", + "grovedb-version 6.0.0", ] [[package]] @@ -4084,20 +4105,20 @@ dependencies = [ [[package]] name = "grovedb-path" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ "hex", ] [[package]] name = "grovedb-query" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ - "bincode 2.0.1", "byteorder", "ed", + "grovedb-bincode", "hex", "indexmap 2.14.0", "integer-encoding", @@ -4115,8 +4136,8 @@ dependencies = [ [[package]] name = "grovedb-version" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ "thiserror 2.0.18", "versioned-feature-core", @@ -4133,8 +4154,8 @@ dependencies = [ [[package]] name = "grovedb-visualize" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?rev=6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e#6fc7e1e82de27a56c3428c0d5dd15b5f6a0ea23e" +version = "6.0.0" +source = "git+https://github.com/dashpay/grovedb?rev=6816457d2b2df98653f286bf9a374f236a17748f#6816457d2b2df98653f286bf9a374f236a17748f" dependencies = [ "hex", "itertools 0.14.0", @@ -5025,7 +5046,7 @@ dependencies = [ [[package]] name = "key-wallet" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" dependencies = [ "async-trait", "base58ck", @@ -5048,7 +5069,7 @@ dependencies = [ [[package]] name = "key-wallet-manager" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd#93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd" +source = "git+https://github.com/dashpay/rust-dashcore?rev=e4208c90786a6854bd498315bcb571ef24182c15#e4208c90786a6854bd498315bcb571ef24182c15" dependencies = [ "async-trait", "dashcore", @@ -5071,8 +5092,8 @@ dependencies = [ [[package]] name = "keyword-search-contract" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "platform-value", "platform-version", @@ -5284,8 +5305,8 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "platform-value", "platform-version", @@ -6507,8 +6528,8 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "platform-encryption" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "aes", "cbc", @@ -6520,17 +6541,17 @@ dependencies = [ [[package]] name = "platform-serialization" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ - "bincode 2.0.1", + "grovedb-bincode", "platform-version", ] [[package]] name = "platform-serialization-derive" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "proc-macro2", "quote", @@ -6540,13 +6561,13 @@ dependencies = [ [[package]] name = "platform-value" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "base64 0.22.1", - "bincode 2.0.1", "bs58", "ciborium", + "grovedb-bincode", "hex", "indexmap 2.14.0", "platform-serialization", @@ -6560,19 +6581,19 @@ dependencies = [ [[package]] name = "platform-version" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ - "bincode 2.0.1", - "grovedb-version 5.0.1", + "grovedb-bincode", + "grovedb-version 6.0.0", "thiserror 2.0.18", "versioned-feature-core", ] [[package]] name = "platform-versioning" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "proc-macro2", "quote", @@ -6581,8 +6602,8 @@ dependencies = [ [[package]] name = "platform-wallet" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "arc-swap", "async-trait", @@ -6615,12 +6636,11 @@ dependencies = [ [[package]] name = "platform-wallet-storage" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "apple-native-keyring-store", "argon2", - "bincode 2.0.1", "chacha20poly1305", "chrono", "clap", @@ -6630,6 +6650,7 @@ dependencies = [ "dpp", "fd-lock", "getrandom 0.2.17", + "grovedb-bincode", "hex", "humantime", "key-wallet", @@ -6901,7 +6922,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" dependencies = [ "heck", - "itertools 0.10.5", + "itertools 0.14.0", "log", "multimap", "petgraph", @@ -6922,7 +6943,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.14.0", "proc-macro2", "quote", "syn 2.0.117", @@ -7615,8 +7636,8 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "backon", "chrono", @@ -7641,8 +7662,8 @@ dependencies = [ [[package]] name = "rs-sdk-trusted-context-provider" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "arc-swap", "dash-async", @@ -8882,8 +8903,8 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "token-history-contract" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "platform-value", "platform-version", @@ -9722,8 +9743,8 @@ dependencies = [ [[package]] name = "wallet-utils-contract" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "platform-value", "platform-version", @@ -10304,7 +10325,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] @@ -11044,8 +11065,8 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "4.2.0-dev.8" -source = "git+https://github.com/dashpay/platform?rev=63cf57f40d0000bf3b2b26026c8fa1c71162852d#63cf57f40d0000bf3b2b26026c8fa1c71162852d" +version = "4.2.0-dev.10" +source = "git+https://github.com/dashpay/platform?rev=01d944795e3dc9776fd4d01959df9abc1ea98c87#01d944795e3dc9776fd4d01959df9abc1ea98c87" dependencies = [ "num_enum 0.5.11", "platform-value", diff --git a/Cargo.toml b/Cargo.toml index 033cb8928..d8e1b08a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ eframe = { version = "0.35.0", features = ["persistence", "wgpu"] } base64 = "0.22.1" # TODO: GHSA-7gcf-g7xr-8hxj (serde_with <3.21.0) is unfixable from here — the 2.x pin lives in # dashcore-rpc-json (dashpay/rust-dashcore, rpc-json/Cargo.toml). Re-check when these pins move. -dash-sdk = { git = "https://github.com/dashpay/platform", rev = "63cf57f40d0000bf3b2b26026c8fa1c71162852d", features = [ +dash-sdk = { git = "https://github.com/dashpay/platform", rev = "01d944795e3dc9776fd4d01959df9abc1ea98c87", features = [ "core_key_wallet", "core_key_wallet_manager", "core_bincode", @@ -30,15 +30,15 @@ dash-sdk = { git = "https://github.com/dashpay/platform", rev = "63cf57f40d0000b "core_spv", "shielded", ] } -rs-sdk-trusted-context-provider = { git = "https://github.com/dashpay/platform", rev = "63cf57f40d0000bf3b2b26026c8fa1c71162852d" } -platform-wallet = { git = "https://github.com/dashpay/platform", rev = "63cf57f40d0000bf3b2b26026c8fa1c71162852d", features = [ +rs-sdk-trusted-context-provider = { git = "https://github.com/dashpay/platform", rev = "01d944795e3dc9776fd4d01959df9abc1ea98c87" } +platform-wallet = { git = "https://github.com/dashpay/platform", rev = "01d944795e3dc9776fd4d01959df9abc1ea98c87", features = [ "serde", "shielded", ] } # `serde` backs `model::secret::Secret`'s `Deserialize`: the upstream # visitor copies a borrowed `&str` straight into guarded memory instead of # routing through a transient `String`. Secret schemas are included by `secrets`. -platform-wallet-storage = { git = "https://github.com/dashpay/platform", rev = "63cf57f40d0000bf3b2b26026c8fa1c71162852d", features = [ +platform-wallet-storage = { git = "https://github.com/dashpay/platform", rev = "01d944795e3dc9776fd4d01959df9abc1ea98c87", features = [ "shielded", "serde", ] } @@ -50,15 +50,21 @@ serde = "1.0.219" serde_json = "1.0.140" serde_yaml_ng = { version = "0.10.0" } tokio = { version = "1.46.1", features = ["full"] } -# INTENTIONAL(bincode-unmaintained-pin): the pin is deliberate; do not "fix" the audit -# warning by bumping. bincode is flagged unmaintained (RUSTSEC-2025-0141, INFO-level — -# no known vulnerability). The advisory -# covers *all* versions, so no bump can clear it: 2.0.1 is the last functional release -# and 3.0.0 is a tombstone whose lib.rs is a bare `compile_error!`. This crate encodes -# the on-disk wallet-secret envelopes and QualifiedIdentity blobs, so switching encoders -# changes the wire format of data users already have on disk — that needs a designed -# read-old/write-new migration, not a dependency bump. -bincode = { version = "=2.0.1", features = ["serde"] } +# INTENTIONAL(bincode-unmaintained-pin): the exact pin is deliberate; do not "fix" the audit +# warning by bumping. bincode is flagged unmaintained (RUSTSEC-2025-0141, INFO-level — no +# known vulnerability). The advisory covers *all* versions, so no bump can clear it: 2.0.1 +# is the last functional release and 3.0.0 is a tombstone whose lib.rs is a bare +# `compile_error!`. +# The dependency is aliased to `grovedb-bincode`, the bincode 2.0.1 fork that dpp, +# platform-value and rust-dashcore implement `Encode`/`Decode` against; the trait +# identities must match or DET's codecs over those types stop compiling. On the ordinary +# (non-`*_untrusted`) paths DET uses — native, `bincode::serde` and the derive macros — +# its wire format is identical to bincode 2.0.1, proven from hash-identical source and +# derive-codegen substitution (docs/ai-design/2026-09-14-platform-4.2-dev-bump/) and +# pinned by the pre-bump fixtures in tests/fixtures/bincode_pre_bump/. This switch +# therefore needs no read-old/write-new migration. Any other encoder change still does: +# this crate encodes the on-disk wallet-secret envelopes and QualifiedIdentity blobs. +bincode = { package = "grovedb-bincode", version = "=2.1.0", features = ["serde"] } hex = { version = "0.4.3" } async-trait = "0.1.89" itertools = "0.14.0" diff --git a/docs/ai-design/2026-09-14-platform-4.2-dev-bump/upgrade-notes.md b/docs/ai-design/2026-09-14-platform-4.2-dev-bump/upgrade-notes.md new file mode 100644 index 000000000..db4597a08 --- /dev/null +++ b/docs/ai-design/2026-09-14-platform-4.2-dev-bump/upgrade-notes.md @@ -0,0 +1,126 @@ +# Platform `v4.2-dev` pin upgrade + +Reviewed on 2026-09-14. The four Platform dependencies (`dash-sdk`, +`rs-sdk-trusted-context-provider`, `platform-wallet`, `platform-wallet-storage`) +move together from `63cf57f40d0000bf3b2b26026c8fa1c71162852d` (`4.2.0-dev.8`) +to `01d944795e3dc9776fd4d01959df9abc1ea98c87` (`4.2.0-dev.10`, `v4.2-dev` HEAD). +The old pin is an ancestor of the new one: 29 new commits, none dropped. + +Transitive moves: + +- rust-dashcore: `93260bf39bac5d9d09e89bfb45e9ea3ff7fdcbcd` becomes + `e4208c90786a6854bd498315bcb571ef24182c15` (0.45.0; five commits, including + transaction detection and filter-sync fixes). +- GroveDB: 5.0.1 becomes 6.0.0 (`6816457d`). The grovestark dependency keeps + its own 4.0.0 copy. +- `grovedb-bincode` / `grovedb-bincode-derive` 2.1.0 are added. crates.io + `bincode` 2.0.1 and 1.3.3 stay in the lock for grovestark and GroveDB 4.0.0 + only. + +The full analysis (findings F1–F17, wire-compatibility proof and compile +probe) lives outside the repository in +`/data/artifacts/dash-evo-tool/2026-09-14/`: +`platform-4.2-dev-impact.md`, `platform-4.2-dev-compile-probe.md` and +`platform-3968-dropped-content.md`. + +## Compatibility work + +| Upstream change | DET change | +| --- | --- | +| [#4635](https://github.com/dashpay/platform/pull/4635): dpp, platform-value and rust-dashcore implement `Encode`/`Decode` from `grovedb-bincode`, which has its own trait identities | `bincode` is aliased to `grovedb-bincode =2.1.0` (`Cargo.toml`). DET's derives and manual codecs over dpp types compile again; import paths are unchanged. | +| [#4625](https://github.com/dashpay/platform/pull/4625): dpp deserialization traits split into trusted and untrusted pairs | The state transition and contract visualizers use the untrusted decoders for pasted bytes. The saved-contract reader (`contract_token_db.rs`) uses the untrusted decoder as well: under the same no-limit config it accepts every valid stored contract, and it does not pre-allocate from length prefixes. | +| [#4645](https://github.com/dashpay/platform/pull/4645): `rewards_in_interval_with_explanation` takes a `&PlatformVersion` | The estimated token-reward query passes the app's active platform version, which selects the version-gated distribution math. | +| [#4708](https://github.com/dashpay/platform/pull/4708) / [#4711](https://github.com/dashpay/platform/pull/4711): new `PlatformWalletError` variants `ShieldedIdentityDebitPending`, `ShieldedRecoveryCorrupted`, `ShieldedRecoveryKeysRequired` | New `TaskError` variants with fixed, actionable messages. The upstream `reason` text stays in the source chain only. Both exhaustive matches name the variants explicitly; identity funding buckets them as `Other` because no identity flow runs a shielded operation. | + +## Existing data + +**bincode blobs: no migration.** `grovedb-bincode` 2.1.0 is a fork of bincode +2.0.1. On every ordinary (non-`*_untrusted`) entry point DET uses (native +`encode_to_vec`/`decode_from_slice`, `bincode::serde`, and the derive macros), +it produces the same bytes and accepts the same inputs. This was proven from +source: files and function bodies hash-identical, and the fork's derive +output reduces to the original's by literal substitution. See +`## grovedb-bincode wire compatibility` in `platform-4.2-dev-impact.md`. That +covers stored `QualifiedIdentity`/`KeyStorage`, token configurations, the +secret envelopes and every serde sidecar. + +The proof is backed by committed fixtures under `tests/fixtures/bincode_pre_bump/`. +They were written with crates.io bincode 2.0.1 on the old pin, before the +dependency switch, and must never be regenerated. + +| Fixture | SHA-256 | Guard test | +| --- | --- | --- | +| `qualified_identity.bin` | `d851ca2dc406350932e30341c4047e63f37652727f42eed78557b0c4f388198f` | `model::qualified_identity::bincode_pre_bump_fixture_tests` | +| `contested_name.bin` | `d6fcde1fd65485fcebd02a7ac2af21133ed7115f6ec3b47491f9a6bb4dbd4cc6` | `model::contested_name::bincode_pre_bump_fixture_tests` | +| `token_configuration.bin` | `92c5b82f907273eea4c48fb628c49d969c51402d0bf4ff846348c7824ed9f6e0` | `context::contract_token_db::bincode_pre_bump_fixture_tests` | +| `stored_seed_envelope.bin` | `68c6dce3d8c1674d93986b26751bfb4c40f94d8366a6ec92f70be148f0114579` | `model::wallet::seed_envelope::bincode_pre_bump_fixture_tests` | +| `wallet_meta.bin` | `afce0da03252ff5a26274831f0f2dba97af2de7d8f4a5c3a8d5b20a028f9d6be` | `model::wallet::meta::bincode_pre_bump_fixture_tests` | + +Each guard does four things: + +- Decodes the fixture through the production reader: `QualifiedIdentity::from_bytes` with its decode limit, and `decode_token_config` for token configurations. +- Requires the whole blob to be consumed and the value to equal the synthetic original. +- Re-encodes the value byte-for-byte. +- Checks that the fixture differs from the legacy-config encoding. + +The identity fixture carries every `PrivateKeyData` variant and `PrivateKeyTarget`, voter and operator identities, contract bounds, a disabled key, and a `WalletDerivationPath` with all four `ChildNumber` kinds. The token fixture carries a perpetual `DistributionFunction`, whose upstream `Decode` impl was rewritten. `ContestedName` is persisted through a serde record today; its fixture guards the forked derive macros. All fixture values are synthetic. + +**`platform-wallet-storage`: no change.** No migration, schema or secret-envelope +change between the pins. + +**Shielded store: additive.** `shielded_pending_spends` gains two +`INTEGER NOT NULL DEFAULT 0` columns via an idempotent `ALTER TABLE`. Older +builds still read the table. Opening the store is stricter: an already-malformed pending-spend row that +cannot be classified now fails the open (`ShieldedRecoveryCorrupted`) instead +of being skipped. + +## Deferred + +- **Contested DPNS fee label.** At protocol version 14 the contested + registration fee is 0.1 DASH and consensus requires the exact amount. The + transition amount already comes from the SDK's platform version, but + `register_dpns_name_screen.rs` still shows "Cost ≈ 0.2006 Dash". Marked + `TODO(platform-4.2-dev-bump)` (impact report F4). +- **Devnet protocol seed.** Upstream seeds devnets at protocol version 14 + because lower versions cannot deserialize devnet contracts. DET still seeds + every network at version 12 (`default_platform_version`). Marked + `TODO(platform-4.2-dev-bump)` (F5). Visibility is not the blocker: + `dash_sdk::sdk` is a public module and `min_protocol_version` is a + `pub const fn` at the new pin (`rs-sdk/src/sdk.rs:70`). What remains is the + seeding decision itself. The older `TODO(platform#4231)` beside it is a + separate cleanup; that PR is already merged. +- Other runtime deltas are covered only by network-dependent tests, which were + not run: + - rust-dashcore transaction detection and filter sync; + - the protocol-14 GroveDB proof-envelope floor; + - grovestark's GroveDB 4.0.0 parsing proofs from GroveDB 6.0 nodes. + +## Corrections to the previous notes + +`docs/ai-design/2026-09-10-platform-pin/upgrade-notes.md` is kept as a +historical record. Two of its claims are stale: + +- [#4585](https://github.com/dashpay/platform/pull/4585) is described as open. + It merged on 2026-09-11 and is included in this pin (FFI-only; DET does not + use it). +- [#4587](https://github.com/dashpay/platform/pull/4587) is described as + carrying the contact-account filter-scan generation fix. That fix was + removed from #4587 on 2026-09-14 and now lives, unmerged, in + [#4740](https://github.com/dashpay/platform/pull/4740). Neither pin contains + it. DET still invalidates scan coverage only for contact accounts it + creates at bootstrap or unlock. This bump does not change that. + +## Validation and limits + +- The pre-bump fixture guards passed on the old pin with crates.io bincode + 2.0.1, before the dependency switch, and again on the new pin. +- `cargo check --all-features --all-targets`, + `cargo fmt --all`, and + `cargo clippy --all-features --all-targets -- -D warnings` on the new pin. +- `cargo test --all-features --lib`, scoped to the bincode-persistence modules + (identity blobs including the golden v0.9.3 blob, key storage, seed and + single-key envelopes, DET k/v, wallet meta, settings, contested names, token + registry), the fixture guards, and the new shielded error-mapping and + message tests. +- Not run: the full workspace suite (CI covers it), backend E2E, GUI tests, and + opening a real user's shielded store. Checks used Linux and synthetic data. diff --git a/src/backend_task/error.rs b/src/backend_task/error.rs index ddcc65bd6..a6ca33299 100644 --- a/src/backend_task/error.rs +++ b/src/backend_task/error.rs @@ -2456,6 +2456,49 @@ pub enum TaskError { source: platform_wallet::wallet::shielded::FileShieldedStoreError, }, + /// An earlier identity-funded shielded payment is still unresolved, so the + /// upstream coordinator refused to start this one. Nothing was built or + /// broadcast; retrying immediately hits the same refusal. + /// + /// Populated by `map_shielded_op_error` from + /// `PlatformWalletError::ShieldedIdentityDebitPending`. + #[error( + "An earlier shielded payment from identity {identity_id} has not finished yet, so this payment was not started. Wait for the earlier payment to complete, then try again." + )] + ShieldedIdentityDebitPending { + identity_id: Identifier, + #[source] + source: Box, + }, + + /// Durable shielded recovery data is damaged, so a pending payment cannot + /// be identified or reconstructed safely. The upstream `reason` stays in + /// the source chain (details/logs) and never reaches the message. + /// + /// Populated by `map_shielded_op_error` from + /// `PlatformWalletError::ShieldedRecoveryCorrupted`. + #[error("{message}", message = shielded_recovery_corrupted_message(*.account_index))] + ShieldedRecoveryCorrupted { + account_index: Option, + #[source] + source: Box, + }, + + /// An unresolved shielded payment needs viewing keys for an account that + /// is not currently available. The upstream `reason` stays in the source + /// chain (details/logs) and never reaches the message. + /// + /// Populated by `map_shielded_op_error` from + /// `PlatformWalletError::ShieldedRecoveryKeysRequired`. + #[error( + "A pending shielded payment needs shielded account #{account_index}, which is not available right now. Unlock or restore the wallet that holds this account, then try again." + )] + ShieldedRecoveryKeysRequired { + account_index: u32, + #[source] + source: Box, + }, + // ────────────────────────────────────────────────────────────────────────── // Network context errors // ────────────────────────────────────────────────────────────────────────── @@ -2859,6 +2902,18 @@ pub(crate) fn vault_error( class(Box::new(source)) } +/// User-facing text for [`TaskError::ShieldedRecoveryCorrupted`]. Upstream +/// reports the account only when the damaged record identifies one, so each +/// case gets its own complete sentence rather than a spliced fragment. +fn shielded_recovery_corrupted_message(account_index: Option) -> String { + match account_index { + Some(account_index) => format!( + "Saved recovery data for shielded account #{account_index} is damaged, so a pending payment cannot be checked safely. Restore your wallet data from a recent backup, then try again." + ), + None => "Saved recovery data for your shielded funds is damaged, so a pending payment cannot be checked safely. Restore your wallet data from a recent backup, then try again.".to_string(), + } +} + /// Escapes control characters in a token name for safe display in error messages. fn escape_token_name(name: &str) -> String { name.chars().filter(|c| !c.is_control()).collect() @@ -4644,6 +4699,54 @@ mod tests { ); } + /// The shielded recovery messages interpolate only DET-owned fields and + /// never echo the upstream `reason` (which targets developers). + #[test] + fn shielded_recovery_displays_are_actionable_and_hide_upstream_reason() { + use platform_wallet::error::PlatformWalletError as P; + const REASON: &str = "pending spend row 7 has an ill-formed nullifier"; + + let corrupted = |account_index| TaskError::ShieldedRecoveryCorrupted { + account_index, + source: Box::new(P::ShieldedRecoveryCorrupted { + account_index, + reason: REASON.to_string(), + }), + }; + let with_account = corrupted(Some(3)).to_string(); + assert!(with_account.contains("#3"), "got: {with_account}"); + let without_account = corrupted(None).to_string(); + assert!(!without_account.contains('#'), "got: {without_account}"); + + let keys = TaskError::ShieldedRecoveryKeysRequired { + account_index: 2, + source: Box::new(P::ShieldedRecoveryKeysRequired { + account_index: 2, + reason: REASON.to_string(), + }), + } + .to_string(); + assert!(keys.contains("#2"), "got: {keys}"); + + let identity_id = Identifier::from([0x5D; 32]); + let pending = TaskError::ShieldedIdentityDebitPending { + identity_id, + source: Box::new(P::ShieldedIdentityDebitPending { + identity_id: [0x5D; 32], + }), + } + .to_string(); + assert!( + pending.contains(&identity_id.to_string(Encoding::Base58)), + "got: {pending}" + ); + + for msg in [&with_account, &without_account, &keys, &pending] { + assert!(!msg.contains(REASON), "upstream reason leaked: {msg}"); + assert!(msg.contains("then try again"), "no action in: {msg}"); + } + } + #[test] fn shielded_fee_exceeds_balance_display_shows_dash() { let err = TaskError::ShieldedFeeExceedsBalance { diff --git a/src/backend_task/tokens/query_token_non_claimed_perpetual_distribution_rewards.rs b/src/backend_task/tokens/query_token_non_claimed_perpetual_distribution_rewards.rs index c99512c7e..66477b4f7 100644 --- a/src/backend_task/tokens/query_token_non_claimed_perpetual_distribution_rewards.rs +++ b/src/backend_task/tokens/query_token_non_claimed_perpetual_distribution_rewards.rs @@ -246,6 +246,7 @@ impl AppContext { max_cycle_moment, Some(get_epoch_reward_ratio), last_claim.is_none(), + self.platform_version(), ) .map_err(|e| TaskError::TokenQueryError { detail: format!("Failed to calculate estimated rewards: {}", e), @@ -258,6 +259,7 @@ impl AppContext { max_cycle_moment, None, last_claim.is_none(), + self.platform_version(), ) .map_err(|e| TaskError::TokenQueryError { detail: format!("Failed to calculate estimated rewards: {}", e), diff --git a/src/context/contract_token_db.rs b/src/context/contract_token_db.rs index 93abb3778..883e631e1 100644 --- a/src/context/contract_token_db.rs +++ b/src/context/contract_token_db.rs @@ -14,7 +14,7 @@ use dash_sdk::dpp::data_contract::associated_token::token_configuration::accesso use dash_sdk::dpp::data_contract::associated_token::token_configuration_convention::accessors::v0::TokenConfigurationConventionV0Getters; use dash_sdk::dpp::platform_value::string_encoding::Encoding; use dash_sdk::dpp::serialization::{ - PlatformDeserializableWithPotentialValidationFromVersionedStructure, + PlatformDeserializableWithPotentialValidationFromVersionedStructureUntrusted, PlatformSerializableWithPlatformVersion, }; use dash_sdk::platform::{DataContract, Identifier}; @@ -184,7 +184,11 @@ impl AppContext { &self, stored: StoredContract, ) -> std::result::Result { - let contract = DataContract::versioned_deserialize( + // DET wrote these bytes, but the untrusted decoder accepts every valid + // stored contract under the same no-limit config and does not + // pre-allocate from length prefixes, so a corrupt local entry fails + // the decode instead of aborting on a huge allocation. + let contract = DataContract::versioned_deserialize_untrusted( &stored.contract_bytes, false, self.platform_version(), diff --git a/src/context/mod.rs b/src/context/mod.rs index 20735b7c3..1f6a24400 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -1619,6 +1619,7 @@ impl AppContext { // Revert to `.with_version()` (a hard pin) or otherwise reconsider this once // https://github.com/dashpay/platform/pull/4231 merges and this repo's platform // pin advances past it. +// TODO(platform-4.2-dev-bump): devnet should seed at ≥PV14 per rs-sdk::min_protocol_version; needs to confirm that function is reachable from DET's dash-sdk re-export first (open question) — see platform-4.2-dev-impact.md F5 pub(crate) const fn default_platform_version(_network: &Network) -> &'static PlatformVersion { &PLATFORM_V12 } diff --git a/src/ui/identity/register_dpns_name_screen.rs b/src/ui/identity/register_dpns_name_screen.rs index de468b1a8..d8267a4a6 100644 --- a/src/ui/identity/register_dpns_name_screen.rs +++ b/src/ui/identity/register_dpns_name_screen.rs @@ -535,6 +535,7 @@ impl ScreenLike for RegisterDpnsNameScreen { ); ui.colored_label( egui::Color32::DARK_RED, + // TODO(platform-4.2-dev-bump): derive from the active platform version's contested_document_vote_resolution_fund_required_amount once PV14 is live on a real network; see /data/artifacts/dash-evo-tool/2026-09-14/platform-4.2-dev-impact.md F4 "Cost ≈ 0.2006 Dash", ); } else { diff --git a/src/ui/tools/contract_visualizer_screen.rs b/src/ui/tools/contract_visualizer_screen.rs index ea3003f7d..912511f78 100644 --- a/src/ui/tools/contract_visualizer_screen.rs +++ b/src/ui/tools/contract_visualizer_screen.rs @@ -7,7 +7,7 @@ use crate::ui::components::tools_subscreen_chooser_panel::add_tools_subscreen_ch use crate::ui::components::top_panel::add_top_panel; use crate::ui::theme::DashColors; use base64::{Engine, engine::general_purpose::STANDARD}; -use dash_sdk::dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructure; +use dash_sdk::dpp::serialization::PlatformDeserializableWithPotentialValidationFromVersionedStructureUntrusted; use dash_sdk::platform::DataContract; use eframe::egui::{Color32, Frame, Margin, RichText, ScrollArea, TextEdit, Ui}; use std::sync::Arc; @@ -88,7 +88,9 @@ impl ContractVisualizerScreen { } }; - match DataContract::versioned_deserialize( + // Pasted bytes are untrusted input: decode without pre-allocating + // from length prefixes. + match DataContract::versioned_deserialize_untrusted( &bytes, false, self.app_context.platform_version(), diff --git a/src/ui/tools/transition_visualizer_screen.rs b/src/ui/tools/transition_visualizer_screen.rs index 128939bad..63c87db41 100644 --- a/src/ui/tools/transition_visualizer_screen.rs +++ b/src/ui/tools/transition_visualizer_screen.rs @@ -13,7 +13,7 @@ use crate::ui::{MessageType, RootScreenType, ScreenLike}; use base64::{Engine, engine::general_purpose::STANDARD}; use dash_sdk::dpp::data_contract::accessors::v0::DataContractV0Getters; use dash_sdk::dpp::platform_value::string_encoding::Encoding; -use dash_sdk::dpp::serialization::PlatformDeserializable; +use dash_sdk::dpp::serialization::PlatformDeserializableUntrusted; use dash_sdk::dpp::state_transition::StateTransition; use dash_sdk::platform::Identifier; use eframe::egui::{self, Color32, ScrollArea, TextEdit, Ui, Window}; @@ -122,8 +122,9 @@ impl TransitionVisualizerScreen { match decoded_bytes { Ok(bytes) => { - // Try to deserialize into a StateTransition - match StateTransition::deserialize_from_bytes(&bytes) { + // Pasted bytes are untrusted input: decode without + // pre-allocating from length prefixes. + match StateTransition::deserialize_from_bytes_untrusted(&bytes) { Ok(state_transition) => { // Convert to JSON match serde_json::to_string_pretty(&state_transition) { diff --git a/src/wallet_backend/mod.rs b/src/wallet_backend/mod.rs index 17e5aacd2..49b433372 100644 --- a/src/wallet_backend/mod.rs +++ b/src/wallet_backend/mod.rs @@ -3136,6 +3136,31 @@ fn map_shielded_op_error(e: platform_wallet::error::PlatformWalletError) -> Task } } + // Upstream refused to start a new identity-funded shield while an + // earlier one is unresolved. Nothing was built or broadcast, so the + // user must wait for the earlier payment rather than retry now. + other @ P::ShieldedIdentityDebitPending { identity_id } => { + TaskError::ShieldedIdentityDebitPending { + identity_id: dash_sdk::platform::Identifier::from(identity_id), + source: Box::new(other), + } + } + + // Durable recovery data is damaged or needs keys that are not loaded. + // Retrying cannot help; the user must restore data or keys first. + other @ P::ShieldedRecoveryCorrupted { account_index, .. } => { + TaskError::ShieldedRecoveryCorrupted { + account_index, + source: Box::new(other), + } + } + other @ P::ShieldedRecoveryKeysRequired { account_index, .. } => { + TaskError::ShieldedRecoveryKeysRequired { + account_index, + source: Box::new(other), + } + } + // Every remaining variant → generic WalletBackend wrapper. other @ (P::WalletCreation(_) | P::StaleReservation @@ -3508,6 +3533,11 @@ fn identity_op_error_kind(e: &platform_wallet::error::PlatformWalletError) -> Id // shielded op. `map_shielded_op_error` routes it where it can occur. | P::ShieldedBroadcastUnconfirmed { .. } | P::ShieldedSpendUnconfirmed { .. } + // Shielded debit / recovery outcomes are likewise unreachable from + // identity register, top-up or address funding. + | P::ShieldedIdentityDebitPending { .. } + | P::ShieldedRecoveryCorrupted { .. } + | P::ShieldedRecoveryKeysRequired { .. } // Funding and credit shortfalls, like their `CoreInsufficientFunds` // sibling above: the submission never reached Platform. | P::CorePooledInsufficientFunds { .. } @@ -4430,6 +4460,75 @@ mod tests { )); } + /// Debit-pending and the two recovery outcomes carry guidance the generic + /// `WalletBackend` envelope ("please retry") would contradict, so each + /// routes to its own typed variant with its identifying field intact. + #[test] + fn map_shielded_op_error_routes_recovery_and_debit_pending() { + use platform_wallet::error::PlatformWalletError as P; + + let identity_bytes = [0x5D; 32]; + match map_shielded_op_error(P::ShieldedIdentityDebitPending { + identity_id: identity_bytes, + }) { + TaskError::ShieldedIdentityDebitPending { identity_id, .. } => { + assert_eq!( + identity_id, + dash_sdk::platform::Identifier::from(identity_bytes) + ); + } + other => panic!("Expected ShieldedIdentityDebitPending, got: {other:?}"), + } + + for expected in [Some(3), None] { + match map_shielded_op_error(P::ShieldedRecoveryCorrupted { + account_index: expected, + reason: "row 7 is damaged".to_string(), + }) { + TaskError::ShieldedRecoveryCorrupted { account_index, .. } => { + assert_eq!(account_index, expected); + } + other => panic!("Expected ShieldedRecoveryCorrupted, got: {other:?}"), + } + } + + match map_shielded_op_error(P::ShieldedRecoveryKeysRequired { + account_index: 2, + reason: "viewing keys missing".to_string(), + }) { + TaskError::ShieldedRecoveryKeysRequired { account_index, .. } => { + assert_eq!(account_index, 2); + } + other => panic!("Expected ShieldedRecoveryKeysRequired, got: {other:?}"), + } + } + + /// No identity register / top-up / address-funding flow runs a shielded + /// op, so these outcomes land in the generic `Other` bucket there. + #[test] + fn identity_op_error_kind_buckets_new_shielded_recovery_variants_as_other() { + use platform_wallet::error::PlatformWalletError as P; + let errors = [ + P::ShieldedIdentityDebitPending { + identity_id: [0x5D; 32], + }, + P::ShieldedRecoveryCorrupted { + account_index: None, + reason: "damaged".to_string(), + }, + P::ShieldedRecoveryKeysRequired { + account_index: 0, + reason: "keys missing".to_string(), + }, + ]; + for error in &errors { + assert!( + matches!(identity_op_error_kind(error), IdentityOpErrorKind::Other), + "Expected IdentityOpErrorKind::Other for {error:?}" + ); + } + } + fn broadcast_unconfirmed() -> platform_wallet::error::PlatformWalletError { platform_wallet::error::PlatformWalletError::TransactionBroadcastUnconfirmed( "peer timed out after send".to_string(), From 4f2a4dc3c0ba018229cb3ead8c7191e327c2531e Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Mon, 14 Sep 2026 15:12:38 +0000 Subject: [PATCH 3/4] fix(shielded): point corrupted-recovery message at a real recourse The ShieldedRecoveryCorrupted message told users to restore wallet data from a backup, but DET has no backup or restore-database flow. Both branches (account known and unknown) now say: make sure you have the wallet's recovery phrase, remove the wallet, then import it again. This recourse really clears the error. Wallet removal runs upstream remove_wallet, which calls unregister_wallet and then purge_wallet. That deletes the wallet's shielded_pending_spends rows, damaged identity-debit guards included, and re-import re-binds and re-syncs from chain. The display test now asserts that action and that no message mentions a backup. Also note in the contested-name fixture module that it guards the derive shape only; contests persist through the serde StoredContestedName record. Co-Authored-By: Claude Opus 5 --- src/backend_task/error.rs | 20 ++++++++++++++++++-- src/model/contested_name.rs | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/backend_task/error.rs b/src/backend_task/error.rs index a6ca33299..b5e17062d 100644 --- a/src/backend_task/error.rs +++ b/src/backend_task/error.rs @@ -2475,6 +2475,11 @@ pub enum TaskError { /// be identified or reconstructed safely. The upstream `reason` stays in /// the source chain (details/logs) and never reaches the message. /// + /// The advised recourse is real: removing the wallet runs upstream + /// `remove_wallet` → `unregister_wallet` → `purge_wallet`, which deletes + /// the wallet's `shielded_pending_spends` rows (damaged guards included); + /// re-importing then re-binds and re-syncs from chain. + /// /// Populated by `map_shielded_op_error` from /// `PlatformWalletError::ShieldedRecoveryCorrupted`. #[error("{message}", message = shielded_recovery_corrupted_message(*.account_index))] @@ -2908,9 +2913,9 @@ pub(crate) fn vault_error( fn shielded_recovery_corrupted_message(account_index: Option) -> String { match account_index { Some(account_index) => format!( - "Saved recovery data for shielded account #{account_index} is damaged, so a pending payment cannot be checked safely. Restore your wallet data from a recent backup, then try again." + "Saved recovery data for shielded account #{account_index} is damaged, so a pending payment cannot be checked safely. Make sure you have this wallet's recovery phrase, remove the wallet, then import it again with that phrase." ), - None => "Saved recovery data for your shielded funds is damaged, so a pending payment cannot be checked safely. Restore your wallet data from a recent backup, then try again.".to_string(), + None => "Saved recovery data for your shielded funds is damaged, so a pending payment cannot be checked safely. Make sure you have this wallet's recovery phrase, remove the wallet, then import it again with that phrase.".to_string(), } } @@ -4743,6 +4748,17 @@ mod tests { for msg in [&with_account, &without_account, &keys, &pending] { assert!(!msg.contains(REASON), "upstream reason leaked: {msg}"); + } + // Each action names a flow DET actually has (Remove + import with the + // recovery phrase; unlock/restore; wait) — never an absent backup flow. + for msg in [&with_account, &without_account] { + assert!( + msg.contains("recovery phrase") && msg.contains("import it again"), + "no remove-and-import action in: {msg}" + ); + assert!(!msg.contains("backup"), "no backup flow exists: {msg}"); + } + for msg in [&keys, &pending] { assert!(msg.contains("then try again"), "no action in: {msg}"); } } diff --git a/src/model/contested_name.rs b/src/model/contested_name.rs index be6129f3d..7d83e4f84 100644 --- a/src/model/contested_name.rs +++ b/src/model/contested_name.rs @@ -490,6 +490,7 @@ mod tests { /// written by `bincode 2.0.1` before the switch and must never be regenerated. #[cfg(test)] mod bincode_pre_bump_fixture_tests { + // Guards the derive shape only: contests persist via serde `StoredContestedName`, not this codec. use super::*; const FIXTURE: &[u8] = include_bytes!(concat!( From c20372fd36109131e0e6d8f259ccc3d72b0684d8 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Mon, 14 Sep 2026 15:34:16 +0000 Subject: [PATCH 4/4] test(bincode): remove pre-bump wire-format fixture tests Drop the five committed bincode 2.0.1 byte fixtures and their inline guard modules, plus the PartialEq derives on ContestedName and Contestant that only those guards used. The grovedb-bincode wire-compatibility verdict now rests on source-level analysis alone; the Cargo.toml comment and the 4.2-dev upgrade notes say so and no longer cite an executable fixture. Co-Authored-By: Claude Opus 5 --- Cargo.toml | 8 +- .../upgrade-notes.md | 56 ++-- src/context/contract_token_db.rs | 81 ------ src/model/contested_name.rs | 87 +----- src/model/qualified_identity/mod.rs | 267 ------------------ src/model/wallet/meta.rs | 39 --- src/model/wallet/seed_envelope.rs | 40 --- .../bincode_pre_bump/contested_name.bin | Bin 441 -> 0 bytes .../bincode_pre_bump/qualified_identity.bin | Bin 1336 -> 0 bytes .../bincode_pre_bump/stored_seed_envelope.bin | Bin 205 -> 0 bytes .../bincode_pre_bump/token_configuration.bin | Bin 216 -> 0 bytes .../fixtures/bincode_pre_bump/wallet_meta.bin | Bin 124 -> 0 bytes 12 files changed, 32 insertions(+), 546 deletions(-) delete mode 100644 tests/fixtures/bincode_pre_bump/contested_name.bin delete mode 100644 tests/fixtures/bincode_pre_bump/qualified_identity.bin delete mode 100644 tests/fixtures/bincode_pre_bump/stored_seed_envelope.bin delete mode 100644 tests/fixtures/bincode_pre_bump/token_configuration.bin delete mode 100644 tests/fixtures/bincode_pre_bump/wallet_meta.bin diff --git a/Cargo.toml b/Cargo.toml index d8e1b08a6..eecf4332c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,10 +59,10 @@ tokio = { version = "1.46.1", features = ["full"] } # platform-value and rust-dashcore implement `Encode`/`Decode` against; the trait # identities must match or DET's codecs over those types stop compiling. On the ordinary # (non-`*_untrusted`) paths DET uses — native, `bincode::serde` and the derive macros — -# its wire format is identical to bincode 2.0.1, proven from hash-identical source and -# derive-codegen substitution (docs/ai-design/2026-09-14-platform-4.2-dev-bump/) and -# pinned by the pre-bump fixtures in tests/fixtures/bincode_pre_bump/. This switch -# therefore needs no read-old/write-new migration. Any other encoder change still does: +# its wire format is identical to bincode 2.0.1, per source-level analysis of hash-identical +# function bodies and derive-codegen substitution (docs/ai-design/2026-09-14-platform-4.2-dev-bump/); +# no executable fixture pins it. This switch therefore needs no read-old/write-new +# migration. Any other encoder change still does: # this crate encodes the on-disk wallet-secret envelopes and QualifiedIdentity blobs. bincode = { package = "grovedb-bincode", version = "=2.1.0", features = ["serde"] } hex = { version = "0.4.3" } diff --git a/docs/ai-design/2026-09-14-platform-4.2-dev-bump/upgrade-notes.md b/docs/ai-design/2026-09-14-platform-4.2-dev-bump/upgrade-notes.md index db4597a08..8933e05e9 100644 --- a/docs/ai-design/2026-09-14-platform-4.2-dev-bump/upgrade-notes.md +++ b/docs/ai-design/2026-09-14-platform-4.2-dev-bump/upgrade-notes.md @@ -37,33 +37,29 @@ probe) lives outside the repository in **bincode blobs: no migration.** `grovedb-bincode` 2.1.0 is a fork of bincode 2.0.1. On every ordinary (non-`*_untrusted`) entry point DET uses (native `encode_to_vec`/`decode_from_slice`, `bincode::serde`, and the derive macros), -it produces the same bytes and accepts the same inputs. This was proven from -source: files and function bodies hash-identical, and the fork's derive -output reduces to the original's by literal substitution. See -`## grovedb-bincode wire compatibility` in `platform-4.2-dev-impact.md`. That -covers stored `QualifiedIdentity`/`KeyStorage`, token configurations, the -secret envelopes and every serde sidecar. - -The proof is backed by committed fixtures under `tests/fixtures/bincode_pre_bump/`. -They were written with crates.io bincode 2.0.1 on the old pin, before the -dependency switch, and must never be regenerated. - -| Fixture | SHA-256 | Guard test | -| --- | --- | --- | -| `qualified_identity.bin` | `d851ca2dc406350932e30341c4047e63f37652727f42eed78557b0c4f388198f` | `model::qualified_identity::bincode_pre_bump_fixture_tests` | -| `contested_name.bin` | `d6fcde1fd65485fcebd02a7ac2af21133ed7115f6ec3b47491f9a6bb4dbd4cc6` | `model::contested_name::bincode_pre_bump_fixture_tests` | -| `token_configuration.bin` | `92c5b82f907273eea4c48fb628c49d969c51402d0bf4ff846348c7824ed9f6e0` | `context::contract_token_db::bincode_pre_bump_fixture_tests` | -| `stored_seed_envelope.bin` | `68c6dce3d8c1674d93986b26751bfb4c40f94d8366a6ec92f70be148f0114579` | `model::wallet::seed_envelope::bincode_pre_bump_fixture_tests` | -| `wallet_meta.bin` | `afce0da03252ff5a26274831f0f2dba97af2de7d8f4a5c3a8d5b20a028f9d6be` | `model::wallet::meta::bincode_pre_bump_fixture_tests` | - -Each guard does four things: - -- Decodes the fixture through the production reader: `QualifiedIdentity::from_bytes` with its decode limit, and `decode_token_config` for token configurations. -- Requires the whole blob to be consumed and the value to equal the synthetic original. -- Re-encodes the value byte-for-byte. -- Checks that the fixture differs from the legacy-config encoding. - -The identity fixture carries every `PrivateKeyData` variant and `PrivateKeyTarget`, voter and operator identities, contract bounds, a disabled key, and a `WalletDerivationPath` with all four `ChildNumber` kinds. The token fixture carries a perpetual `DistributionFunction`, whose upstream `Decode` impl was rewritten. `ContestedName` is persisted through a serde record today; its fixture guards the forked derive macros. All fixture values are synthetic. +it produces the same bytes and accepts the same inputs. That covers stored +`QualifiedIdentity`/`KeyStorage`, token configurations, the secret envelopes +and every serde sidecar. + +This verdict rests on source-level analysis only (see +`## grovedb-bincode wire compatibility` in `platform-4.2-dev-impact.md`): + +- **Runtime.** Every file outside the untrusted additions is byte-identical + between bincode 2.0.1 and grovedb-bincode 2.1.0. In the files that differ, + the bodies on the ordinary path hash-identical (`Decoder for DecoderImpl`, + `decode_from_slice`, `borrow_decode_from_slice`, the serde decode chain, + limit accounting). The serde deserializer's edited methods reduce to the old + behaviour under the fixed `Ordinary` policy. +- **Derive macros.** `Encode` generation is hash-identical. `Decode` and + `BorrowDecode` generation reduce to bincode_derive 2.0.1's output by literal + substitution when the fork's `untrusted` attribute is unset, which holds for + every plain `#[derive(Decode)]`/`#[derive(BorrowDecode)]`. + +This repository has no executable regression fixture for bincode wire +compatibility. The fork's own compatibility tests against bincode 2.0.1 were +read, not run. Existing blobs round-trip through the persistence unit tests, +but those tests encode and decode with the same crate, so they cannot detect +an encoder drift. **`platform-wallet-storage`: no change.** No migration, schema or secret-envelope change between the pins. @@ -112,15 +108,15 @@ historical record. Two of its claims are stale: ## Validation and limits -- The pre-bump fixture guards passed on the old pin with crates.io bincode - 2.0.1, before the dependency switch, and again on the new pin. +- bincode wire compatibility: source-level analysis only (see + "Existing data"); no executable fixture. - `cargo check --all-features --all-targets`, `cargo fmt --all`, and `cargo clippy --all-features --all-targets -- -D warnings` on the new pin. - `cargo test --all-features --lib`, scoped to the bincode-persistence modules (identity blobs including the golden v0.9.3 blob, key storage, seed and single-key envelopes, DET k/v, wallet meta, settings, contested names, token - registry), the fixture guards, and the new shielded error-mapping and + registry), and the new shielded error-mapping and message tests. - Not run: the full workspace suite (CI covers it), backend E2E, GUI tests, and opening a real user's shielded store. Checks used Linux and synthetic data. diff --git a/src/context/contract_token_db.rs b/src/context/contract_token_db.rs index 883e631e1..2bb044e63 100644 --- a/src/context/contract_token_db.rs +++ b/src/context/contract_token_db.rs @@ -1187,84 +1187,3 @@ mod tests { ); } } - -/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the -/// `grovedb-bincode` fork. The fixture was written by `bincode 2.0.1` before -/// the switch and must never be regenerated. -#[cfg(test)] -mod bincode_pre_bump_fixture_tests { - use super::*; - use dash_sdk::dpp::data_contract::associated_token::token_configuration::v0::TokenConfigurationV0; - use dash_sdk::dpp::data_contract::associated_token::token_configuration_convention::TokenConfigurationConvention; - use dash_sdk::dpp::data_contract::associated_token::token_configuration_localization::TokenConfigurationLocalization; - use dash_sdk::dpp::data_contract::associated_token::token_configuration_localization::v0::TokenConfigurationLocalizationV0; - use dash_sdk::dpp::data_contract::associated_token::token_distribution_rules::TokenDistributionRules; - use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::TokenPerpetualDistribution; - use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::distribution_function::DistributionFunction; - use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::distribution_recipient::TokenDistributionRecipient; - use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::reward_distribution_type::RewardDistributionType; - use dash_sdk::dpp::data_contract::associated_token::token_perpetual_distribution::v0::TokenPerpetualDistributionV0; - - const FIXTURE: &[u8] = include_bytes!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/tests/fixtures/bincode_pre_bump/token_configuration.bin" - )); - - /// The most-restrictive preset (the shape DET's token builder starts from) - /// plus a localization and a perpetual distribution carrying a - /// multi-field `DistributionFunction`, whose upstream `Decode` impl was - /// rewritten across the platform bump. - fn sample() -> TokenConfiguration { - let mut v0 = TokenConfigurationV0::default_most_restrictive(); - let TokenConfigurationConvention::V0(ref mut conventions) = v0.conventions; - conventions.decimals = 6; - conventions.localizations.insert( - "en".to_string(), - TokenConfigurationLocalization::V0(TokenConfigurationLocalizationV0 { - should_capitalize: true, - singular_form: "Fixture".to_string(), - plural_form: "Fixtures".to_string(), - }), - ); - v0.base_supply = 1_000_000; - v0.max_supply = Some(9_000_000); - v0.start_as_paused = true; - let TokenDistributionRules::V0(ref mut rules) = v0.distribution_rules; - rules.perpetual_distribution = Some(TokenPerpetualDistribution::V0( - TokenPerpetualDistributionV0 { - distribution_type: RewardDistributionType::EpochBasedDistribution { - interval: 7, - function: DistributionFunction::Linear { - a: -3, - d: 10, - start_step: Some(2), - starting_amount: 500, - min_value: Some(10), - max_value: Some(1_000), - }, - }, - distribution_recipient: TokenDistributionRecipient::Identity(Identifier::from( - [0x71; 32], - )), - }, - )); - rules.new_tokens_destination_identity = Some(Identifier::from([0x72; 32])); - TokenConfiguration::V0(v0) - } - - /// Decodes through the production reader (`decode_token_config`) and - /// re-encodes with the same config `insert_token` writes with. - #[test] - fn pre_bump_bytes_decode_and_reencode_identically() { - let decoded = decode_token_config(FIXTURE).expect("decode pre-bump fixture"); - let (_, consumed): (TokenConfiguration, usize) = - bincode::decode_from_slice(FIXTURE, config::standard()).expect("decode"); - assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); - assert_eq!(decoded, sample(), "decoded value drifted"); - let reencoded = bincode::encode_to_vec(&decoded, config::standard()).expect("encode"); - assert_eq!(reencoded, FIXTURE, "re-encoded bytes drifted"); - // Sensitivity: the byte comparison tells encodings apart. - let legacy = bincode::encode_to_vec(sample(), config::legacy()).expect("encode legacy"); - assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); - } -} diff --git a/src/model/contested_name.rs b/src/model/contested_name.rs index 7d83e4f84..893dcde65 100644 --- a/src/model/contested_name.rs +++ b/src/model/contested_name.rs @@ -25,7 +25,7 @@ impl ContestState { } } -#[derive(Debug, Encode, Decode, Clone, PartialEq)] +#[derive(Debug, Encode, Decode, Clone)] pub struct ContestedName { pub normalized_contested_name: String, pub contestants: Option>, @@ -210,7 +210,7 @@ pub struct MasternodeContestSummary { pub has_scheduled_vote: bool, } -#[derive(Debug, Encode, Decode, Clone, PartialEq)] +#[derive(Debug, Encode, Decode, Clone)] pub struct Contestant { pub id: Identifier, pub name: String, @@ -484,86 +484,3 @@ mod tests { assert!(sanitized.chars().all(|character| character == 'é')); } } - -/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the -/// `grovedb-bincode` fork (and its forked derive macros). The fixture was -/// written by `bincode 2.0.1` before the switch and must never be regenerated. -#[cfg(test)] -mod bincode_pre_bump_fixture_tests { - // Guards the derive shape only: contests persist via serde `StoredContestedName`, not this codec. - use super::*; - - const FIXTURE: &[u8] = include_bytes!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/tests/fixtures/bincode_pre_bump/contested_name.bin" - )); - - /// Covers every field kind the derive emits: `Identifier` (upstream - /// type), nested `Vec`/`Option`, a data-carrying enum variant, and a - /// `BTreeMap` keyed by a tuple with `ResourceVoteChoice` values. - fn sample() -> ContestedName { - let alice = Identifier::from([0x51; 32]); - let bob = Identifier::from([0x52; 32]); - let voter = Identifier::from([0x53; 32]); - let mut my_votes = BTreeMap::new(); - my_votes.insert( - (voter, PrivateKeyTarget::PrivateKeyOnVoterIdentity, 2), - ResourceVoteChoice::TowardsIdentity(alice), - ); - my_votes.insert( - (voter, PrivateKeyTarget::PrivateKeyOnMainIdentity, 0), - ResourceVoteChoice::Abstain, - ); - my_votes.insert( - (bob, PrivateKeyTarget::PrivateKeyOnOperatorIdentity, 1), - ResourceVoteChoice::Lock, - ); - ContestedName { - normalized_contested_name: "fixture-name".to_string(), - contestants: Some(vec![ - Contestant { - id: alice, - name: "Fixture-Name".to_string(), - info: "first contender".to_string(), - votes: 17, - created_at: Some(1_700_000_000_000), - created_at_block_height: Some(123_456), - created_at_core_block_height: Some(987_654), - document_id: Identifier::from([0x61; 32]), - }, - Contestant { - id: bob, - name: "fixture-name".to_string(), - info: String::new(), - votes: 0, - created_at: None, - created_at_block_height: None, - created_at_core_block_height: None, - document_id: Identifier::from([0x62; 32]), - }, - ]), - locked_votes: Some(3), - abstain_votes: Some(5), - awarded_to: Some(alice), - end_time: Some(1_700_000_600_000), - state: ContestState::WonBy(alice), - last_updated: Some(1_700_000_300_000), - my_votes, - } - } - - #[test] - fn pre_bump_bytes_decode_and_reencode_identically() { - let cfg = bincode::config::standard(); - let (decoded, consumed): (ContestedName, usize) = - bincode::decode_from_slice(FIXTURE, cfg).expect("decode pre-bump fixture"); - assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); - assert_eq!(decoded, sample(), "decoded value drifted"); - let reencoded = bincode::encode_to_vec(&decoded, cfg).expect("encode"); - assert_eq!(reencoded, FIXTURE, "re-encoded bytes drifted"); - // Sensitivity: the byte comparison tells encodings apart. - let legacy = - bincode::encode_to_vec(sample(), bincode::config::legacy()).expect("encode legacy"); - assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); - } -} diff --git a/src/model/qualified_identity/mod.rs b/src/model/qualified_identity/mod.rs index f0e5f57af..550d973fb 100644 --- a/src/model/qualified_identity/mod.rs +++ b/src/model/qualified_identity/mod.rs @@ -2629,270 +2629,3 @@ mod decode_limit_tests { assert_eq!(decoded, payload); } } - -/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the -/// `grovedb-bincode` fork (and its forked derive macros). The fixture was -/// written by `bincode 2.0.1` before the switch and must never be regenerated. -#[cfg(test)] -mod bincode_pre_bump_fixture_tests { - use super::*; - use crate::model::qualified_identity::encrypted_key_storage::{ - PrivateKeyData, WalletDerivationPath, - }; - use dash_sdk::dpp::identity::identity_public_key::contract_bounds::ContractBounds; - use dash_sdk::dpp::identity::identity_public_key::v0::IdentityPublicKeyV0; - use dash_sdk::dpp::identity::v0::IdentityV0; - use dash_sdk::dpp::identity::{KeyType, Purpose, SecurityLevel}; - use dash_sdk::dpp::key_wallet::bip32::{ChildNumber, DerivationPath}; - use dash_sdk::dpp::platform_value::BinaryData; - use dash_sdk::platform::{Identifier, IdentityPublicKey}; - - const FIXTURE: &[u8] = include_bytes!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/tests/fixtures/bincode_pre_bump/qualified_identity.bin" - )); - - #[allow(clippy::too_many_arguments)] - fn key( - id: KeyID, - purpose: Purpose, - security_level: SecurityLevel, - key_type: KeyType, - contract_bounds: Option, - read_only: bool, - data: Vec, - disabled_at: Option, - ) -> IdentityPublicKey { - IdentityPublicKey::V0(IdentityPublicKeyV0 { - id, - purpose, - security_level, - contract_bounds, - key_type, - read_only, - data: BinaryData::new(data), - disabled_at, - }) - } - - fn identity(id: [u8; 32], keys: &[IdentityPublicKey], balance: u64, revision: u64) -> Identity { - Identity::V0(IdentityV0 { - id: Identifier::from(id), - public_keys: keys.iter().map(|k| (k.id(), k.clone())).collect(), - balance, - revision, - }) - } - - /// A DIP-9-shaped path plus one of each 256-bit child kind, so every - /// `ChildNumber` discriminant of the manual `WalletDerivationPath` codec - /// is pinned. - fn wallet_path(seed_hash_byte: u8) -> WalletDerivationPath { - WalletDerivationPath { - wallet_seed_hash: [seed_hash_byte; 32], - derivation_path: DerivationPath::from(vec![ - ChildNumber::Hardened { index: 9 }, - ChildNumber::Hardened { index: 1 }, - ChildNumber::Hardened { index: 5 }, - ChildNumber::Normal { index: 0 }, - ChildNumber::Normal256 { index: [0x0A; 32] }, - ChildNumber::Hardened256 { index: [0x0B; 32] }, - ]), - } - } - - /// Synthetic masternode identity — byte patterns only, no real keys. - /// Holds every `PrivateKeyData` variant, every `PrivateKeyTarget`, - /// voter + operator identities, contract bounds, a disabled key and a - /// wallet-linked public key. - fn sample() -> QualifiedIdentity { - let master = key( - 0, - Purpose::AUTHENTICATION, - SecurityLevel::MASTER, - KeyType::ECDSA_SECP256K1, - None, - false, - [vec![0x02], vec![0x21; 32]].concat(), - None, - ); - let bounded = key( - 1, - Purpose::AUTHENTICATION, - SecurityLevel::HIGH, - KeyType::ECDSA_SECP256K1, - Some(ContractBounds::SingleContractDocumentType { - id: Identifier::from([0x31; 32]), - document_type_name: "note".to_string(), - }), - true, - [vec![0x03], vec![0x22; 32]].concat(), - Some(1_700_000_000_000), - ); - let medium = key( - 2, - Purpose::AUTHENTICATION, - SecurityLevel::MEDIUM, - KeyType::ECDSA_SECP256K1, - Some(ContractBounds::SingleContract { - id: Identifier::from([0x32; 32]), - }), - false, - [vec![0x02], vec![0x23; 32]].concat(), - None, - ); - let transfer = key( - 3, - Purpose::TRANSFER, - SecurityLevel::CRITICAL, - KeyType::ECDSA_HASH160, - None, - false, - vec![0x24; 20], - None, - ); - let vaulted = key( - 4, - Purpose::OWNER, - SecurityLevel::CRITICAL, - KeyType::ECDSA_HASH160, - None, - false, - vec![0x25; 20], - None, - ); - let voting = key( - 0, - Purpose::VOTING, - SecurityLevel::HIGH, - KeyType::ECDSA_HASH160, - None, - false, - vec![0x26; 20], - None, - ); - let operator = key( - 0, - Purpose::SYSTEM, - SecurityLevel::CRITICAL, - KeyType::BLS12_381, - None, - false, - vec![0x27; 48], - None, - ); - - let main_identity = identity( - [0xB1; 32], - &[ - master.clone(), - bounded.clone(), - medium.clone(), - transfer.clone(), - vaulted.clone(), - ], - 123_456_789, - 4, - ); - let voter_identity = identity([0xB2; 32], std::slice::from_ref(&voting), 0, 0); - let operator_identity = identity([0xB3; 32], std::slice::from_ref(&operator), 7, 1); - - let mut private_keys = BTreeMap::new(); - private_keys.insert( - (PrivateKeyTarget::PrivateKeyOnMainIdentity, master.id()), - ( - QualifiedIdentityPublicKey::from(master), - PrivateKeyData::Clear([0x11; 32]), - ), - ); - private_keys.insert( - (PrivateKeyTarget::PrivateKeyOnMainIdentity, bounded.id()), - ( - QualifiedIdentityPublicKey::from(bounded), - PrivateKeyData::Encrypted(vec![0x12; 48]), - ), - ); - private_keys.insert( - (PrivateKeyTarget::PrivateKeyOnMainIdentity, medium.id()), - ( - QualifiedIdentityPublicKey::from(medium), - PrivateKeyData::AlwaysClear([0x13; 32]), - ), - ); - private_keys.insert( - (PrivateKeyTarget::PrivateKeyOnMainIdentity, transfer.id()), - ( - QualifiedIdentityPublicKey { - identity_public_key: transfer, - in_wallet_at_derivation_path: Some(wallet_path(0x14)), - }, - PrivateKeyData::AtWalletDerivationPath(wallet_path(0x14)), - ), - ); - private_keys.insert( - (PrivateKeyTarget::PrivateKeyOnMainIdentity, vaulted.id()), - ( - QualifiedIdentityPublicKey::from(vaulted), - PrivateKeyData::InVault, - ), - ); - private_keys.insert( - (PrivateKeyTarget::PrivateKeyOnVoterIdentity, voting.id()), - ( - QualifiedIdentityPublicKey::from(voting.clone()), - PrivateKeyData::Clear([0x15; 32]), - ), - ); - private_keys.insert( - ( - PrivateKeyTarget::PrivateKeyOnOperatorIdentity, - operator.id(), - ), - ( - QualifiedIdentityPublicKey::from(operator.clone()), - PrivateKeyData::InVault, - ), - ); - - QualifiedIdentity { - identity: main_identity, - associated_voter_identity: Some((voter_identity, voting)), - associated_operator_identity: Some((operator_identity, operator)), - associated_owner_key_id: Some(4), - identity_type: IdentityType::Masternode, - alias: Some("fixture-masternode".to_string()), - private_keys: KeyStorage::from(private_keys), - dpns_names: vec![DPNSNameInfo { - name: "fixture".to_string(), - acquired_at: 1_700_000_000_000, - }], - // Everything below is not encoded; these are the values `decode` - // reconstructs, so a decoded fixture compares equal field-for-field. - associated_wallets: BTreeMap::new(), - secret_access: None, - wallet_index: None, - top_ups: BTreeMap::new(), - status: IdentityStatus::Unknown, - network: Network::Mainnet, - } - } - - /// Decodes through the production entry point (`from_bytes`, with the - /// identity-blob decode limit) and re-encodes through `to_bytes`. The - /// manual `PartialEq` skips runtime-only fields, so the byte comparison - /// is what pins every encoded field. - #[test] - fn pre_bump_bytes_decode_and_reencode_identically() { - let decoded = QualifiedIdentity::from_bytes(FIXTURE).expect("decode pre-bump fixture"); - let (_, consumed): (QualifiedIdentity, usize) = - bincode::decode_from_slice(FIXTURE, identity_blob_decode_config()) - .expect("decode pre-bump fixture under the limit config"); - assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); - assert_eq!(decoded, sample(), "decoded value drifted"); - assert_eq!(decoded.to_bytes(), FIXTURE, "re-encoded bytes drifted"); - // Sensitivity: the byte comparison tells encodings apart. - let legacy = - bincode::encode_to_vec(sample(), bincode::config::legacy()).expect("encode legacy"); - assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); - } -} diff --git a/src/model/wallet/meta.rs b/src/model/wallet/meta.rs index e29ecc6a5..6c8e9e8c7 100644 --- a/src/model/wallet/meta.rs +++ b/src/model/wallet/meta.rs @@ -277,42 +277,3 @@ mod tests { assert_no_leak_bytes(&rendered, &secret, "WalletMeta sidecar blob"); } } - -/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the -/// `grovedb-bincode` fork. The fixture was written by `bincode 2.0.1` before -/// the switch and must never be regenerated. -#[cfg(test)] -mod bincode_pre_bump_fixture_tests { - use super::*; - - const FIXTURE: &[u8] = include_bytes!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/tests/fixtures/bincode_pre_bump/wallet_meta.bin" - )); - - fn sample() -> WalletMeta { - WalletMeta { - alias: "fixture wallet".to_string(), - is_main: true, - core_wallet_name: Some("fixture-core".to_string()), - xpub_encoded: (0..78u8).rev().collect(), - uses_password: true, - password_hint: Some("fixture hint".to_string()), - } - } - - #[test] - fn pre_bump_bytes_decode_and_reencode_identically() { - let cfg = bincode::config::standard(); - let (decoded, consumed): (WalletMeta, usize) = - bincode::serde::decode_from_slice(FIXTURE, cfg).expect("decode pre-bump fixture"); - assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); - assert_eq!(decoded, sample(), "decoded value drifted"); - let reencoded = bincode::serde::encode_to_vec(&decoded, cfg).expect("encode"); - assert_eq!(reencoded, FIXTURE, "re-encoded bytes drifted"); - // Sensitivity: the byte comparison tells encodings apart. - let legacy = bincode::serde::encode_to_vec(sample(), bincode::config::legacy()) - .expect("encode legacy"); - assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); - } -} diff --git a/src/model/wallet/seed_envelope.rs b/src/model/wallet/seed_envelope.rs index 883c0bbb4..7d5eaeb71 100644 --- a/src/model/wallet/seed_envelope.rs +++ b/src/model/wallet/seed_envelope.rs @@ -148,43 +148,3 @@ mod tests { assert_zeroize_on_drop(&decoded.encrypted_seed); } } - -/// Wire-format guard for the switch from crates.io `bincode 2.0.1` to the -/// `grovedb-bincode` fork. The fixture was written by `bincode 2.0.1` before -/// the switch and must never be regenerated. -#[cfg(test)] -mod bincode_pre_bump_fixture_tests { - use super::*; - - const FIXTURE: &[u8] = include_bytes!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/tests/fixtures/bincode_pre_bump/stored_seed_envelope.bin" - )); - - /// Synthetic envelope — byte patterns only, no real seed material. - fn sample() -> StoredSeedEnvelope { - StoredSeedEnvelope { - encrypted_seed: Zeroizing::new(vec![0xA5; 80]), - salt: vec![0x5A; 16], - nonce: vec![0x3C; 12], - password_hint: Some("fixture hint".to_string()), - uses_password: true, - xpub_encoded: (0..78u8).collect(), - } - } - - #[test] - fn pre_bump_bytes_decode_and_reencode_identically() { - let cfg = bincode::config::standard(); - let (decoded, consumed): (StoredSeedEnvelope, usize) = - bincode::serde::decode_from_slice(FIXTURE, cfg).expect("decode pre-bump fixture"); - assert_eq!(consumed, FIXTURE.len(), "the whole blob must be consumed"); - assert_eq!(decoded, sample(), "decoded value drifted"); - let reencoded = bincode::serde::encode_to_vec(&decoded, cfg).expect("encode"); - assert_eq!(reencoded, FIXTURE, "re-encoded bytes drifted"); - // Sensitivity: the byte comparison tells encodings apart. - let legacy = bincode::serde::encode_to_vec(sample(), bincode::config::legacy()) - .expect("encode legacy"); - assert_ne!(legacy, FIXTURE, "fixture must pin the standard encoding"); - } -} diff --git a/tests/fixtures/bincode_pre_bump/contested_name.bin b/tests/fixtures/bincode_pre_bump/contested_name.bin deleted file mode 100644 index c77650ebdc5cf9fefd847ad576d9a1fb9ed5cec2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 441 zcmd-{%d99VElSnROUzAWWC|nzc-)}M{ea5((=v;SOB9mx^GZ_lQc{Zq8UHe5JU!pd z$iTq($KeqpkYp3$XGkOff(QT}WG6C!KoSAK$jr#fNWdq7jDHXGzXLm#nXu9azh6R> Z5^!q}6C+bF0RRjg0xE(TnHUJU2>@{Dk7xh@ diff --git a/tests/fixtures/bincode_pre_bump/qualified_identity.bin b/tests/fixtures/bincode_pre_bump/qualified_identity.bin deleted file mode 100644 index 13eb781550a44f78c8cf785eefbaa9907cf29a38..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1336 zcmcK4L2AN47zN<>W=2EXm1%N-u~t`tdL37VrnHMHXaw)zX|MrK|KqaOn!6Eh1d8#@Ol7dHqnoxOvjle3Gfo4bdn Im$#2E01SFfUH||9 diff --git a/tests/fixtures/bincode_pre_bump/token_configuration.bin b/tests/fixtures/bincode_pre_bump/token_configuration.bin deleted file mode 100644 index b83d8a93e7fdabd1d29d36eee3a23c1fcc31b05c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 216 zcmZQzU}Q?oV_;-=%d99VElTBp(#32HVDQJmiJyV-k3&c&0|O%zKx7yg8JO5vSh*OP det%(PFQ`}X=