Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions book/src/versioning/feature-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -485,16 +485,19 @@ slots edited. Newer ones use struct update syntax, so that the file *is* the
diff:

```rust
// packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_query_versions/v3.rs
// packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_query_versions/v2.rs

/// Differs from v2 in exactly one slot:
/// Differs from v1 in two slots.
/// `document_query_helpers.compute_aggregate_mode_and_check_limit` is 2
/// rather than 1. That is the boolean-`HAVING` routing gate. ...
pub const DRIVE_ABCI_QUERY_VERSIONS_V3: DriveAbciQueryVersions = DriveAbciQueryVersions {
/// rather than 0: the ranked and boolean-`HAVING` routing gate. ...
pub const DRIVE_ABCI_QUERY_VERSIONS_V2: DriveAbciQueryVersions = DriveAbciQueryVersions {
document_query_helpers: DriveAbciDocumentQueryHelperVersions {
compute_aggregate_mode_and_check_limit: 2,
},
..DRIVE_ABCI_QUERY_VERSIONS_V2
data_contract_query_helpers: DriveAbciDataContractQueryHelperVersions {
latest_versions_read: 1,
},
..DRIVE_ABCI_QUERY_VERSIONS_V1
};
```

Expand Down Expand Up @@ -564,7 +567,7 @@ version/
v1.rs .. v10.rs
drive_abci_query_versions/
mod.rs
v0.rs .. v3.rs
v0.rs .. v2.rs
drive_abci_withdrawal_constants/
mod.rs # DriveAbciWithdrawalConstants (parameters, not method versions)
v1.rs .. v3.rs
Expand Down
2 changes: 1 addition & 1 deletion book/src/versioning/platform-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub const PLATFORM_V14: PlatformVersion = PlatformVersion {
methods: DRIVE_ABCI_METHOD_VERSIONS_V10, // changed: records the per-block total credits history
validation_and_processing: DRIVE_ABCI_VALIDATION_VERSIONS_V10, // changed: contested-index cross-check + refersTo validation
withdrawal_constants: DRIVE_ABCI_WITHDRAWAL_CONSTANTS_V3, // changed: prune bound for the total credits history
query: DRIVE_ABCI_QUERY_VERSIONS_V3, // changed: ranked + boolean-HAVING routing gate
query: DRIVE_ABCI_QUERY_VERSIONS_V2, // changed: ranked + boolean-HAVING routing gate
checkpoints: DRIVE_ABCI_CHECKPOINT_PARAMETERS_V1,
},
dpp: DPPVersion {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub mod v0;
pub mod v1;
pub mod v2;
pub mod v3;

use versioned_feature_core::{FeatureVersion, FeatureVersionBounds};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,48 @@
use crate::version::drive_abci_versions::drive_abci_query_versions::v1::DRIVE_ABCI_QUERY_VERSIONS_V1;
use crate::version::drive_abci_versions::drive_abci_query_versions::{
DriveAbciDocumentQueryHelperVersions, DriveAbciQueryVersions,
DriveAbciDataContractQueryHelperVersions, DriveAbciDocumentQueryHelperVersions,
DriveAbciQueryVersions,
};

/// Version 2 of the Drive ABCI query versions.
/// Version 2 of the Drive ABCI query versions, selected by protocol version 14.
///
/// Differs from v1 in exactly one slot:
/// `document_query_helpers.compute_aggregate_mode_and_check_limit` is 1
/// rather than 0. That is the ranked-routing gate. The v0 helper has no
/// ranked path at all; the v1 helper routes a grouped aggregate whose
/// single `order_by` names the selected aggregate (`ORDER BY <agg>
/// [ASC|DESC] LIMIT n [OFFSET m]`) to the ranked executor, and otherwise
/// behaves exactly as v0. Both reject every non-empty `having` with
/// "HAVING clause is not yet implemented".
/// Differs from v1 in two slots.
///
/// Keeping the flip in v14's own table is what lets a mixed-version network
/// agree: protocol version 13 and earlier keep the v1 table, so those nodes
/// still reject ranked queries, while v14 nodes answer them. The wire
/// surface is unchanged — `document_query` stays at v1 because
/// `GetDocumentsRequestV1` already carries `selects` / `group_by` /
/// `having`, and the ranked *response* shape is an additive
/// `ResultData.ranked` variant older clients simply never receive.
/// `document_query_helpers.compute_aggregate_mode_and_check_limit` is 2
/// rather than 0. That opens two routes on the v1 document-query handler:
/// the ranked path, a grouped aggregate whose single `order_by` names the
/// selected aggregate (`ORDER BY <agg> [ASC|DESC] LIMIT n [OFFSET m]`),
/// served by the ranked executor; and the boolean-`HAVING` range path, a
/// grouped aggregate carrying exactly one `having` clause
/// (`GROUP BY p HAVING <agg> <op> <value> LIMIT n`), served as a
/// value-bounded range read of the covering ranked index's axis secondary.
/// Everything else, including multi-clause `having` and `having` on a
/// select with no ranked axis, is rejected as before ("HAVING clause is not
/// yet implemented").
///
/// `data_contract_query_helpers.latest_versions_read` is 1 rather than 0:
/// from protocol version 14 every contract carries a four-byte version item
/// beside it (`[64, id, 2] / 64`, backfilled on the first block of the version),
/// so `getDataContractsLatestVersions` without `include_contracts` reads that
/// item and proves it instead of the contracts. The tables protocol versions
/// 1 to 13 select keep helper version 0, which reads and proves the contracts
/// a state without the items still has.
///
/// Mixed-network safety comes from the shipped tables: protocol versions
/// 1-11 select `DRIVE_ABCI_QUERY_VERSIONS_V0` and 12-13 select
/// `DRIVE_ABCI_QUERY_VERSIONS_V1`. Both use helper version 0 and reject
/// ranked and `HAVING` shapes, so nodes agree until the protocol version 14
/// upgrade carries. The wire surface is unchanged: `document_query` stays at
/// v1 because `GetDocumentsRequestV1` already carries `selects` / `group_by`
/// / `having`, and the ranked and range responses reuse the additive
/// `ResultData.ranked` entries shape (with `skipped` unset for a range page,
/// which has no rank base), which older clients never receive.
pub const DRIVE_ABCI_QUERY_VERSIONS_V2: DriveAbciQueryVersions = DriveAbciQueryVersions {
document_query_helpers: DriveAbciDocumentQueryHelperVersions {
compute_aggregate_mode_and_check_limit: 1,
compute_aggregate_mode_and_check_limit: 2,
},
data_contract_query_helpers: DriveAbciDataContractQueryHelperVersions {
latest_versions_read: 1,
},
..DRIVE_ABCI_QUERY_VERSIONS_V1
};

This file was deleted.

6 changes: 3 additions & 3 deletions packages/rs-platform-version/src/version/v14.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::version::dpp_versions::dpp_voting_versions::v2::VOTING_VERSION_V2;
use crate::version::dpp_versions::DPPVersion;
use crate::version::drive_abci_versions::drive_abci_checkpoint_parameters::v1::DRIVE_ABCI_CHECKPOINT_PARAMETERS_V1;
use crate::version::drive_abci_versions::drive_abci_method_versions::v10::DRIVE_ABCI_METHOD_VERSIONS_V10;
use crate::version::drive_abci_versions::drive_abci_query_versions::v3::DRIVE_ABCI_QUERY_VERSIONS_V3;
use crate::version::drive_abci_versions::drive_abci_query_versions::v2::DRIVE_ABCI_QUERY_VERSIONS_V2;
use crate::version::drive_abci_versions::drive_abci_structure_versions::v2::DRIVE_ABCI_STRUCTURE_VERSIONS_V2;
use crate::version::drive_abci_versions::drive_abci_validation_versions::v10::DRIVE_ABCI_VALIDATION_VERSIONS_V10;
use crate::version::drive_abci_versions::drive_abci_withdrawal_constants::v3::DRIVE_ABCI_WITHDRAWAL_CONSTANTS_V3;
Expand Down Expand Up @@ -181,7 +181,7 @@ pub const PROTOCOL_VERSION_14: ProtocolVersion = 14;
/// moderation election (an `electedCharter` contest) runs on its target
/// contract's join and vote windows, which the document create join check
/// and the contested insert read.
/// * `DRIVE_ABCI_QUERY_VERSIONS_V3` bumps
/// * `DRIVE_ABCI_QUERY_VERSIONS_V2` bumps
/// `document_query_helpers.compute_aggregate_mode_and_check_limit` 0 → 2,
/// opening two routes on the v1 document-query handler: the ranked path
/// (a grouped aggregate whose single `order_by` names the selected
Expand Down Expand Up @@ -1389,7 +1389,7 @@ pub const PLATFORM_V14: PlatformVersion = PlatformVersion {
methods: DRIVE_ABCI_METHOD_VERSIONS_V10, // changed: records the per-block total credits history for the daily withdrawal limit
validation_and_processing: DRIVE_ABCI_VALIDATION_VERSIONS_V10, // changed: contested-index cross-check + refersTo document reference validation; the ContractUserModeration gates and the batch transformer's contract_moderation_gate; a contest accepts at most max_contenders_per_contest contenders and maximum_contenders_to_consider rises to 10,000; a contender's fund doubles past 250 contenders and for every 50 more
withdrawal_constants: DRIVE_ABCI_WITHDRAWAL_CONSTANTS_V3, // changed: prune bound for the total credits history
query: DRIVE_ABCI_QUERY_VERSIONS_V3, // changed: ranked + boolean-HAVING routing gate; the v1 handler also resolves IN_TIME_RANGE from committed block time
query: DRIVE_ABCI_QUERY_VERSIONS_V2, // changed: ranked + boolean-HAVING routing gate; the v1 handler also resolves IN_TIME_RANGE from committed block time
checkpoints: DRIVE_ABCI_CHECKPOINT_PARAMETERS_V1,
},
dpp: DPPVersion {
Expand Down
Loading