diff --git a/Cargo.lock b/Cargo.lock index e3097c08145..99233b4a698 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6643,6 +6643,7 @@ dependencies = [ "hex", "js-sys", "lru", + "platform-version", "reqwest 0.12.28", "rs-dapi-client", "serde", diff --git a/book/src/data-model/non-transferable-tokens.md b/book/src/data-model/non-transferable-tokens.md index 800043a1783..ba1a3d1b079 100644 --- a/book/src/data-model/non-transferable-tokens.md +++ b/book/src/data-model/non-transferable-tokens.md @@ -46,7 +46,7 @@ contract update cannot change an existing token's configuration. | A document type of the token's own contract charging it with `effect: 0` (pay the contract owner) | `NonTransferableTokenPaymentMustBurnError` (10280) | Contract create and update, when the document type is parsed. A document payment refuses it again (`TokenNotTransferableError`, 40726) from the configuration the contract already carries, so a contract that bypassed registration cannot pay with it either | | A document type of another contract charging it | `TokenNotTransferableError` (40726) | Contract create and update state validation, which already reads the token's contract to check the token exists. Such a cost always pays the contract owner, since another contract's token cannot be burned (10261) | | `hasShieldedPool: true` | `NonTransferableTokenShieldedPoolError` (10279) | Contract create and update, before anything is charged | -| `marketplaceRules.tradeMode: Tradeable` (protocol version 15) | `NonTransferableTokenTradeableError` (10281) | Contract create and update, before anything is charged, and the batch advanced structure validation of a `TokenConfigUpdate` that makes the token tradeable: the mempool refuses it, and a block charges the signer and bumps the nonce | +| `marketplaceRules.tradeMode: Tradeable` (protocol version 16; refused as not active before it) | `NonTransferableTokenTradeableError` (10281) | Contract create and update, before anything is charged, and the batch advanced structure validation of a `TokenConfigUpdate` that makes the token tradeable: the mempool refuses it, and a block charges the signer and bumps the nonce | A shielded pool is refused because a note spent inside the pool can be unshielded to any identity, so shielding and unshielding would move the token between holders. The diff --git a/book/src/data-model/token-marketplace.md b/book/src/data-model/token-marketplace.md index 25d52b69cae..dea63942bc0 100644 --- a/book/src/data-model/token-marketplace.md +++ b/book/src/data-model/token-marketplace.md @@ -1,7 +1,9 @@ # Token Marketplace -From protocol version 15 a token can be tradeable: its holders can sell it to each other on -Platform at a price they set, and anyone can make an offer for it. Nobody has to trust the other +From protocol version 16 a token can be tradeable: its holders can sell it to each other on +Platform at a price they set, and anyone can make an offer for it. Nothing of the market exists +before that version: no escrow tree, no token market contract and no tradeable token. Nobody has +to trust the other side. The tokens a seller lists and the credits a buyer offers are held in escrow until the order is filled or cancelled, so a fill always delivers what the order promised. @@ -43,8 +45,8 @@ created tradeable becomes tradeable only if its issuer kept the right to change | Rule | Refused with | Where | |---|---|---| -| `Tradeable` before protocol version 15 | `StateTransitionNotActiveError` (10603), as `TokenTradeModeTradeable` on a contract and `TokenConfigUpdateMarketplaceTradeModeTradeable` on an update | Contract create and update, and the batch carrying the update, before anything is charged. Software older than protocol version 15 cannot decode the mode, so this is the refusal it gives too | -| `Tradeable` on a [non-transferable token](non-transferable-tokens.md) | `NonTransferableTokenTradeableError` (10281) | Contract create and update before anything is charged, and the advanced structure validation of a `TokenConfigUpdate`, which charges the signer and runs in check_tx too, so the mempool refuses the update | +| `Tradeable` before protocol version 16 | `StateTransitionNotActiveError` (10603), as `TokenTradeModeTradeable` on a contract and `TokenConfigUpdateMarketplaceTradeModeTradeable` on an update | Contract create and update, and the batch carrying the update, before anything is charged. Software older than protocol version 15 cannot decode the mode, so this is the refusal it gives too. Protocol version 15 decodes the mode and gives the same refusal: it has no transitions that place or fill an order, so no contract stores the mode before they exist | +| `Tradeable` on a [non-transferable token](non-transferable-tokens.md), from protocol version 16 | `NonTransferableTokenTradeableError` (10281) | Contract create and update before anything is charged, and the advanced structure validation of a `TokenConfigUpdate`, which charges the signer and runs in check_tx too, so the mempool refuses the update | A non-transferable token cannot be tradeable because filling a listing or an offer moves the token from the seller to the buyer, which is the transfer the token refuses. `transferable` is fixed @@ -53,8 +55,8 @@ when the token is created, so the trade mode is the only half of the rule an upd ## Where orders and escrow live Open orders are documents of the token market system contract -(`AE6yYq65VdfGCg2MSyV9vV7cWGiFWjbwBuy7THesDh4e`), registered at genesis from protocol version 15 -and inserted by the upgrade to 15. It has two document types, `ask` (a listing) and `bid` (an +(`AE6yYq65VdfGCg2MSyV9vV7cWGiFWjbwBuy7THesDh4e`), registered at genesis from protocol version 16 +and inserted by the upgrade to 16. It has two document types, `ask` (a listing) and `bid` (an offer), each with three indexes: | Index | Properties | Serves | diff --git a/packages/data-contracts/src/lib.rs b/packages/data-contracts/src/lib.rs index 7ee3f71f725..b4343a1d263 100644 --- a/packages/data-contracts/src/lib.rs +++ b/packages/data-contracts/src/lib.rs @@ -67,9 +67,9 @@ pub enum SystemDataContract { /// vote poll it funds (protocol version 15). Registered from protocol version 15 on: /// registered at genesis by chains born at 15 and inserted by the upgrade to 15. DecisionProposals = 11, - /// The open listings and offers of the token marketplace (protocol version 15). Registered - /// from protocol version 15 on: registered at genesis by chains born at 15 and inserted by - /// the upgrade to 15. + /// The open listings and offers of the token marketplace (protocol version 16). Registered + /// from protocol version 16 on: registered at genesis by chains born at 16 and inserted by + /// the upgrade to 16. TokenMarket = 12, } diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 19df88f7b42..2fb61ac1afd 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -96,6 +96,11 @@ tracing = { version = "0.1.41" } grovedb-commitment-tree = { workspace = true, optional = true } [dev-dependencies] +# The test platform versions: the token marketplace is tested under one until protocol version +# 16 has tables. +platform-version = { path = "../rs-platform-version", features = [ + "mock-versions", +] } tokio = { version = "1.40", features = ["full"] } pretty_assertions = { version = "1.4.1" } dpp = { path = ".", default-features = false, features = [ diff --git a/packages/rs-dpp/src/balances/total_tokens_balance/mod.rs b/packages/rs-dpp/src/balances/total_tokens_balance/mod.rs index d29cc435c1b..b0bc14dc2b7 100644 --- a/packages/rs-dpp/src/balances/total_tokens_balance/mod.rs +++ b/packages/rs-dpp/src/balances/total_tokens_balance/mod.rs @@ -12,7 +12,7 @@ pub struct TotalTokensBalance { /// all the tokens held in token shielded pools (0 before protocol version 14) pub total_token_shielded_pool_balances: SumTokenAmount, /// all the tokens the token marketplace holds in escrow for open listings (0 before - /// protocol version 15) + /// protocol version 16) pub total_token_order_escrow_balances: SumTokenAmount, } @@ -72,7 +72,7 @@ impl TotalTokensBalance { } // Every protocol version runs this check. The escrow term is zero below protocol - // version 15, where `calculate_total_tokens_balance` 0 and 1 report none, so this + // version 16, where `calculate_total_tokens_balance` 0 and 1 report none, so this // refusal and its share of the sum below cannot change their verdict. if total_token_order_escrow_balances < 0 { return Err(ProtocolError::CriticalCorruptedCreditsCodeExecution( diff --git a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/mod.rs b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/mod.rs index f022ecc2f2c..e12c5867ad7 100644 --- a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/mod.rs +++ b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/mod.rs @@ -156,10 +156,12 @@ impl TokenConfiguration { } /// A tradeable token (`marketplaceRules.tradeMode` `Tradeable`) is admitted from protocol - /// version 15 (`TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION`): below it the mode is refused as - /// not active, the refusal software that predates the marketplace gives by failing to decode - /// it. A tradeable token must also be transferable, since filling a listing or an offer moves - /// the token from one identity to another. Checked on contract create and update. + /// version 16 (`TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION`): below it the mode is + /// refused as not active. Software that predates protocol version 15 gives that refusal by + /// failing to decode the mode; protocol version 15 decodes it and refuses it here, as it has + /// no way to trade a token. A tradeable token must also be transferable, since filling a + /// listing or an offer moves the token from one identity to another. Checked on contract + /// create and update. pub fn validate_marketplace_rules( &self, token_contract_position: TokenContractPosition, @@ -1212,6 +1214,7 @@ mod marketplace_rules_tests { use crate::data_contract::associated_token::token_configuration_item::TokenConfigurationChangeItem; use crate::data_contract::associated_token::token_marketplace_rules::accessors::v0::TokenMarketplaceRulesV0Setters; use crate::data_contract::associated_token::token_marketplace_rules::v0::TokenTradeMode; + use platform_version::version::mocks::v5_test::TEST_PROTOCOL_VERSION_5; fn not_tradeable() -> TokenConfiguration { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()) @@ -1229,6 +1232,15 @@ mod marketplace_rules_tests { PlatformVersion::get(14).expect("expected protocol version 14") } + /// The protocol version that admits a tradeable token. While it has no tables of its own, + /// the test version that selects the token marketplace stands in for it; once it has them, + /// they are the ones used. + fn protocol_version_admitting_tradeable() -> &'static PlatformVersion { + PlatformVersion::get(TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION) + .or_else(|_| PlatformVersion::get(TEST_PROTOCOL_VERSION_5)) + .expect("expected a version that admits a tradeable token") + } + #[test] fn should_accept_a_token_that_is_not_tradeable_at_every_protocol_version() { let configurations = BTreeMap::from([(0, not_tradeable())]); @@ -1237,31 +1249,43 @@ mod marketplace_rules_tests { } } + /// Protocol version 15 decodes the mode, creates the marketplace's state and still refuses + /// the mode: every version below the one that admits it does. #[test] - fn should_refuse_a_tradeable_token_as_not_active_before_protocol_version_15() { + fn should_refuse_a_tradeable_token_as_not_active_before_protocol_version_16() { let configurations = BTreeMap::from([(1, tradeable())]); - let result = validate_token_configurations(&configurations, protocol_version_14()); - match result.errors.as_slice() { - [error - @ ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(inner))] => { - assert_eq!(inner.state_transition_type(), "TokenTradeModeTradeable"); - assert_eq!(inner.current_protocol_version(), 14); - assert_eq!( - inner.required_protocol_version(), - TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION - ); - assert_eq!(error.code(), 10603); + let protocol_version_15 = PlatformVersion::get(15).expect("expected protocol version 15"); + for platform_version in [protocol_version_14(), protocol_version_15] { + let result = validate_token_configurations(&configurations, platform_version); + match result.errors.as_slice() { + [error @ ConsensusError::BasicError(BasicError::StateTransitionNotActiveError( + inner, + ))] => { + assert_eq!(inner.state_transition_type(), "TokenTradeModeTradeable"); + assert_eq!( + inner.current_protocol_version(), + platform_version.protocol_version + ); + assert_eq!( + inner.required_protocol_version(), + TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION + ); + assert_eq!(inner.required_protocol_version(), 16); + assert_eq!(error.code(), 10603); + } + other => panic!("expected StateTransitionNotActiveError, got {other:?}"), } - other => panic!("expected StateTransitionNotActiveError, got {other:?}"), } } #[test] - fn should_accept_a_tradeable_transferable_token_from_protocol_version_15() { + fn should_accept_a_tradeable_transferable_token_from_protocol_version_16() { let configurations = BTreeMap::from([(0, tradeable())]); - assert!( - validate_token_configurations(&configurations, PlatformVersion::latest()).is_valid() - ); + assert!(validate_token_configurations( + &configurations, + protocol_version_admitting_tradeable() + ) + .is_valid()); } #[test] @@ -1269,7 +1293,8 @@ mod marketplace_rules_tests { let mut configuration = tradeable(); configuration.set_transferable(false); let configurations = BTreeMap::from([(3, configuration)]); - let result = validate_token_configurations(&configurations, PlatformVersion::latest()); + let result = + validate_token_configurations(&configurations, protocol_version_admitting_tradeable()); match result.errors.as_slice() { [error @ ConsensusError::BasicError(BasicError::NonTransferableTokenTradeableError( inner, @@ -1288,12 +1313,10 @@ mod marketplace_rules_tests { fn should_refuse_making_a_non_transferable_token_tradeable_through_its_configuration_item() { let mut configuration = not_tradeable(); configuration.set_transferable(false); + let platform_version = protocol_version_admitting_tradeable(); - let proposed = configuration.validate_trade_mode( - &TokenTradeMode::Tradeable, - 0, - PlatformVersion::latest(), - ); + let proposed = + configuration.validate_trade_mode(&TokenTradeMode::Tradeable, 0, platform_version); assert!(matches!( proposed.errors.as_slice(), [ConsensusError::BasicError( @@ -1304,7 +1327,7 @@ mod marketplace_rules_tests { configuration.apply_token_configuration_item( TokenConfigurationChangeItem::MarketplaceTradeMode(TokenTradeMode::Tradeable), ); - let applied = configuration.validate_marketplace_rules(0, PlatformVersion::latest()); + let applied = configuration.validate_marketplace_rules(0, platform_version); assert_eq!(applied.errors, proposed.errors); } diff --git a/packages/rs-dpp/src/data_contract/associated_token/token_marketplace_rules/v0/mod.rs b/packages/rs-dpp/src/data_contract/associated_token/token_marketplace_rules/v0/mod.rs index 370f9981d68..929570c8134 100644 --- a/packages/rs-dpp/src/data_contract/associated_token/token_marketplace_rules/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/associated_token/token_marketplace_rules/v0/mod.rs @@ -29,8 +29,8 @@ pub enum TokenTradeMode { NotTradeable, /// Holders may list the token at a price and make offers for it: listed tokens and offered /// credits are held in escrow until the order is filled or cancelled. Admitted from protocol - /// version 15 (`TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION`), and only on a transferable - /// token, since every fill moves the token from one identity to another. + /// version 16 (`TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION`), and only on a + /// transferable token, since every fill moves the token from one identity to another. Tradeable, } diff --git a/packages/rs-dpp/src/system_data_contracts.rs b/packages/rs-dpp/src/system_data_contracts.rs index 4c26d2df695..cd374605a75 100644 --- a/packages/rs-dpp/src/system_data_contracts.rs +++ b/packages/rs-dpp/src/system_data_contracts.rs @@ -1817,6 +1817,7 @@ mod token_market_tests { use crate::document::transfer::Transferable; use crate::nft::TradeMode; use crate::system_data_contracts::token_market_contract::v1::document_types::{ask, bid}; + use platform_version::version::mocks::v5_test::TEST_PLATFORM_V5; /// The order types are what the marketplace transitions rely on: only they create orders, /// orders stay mutable and deletable so a partial fill can rewrite them and a close can @@ -1824,8 +1825,10 @@ mod token_market_tests { /// `depth` index sums what the order holds in escrow. #[test] fn should_load_the_order_types_the_marketplace_writes() { + // The token marketplace starts with protocol version 16, which has no tables yet: the + // test version that selects it stands in. let contract = - load_system_data_contract(SystemDataContract::TokenMarket, PlatformVersion::latest()) + load_system_data_contract(SystemDataContract::TokenMarket, &TEST_PLATFORM_V5) .expect("the token market contract loads with full validation"); assert_eq!(contract.id(), token_market_contract::ID); assert_eq!(contract.owner_id(), token_market_contract::OWNER_ID); @@ -1908,10 +1911,15 @@ mod token_market_tests { } #[test] - fn should_not_exist_before_protocol_version_15() { - let platform_version = PlatformVersion::get(14).expect("protocol version 14"); - assert!( - load_system_data_contract(SystemDataContract::TokenMarket, platform_version).is_err() - ); + fn should_not_exist_before_protocol_version_16() { + for protocol_version in [14, 15] { + let platform_version = + PlatformVersion::get(protocol_version).expect("expected the protocol version"); + assert!( + load_system_data_contract(SystemDataContract::TokenMarket, platform_version) + .is_err(), + "protocol version {protocol_version}" + ); + } } } diff --git a/packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl b/packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl index 7ea1e4380ea..a3fc2ace36c 100644 --- a/packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl +++ b/packages/rs-dpp/tests/fixtures/stored_contracts/stored.jsonl @@ -9,7 +9,6 @@ {"contract":"system AppConnect","sha256":"4d6dd642c6f74fe2fcfd04696bd8d58b8ca418586619301b235fe7729f73c09a","indexStructures":"05f449543911990d081569c8124f9fbb312a5d3dcbbe045d6f7dfb0a14dd8da4","bytes":"Au+WDqVpcuutvviifvfaXIH/S7OKApaXRX4k2kK3m1S3AgAAAAABAQAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARBsb2dpbktleVJlc3BvbnNlFgsSBHR5cGUSBm9iamVjdBIQZG9jdW1lbnRzTXV0YWJsZRMAEgxjYW5CZURlbGV0ZWQTARIXY3JlYXRpb25SZXN0cmljdGlvbk1vZGUCABIHaW5kaWNlcxUBFgISBG5hbWUSCWJ5UmVxdWVzdBIIdGVybWluYWwVAhIWYXBwRXBoZW1lcmFsUHViS2V5SGFzaBIIJG93bmVySWQSCnByb3BlcnRpZXMWAxIWYXBwRXBoZW1lcmFsUHViS2V5SGFzaBYGEgR0eXBlEgVhcnJheRIJYnl0ZUFycmF5EwESCG1pbkl0ZW1zAhQSCG1heEl0ZW1zAhQSC2Rlc2NyaXB0aW9uEl5oYXNoMTYwIG9mIHRoZSBlcGhlbWVyYWwgcHVibGljIGtleSB0aGUgYXBwIHB1dCBpbiBpdHMgY29ubmVjdCByZXF1ZXN0OyBpZGVudGlmaWVzIHRoZSByZXF1ZXN0Eghwb3Np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AEAAAE8AfsCPAABAAAAAQABAxZhcHBFcGhlbWVyYWxQdWJLZXlIYXNoFXdhbGxldEVwaGVtZXJhbFB1YktleRBlbmNyeXB0ZWRQYXlsb2FkAAAAAAAAAAAA"} {"contract":"system ModerationCharters","sha256":"08e879d58b351ca5dbb3beb72f0c2905679a24233c4aef7682a5cf4d7bae24cb","indexStructures":"959daf512c8055ab2f16c63e84b5ca8cbf1fba87c461bbc30279be340c74ad35","bytes":"AsUG5khqxlKB/YcrVrm2EXCkf2AFa7mcLg4Kbe1N5PiBAgAAAAABAQAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABw5hZGRlZE1vZGVyYXRvchYIEgR0eXBlEgZvYmplY3QSEGRvY3VtZW50c011dGFibGUTABIMY2FuQmVEZWxldGVkEwESB2luZGljZXMVARYDEgRuYW1lEhZieUVsZWN0ZWRDaGFydGVyTWVtYmVyEgpwcm9wZXJ0aWVzFQIWARIQZWxlY3RlZENoYXJ0ZXJJZBIDYXNjFgESCG1lbWJlcklkEgNhc2MSBnVuaXF1ZRMBEgpwcm9wZXJ0aWVzFgMSEGVsZWN0ZWRDaGFydGVySWQWCBIEdHlwZRIFYXJyYXkSCWJ5dGVBcnJheRMBEghtaW5JdGVtcwIgEghtYXhJdGVtcwIgEhBjb250ZW50TWVkaWFUeXBlEiFhcHBsaWNhdGlvbi94LmRhc2guZHBwLmlkZW50aWZpZXISCHJlZmVyc1RvFgMSBHR5cGUSEXBlcm1hbmVudERvY3VtZW50Egxkb2N1bWVudFR5cGUSDmVsZWN0ZWRDaGFydGVyEgV3aGVyZRYCEggkb3duZXJJZBIIJG93bmVySWQSEnN1Ym1pdHRlZENoYXJ0ZXJJZBISc3VibWl0dGVkQ2hhcnRlcklkEgtkZXNjcmlwdGlvbhIrVGhlIHNlYXRlZCBjaGFydGVyOyBvbmx5IGl0cyBsZWFkZXIgbWF5IGFkZBIIcG9zaXRpb24CABISc3VibWl0dGVkQ2hhcnRlcklk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AAgKJGNyZWF0ZWRBdAtkZXNjcmlwdGlvbgdyZWFzb25zC3Jld2FyZFNwbGl0E3Jld2FyZFNwbGl0LmFjdGlvbnMRcmV3YXJkU3BsaXQuZXF1YWwScmV3YXJkU3BsaXQubGVhZGVyEHRhcmdldENvbnRyYWN0SWQAAAAAAAAAAAAAAAAAAAAAAQECAAAAAAAAAAAAAAAAAAAAAAAAAAAAARJyZXdhcmRTcGxpdElzV2hvbGUAAAYDARJyZXdhcmRTcGxpdC5sZWFkZXIAARFyZXdhcmRTcGxpdC5lcXVhbAABE3Jld2FyZFNwbGl0LmFjdGlvbnMAAMgAAAACAPsBZgABAAIAAAEBBRB0YXJnZXRDb250cmFjdElkAAEAAwAAAAEAAAEgASAAAQAAAAtkZXNjcmlwdGlvbgABAAUAAAAAAQEBAfsQAAH7EAAAAAAHcmVhc29ucwABAAMAAAABAQABAAMAAAABAAABIAEgAAEAAAAAAQABQAEBAAAAAA9tb2RlcmF0b3JzU2hhcmUAAQAGAAAAAAABAQIAAQJkAAAAAAtyZXdhcmRTcGxpdAABAAIAAAEBAwZsZWFkZXIAAQAGAAAAAAABAQIAAQJkAAAAAAVlcXVhbAABAAYAAAAAAAEBAgABAmQAAAAAB2FjdGlvbnMAAQAGAAAAAAABAQIAAQJkAAAAAAEAAQMGbGVhZGVyBWVxdWFsB2FjdGlvbnMAAAAAAAAAAQABBBB0YXJnZXRDb250cmFjdElkC2Rlc2NyaXB0aW9uB3JlYXNvbnMLcmV3YXJkU3BsaXQAAAAAAAAAAAA="} {"contract":"system DecisionProposals","sha256":"ad1fd3ed595e76cb6cbb2f4c0d6493bf9c9d66d2a7f4f84c2d5742089fd7a895","indexStructures":"0b3ce0e20cde7b45a89351adea5ee84da634ab0b36268c00891c7917a5969bc8","bytes":"AihRCgKmaz7aBrhvyubaqp21d2bTw3JcyFpYzR6uMcvIAgAAAAABAQAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwZjaG9pY2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R1cm5vdXRQZXJjZW50AAEABgAAAAAAAQECAAECMgAAAAAHZW5kRGF0ZQABAAYAAAAAAAEBAgAAAAAAAAEAAQUFdGl0bGULZGVzY3JpcHRpb24LcGFzc1BlcmNlbnQVbWluaW11bVR1cm5vdXRQZXJjZW50B2VuZERhdGUAAAAAAAAAAAA="} -{"contract":"system TokenMarket","sha256":"a76774b65159a4ff93874a556e72cd29a7d7d3aa35fcd972e76e3b2e85cf2d0e","indexStructures":"8ff1e8772d7b8e32e036dc6ef3324be80c0bd02177c35fac5f18419a6926d279","bytes":"AokUfSEJcaCMnscCt0vmRybVw0ENgSAKW+J05qRNZQCTAgAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgNhc2sWBxIEdHlwZRIGb2JqZWN0EgtkZXNjcmlwdGlvbhK5VG9rZW5zIGEgaG9sZGVyIG9mZmVycyBmb3Igc2FsZSBhdCBhIHByaWNlLiBXcml0dGVuIG9ubHkgYnkgdGhlIHRva2VuIG1hcmtldHBsYWNlIHRyYW5zaXRpb25zOiB0aGUgbGlzdGVkIHRva2VucyBhcmUgaGVsZCBpbiBlc2Nyb3cgdW5kZXIgdGhlIG9yZGVyJ3MgaWQgdW50aWwgaXQgaXMgZmlsbGVkIG9yIGNhbmNlbGxlZC4SF2NyZWF0aW9uUmVzdHJpY3Rpb25Nb2RlAgISB2luZGljZXMVAxYCEgRuYW1lEgRib29rEgpwcm9wZXJ0aWVzFQQWARIHdG9rZW5JZBIDYXNjFgESCGRlY2ltYWxzEgNhc2MWARIFcHJpY2USA2FzYxYBEgokY3JlYXRlZEF0EgNhc2MWBBIEbmFtZRIFZGVwdGgSCnByb3BlcnRpZXMVAxYBEgd0b2tlbklkEgNhc2MWARIIZGVjaW1hbHMSA2FzYxYBEgVwcmljZRIDYXNjEghzdW1tYWJsZRIJcmVtYWluaW5nEg1yYW5nZVN1bW1hYmxlEwEWAhIEbmFtZRIHYnlPd25lchIKcHJvcGVydG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klkAQokY3JlYXRlZEF0AQABAAAAAAAAAAAAAAAAAAAAAAAAAAAFZGVwdGgFZGVwdGgDB3Rva2VuSWQBCGRlY2ltYWxzAQVwcmljZQEAAQAAAAEGZXNjcm93AQAAAAAAAAAAAAAAAAAAAAABB3Rva2VuSWQACAokY3JlYXRlZEF0CiR1cGRhdGVkQXQGYW1vdW50CGRlY2ltYWxzBmVzY3JvdwVwcmljZQlyZW1haW5pbmcHdG9rZW5JZAAAAAAAAAAAAAEBAAAAAgAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAOUAAQACAAABAQYHdG9rZW5JZAABAAMAAAABAAABIAEgAAEAAAAFcHJpY2UAAQAGAAAAAAABAQIBAAAAAAAGYW1vdW50AAEABgAAAAAAAQECAQAAAAAACXJlbWFpbmluZwABAAYAAAAAAAEBAgEAAAAAAAZlc2Nyb3cAAQAGAAAAAAABAQIAAAAAAAAIZGVjaW1hbHMAAQAGAAAAAAABAQIAAQL7AP8AAAAAAQABBgd0b2tlbklkBXByaWNlBmFtb3VudAlyZW1haW5pbmcIZGVjaW1hbHMGZXNjcm93AAAAAAAAAAAA"} {"contract":"mainnet 2NZwXdb3wGQzbWQeQZHFAaL4GuQzuzF2v8iQfcKuUC5q","sha256":"f88948650030b46642a88f5bbe753b611fea8bc426736536ed92fcc34f046775","indexStructures":"4fe79ced8e35b61d7ebb7b90bd5e022c8ce761fd5f1ad500616b65d7ead95eb0","bytes":"AhRiISPCxl4HHAwk/78Fz+U539mkTynR9H2sHE/5Ej8cAAAAAAABAQAAAThF4gNxUKAYvnAU+jjyexfXrK+scXqTTb3Iz5asr4nFAAEFb2ZmZXIWBRIEdHlwZRIGb2JqZWN0EgdpbmRpY2VzFQUWAxIEbmFtZRIYdG9NZXRvTWVWaWF0b1V0b1VWaWFVUEF0Egpwcm9wZXJ0aWVzFQUWARIEdG9NZRIDYXNjFgESB3RvTWVWaWESA2FzYxYBEgN0b1USA2FzYxYBEgZ0b1VWaWESA2FzYxYB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AEABQAAAAABAQABIgAAAAAGZXhSYXRlAAEABgAAAAAAAQECAAEC/QAACRhOcqAAAAAAAAtpbnN0cnVjdGlvbgABAAUAAAAAAQEAAfsCWAAAAAAGbWluQW10AAEABgAAAAAAAQECAAEC/QAAAOjUpRAAAAAAAAZtYXhBbXQAAQAGAAAAAAABAQIAAQL9AAAA6NSlEAAAAAAABmFjdGl2ZQABAAEAAAAAAAAAB215U3RvcmUAAQABAAAAAAAAAAEAAQsEdG9NZQd0b01lVmlhCnRvTWVIYW5kbGUDdG9VBnRvVVZpYQZleFJhdGULaW5zdHJ1Y3Rpb24GbWluQW10Bm1heEFtdAZhY3RpdmUHbXlTdG9yZQAAAAAAAAAAAA=="} {"contract":"mainnet 2UDyunHraJLbg1TqjYBHhVoaCetPKcy5aAVdGYxmWZga","sha256":"a3353b8902cb43493e3f2748ee49e9d30b41039ca87e7ef65c82b5b9cf7bcada","indexStructures":"74eaa293ce4381e8af811c0b929a7993cbe2ef218f2f7f9452e0f3dbf0d4ed03","bytes":"AhXVC/KBoXOMVjfhmUg5RJO8HV2kSxbGS8a+p1IpXs9fAAAAAAABAQAAASj+fLksRsQidDbOM1gGlYam9hkWlYmgY835HLI6FUqTAAEEbm90ZRYEEgR0eXBlEgZvYmplY3QSCnByb3BlcnRpZXMWARIHbWVzc2FnZRYDEgR0eXBlEgZzdHJpbmcSCW1heExlbmd0aAN+Eghwb3NpdGlvbgMAEgdpbmRpY2VzFQEWAxIEbmFtZRIHbWVzc2FnZRIKcHJvcGVydGllcxUBFgESB21lc3NhZ2USA2FzYxIGdW5pcXVlEwASFGFkZGl0aW9uYWxQcm9wZXJ0aWVzEwAAAAAAAAAAAAAAAQRub3RlAAEHbWVzc2FnZQsAAT8AAAAAAAAAAAEHbWVzc2FnZQsAAT8AAAAAAAAAAAEHbWVzc2FnZQdtZXNzYWdlAQdtZXNzYWdlAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIALQABAAIAAAEBAQdtZXNzYWdlAAEABQAAAAABAAE/AAAAAAEAAAAAAAAAAAAAAA=="} {"contract":"mainnet 2hdxAYHjecJyd5o1nDYqZnabN3f9ZqywKit2KUsEEo83","sha256":"06f6c76a08b9cec87a5ff9332db453a01d71f2590b2ee97f6ee781dc81ed22c1","indexStructures":"84a3291cdd8603ad82c4a90605f117775acfe5c1f4b078bde3ba9e9d0ed5e67a","bytes":"AhlEszYc95lpJlqvyxkehqFoYLXdlambfi9rduesib3oAAAAAAABAQAAAjUKspTG4VmUvLItWG9X30oWgDAlKQcBO3o6bkg/hpLtAAQFb2ZmZXIWBxIEdHlwZRIGb2JqZWN0EhBkb2N1bWVudHNNdXRhYmxlEwESDGNhbkJlRGVsZXRlZBMBEgpwcm9wZXJ0aWVzFgoSBHBhaXIWBBIEdHlwZRIGc3RyaW5nEgltYXhMZW5ndGgCIBILZGVzY3JpcHRpb24SNVRyYWRpbmcgcGFpciBsYWJlbCwgZS5nLiBERVhZL0RBU0ggb3IgREVYWS9PVEhFUlRPS0VOEghwb3NpdGlvbgIAEgRzaWRlFgUSBHR5cGUSBnN0cmluZxIJbWF4TGVuZ3RoAggSBGVudW0VAhIDYnV5EgRzZWxsEgtkZXNjcmlwdGlvbhJHTWFrZXIncyBzaWRlIGZyb20gdGhlIHBlcnNwZWN0aXZlIG9mIHRoZSBiYXNlIChmaXJzdCkgYXNzZXQgaW4gdGhlIHBhaXISCHBvc2l0aW9uAgESDmdpdmVDb250cmFjdElkFgUSBHR5cGUSBnN0cmluZxIJbWluTGVuZ3RoAioSCW1heExlbmd0aAIsEgtkZXNjcmlwdGlvbhI7RGF0YSBjb250cmFjdCBpZCBvZiB0aGUgdG9rZW4gdGhlIG1ha2VyIGlzIG9mZmVyaW5nIHRvIGdpdmUSCHBvc2l0aW9uAgISEWdpdmVUb2tlblBvc2l0aW9uFgUSBHR5cGUSB2ludGVnZXISB21pbmltdW0CAB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hbWUGc3ltYm9sD3Rva2VuQ29udHJhY3RJZA10b2tlblBvc2l0aW9uAAAAAAAAAAAAAQEAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAyQABAAIAAAEBBQ90b2tlbkNvbnRyYWN0SWQAAQAFAAAAAAEBKgEsAAAAAA10b2tlblBvc2l0aW9uAAEABgAAAAAAAQECAAEC+///AAAAAAZzeW1ib2wAAQAFAAAAAAEAARAAAAAABG5hbWUAAQAFAAAAAAEAAUAAAAAAAmF0AAEABgAAAAAAAQECAAAAAAAAAQABBQ90b2tlbkNvbnRyYWN0SWQNdG9rZW5Qb3NpdGlvbgZzeW1ib2wEbmFtZQJhdAAAAAAAAAAAAA=="} diff --git a/packages/rs-dpp/tests/stored_contract_compatibility.rs b/packages/rs-dpp/tests/stored_contract_compatibility.rs index 8af237ff9b4..48f63e21971 100644 --- a/packages/rs-dpp/tests/stored_contract_compatibility.rs +++ b/packages/rs-dpp/tests/stored_contract_compatibility.rs @@ -44,8 +44,9 @@ const UPDATE: &str = "UPDATE_STORED_CONTRACT_FIXTURE"; const FIXTURE: &str = "tests/fixtures/stored_contracts/stored.jsonl"; -/// The system contracts protocol version 15 has: every slot but the reserved feature flags. -const SYSTEM_CONTRACTS: [SystemDataContract; 12] = [ +/// The system contracts protocol version 15 has: every slot but the reserved feature flags and +/// the token market contract, which arrives with the token marketplace in protocol version 16. +const SYSTEM_CONTRACTS: [SystemDataContract; 11] = [ SystemDataContract::Withdrawals, SystemDataContract::MasternodeRewards, SystemDataContract::DPNS, @@ -57,7 +58,6 @@ const SYSTEM_CONTRACTS: [SystemDataContract; 12] = [ SystemDataContract::AppConnect, SystemDataContract::ModerationCharters, SystemDataContract::DecisionProposals, - SystemDataContract::TokenMarket, ]; /// Contracts written for the fixture, in JSON, for what neither the system contracts nor the diff --git a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v1/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v1/mod.rs index 00263e4e8f7..3cf8c6cae1d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v1/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/v1/mod.rs @@ -99,8 +99,9 @@ impl Platform { ); } - // The token market contract activates with protocol version 15: a chain born at 15 - // registers it at genesis, an older chain gets it from `transition_to_version_15`. + // The token market contract activates with the token marketplace, at protocol version + // 16: a chain born at that version or later registers it at genesis, an older chain + // gets it from the upgrade to it. if platform_version.protocol_version >= TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION { system_data_contract_types.insert( SystemDataContract::TokenMarket, @@ -156,6 +157,7 @@ mod tests { use dpp::data_contracts::SystemDataContract; use dpp::prelude::Identifier; use drive::config::DriveConfig; + use platform_version::version::mocks::v5_test::TEST_PROTOCOL_VERSION_5; use platform_version::version::{PlatformVersion, INITIAL_PROTOCOL_VERSION}; #[test] @@ -330,14 +332,21 @@ mod tests { } } - /// The token market contract joins the genesis state at protocol version 15. + /// The token market contract joins the genesis state at protocol version 16, with the + /// token marketplace. That version has no tables yet, so the test version that selects + /// the marketplace stands in for it. #[test] - pub fn should_register_the_token_market_contract_only_from_protocol_version_15() { + pub fn should_register_the_token_market_contract_only_from_protocol_version_16() { let token_market_id = SystemDataContract::TokenMarket.id(); for (platform_version, expected) in [ (PlatformVersion::get(14).expect("protocol 14"), false), - (PlatformVersion::latest(), true), + (PlatformVersion::get(15).expect("protocol 15"), false), + ( + PlatformVersion::get(TEST_PROTOCOL_VERSION_5) + .expect("the token marketplace test version"), + true, + ), ] { let initial_protocol_version = platform_version.protocol_version; let platform = TestPlatformBuilder::new() diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs index 17b31c0c2ab..8cab82658ba 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs @@ -927,8 +927,7 @@ where /// trigger, re-store the DashPay contract whose v3 schema states the checks of /// both its data triggers, create the vote decisions trees that yes/no polls /// live in, insert the decision proposals contract whose proposals open those - /// polls, add the token marketplace: its escrow trees and the token market - /// contract, and reconcile the operator payouts of Platform's masternode list + /// polls, and reconcile the operator payouts of Platform's masternode list /// with Dash Core's. fn transition_to_version_15( &self, @@ -1007,30 +1006,6 @@ where platform_version, )?; - // Token marketplace escrow trees (v15 note 17): the BigSumTree under the Tokens tree of - // the tokens open listings hold, and the SumTree under the prefunded specialized - // balances of the credits open offers hold. The same helper builds them at genesis - // (`create_initial_state_structure_v5`), last, so both node populations build the same - // `[Tokens]` and `[PreFundedSpecializedBalances]` subtrees. - self.drive - .insert_token_order_escrow_trees(Some(transaction), platform_version)?; - - // Token market contract: the open listings and offers of the token marketplace, one - // system contract id on every network from this version. Fresh chains register it at - // genesis (`create_genesis_state` v1). Stored without storage flags, as genesis stores - // system contracts. - let token_market_contract = - load_system_data_contract(SystemDataContract::TokenMarket, platform_version)?; - - self.drive.apply_contract( - &token_market_contract, - *block_info, - true, - None, - Some(transaction), - platform_version, - )?; - Ok(()) } } @@ -4583,31 +4558,40 @@ mod tests { ); } - /// The token marketplace escrow trees are built by two paths that must coincide byte for - /// byte: `Drive::create_initial_state_structure_v5` at a v15 genesis and - /// `transition_to_version_15` on a chain upgraded from v14. + /// The token marketplace starts with protocol version 16: protocol version 15 creates + /// neither of its escrow trees nor the token market contract, at genesis or on the upgrade. #[test] - fn test_genesis_v15_and_upgrade_to_v15_build_identical_token_order_escrow_trees() { + fn should_not_create_the_token_marketplace_at_genesis_v15_or_on_the_upgrade_to_v15() { use drive::drive::prefunded_specialized_balances::PREFUNDED_BALANCES_FOR_TOKEN_ORDERS; use drive::drive::tokens::paths::TOKEN_ORDER_ESCROW_KEY; let platform_version_15 = PlatformVersion::get(15).expect("expected v15"); + let token_market_id = SystemDataContract::TokenMarket.id(); - let platform_a = TestPlatformBuilder::new() + let born_at_15 = TestPlatformBuilder::new() .with_initial_protocol_version(15) .build_with_mock_rpc() .with_no_core_masternodes() .set_genesis_state(); - let platform_b = TestPlatformBuilder::new() + let upgraded_to_15 = TestPlatformBuilder::new() .with_initial_protocol_version(14) .build_with_mock_rpc() .with_no_core_masternodes() .set_genesis_state(); - // A genuine v14 genesis has neither escrow tree yet. + let transaction = upgraded_to_15.drive.grove.start_transaction(); + upgraded_to_15 + .transition_to_version_15( + &mut PlatformState::clone(&upgraded_to_15.state.load()), + &BlockInfo::default(), + &transaction, + platform_version_15, + ) + .expect("upgrade: transition_to_version_15 should succeed"); + + for (platform, transaction) in [(&born_at_15, None), (&upgraded_to_15, Some(&transaction))] { - let txn = platform_b.drive.grove.start_transaction(); for (root, key) in [ (RootTree::Tokens as u8, TOKEN_ORDER_ESCROW_KEY), ( @@ -4616,186 +4600,44 @@ mod tests { ), ] { let root_path: [&[u8]; 1] = [&[root]]; - let escrow_root = platform_b.drive.grove.get( + let escrow_root = platform.drive.grove.get( SubtreePath::from(&root_path[..]), &[key], - Some(&txn), + transaction, &platform_version_15.drive.grove_version, ); assert!( escrow_root.value.is_err(), - "v14 genesis must not contain the escrow tree {key} under root {root}; got {:?}", + "protocol version 15 must not hold the escrow tree {key} under root {root}; got {:?}", escrow_root.value ); } - } - - let txn_b = platform_b.drive.grove.start_transaction(); - platform_b - .transition_to_version_15( - &mut PlatformState::clone(&platform_b.state.load()), - &BlockInfo::default(), - &txn_b, - platform_version_15, - ) - .expect("upgrade: transition_to_version_15 should succeed"); - let roots = [ - RootTree::Tokens as u8, - RootTree::PreFundedSpecializedBalances as u8, - ]; - // `collect_subtree_diffs` walks one subtree from its path, so each root is compared on - // its own. - let mut diffs = Vec::new(); - for root in roots { - diffs.extend(collect_subtree_diffs( - &platform_a, - &platform_b, - &txn_b, - vec![vec![root]], - )); - } - assert!( - diffs.is_empty(), - "CONSENSUS FORK: the [Tokens] or [PreFundedSpecializedBalances] subtree differs \ - between a fresh genesis-v15 node and an in-place-upgraded v15 node.\n{}", - diffs.join("\n"), - ); - - // The children agree; the Merk of each root holds the new key itself, so compare the - // root elements too, which carry its root key and sum. - let root_element = |platform: &crate::platform_types::platform::Platform< - crate::rpc::core::MockCoreRPCLike, - >, - root: u8, - txn: drive::grovedb::TransactionArg| { - platform - .drive - .grove - .get_raw( - drive::grovedb_path::SubtreePath::empty(), - &[root], - txn, - &platform_version_15.drive.grove_version, - ) - .unwrap() - .expect("expected to read the root element") - }; - for root in roots { - assert_eq!( - root_element(&platform_a, root, None), - root_element(&platform_b, root, Some(&txn_b)), - "CONSENSUS FORK: the Merk of root {root} is shaped differently on a fresh \ - genesis-v15 node and an in-place-upgraded one" + assert!( + platform + .drive + .fetch_contract( + token_market_id.to_buffer(), + None, + None, + transaction, + platform_version_15, + ) + .value + .expect("expected to query the token market contract") + .is_none(), + "protocol version 15 must not hold the token market contract" ); - } - - // The walks above compare decoded keys and elements, which carry no Merk hash: two - // subtrees holding the same entries in a differently balanced tree would pass them. - // A tree element's value hash in its parent Merk commits to the root hash of the Merk - // below it, and so to everything that subtree holds and how it is arranged; a raw proof - // of the root element yields it. GroveDB proves only committed state, so the upgrade is - // committed first. - platform_b - .drive - .grove - .commit_transaction(txn_b) - .unwrap() - .expect("expected to commit the upgrade"); - let subtree_hash = |platform: &crate::platform_types::platform::Platform< - crate::rpc::core::MockCoreRPCLike, - >, - root: u8| { - let grove_version = &platform_version_15.drive.grove_version; - let query = drive::grovedb::PathQuery::new_single_key(vec![], vec![root]); - let proof = platform + assert!(platform .drive - .grove - .get_proved_path_query(&query, None, None, grove_version) - .unwrap() - .expect("expected to prove the root element"); - let (_, proved) = - drive::grovedb::GroveDb::verify_query_raw(&proof, &query, grove_version) - .expect("expected the proof of the root element to verify"); - assert_eq!(proved.len(), 1, "expected the root element alone"); - proved[0].proof - }; - for root in roots { - assert_eq!( - subtree_hash(&platform_a, root), - subtree_hash(&platform_b, root), - "CONSENSUS FORK: root {root} authenticates to a different hash on a fresh \ - genesis-v15 node and an in-place-upgraded one" - ); + .cache + .system_data_contracts + .find_by_id(token_market_id, platform_version_15) + .expect("expected the lookup to succeed") + .is_none()); } } - #[test] - fn should_insert_the_token_market_contract_on_transition_to_version_15() { - use dpp::data_contract::accessors::v0::DataContractV0Getters; - - let platform = TestPlatformBuilder::new() - .with_initial_protocol_version(14) - .build_with_mock_rpc() - .with_no_core_masternodes() - .set_genesis_state(); - - let platform_version_14 = PlatformVersion::get(14).expect("expected platform version 14"); - let platform_version = PlatformVersion::get(15).expect("expected platform version 15"); - let token_market_id = SystemDataContract::TokenMarket.id(); - - let transaction = platform.drive.grove.start_transaction(); - - assert!( - platform - .drive - .fetch_contract( - token_market_id.to_buffer(), - None, - None, - Some(&transaction), - platform_version_14, - ) - .value - .expect("expected to query the token market contract") - .is_none(), - "the token market contract must not exist before transition_to_version_15" - ); - - platform - .transition_to_version_15( - &mut PlatformState::clone(&platform.state.load()), - &BlockInfo::default(), - &transaction, - platform_version, - ) - .expect("expected the transition to succeed"); - - let stored = platform - .drive - .fetch_contract( - token_market_id.to_buffer(), - None, - None, - Some(&transaction), - platform_version, - ) - .value - .expect("expected to fetch the token market contract") - .expect("the token market contract must exist after transition_to_version_15"); - - assert_eq!(stored.contract.id(), token_market_id); - assert_eq!(stored.contract.owner_id(), Identifier::from([0u8; 32])); - assert_eq!(stored.contract.document_types().len(), 2); - assert!(platform - .drive - .cache - .system_data_contracts - .find_by_id(token_market_id, platform_version) - .expect("expected the post-activation lookup to succeed") - .is_some()); - } - /// CONSENSUS-CRITICAL equivalence guard for the v11→v12 boundary. /// /// The `[ShieldedBalances]` subtree is built two ways that MUST be diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v3/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v3/mod.rs index 35e83fe7629..64cbae8f07a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v3/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v3/mod.rs @@ -256,7 +256,7 @@ mod tests { .unwrap(); assert_eq!( hex::encode(root), - "e5d0618fe04440f521c7ae1f7e4f7ae1eabe62a12211538208faa5d4431f7404", + "eb3abfdbeb12039eaf6e9c45e8daafb8803482288090be30255faafac936948e", "activation includes the current system contracts and retained-history migration", ); roots.push(root); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs index 9fc1c20a620..2780f26f314 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/traits/is_allowed.rs @@ -172,8 +172,10 @@ impl StateTransitionIsAllowedValidationV0 for StateTransition { } if platform_version.protocol_version < TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION { // The token marketplace: a configuration update that makes a token - // tradeable. Software older than the marketplace cannot decode one, so it - // is refused unpaid, as that software refuses it. + // tradeable. Software older than protocol version 15 cannot decode one, so + // it is refused unpaid, as that software refuses it. Protocol version 15 + // decodes one and refuses it the same way: it has no order transitions, + // and no contract may store the mode before they ship. if let Some(transition) = st.transitions_iter() .find_map(|transition| match transition { @@ -805,6 +807,7 @@ mod tests { use dpp::data_contract::associated_token::token_marketplace_rules::v0::TokenTradeMode; use dpp::platform_value::BinaryData; use dpp::prelude::IdentityNonce; + use dpp::version::mocks::v5_test::TEST_PROTOCOL_VERSION_5; use dpp::state_transition::batch_transition::batched_transition::token_config_update_transition::{TokenConfigUpdateTransition, TokenConfigUpdateTransitionV0}; use dpp::state_transition::batch_transition::batched_transition::BatchedTransition; use dpp::state_transition::batch_transition::BatchTransitionV1; @@ -812,9 +815,23 @@ mod tests { use dpp::tests::fixtures::get_data_contract_fixture; use platform_version::TryIntoPlatformVersioned; - fn protocol_version_14() -> &'static PlatformVersion { - PlatformVersion::get(TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION - 1) - .expect("the version before the token marketplace") +/// The versions that refuse a tradeable token: the last whose software cannot decode +/// the mode, and protocol version 15, which decodes it but creates none of its state. + fn protocol_versions_before_tradeable() -> [&'static PlatformVersion; 2] { + [ + PlatformVersion::get(14).expect("expected protocol version 14"), + PlatformVersion::get(TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION - 1) + .expect("the version before tradeable tokens"), + ] + } + + /// The protocol version that admits a tradeable token. While it has no tables of its own, + /// the test version that selects the token marketplace stands in for it; once it has them, + /// they are the ones used. + fn protocol_version_admitting_tradeable() -> &'static PlatformVersion { + PlatformVersion::get(TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION) + .or_else(|_| PlatformVersion::get(TEST_PROTOCOL_VERSION_5)) + .expect("expected a version that admits a tradeable token") } /// A batch whose only transition sets a token's trade mode to `trade_mode`. @@ -863,36 +880,38 @@ mod tests { } #[test] - fn should_refuse_making_a_token_tradeable_before_protocol_version_15() { - let result = trade_mode_update(TokenTradeMode::Tradeable) - .validate_is_allowed(protocol_version_14()) - .expect("should not error"); - assert_matches!( - result.errors.as_slice(), - [ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error))] - if error.state_transition_type() - == "TokenConfigUpdateMarketplaceTradeModeTradeable" - && error.current_protocol_version() == 14 - && error.required_protocol_version() - == TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION - ); + fn should_refuse_making_a_token_tradeable_before_protocol_version_16() { + for platform_version in protocol_versions_before_tradeable() { + let result = trade_mode_update(TokenTradeMode::Tradeable) + .validate_is_allowed(platform_version) + .expect("should not error"); + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error))] + if error.state_transition_type() + == "TokenConfigUpdateMarketplaceTradeModeTradeable" + && error.current_protocol_version() + == platform_version.protocol_version + && error.required_protocol_version() == 16 + ); + } } - /// Setting the trade mode to the only mode older software knows stays allowed. + /// Setting the trade mode to the mode every version knows stays allowed. #[test] - fn should_allow_setting_the_trade_mode_to_not_tradeable_before_protocol_version_15() { - let result = trade_mode_update(TokenTradeMode::NotTradeable) - .validate_is_allowed(protocol_version_14()) - .expect("should not error"); - assert!(result.is_valid(), "{:?}", result.errors); + fn should_allow_setting_the_trade_mode_to_not_tradeable_before_protocol_version_16() { + for platform_version in protocol_versions_before_tradeable() { + let result = trade_mode_update(TokenTradeMode::NotTradeable) + .validate_is_allowed(platform_version) + .expect("should not error"); + assert!(result.is_valid(), "{:?}", result.errors); + } } #[test] - fn should_allow_making_a_token_tradeable_from_protocol_version_15() { - let platform_version = PlatformVersion::get(TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION) - .expect("the version that introduced the token marketplace"); + fn should_allow_making_a_token_tradeable_from_protocol_version_16() { let result = trade_mode_update(TokenTradeMode::Tradeable) - .validate_is_allowed(platform_version) + .validate_is_allowed(protocol_version_admitting_tradeable()) .expect("should not error"); assert!(result.is_valid(), "{:?}", result.errors); } @@ -917,25 +936,26 @@ mod tests { } #[test] - fn should_refuse_a_contract_with_a_tradeable_token_before_protocol_version_15() { - let platform_version = protocol_version_14(); - let result = - contract_create_with_trade_mode(TokenTradeMode::Tradeable, platform_version) - .validate_is_allowed(platform_version) - .expect("should not error"); - assert_matches!( - result.errors.as_slice(), - [ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error))] - if error.state_transition_type() == "TokenTradeModeTradeable" - && error.required_protocol_version() - == TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION - ); + fn should_refuse_a_contract_with_a_tradeable_token_before_protocol_version_16() { + for platform_version in protocol_versions_before_tradeable() { + let result = + contract_create_with_trade_mode(TokenTradeMode::Tradeable, platform_version) + .validate_is_allowed(platform_version) + .expect("should not error"); + assert_matches!( + result.errors.as_slice(), + [ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error))] + if error.state_transition_type() == "TokenTradeModeTradeable" + && error.current_protocol_version() + == platform_version.protocol_version + && error.required_protocol_version() == 16 + ); + } } #[test] - fn should_allow_a_contract_with_a_tradeable_token_from_protocol_version_15() { - let platform_version = PlatformVersion::get(TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION) - .expect("the version that introduced the token marketplace"); + fn should_allow_a_contract_with_a_tradeable_token_from_protocol_version_16() { + let platform_version = protocol_version_admitting_tradeable(); let result = contract_create_with_trade_mode(TokenTradeMode::Tradeable, platform_version) .validate_is_allowed(platform_version) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/token/token_config_update_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/token/token_config_update_transition_action/structure_v0/mod.rs index 55f4006bebb..f92b970dbdd 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/token/token_config_update_transition_action/structure_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/action_validation/token/token_config_update_transition_action/structure_v0/mod.rs @@ -29,7 +29,8 @@ impl TokenConfigUpdateTransitionActionStructureValidationV0 for TokenConfigUpdat /// which Drive refuses for a read-only one. An update that is not performed yet, a group /// member's vote, is refused too, as the group action it opens or joins could never close. /// - /// Then the marketplace rules of the trade mode the update proposes (protocol version 15): a + /// Then the marketplace rules of the trade mode the update proposes (reached with a tradeable + /// mode from protocol version 16, the first whose `is_allowed` gate lets one through): a /// `MarketplaceTradeMode` item can make a token tradeable only if the token is transferable /// (`NonTransferableTokenTradeableError`, 10281), the rule contract create and update apply to /// the configuration they carry. `transferable` is fixed at creation and no other item changes diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/mod.rs index 7a34659aa3e..f0d4ab9056d 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/mod.rs @@ -57,6 +57,7 @@ mod tests { use dpp::system_data_contracts::token_market_contract; use dpp::system_data_contracts::token_market_contract::v1::document_types::{ask, bid}; use dpp::tokens::gas_fees_paid_by::GasFeesPaidBy; + use dpp::version::mocks::v5_test::TEST_PROTOCOL_VERSION_5; use drive::drive::contract::DataContractFetchInfo; use drive::state_transition_action::batch::batched_transition::document_transition::document_base_transition_action::{DocumentBaseTransitionAction, DocumentBaseTransitionActionV0}; use drive::state_transition_action::batch::batched_transition::document_transition::document_delete_transition_action::v0::DocumentDeleteTransitionActionV0; @@ -117,12 +118,15 @@ mod tests { } } - /// Through the version dispatch: the latest protocol version binds exactly one trigger to - /// each replace and delete of an `ask` and a `bid`, and running it refuses the write with - /// `DataTriggerConditionError`. Protocol version 14 binds none of them. + /// Through the version dispatch: the latest bindings bind exactly one trigger to each + /// replace and delete of an `ask` and a `bid`, and running it refuses the write with + /// `DataTriggerConditionError`. Protocol version 14 binds none of them. The token market + /// contract exists from protocol version 16, which has no tables yet, so the platform is + /// born at the test version that selects the token marketplace. #[test] fn should_refuse_order_writes_through_the_latest_bindings_and_bind_none_before_15() { let platform = TestPlatformBuilder::new() + .with_initial_protocol_version(TEST_PROTOCOL_VERSION_5) .build_with_mock_rpc() .set_genesis_state(); let state = platform.state.load(); @@ -131,7 +135,8 @@ mod tests { state: &state, config: &platform.config, }; - let latest = PlatformVersion::latest(); + let latest = PlatformVersion::get(TEST_PROTOCOL_VERSION_5) + .expect("expected the token marketplace test version"); let contract = platform .drive .get_contract_with_fetch_info( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/v3/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/v3/mod.rs index 09b1d669382..7278bc3242c 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/v3/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/data_triggers/bindings/list/v3/mod.rs @@ -20,7 +20,8 @@ use drive::state_transition_action::batch::batched_transition::document_transiti /// sent as a document transition. Only the token marketplace transitions write orders: /// creating one as a document is refused by `creationRestrictionMode` 2, and the types stay /// mutable and deletable, so documents carry a revision and storage flags for the partial -/// fills and closes the platform writes. +/// fills and closes the platform writes. The contract exists from protocol version 16, so +/// nothing matches these bindings under protocol version 15. /// /// Every other binding is v2's. #[inline(always)] diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/commit_reveal_lookup.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/commit_reveal_lookup.rs index f3468e73554..9cc1deffe40 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/commit_reveal_lookup.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/commit_reveal_lookup.rs @@ -904,8 +904,8 @@ mod commit_reveal_lookup_tests { ), ( 15, - (1_766_860, 9_720_000, 15_181_239), - (3_528_980, 75_411_000, 15_181_239) + (1_720_940, 9_720_000, 15_181_239), + (3_483_060, 75_411_000, 15_181_239) ), ] ); @@ -1877,13 +1877,15 @@ mod commit_reveal_lookup_tests { actual_fees.processing_fee, )); } - // A chain born at 15 also holds the decision proposals and token market contracts, - // two more siblings registered at genesis in the contracts tree; with both, the - // written post reads its contract for as many bytes as at 14. The lookups cost the - // same. + // A chain born at 15 also holds the decision proposals contract, one more sibling + // registered at genesis in the contracts tree, which reshapes it so the written post + // reads its contract for fewer bytes (-45_920). The lookups cost the same. + let ((found_at_14, found_storage_at_14), missing_at_14) = fees[0]; assert_eq!( - fees[0], fees[1], - "keyed by owner {keyed_by_owner}: the fees at 14, then at 15" + ((found_at_14 - 45_920, found_storage_at_14), missing_at_14), + fees[1], + "keyed by owner {keyed_by_owner}: the fees at 14 less the genesis shift, then at \ + 15" ); } } @@ -3117,10 +3119,10 @@ mod commit_reveal_lookup_tests { /// it consumes from what its lookup read, without reading it again. #[tokio::test] async fn should_pin_the_fees_of_a_reveal_choosing_the_first_of_its_preorders() { - // At 15 the contracts tree also holds the decision proposals and token market contracts, - // two more siblings registered at genesis; with both, the fixture contract's node is - // billed as many bytes to reach as at 14 - for (protocol_version, accepted_processing_fee) in [(14, 3_574_720), (15, 3_562_700)] { + // At 15 the contracts tree also holds the decision proposals contract, one more sibling + // registered at genesis, which reshapes it so the fixture contract's node is billed + // fewer bytes to reach (-45_920) + for (protocol_version, accepted_processing_fee) in [(14, 3_574_720), (15, 3_516_780)] { let platform_version = PlatformVersion::get(protocol_version).expect("expected the platform version"); let mut fixture = CommitRevealFixture::new_at(platform_version, |contract| { diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs index c76768a561b..65cd14bc534 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs @@ -20,8 +20,9 @@ mod deletion_tests { // increases byte-billed contract-tree reads. // The app-connect and moderation charters contracts each add one sibling to the // genesis contracts tree, increasing the bytes billed when reading that tree - // (protocol 14 only). The decision proposals and token market contracts add two more - // at protocol 15, which reshape the tree so the contract read is billed fewer bytes (-47_280). + // (protocol 14 only). The decision proposals contract adds another at protocol + // 15, which reshapes the tree so the contract's node is billed fewer bytes to + // reach (-47_280). // DashPay v3's privateContactRequest type makes its sibling node larger (+2_860). 1773020, ) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs index 2df11542360..d88df79566d 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns.rs @@ -37,9 +37,9 @@ mod dpns_tests { // increasing the bytes billed when reading that tree (protocol 14 only). The // moderation charters contract adds another, which reshapes the tree so the // DPNS contract's node is billed fewer bytes to reach (-287_760). The decision - // proposals and token market contracts add two more at protocol 15, and the DPNS - // node is billed more bytes to reach again (+137_760). - 5_899_360, + // proposals contract adds a third at protocol 15, which reshapes it back to as + // many bytes as with the app-connect contract alone (+287_760, 95_920 a create). + 6_049_360, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns_v3.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns_v3.rs index 6c7e8a8c976..5d77e246fdf 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns_v3.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/dpns_v3.rs @@ -1571,9 +1571,8 @@ mod dpns_v3_tests { } } // At 15 each create also reads the DPNS contract through a contracts tree holding the - // decision proposals and token market contracts, two more siblings registered at - // genesis, which reshape the tree so the DPNS contract's node is billed more bytes to - // reach (+95_920 a create). + // decision proposals contract, one more sibling registered at genesis, which reshapes + // the tree so the DPNS contract's node is billed more bytes to reach (+95_920 a create). assert_eq!( measured, vec![ diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs index ba9302c1f68..eff503ee8f7 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/replacement.rs @@ -525,8 +525,9 @@ mod replacement_tests { // increases byte-billed contract-tree reads. // The app-connect and moderation charters contracts each add one sibling to the // genesis contracts tree, increasing the bytes billed when reading that tree - // (protocol 14 only). The decision proposals and token market contracts add two more - // at protocol 15, which reshape the tree so the contract read is billed fewer bytes (-47_280). + // (protocol 14 only). The decision proposals contract adds another at protocol + // 15, which reshapes the tree so the contract's node is billed fewer bytes to + // reach (-47_280). // DashPay v3's privateContactRequest type makes its sibling node larger (+2_860). 1501720, ) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/token_market_orders.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/token_market_orders.rs index c6c243f48e7..1c82675045e 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/token_market_orders.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/token_market_orders.rs @@ -1,4 +1,4 @@ -//! The token market contract's orders (`ask` and `bid`, protocol version 15) through block +//! The token market contract's orders (`ask` and `bid`, protocol version 16) through block //! processing. Only the token marketplace transitions write an order, so a document //! transition replacing or deleting a stored order is refused by the reject data trigger, //! even when its owner signs it, and the order stays as stored. @@ -17,11 +17,19 @@ mod token_market_orders_tests { use dpp::state_transition::StateTransition; use dpp::system_data_contracts::token_market_contract; use dpp::system_data_contracts::token_market_contract::v1::document_types::{ask, bid}; + use dpp::version::mocks::v5_test::TEST_PROTOCOL_VERSION_5; use drive::util::object_size_info::{ DocumentAndContractInfo, DocumentInfo::DocumentRefInfo, OwnedDocumentInfo, }; use std::collections::BTreeMap; + /// The token market contract exists from protocol version 16, which has no tables yet: the + /// test version that selects the token marketplace stands in for it. + fn token_marketplace_version() -> &'static PlatformVersion { + PlatformVersion::get(TEST_PROTOCOL_VERSION_5) + .expect("expected the token marketplace test version") + } + /// An order of `document_type_name` owned by `owner_id`, for 10 units of `token_id` (a /// token of 6 decimals) at a price of 5, as the marketplace stores it. fn order( @@ -63,7 +71,7 @@ mod token_market_orders_tests { &format!("select * from {document_type_name}"), market, Some(&platform.config.drive), - PlatformVersion::latest(), + token_marketplace_version(), ) .expect("expected an order query"); platform @@ -89,7 +97,7 @@ mod token_market_orders_tests { &platform.state.load(), &BlockInfo::default(), &transaction, - PlatformVersion::latest(), + token_marketplace_version(), false, None, ) @@ -108,8 +116,9 @@ mod token_market_orders_tests { /// leaves both orders as stored. #[tokio::test] async fn should_refuse_a_signed_replace_or_delete_of_a_stored_order() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let mut platform = TestPlatformBuilder::new() + .with_initial_protocol_version(platform_version.protocol_version) .build_with_mock_rpc() .set_genesis_state(); let (owner, signer, key) = setup_identity(&mut platform, 961, dash_to_credits!(0.5)); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs index 78242a65169..5c543bf6fca 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/burn/mod.rs @@ -3963,10 +3963,10 @@ mod token_burn_tests { // +740 per document write from protocol version 14: the contract's version item is // one more node to rehash; -12_820: the documents expirations tree joins `Misc` // beside the token supplies tree the burn rewrites, reshaping the `Misc` Merk - // PROTOCOL_VERSION_15: +48_640: the decision proposals and token market contracts - // join the genesis contracts tree, which reshapes it so the token contract's node is - // billed more bytes to reach - 4_404_840, + // PROTOCOL_VERSION_15: -48_640: the decision proposals contract adds one + // sibling to the genesis contracts tree, which reshapes the tree so the token + // contract's node is billed fewer bytes to reach + 4_307_560, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/direct_selling/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/direct_selling/mod.rs index 90730a76378..911fe3476d8 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/direct_selling/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/direct_selling/mod.rs @@ -31,10 +31,10 @@ mod token_selling_tests { // reads the total supply even though the token sets no max supply. 12_820 credits // less in fees: the documents expirations tree joins `Misc` beside the token // supplies tree the purchase rewrites, reshaping the `Misc` Merk - // PROTOCOL_VERSION_15: 48_640 credits more in fees: the decision proposals and token - // market contracts join the genesis contracts tree, which reshapes it so the token - // contract's node is billed more bytes to reach - 699_868_001_200, + // PROTOCOL_VERSION_15: 48_640 credits less in fees: the decision proposals + // contract adds one sibling to the genesis contracts tree, which reshapes the tree + // so the token contract's node is billed fewer bytes to reach + 699_868_098_480, ) .await; } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/non_transferable/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/non_transferable/mod.rs index 8e1959a5d08..4851ca43680 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/non_transferable/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/non_transferable/mod.rs @@ -602,14 +602,14 @@ mod tradeable { } /// Sends the contract owner's update of the token's trade mode to `Tradeable` to the mempool - /// and then in one block, and returns what check_tx refused it with, the block's result and + /// and then in one block, at protocol version 15, and returns what check_tx refused it with, the block's result and /// the trade mode the token has afterwards. async fn make_tradeable( non_transferable: bool, ) -> (Vec, StateTransitionExecutionResult, bool) { - let platform_version = PlatformVersion::latest(); + let platform_version = PlatformVersion::get(15).expect("expected protocol version 15"); let mut platform = TestPlatformBuilder::new() - .with_latest_protocol_version() + .with_initial_protocol_version(15) .build_with_mock_rpc() .set_genesis_state(); @@ -718,37 +718,30 @@ mod tradeable { (check_tx_errors, result, is_tradeable) } - /// The rule reads only the contract the action carries, so it runs with the batch's advanced - /// structure and the mempool refuses the update too. + /// Before protocol version 16 nothing can trade a token, so an update that makes one tradeable + /// is refused unpaid as not active, in the mempool and in a block, whether or not the token + /// is transferable: the refusal comes before the transferable rule (10281), which the update + /// first reaches at protocol version 16. #[tokio::test] - async fn should_refuse_making_a_non_transferable_token_tradeable_with_a_paid_error_10281() { - let (check_tx_errors, result, is_tradeable) = make_tradeable(true).await; - assert_matches!( - check_tx_errors.as_slice(), - [ConsensusError::BasicError( - BasicError::NonTransferableTokenTradeableError(_) - )] - ); - assert_matches!( - result, - PaidConsensusError { - error: error @ ConsensusError::BasicError( - BasicError::NonTransferableTokenTradeableError(_) - ), - .. - } if error.code() == 10281 - ); - assert!(!is_tradeable); - } - - #[tokio::test] - async fn should_make_a_transferable_token_tradeable_from_protocol_version_15() { - let (check_tx_errors, result, is_tradeable) = make_tradeable(false).await; - assert!(check_tx_errors.is_empty(), "{check_tx_errors:?}"); - assert_matches!( - result, - StateTransitionExecutionResult::SuccessfulExecution { .. } - ); - assert!(is_tradeable); + async fn should_refuse_making_a_token_tradeable_unpaid_as_not_active_at_protocol_version_15() { + for non_transferable in [false, true] { + let (check_tx_errors, result, is_tradeable) = make_tradeable(non_transferable).await; + assert_matches!( + check_tx_errors.as_slice(), + [ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(error))] + if error.state_transition_type() + == "TokenConfigUpdateMarketplaceTradeModeTradeable" + && error.required_protocol_version() == 16, + "non_transferable {non_transferable}: {check_tx_errors:?}" + ); + assert_matches!( + &result, + StateTransitionExecutionResult::UnpaidConsensusError( + error @ ConsensusError::BasicError(BasicError::StateTransitionNotActiveError(_)) + ) if error.code() == 10603, + "non_transferable {non_transferable}: {result:?}" + ); + assert!(!is_tradeable); + } } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs index 8773474ce62..9ea1e69a58a 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/token/shielded/nullifier_batch_guard.rs @@ -731,7 +731,7 @@ async fn should_preserve_single_entry_full_processor_fees_and_result() { .value .unwrap() ), - "9401d37544da815c64abeff4aba2c939cddf246f6e56af99e220b78c98514e46" + "cf69ef6453230e20690be3b3bc3ce08a7db20409a297f1dcc24e14ba1f3dce52" ); assert_eq!( pool.platform @@ -1893,9 +1893,9 @@ async fn should_preserve_a_real_single_payment_sponsor_on_first_check_recheck_an // the batch's estimate (protocol v15 note 14). let (estimated_storage, estimated_processing, actual_storage, actual_processing) = if shielded { - (171_126_000, 213_389_040, 155_142_000, 92_739_560) + (171_126_000, 213_389_040, 155_142_000, 92_785_480) } else { - (138_024_000, 117_713_120, 126_468_000, 3_870_440) + (138_024_000, 117_713_120, 126_468_000, 3_916_360) }; assert_eq!( result.execution_results().as_slice(), @@ -2185,39 +2185,39 @@ async fn should_preserve_single_entry_actions_errors_operations_and_settled_stat let (expected_validation, expected_settled) = match case { "shield" => ( "6a823c2db94612652926e6b9c1ae7feec9c2547dfd4cfc4e474318da1c16d59c", - "6eec6da9023f5143a81f4ee42f3549b31ea8d7f035cf664b5ec429cc5da4d81a", + "7dc04b305978bbe10c536bdc48dd78d5de4e97df259557c6c144b64f7074a2d2", ), "valid-payment" => ( "9388d5cf63c4a571b9fb009679e2e34d0b681acc88f0f5195e7287c7efbd92f7", - "0c3d3f5692aa6b658389d5b6c477f081dba505f350f65f8c3ee1f28dde3a68f2", + "c02bb91ee2f7c6a3bbdbe5f4872e7e09b9ef26f300325d6e54d8ea81cec78f2f", ), "failed-payment" => ( "d9b5fe191841bea952494f2a45e3833f925f4d367a1937b2ef1235a1aa01f51e", - "53c5a1d1399e154096559ec2a9a3ba560db72f08c1f6b0cd316e87131af5d657", + "0371f7c9a204d21e095852f8252e3605c050a52f8f6c161873cfc0b141da1db1", ), "within-bundle-repeat" => ( "8023e03a697a20f6a78396a05503a4bc583ca8f69e19bd7ee07a6ae0ce7be478", - "5766cf0e494a1cae19e034a4336196c62184c699a646d71f0de5e382b6b61fc1", + "58ac5c36b2f2e2b026b35e5f9779bc6e7f455239d628930a342980bf0ff98b97", ), "stored-repeat" => ( "05652ac85c972902e8c09d20a7d8586e17e9434a478b335da136ad85f73def01", - "653f494271acdedb71dc0b9e7a224cc47c84e188a6c5aeb315ff7da2f66627ec", + "f4926cd89acca5f8e4e83faf2e9443c6596faba5d33cb6fd4ff2a623931a6f66", ), "open-mint-group" => ( "5c68381297c9bf68c5e85ebe6bb9e0f1289e2c07718eecfb5e6773d6009455bb", - "c4f5e4054bfa4e85548d713765c6da605f38559e871a2824c38bc8209f3b5a17", + "149ce9457c30a7ae11564b1d87d1891e2755067b899fc244a11eac605ee30a8f", ), "closing-mint-group" => ( "2cedc16732c76e0605b5f46085db3d69c12936a5af55a2a82f52ec9e9ca67e38", - "16e25a2c4139c7b5294599a63461d1ecbba5109fcbf16e61a3578fb152ea72b2", + "0eb8bb2257372efdc4c3f226edf4bc673909ace34dddf9d88b83da7089f9c59e", ), "open-burn-group" => ( "e664a045f020ff84de1ca98f364fbabccfc141ad46aa82c79491a340bb0db5f8", - "f49e470f2f1b5a9ca68245783952dac60d26d7b8b89c20766cc1a3ba43c5e0f5", + "e18f310b05100d9d760e9dba56a95739b011f58a9e584f2e39a2e67c6ef05089", ), "closing-burn-group" => ( "93e1732286f168c4a91d2765931e181c5721bfca1bfd5f93b8baacca03e00b2b", - "3d5beeb201a0a33daacce4469c0a4aec845a82e6b74d31678dfe6aec24481830", + "086f76c36de8a93f1a659ac36f3f2937690443a51a230cb154f0aad0462bc2c0", ), _ => unreachable!("enumerated characterization case"), }; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs index c43c29bcb37..676f95277f8 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/contract_user_moderation/tests/restore_constraints.rs @@ -414,10 +414,9 @@ async fn should_preserve_the_rule_free_restore_fee_and_document() { FeeResult { storage_fee: 9_612_000, // from protocol version 15 the restore reads its contract stored compiled (format - // version 2), about 1.8 times its bytes; the decision proposals and token market - // contracts registered at genesis from 15 add siblings to the contracts tree the - // restore's path crosses - processing_fee: 1_492_880, + // version 2), about 1.8 times its bytes; the decision proposals contract registered at + // genesis from 15 adds a sibling to the contracts tree the restore's path crosses + processing_fee: 1_442_880, ..Default::default() } ); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/contract_structure_error_tests.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/contract_structure_error_tests.rs index 423f1120c43..8c55717ac03 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/contract_structure_error_tests.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/contract_structure_error_tests.rs @@ -559,6 +559,22 @@ async fn should_refuse_a_contract_with_a_tradeable_token_unpaid_at_protocol_vers assert_refused_unpaid_as_not_active(&outcome, "TokenTradeModeTradeable"); } +/// Protocol version 15 decodes the trade mode and creates the marketplace's state, and refuses a +/// tradeable token as protocol version 13 does: nothing can trade one before protocol version 16, +/// so no contract stores the mode before then. +#[tokio::test] +async fn should_refuse_a_contract_with_a_tradeable_token_unpaid_at_protocol_version_15() { + let outcome = register_contract_with( + |contract| add_token_with_trade_mode(contract, TokenTradeMode::Tradeable), + 15, + dash_to_credits!(1.0), + ) + .await + .outcome; + + assert_refused_unpaid_as_not_active(&outcome, "TokenTradeModeTradeable"); +} + /// The same contract with a token that is not tradeable registers. #[tokio::test] async fn should_register_a_contract_with_a_token_that_is_not_tradeable_at_protocol_version_13() { diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/contract_structure_error_tests.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/contract_structure_error_tests.rs index eed2de4d24c..4e792c40461 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/contract_structure_error_tests.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/contract_structure_error_tests.rs @@ -371,6 +371,19 @@ async fn should_refuse_an_update_adding_a_tradeable_token_unpaid_at_protocol_ver assert_refused_unpaid_as_not_active(&outcome, "TokenTradeModeTradeable"); } +/// Protocol version 15 decodes the trade mode and refuses the update as protocol version 13 +/// does: nothing can trade a token before protocol version 16. +#[tokio::test] +async fn should_refuse_an_update_adding_a_tradeable_token_unpaid_at_protocol_version_15() { + let outcome = update_fixture_contract( + |contract| add_token_with_trade_mode(contract, TokenTradeMode::Tradeable), + 15, + ) + .await; + + assert_refused_unpaid_as_not_active(&outcome, "TokenTradeModeTradeable"); +} + /// The same update with a token that is not tradeable passes the gate: check_tx admits it. #[tokio::test] async fn should_admit_an_update_adding_a_token_that_is_not_tradeable_at_protocol_version_13() { diff --git a/packages/rs-drive/grovedb-structure.json b/packages/rs-drive/grovedb-structure.json index 3319a196895..3bfb3fc1b22 100644 --- a/packages/rs-drive/grovedb-structure.json +++ b/packages/rs-drive/grovedb-structure.json @@ -792,7 +792,7 @@ "kinds": [ "BigSumTree" ], - "since": 15, + "since": 16, "presence": "always", "source": "packages/rs-drive/src/drive/tokens/paths.rs", "book": "data-model/token-marketplace.md", @@ -813,7 +813,7 @@ "kinds": [ "SumTree" ], - "since": 15, + "since": 16, "presence": "lazy", "source": "packages/rs-drive/src/drive/tokens/paths.rs", "description": "The escrowed listings of one token; created with its first listing.", @@ -834,7 +834,7 @@ "SumItem" ], "value": "token amount", - "since": 15, + "since": 16, "presence": "lazy", "source": "packages/rs-drive/src/drive/tokens/paths.rs", "description": "What one open listing still holds.", @@ -2044,7 +2044,7 @@ "kinds": [ "SumTree" ], - "since": 15, + "since": 16, "presence": "always", "source": "packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs", "book": "data-model/token-marketplace.md", @@ -2066,7 +2066,7 @@ "SumItem" ], "value": "credits", - "since": 15, + "since": 16, "presence": "lazy", "source": "packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs", "description": "What one open offer still holds.", @@ -6551,10 +6551,7 @@ "tree": { "hex": "80", "left": { - "hex": "40", - "left": { - "hex": "20" - } + "hex": "40" }, "right": { "hex": "c0" @@ -6658,10 +6655,7 @@ "hex": "20" }, "right": { - "hex": "5c", - "right": { - "hex": "60" - } + "hex": "5c" } }, "right": { diff --git a/packages/rs-drive/src/cache/system_contracts.rs b/packages/rs-drive/src/cache/system_contracts.rs index 71d368d7711..93bdf0509c1 100644 --- a/packages/rs-drive/src/cache/system_contracts.rs +++ b/packages/rs-drive/src/cache/system_contracts.rs @@ -251,7 +251,7 @@ impl SystemDataContracts { SystemDataContract::DecisionProposals => { DECISION_PROPOSALS_CONTRACT_INITIAL_PROTOCOL_VERSION } - // Written to state by the transition to protocol version 15. + // Written to state by the transition to protocol version 16. SystemDataContract::TokenMarket => TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION, // Never served from this cache: `WalletUtils` is only ever read from grovedb, and // the reserved `FeatureFlags` slot has no implementation. @@ -326,6 +326,7 @@ mod tests { use super::*; use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::data_contract::document_type::accessors::DocumentTypeV0Getters; + use platform_version::version::mocks::v5_test::TEST_PROTOCOL_VERSION_5; fn platform_version(protocol_version: ProtocolVersion) -> &'static PlatformVersion { PlatformVersion::get(protocol_version).expect("expected a supported platform version") @@ -513,19 +514,35 @@ mod tests { fn should_serve_token_market_only_from_its_activation_version() { let contracts = SystemDataContracts::new(); - assert!(contracts - .find_by_id(SystemDataContract::TokenMarket.id(), platform_version(14)) - .expect("expected the pre-activation lookup to succeed") - .is_none()); + // Protocol version 16, the token marketplace's first, has no tables yet: the test + // version that selects the marketplace stands in for it. + let token_marketplace_version = platform_version(TEST_PROTOCOL_VERSION_5); + assert!( + token_marketplace_version.protocol_version + >= TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION + ); + + for before in [14, TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION - 1] { + assert!(contracts + .find_by_id( + SystemDataContract::TokenMarket.id(), + platform_version(before) + ) + .expect("expected the pre-activation lookup to succeed") + .is_none()); + } assert!(contracts .find_by_id( SystemDataContract::TokenMarket.id(), - platform_version(TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION) + token_marketplace_version ) - .expect("expected the v15 lookup to succeed") + .expect("expected the lookup from the activation version to succeed") .is_some()); assert!(contracts - .find_by_id(SystemDataContract::TokenMarket.id(), platform_version(14)) + .find_by_id( + SystemDataContract::TokenMarket.id(), + platform_version(TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION - 1) + ) .expect("an old-version lookup after materialization must succeed") .is_none()); } diff --git a/packages/rs-drive/src/drive/contract/fee_pots/estimated_costs/v1/mod.rs b/packages/rs-drive/src/drive/contract/fee_pots/estimated_costs/v1/mod.rs index 96b629ff9f9..9ac2aba6a01 100644 --- a/packages/rs-drive/src/drive/contract/fee_pots/estimated_costs/v1/mod.rs +++ b/packages/rs-drive/src/drive/contract/fee_pots/estimated_costs/v1/mod.rs @@ -6,7 +6,7 @@ use dpp::data_contract::document_type::action_fees::ContractFeePot; use grovedb::batch::KeyInfoPath; impl Drive { - /// v0 (protocol version 15), keeping a deeper description of the prefunded balances layer + /// v0 (protocol version 16), keeping a deeper description of the prefunded balances layer /// that another write of the batch registered: the escrow of the token marketplace's offers /// sits a level below the fee pots' keys. #[inline(always)] diff --git a/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v1/mod.rs b/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v1/mod.rs index 017dd1c5141..86471eff905 100644 --- a/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v1/mod.rs +++ b/packages/rs-drive/src/drive/identity/estimation_costs/for_balances/v1/mod.rs @@ -4,7 +4,7 @@ use crate::util::estimated_layers::EstimatedLayers; use grovedb::batch::KeyInfoPath; impl Drive { - /// Adds estimation costs for identity balances (protocol version 15): v0, keeping a deeper + /// Adds estimation costs for identity balances (protocol version 16): v0, keeping a deeper /// description of the root layer that another write of the batch registered. An offer of the /// token marketplace debits the buyer's balance and credits its escrow under the prefunded /// specialized balances, which sit deeper in the root tree than the balances, whichever diff --git a/packages/rs-drive/src/drive/initialization/v5/mod.rs b/packages/rs-drive/src/drive/initialization/v5/mod.rs index 858f42f8894..f23b0542b81 100644 --- a/packages/rs-drive/src/drive/initialization/v5/mod.rs +++ b/packages/rs-drive/src/drive/initialization/v5/mod.rs @@ -1,6 +1,6 @@ //! Drive Initialization //! -//! Version 5: version 4 plus the token marketplace escrow trees (protocol version 15). +//! Version 5: version 4 plus the token marketplace escrow trees (protocol version 16). use crate::drive::Drive; use crate::error::Error; @@ -16,12 +16,12 @@ impl Drive { ) -> Result<(), Error> { self.create_initial_state_structure_v4(transaction, platform_version)?; - // Token marketplace escrow trees (protocol version 15): the BigSumTree under the Tokens + // Token marketplace escrow trees (protocol version 16): the BigSumTree under the Tokens // tree of the tokens open listings hold, and the SumTree under the prefunded specialized // balances of the credits open offers hold. Last, after everything version 4 builds, and - // through the same helper as the upgrade path (`Platform::transition_to_version_15`), so - // a chain born at version 15 and one upgraded to it build byte-identical `[Tokens]` and - // `[PreFundedSpecializedBalances]` subtrees. + // through the helper the upgrade to that version must use too, so a chain born at it and + // one upgraded to it build byte-identical `[Tokens]` and `[PreFundedSpecializedBalances]` + // subtrees. self.insert_token_order_escrow_trees(transaction, platform_version)?; Ok(()) diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs index 055d96c0f3f..ebe6f751303 100644 --- a/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs @@ -28,7 +28,7 @@ use crate::util::batch::GroveDbOpBatch; pub const PREFUNDED_BALANCES_FOR_VOTING: u8 = 128; /// The key for the credits the token marketplace holds in escrow for open offers (protocol -/// version 15): a SumTree whose SumItems are keyed by order id. It sits under the prefunded +/// version 16): a SumTree whose SumItems are keyed by order id. It sits under the prefunded /// specialized balances root, a SumTree, so the credit conservation check counts it. pub const PREFUNDED_BALANCES_FOR_TOKEN_ORDERS: u8 = 32; diff --git a/packages/rs-drive/src/drive/prefunded_specialized_balances/structure.rs b/packages/rs-drive/src/drive/prefunded_specialized_balances/structure.rs index d34de62cd7b..cfd25a18b30 100644 --- a/packages/rs-drive/src/drive/prefunded_specialized_balances/structure.rs +++ b/packages/rs-drive/src/drive/prefunded_specialized_balances/structure.rs @@ -63,7 +63,7 @@ pub(crate) fn structure() -> StructureNode { "PREFUNDED_BALANCES_FOR_TOKEN_ORDERS", ) .kind(ElementKind::SumTree) - .since(15) + .since(16) .source("packages/rs-drive/src/drive/prefunded_specialized_balances/mod.rs") .book("data-model/token-marketplace.md") .describe( diff --git a/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v0/mod.rs b/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v0/mod.rs index e7eecb2e56d..d3e73b33008 100644 --- a/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v0/mod.rs @@ -44,7 +44,7 @@ impl Drive { total_identity_token_balances, // Token shielded pools do not exist before protocol version 14. total_token_shielded_pool_balances: 0, - // v0 predates the token order escrow (protocol version 15): zero leaves the + // v0 predates the token order escrow (protocol version 16): zero leaves the // conservation check of every protocol version that selects v0 as it was. total_token_order_escrow_balances: 0, }) diff --git a/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v1/mod.rs b/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v1/mod.rs index 89cfb39c925..77ca3a35805 100644 --- a/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v1/mod.rs +++ b/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v1/mod.rs @@ -53,7 +53,7 @@ impl Drive { total_tokens_in_platform, total_identity_token_balances, total_token_shielded_pool_balances, - // v1 predates the token order escrow (protocol version 15): zero leaves the + // v1 predates the token order escrow (protocol version 16): zero leaves the // conservation check of protocol version 14, which selects v1, as it was. total_token_order_escrow_balances: 0, }) diff --git a/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v2/mod.rs b/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v2/mod.rs index c4e69d0f301..1b0ed80b1c2 100644 --- a/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v2/mod.rs +++ b/packages/rs-drive/src/drive/tokens/calculate_total_tokens_balance/v2/mod.rs @@ -11,7 +11,7 @@ use grovedb::TransactionArg; use platform_version::version::PlatformVersion; impl Drive { - /// Version 2 (protocol version 15): the token marketplace escrow BigSumTree joins the + /// Version 2 (protocol version 16): the token marketplace escrow BigSumTree joins the /// identity balances and the shielded pools on the balance side, so `identity balances + /// shielded pool balances + escrowed listings` must equal the total supplies. Listing a token /// moves it from its holder's balance into escrow without touching supply. diff --git a/packages/rs-drive/src/drive/tokens/mod.rs b/packages/rs-drive/src/drive/tokens/mod.rs index e5127d9461a..6597d0e40aa 100644 --- a/packages/rs-drive/src/drive/tokens/mod.rs +++ b/packages/rs-drive/src/drive/tokens/mod.rs @@ -55,7 +55,7 @@ pub mod unfreeze; #[cfg(feature = "server")] pub mod calculate_total_tokens_balance; -/// The escrow of the token marketplace (protocol version 15): the tokens open listings hold and +/// The escrow of the token marketplace (protocol version 16): the tokens open listings hold and /// the credits open offers hold. #[cfg(feature = "server")] pub mod order_escrow; diff --git a/packages/rs-drive/src/drive/tokens/order_escrow/estimated_costs/v0/mod.rs b/packages/rs-drive/src/drive/tokens/order_escrow/estimated_costs/v0/mod.rs index f749a910981..e825612783d 100644 --- a/packages/rs-drive/src/drive/tokens/order_escrow/estimated_costs/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/order_escrow/estimated_costs/v0/mod.rs @@ -44,7 +44,7 @@ impl Drive { // The escrow key sits deeper in the Tokens Merk than the balances key the token balance // estimation describes at level 0, and a batch moving tokens into or out of escrow writes - // both. From protocol version 15 the token balance estimation keeps this deeper + // both. From protocol version 16 the token balance estimation keeps this deeper // description too (`for_token_balances` 1), whichever registers first. insert_estimated_layer_keeping_deeper( estimated_costs_only_with_layer_info, diff --git a/packages/rs-drive/src/drive/tokens/order_escrow/insert_trees.rs b/packages/rs-drive/src/drive/tokens/order_escrow/insert_trees.rs index c8d17cb7a45..4f954cdd7ea 100644 --- a/packages/rs-drive/src/drive/tokens/order_escrow/insert_trees.rs +++ b/packages/rs-drive/src/drive/tokens/order_escrow/insert_trees.rs @@ -9,7 +9,7 @@ use grovedb::{Element, TransactionArg}; use grovedb_path::SubtreePath; impl Drive { - /// Inserts the two escrow trees of the token marketplace (protocol version 15) if they do not + /// Inserts the two escrow trees of the token marketplace (protocol version 16) if they do not /// exist yet: /// /// - `[Tokens, TOKEN_ORDER_ESCROW_KEY]`, an empty BigSumTree that holds one SumTree per @@ -21,9 +21,9 @@ impl Drive { /// specialized balances root is a SumTree, so the credit conservation check counts it /// without a change. /// - /// CONSENSUS-CRITICAL: both the genesis path (`Drive::create_initial_state_structure_v5`) - /// and the upgrade path (`Platform::transition_to_version_15`) call this one helper, in the - /// same position, so a chain born at protocol version 15 and a chain upgraded to it build + /// CONSENSUS-CRITICAL: the genesis path (`Drive::create_initial_state_structure_v5`) calls + /// this helper last, and the upgrade to protocol version 16 must call it too, in the same + /// position, so a chain born at that version and a chain upgraded to it build /// byte-identical `[Tokens]` and `[PreFundedSpecializedBalances]` subtrees. pub fn insert_token_order_escrow_trees( &self, diff --git a/packages/rs-drive/src/drive/tokens/order_escrow/mod.rs b/packages/rs-drive/src/drive/tokens/order_escrow/mod.rs index d5ad05bc43b..d44df3ecc6a 100644 --- a/packages/rs-drive/src/drive/tokens/order_escrow/mod.rs +++ b/packages/rs-drive/src/drive/tokens/order_escrow/mod.rs @@ -1,4 +1,4 @@ -//! The escrow of the token marketplace (protocol version 15). +//! The escrow of the token marketplace (protocol version 16). //! //! An open listing holds the tokens it offers in `[Tokens, TOKEN_ORDER_ESCROW_KEY, token id, //! order id]`, a SumItem of the token's escrow SumTree, and an open offer holds the credits it @@ -43,8 +43,16 @@ mod tests { use grovedb::EstimatedLayerSizes::AllSubtrees; use grovedb::EstimatedSumTrees::AllBigSumTrees; use grovedb::{EstimatedLayerInformation, GroveDb, TreeType}; + use platform_version::version::mocks::v5_test::TEST_PROTOCOL_VERSION_5; use std::collections::BTreeMap; + /// The token marketplace starts with protocol version 16, which has no tables yet: its + /// escrow is tested under the test version that selects it on top of protocol version 15. + fn token_marketplace_version() -> &'static PlatformVersion { + PlatformVersion::get(TEST_PROTOCOL_VERSION_5) + .expect("expected the token marketplace test version") + } + fn apply(drive: &Drive, operations: Vec) { drive .apply_batch_low_level_drive_operations( @@ -52,14 +60,14 @@ mod tests { None, operations, &mut vec![], - &PlatformVersion::latest().drive, + &token_marketplace_version().drive, ) .expect("expected to apply the operations"); } #[test] fn should_hold_set_and_release_what_a_listing_escrows() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let token_id = [5; 32]; let order_id = [9; 32]; @@ -119,7 +127,7 @@ mod tests { #[test] fn should_hold_set_and_release_what_an_offer_escrows() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let order_id = [9; 32]; let fetch = |drive: &Drive| { @@ -158,11 +166,11 @@ mod tests { } /// Listing moves tokens from a balance into escrow: the supply is unchanged, and the token - /// conservation check of protocol version 15 counts the escrow. The calculator of protocol + /// conservation check of protocol version 16 counts the escrow. The calculator of protocol /// version 14, which reads no escrow, would see tokens missing. #[test] fn should_keep_the_token_supply_balanced_when_tokens_move_into_escrow() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let token_id = [5; 32]; let identity_id = [6; 32]; @@ -244,14 +252,14 @@ mod tests { order_id, None, &mut vec![], - PlatformVersion::latest(), + token_marketplace_version(), ) .expect("expected to fetch the escrow") } fn fetch_offer(drive: &Drive, order_id: [u8; 32]) -> Option { drive - .fetch_credit_order_escrow(order_id, None, &mut vec![], PlatformVersion::latest()) + .fetch_credit_order_escrow(order_id, None, &mut vec![], token_marketplace_version()) .expect("expected to fetch the escrow") } @@ -259,7 +267,7 @@ mod tests { /// tree the first queues and does not insert it again. #[test] fn should_insert_a_tokens_escrow_tree_once_for_two_listings_in_one_batch() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let token_id = [5; 32]; @@ -296,7 +304,7 @@ mod tests { /// the batch is refused: what the shared operations prevent. #[test] fn should_refuse_a_batch_inserting_a_tokens_escrow_tree_twice() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let token_id = [5; 32]; let mut batch = vec![]; @@ -330,7 +338,7 @@ mod tests { /// cost something to apply and change nothing. #[test] fn should_estimate_every_escrow_write_without_writing_it() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let token_id = [5; 32]; let order_id = [9; 32]; @@ -455,7 +463,7 @@ mod tests { /// deeper description already registered for the same batch. #[test] fn should_keep_the_deeper_tokens_layer_estimate() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let tokens_layer_level = |estimation: &EstimatedLayers| match estimation .get(&KeyInfoPath::from_known_path(tokens_root_path())) .map(|layer| &layer.estimated_layer_count) @@ -503,7 +511,7 @@ mod tests { /// Both escrows hold signed 8-byte values: `i64::MAX` is held, one more is refused. #[test] fn should_hold_up_to_i64_max_in_either_escrow() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let token_id = [5; 32]; let largest = i64::MAX as u64; @@ -569,11 +577,12 @@ mod tests { .is_err()); } - /// The escrow methods are active from protocol version 15: at 14 every one of them refuses - /// with `VersionNotActive` instead of building operations for trees that do not exist there. + /// The escrow methods are active from protocol version 16: at 14 and 15 every one of them + /// refuses with `VersionNotActive` instead of building operations for trees that do not + /// exist there. #[test] - fn should_refuse_every_escrow_method_before_protocol_version_15() { - let latest = PlatformVersion::latest(); + fn should_refuse_every_escrow_method_before_protocol_version_16() { + let latest = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(latest)); let token_id = [5; 32]; let order_id = [9; 32]; @@ -686,20 +695,23 @@ mod tests { ] }; - let before = PlatformVersion::get(14).expect("expected protocol version 14"); - for (name, result) in calls(before) { - assert!( - matches!( - result, - Err(Error::Drive(DriveError::VersionNotActive { .. })) - ), - "{name} at protocol version 14: expected VersionNotActive, got {result:?}" - ); + for before in [14, 15] { + let platform_version = + PlatformVersion::get(before).expect("expected the protocol version"); + for (name, result) in calls(platform_version) { + assert!( + matches!( + result, + Err(Error::Drive(DriveError::VersionNotActive { .. })) + ), + "{name} at protocol version {before}: expected VersionNotActive, got {result:?}" + ); + } } for (name, result) in calls(latest) { assert!( result.is_ok(), - "{name} at the latest protocol version: {result:?}" + "{name} at the token marketplace test version: {result:?}" ); } } @@ -710,7 +722,7 @@ mod tests { drive: &Drive, build: impl Fn(&mut Option) -> Vec, ) -> (FeeResult, FeeResult) { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let fee = |costs: Vec| { drive .calculate_fee( @@ -755,7 +767,7 @@ mod tests { /// specialized balances Merk and a listing's on the fourth of the Tokens Merk. #[test] fn should_estimate_at_least_what_an_escrow_write_costs() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let token_id = [5; 32]; @@ -822,11 +834,11 @@ mod tests { } /// The offers' escrow is described at its key's depth in the prefunded specialized balances - /// layer, and from protocol version 15 the voting balance and fee pot estimations of the + /// layer, and from protocol version 16 the voting balance and fee pot estimations of the /// same batch keep that deeper description, whichever registers first. #[test] fn should_keep_the_deeper_prefunded_balances_layer_estimate() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let prefunded_layer_level = |estimation: &EstimatedLayers| match estimation .get(&KeyInfoPath::from_known_path( prefunded_specialized_balances_path(), @@ -889,7 +901,7 @@ mod tests { /// the balance estimation built last lowers it to the balances key, as it always did. #[test] fn should_keep_the_escrow_depth_whichever_of_balance_and_escrow_is_built_first() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let token_id = [5; 32]; let tokens_layer_level = |estimation: &Option| match estimation @@ -954,7 +966,7 @@ mod tests { /// did. #[test] fn should_keep_the_credit_escrow_depths_whichever_of_debit_and_escrow_is_built_first() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let level_at = |estimation: &Option, path: KeyInfoPath| match estimation .as_ref() @@ -1018,7 +1030,7 @@ mod tests { /// rebuilds and holds that scale's orders alone. #[test] fn should_sum_the_depth_of_each_price_scale_apart() { - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let contract = load_system_data_contract(SystemDataContract::TokenMarket, platform_version) .expect("expected the token market contract"); diff --git a/packages/rs-drive/src/drive/tokens/paths.rs b/packages/rs-drive/src/drive/tokens/paths.rs index 63037812436..25e38decbd1 100644 --- a/packages/rs-drive/src/drive/tokens/paths.rs +++ b/packages/rs-drive/src/drive/tokens/paths.rs @@ -32,7 +32,7 @@ pub const TOKEN_DISTRIBUTIONS_KEY: u8 = 32; pub const TOKEN_SHIELDED_POOLS_KEY: u8 = 224; /// Key for the token order escrow tree (a BigSumTree of per-token SumTrees). /// -/// Introduced in protocol version 15 for the token marketplace. Each token that has had an open +/// Introduced in protocol version 16 for the token marketplace. Each token that has had an open /// listing owns one child SumTree keyed by its token id, created with its first listing, whose /// SumItems, keyed by order id, are the tokens each open listing holds in escrow. The BigSumTree /// total is every token held in escrow and joins the identity balances and the shielded pools on @@ -47,7 +47,7 @@ pub const TOKEN_ORDER_ESCROW_KEY: u8 = 96; // TOKEN_DISTRIBUTIONS_KEY TOKEN_DIRECT_SELL_PRICE_KEY TOKEN_CONTRACT_INFO_KEY // // TOKEN_SHIELDED_POOLS_KEY (protocol version 14) is the right child of TOKEN_IDENTITY_INFO_KEY, -// and TOKEN_ORDER_ESCROW_KEY (protocol version 15) the right child of TOKEN_DIRECT_SELL_PRICE_KEY. +// and TOKEN_ORDER_ESCROW_KEY (protocol version 16) the right child of TOKEN_DIRECT_SELL_PRICE_KEY. // The token distribution Tree level diff --git a/packages/rs-drive/src/drive/tokens/structure.rs b/packages/rs-drive/src/drive/tokens/structure.rs index 435e2b87491..39041c5ffe1 100644 --- a/packages/rs-drive/src/drive/tokens/structure.rs +++ b/packages/rs-drive/src/drive/tokens/structure.rs @@ -373,7 +373,7 @@ fn distributions() -> StructureNode { ]) } -/// The tokens the token marketplace holds in escrow for open listings, from protocol 15. +/// The tokens the token marketplace holds in escrow for open listings, from protocol 16. fn order_escrow() -> StructureNode { StructureNode::fixed( "order_escrow", @@ -382,7 +382,7 @@ fn order_escrow() -> StructureNode { "TOKEN_ORDER_ESCROW_KEY", ) .kind(ElementKind::BigSumTree) - .since(15) + .since(16) .source(SOURCE) .book("data-model/token-marketplace.md") .describe( diff --git a/packages/rs-drive/src/structure/tests.rs b/packages/rs-drive/src/structure/tests.rs index c84105bb2e2..b239de8c3be 100644 --- a/packages/rs-drive/src/structure/tests.rs +++ b/packages/rs-drive/src/structure/tests.rs @@ -9,6 +9,7 @@ use crate::util::test_helpers::setup::{setup_drive, setup_drive_with_initial_sta use dpp::block::block_info::BlockInfo; use dpp::identity::Identity; use dpp::version::PlatformVersion; +use platform_version::version::mocks::v5_test::TEST_PROTOCOL_VERSION_5; use std::collections::BTreeSet; use std::fs; use std::path::{Path, PathBuf}; @@ -1946,9 +1947,11 @@ mod fixtures { conformance_of(&drive, "token_shielded_pool", run); } /// The token marketplace escrow: two listings of one token holding tokens, and two offers - /// holding credits. + /// holding credits. The marketplace starts with protocol version 16, which has no tables + /// yet, so the fixture is built under the test version that selects it. fn token_order_escrow(run: &mut FixtureRun) { - let platform_version = PlatformVersion::latest(); + let platform_version = PlatformVersion::get(TEST_PROTOCOL_VERSION_5) + .expect("expected the token marketplace test version"); let drive = setup_drive_with_initial_state_structure(Some(platform_version)); let token_id = [7; 32]; for (order_id, amount) in [([1; 32], 500), ([2; 32], 30)] { @@ -1980,7 +1983,7 @@ mod fixtures { .expect("expected the offer escrow operations"), ); } - conformance_of(&drive, "token_order_escrow", run); + conformance_of_at_version(&drive, "token_order_escrow", run, platform_version); } /// Documents of a type declaring a `ttl`: stored without storage flags, each with an entry /// in the documents expirations tree under the time it expires, and a lifetime storage fee diff --git a/packages/rs-drive/src/verify/document/verify_document_history/tests.rs b/packages/rs-drive/src/verify/document/verify_document_history/tests.rs index 277f4517cd3..40414fcfd0e 100644 --- a/packages/rs-drive/src/verify/document/verify_document_history/tests.rs +++ b/packages/rs-drive/src/verify/document/verify_document_history/tests.rs @@ -393,8 +393,8 @@ fn should_preserve_non_history_roots_fees_and_proofs_after_grove_upgrade() { ) } else { ( - "651594de7d2cae89a6730ecdd0332a8b9702ca4ae0774765ffe4c5a8df75b7dc", - "19f71d377e3e4378cc613495e47b6854f41d1a626b37c6a35c8ea5f8e8a19126", + "345843c481567f2c52b2245f36ab9e8ff22dc6eb0972c779b7ac5f2bbd8e3a18", + "234aacc1287d406f115f9a69469bba948a052f9374b5375e1b5f0361006294e6", ) }; let mut reference = selected.clone(); @@ -611,7 +611,7 @@ fn should_preserve_non_history_roots_fees_and_proofs_after_grove_upgrade() { let expected_nested_proof = if selected.protocol_version == 14 { "9a1b6f2933735c9a54d7eadac8872d08ce5936e4bc798aa6d00abebd73248578" } else { - "3c84d97bc0393698e5e2a33cd55e52c4e2f526dd4e13c96065578d25af797846" + "d5a96f13bd5f69e3bba2d20b5573a6e060524b03285c5d9518a5770cd775a233" }; assert_eq!( sha256::Hash::hash(&nested_proof).to_string(), diff --git a/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v11.rs b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v11.rs index 6f990d7d0ad..cf2ae46dd13 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v11.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v11.rs @@ -28,7 +28,8 @@ use super::{ /// and the profile create and replace triggers, as the DashPay contract v3 /// (`SYSTEM_DATA_CONTRACT_VERSIONS_V4`) declares their checks as schema keywords; and with a /// refusal of a document transition's replace or delete of a token market contract order -/// (`ask` and `bid`), as only the token marketplace transitions write them. +/// (`ask` and `bid`), as only the token marketplace transitions write them. That contract +/// exists from protocol version 16, so nothing matches these bindings before it. /// - the batch `advanced_structure` 2: v1, then the structure checks of token actions protocol /// v15 introduces, which read only the contract the action carries and so run in check_tx too. /// A `TokenConfigUpdate` can make a token tradeable only if it is transferable. @@ -126,7 +127,7 @@ pub const DRIVE_ABCI_VALIDATION_VERSIONS_V11: DriveAbciValidationVersions = document_create_transition_structure_validation: 2, // a decision proposal states its fund, a rule within the limits and an end date one to four weeks away; the poll a contested create names is compared with the expected one by what names the index document_create_transition_state_validation: 3, // a non-contested create cannot take the values of a live contest its index values do not decide data_triggers: DriveAbciValidationDataTriggerAndBindingVersions { - bindings: 3, // no DashPay bindings (DashPay v3 declares their checks); the token market contract's orders are written by the marketplace transitions only + bindings: 3, // no DashPay bindings (DashPay v3 declares their checks); also lists the token market order rejects, unreachable before that contract exists (protocol version 16) triggers: DriveAbciValidationDataTriggerVersions { create_domain_data_trigger: 2, ..DRIVE_ABCI_VALIDATION_VERSIONS_V10 diff --git a/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/mod.rs b/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/mod.rs index 650f5adbce7..471891f73f1 100644 --- a/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/mod.rs +++ b/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/mod.rs @@ -11,13 +11,13 @@ pub struct DriveTokenMethodVersions { pub update: DriveTokenUpdateMethodVersions, pub calculate_total_tokens_balance: FeatureVersion, pub distribution: DriveTokenDistributionMethodVersions, - /// The escrow of the token marketplace (protocol version 15): the tokens open listings hold + /// The escrow of the token marketplace (protocol version 16): the tokens open listings hold /// and the credits open offers hold. pub order_escrow: DriveTokenOrderEscrowMethodVersions, } /// The escrow methods of the token marketplace: `None` in every table before protocol version -/// 15, whose transitions are refused there, so a call before 15 is an error rather than a +/// 16, whose transitions are refused there, so a call before 16 is an error rather than a /// silent write. #[derive(Clone, Debug, Default)] pub struct DriveTokenOrderEscrowMethodVersions { diff --git a/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v1.rs b/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v1.rs index 7f3280a7831..6766045d53f 100644 --- a/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v1.rs +++ b/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v1.rs @@ -70,7 +70,7 @@ pub const DRIVE_TOKEN_METHOD_VERSIONS_V1: DriveTokenMethodVersions = DriveTokenM mark_once_per_identity_release_as_distributed: 0, evonode_participation_rewards: 0, }, - // The token marketplace's escrow is active from protocol version 15 + // The token marketplace's escrow is active from protocol version 16 // (`DRIVE_TOKEN_METHOD_VERSIONS_V3`). order_escrow: DriveTokenOrderEscrowMethodVersions { add_tokens: None, diff --git a/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v3.rs b/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v3.rs index 84a628706b2..43c3aea7a6a 100644 --- a/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v3.rs +++ b/packages/rs-platform-version/src/version/drive_versions/drive_token_method_versions/v3.rs @@ -3,7 +3,9 @@ use crate::version::drive_versions::drive_token_method_versions::{ DriveTokenMethodVersions, DriveTokenOrderEscrowMethodVersions, }; -/// Drive token methods for protocol v15+. +/// Drive token methods with the token marketplace, which starts with protocol version 16. No +/// protocol version's tables select them yet: until protocol version 16 has tables, the test +/// version `TEST_PLATFORM_V5` does. /// /// Identical to [`super::v2::DRIVE_TOKEN_METHOD_VERSIONS_V2`] except /// `calculate_total_tokens_balance` is bumped to `2`: the tokens the token marketplace holds in diff --git a/packages/rs-platform-version/src/version/drive_versions/v10.rs b/packages/rs-platform-version/src/version/drive_versions/v10.rs index 9a274e09b99..f9f3078a922 100644 --- a/packages/rs-platform-version/src/version/drive_versions/v10.rs +++ b/packages/rs-platform-version/src/version/drive_versions/v10.rs @@ -1,24 +1,17 @@ use crate::version::drive_versions::drive_contract_method_versions::v5::DRIVE_CONTRACT_METHOD_VERSIONS_V5; -use crate::version::drive_versions::drive_contract_method_versions::{ - DriveContractFeePotMethodVersions, DriveContractMethodVersions, -}; use crate::version::drive_versions::drive_document_method_versions::v5::DRIVE_DOCUMENT_METHOD_VERSIONS_V5; use crate::version::drive_versions::drive_grove_method_versions::v2::DRIVE_GROVE_METHOD_VERSIONS_V2; use crate::version::drive_versions::drive_identity_method_versions::v2::DRIVE_IDENTITY_METHOD_VERSIONS_V2; use crate::version::drive_versions::drive_identity_method_versions::{ - DriveIdentityCostEstimationMethodVersions, DriveIdentityMethodVersions, - DriveIdentityUpdateMethodVersions, + DriveIdentityMethodVersions, DriveIdentityUpdateMethodVersions, }; use crate::version::drive_versions::drive_state_transition_method_versions::v5::DRIVE_STATE_TRANSITION_METHOD_VERSIONS_V5; -use crate::version::drive_versions::drive_token_method_versions::v3::DRIVE_TOKEN_METHOD_VERSIONS_V3; use crate::version::drive_versions::drive_verify_method_versions::v4::DRIVE_VERIFY_METHOD_VERSIONS_V4; use crate::version::drive_versions::drive_vote_method_versions::v4::DRIVE_VOTE_METHOD_VERSIONS_V4; use crate::version::drive_versions::v9::DRIVE_VERSION_V9; use crate::version::drive_versions::{ - DriveBatchOperationsMethodVersion, DriveFeesMethodVersions, DriveInitializationMethodVersions, - DriveMethodVersions, DrivePlatformSystemMethodVersions, - DrivePrefundedSpecializedMethodVersions, DriveSystemEstimationCostsMethodVersions, - DriveVersion, + DriveBatchOperationsMethodVersion, DriveFeesMethodVersions, DriveMethodVersions, + DrivePlatformSystemMethodVersions, DriveSystemEstimationCostsMethodVersions, DriveVersion, }; use grovedb_version::version::v5::GROVE_V5; @@ -30,25 +23,6 @@ use grovedb_version::version::v5::GROVE_V5; /// nothing when its format version 1 bytes match the stored contract's, whatever format the /// stored one is in, as contracts are stored compiled from this version /// (`contract_storage_serialization_version` 2). -/// * **Escrow trees**: `create_initial_state_structure` 5 adds the two escrow trees of the -/// token marketplace: `[Tokens, TOKEN_ORDER_ESCROW_KEY]`, the BigSumTree of the tokens open -/// listings hold, and `[PreFundedSpecializedBalances, PREFUNDED_BALANCES_FOR_TOKEN_ORDERS]`, -/// the SumTree of the credits open offers hold. The upgrade path -/// (`Platform::transition_to_version_15`) inserts them through the same helper. -/// * **Token conservation**: `DRIVE_TOKEN_METHOD_VERSIONS_V3` bumps -/// `calculate_total_tokens_balance` to 2, which counts the escrowed listings on the balance -/// side; its escrow methods, `None` before, are active. -/// * **Escrow fee estimates**: the offers' escrow key sits a level below the other keys of the -/// prefunded specialized balances layer, so `estimated_cost_for_prefunded_specialized_balance_update` -/// 2 and `add_estimation_costs_for_contract_fee_pot_update` 1 keep a deeper description of that -/// layer another write of the batch registered, rather than lowering it to their keys' level; -/// likewise the listings' escrow key sits deeper in the Tokens layer than the balances key, and -/// `for_token_balances` 1 keeps a deeper description of the Tokens layer. The escrows also sit -/// deeper in the root tree than the identity balances and the token balances, so -/// `for_balances` 1, `for_token_balances` 1 and the voting balance estimation 2 keep a deeper -/// description of the root as well. Beyond the estimators, `apply_drive_operations` 2 merges -/// the descriptions of every write of a batch (below), so no other write of the batch (a -/// document, a nonce) lowers what the escrows describe, whichever is built first. /// * **Yes/no vote polls**: `DRIVE_VOTE_METHOD_VERSIONS_V4` bumps /// `insert.register_identity_vote` to 1, which registers a vote of either poll kind, and /// `cleanup.remove_all_votes_given_by_identities` to 1, which also removes the yes/no votes of @@ -128,23 +102,8 @@ use grovedb_version::version::v5::GROVE_V5; /// Everything else matches `DRIVE_VERSION_V9`. pub const DRIVE_VERSION_V10: DriveVersion = DriveVersion { methods: DriveMethodVersions { - initialization: DriveInitializationMethodVersions { - create_initial_state_structure: 5, // changed in v10: adds the token marketplace escrow trees - }, - token: DRIVE_TOKEN_METHOD_VERSIONS_V3, // changed in v10: calculate_total_tokens_balance 2 counts the token marketplace escrow; order_escrow active - contract: DriveContractMethodVersions { - fee_pots: DriveContractFeePotMethodVersions { - add_estimation_costs_for_contract_fee_pot_update: 1, // changed in v10: keeps a deeper prefunded balances layer description - ..DRIVE_CONTRACT_METHOD_VERSIONS_V5.fee_pots - }, - ..DRIVE_CONTRACT_METHOD_VERSIONS_V5 // changed in v10: apply_contract_with_serialization 1 (compiled contract storage) - }, + contract: DRIVE_CONTRACT_METHOD_VERSIONS_V5, // changed in v10: apply_contract_with_serialization 1 (compiled contract storage) identity: DriveIdentityMethodVersions { - cost_estimation: DriveIdentityCostEstimationMethodVersions { - for_balances: 1, // changed in v10: keeps a deeper root description - for_token_balances: 1, // changed in v10: keeps a deeper root and Tokens layer description - ..DRIVE_IDENTITY_METHOD_VERSIONS_V2.cost_estimation - }, update: DriveIdentityUpdateMethodVersions { add_new_keys_to_masternode_identity: 1, // changed in v10: a masternode key whose hash the identity already holds a reference for is added without a second one ..DRIVE_IDENTITY_METHOD_VERSIONS_V2.update @@ -156,10 +115,6 @@ pub const DRIVE_VERSION_V10: DriveVersion = DriveVersion { convert_drive_operations_to_grove_operations: 2, // changed: sibling history deletes share their pending lifecycle container (note 41) apply_drive_operations: 2, // changed in v10: a batch's estimate is resolved (note 14) }, - prefunded_specialized_balances: DrivePrefundedSpecializedMethodVersions { - estimated_cost_for_prefunded_specialized_balance_update: 2, // changed in v10: keeps a deeper prefunded balances layer description - ..DRIVE_VERSION_V9.methods.prefunded_specialized_balances - }, vote: DRIVE_VOTE_METHOD_VERSIONS_V4, // changed in v10: the yes/no poll kind verify: DRIVE_VERIFY_METHOD_VERSIONS_V4, // changed in v10: the yes/no and private document entries proof verifiers; a document that may be contested is verified state_transitions: DRIVE_STATE_TRANSITION_METHOD_VERSIONS_V5, // changed in v10: a consume deletes what its lookup read diff --git a/packages/rs-platform-version/src/version/feature_initial_protocol_versions.rs b/packages/rs-platform-version/src/version/feature_initial_protocol_versions.rs index fd91614fd9a..ec1271420d6 100644 --- a/packages/rs-platform-version/src/version/feature_initial_protocol_versions.rs +++ b/packages/rs-platform-version/src/version/feature_initial_protocol_versions.rs @@ -30,11 +30,16 @@ pub const TOKEN_SHIELDED_POOL_INITIAL_PROTOCOL_VERSION: ProtocolVersion = 14; /// version 14 and registered at genesis from that version on; below it the contract does not /// exist and lookups must report it absent. pub const MODERATION_CHARTERS_CONTRACT_INITIAL_PROTOCOL_VERSION: ProtocolVersion = 14; -/// The token marketplace (a token whose `marketplaceRules.tradeMode` is `Tradeable`, whose holders -/// sell it to each other through escrowed listings and offers) activates with protocol version 15. -/// Below it a token configuration or a configuration update that makes a token tradeable is -/// refused without a fee, as software that predates the marketplace cannot decode one. -pub const TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION: ProtocolVersion = 15; +/// The token marketplace starts with protocol version 16, the version that brings the +/// transitions placing and filling its orders. From that version on its escrow trees and the +/// token market system contract are created at genesis; below it the contract does not exist and +/// lookups must report it absent. A tradeable token (`marketplaceRules.tradeMode` `Tradeable`, +/// whose holders sell it to each other through escrowed listings and offers) is admitted from +/// the same version: below it a token configuration or a configuration update that makes a token +/// tradeable is refused without a fee. That covers protocol version 15, whose software decodes +/// the mode: the stored form of the mode is not final until the order transitions ship, so no +/// contract may store it before then. +pub const TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION: ProtocolVersion = 16; /// Yes/no masternode vote polls activate with protocol version 15: a masternode vote naming one /// (a `YesNoVote`, or a resource vote on a `YesNoVotePoll`) is not active before it, every /// yes/no method slot is `None` in the tables before it, and the vote decisions trees are diff --git a/packages/rs-platform-version/src/version/mocks/mod.rs b/packages/rs-platform-version/src/version/mocks/mod.rs index c2d2c94a49f..afc341e5a68 100644 --- a/packages/rs-platform-version/src/version/mocks/mod.rs +++ b/packages/rs-platform-version/src/version/mocks/mod.rs @@ -1,5 +1,6 @@ pub mod v2_test; pub mod v3_test; pub mod v4_test; +pub mod v5_test; pub const TEST_PROTOCOL_VERSION_SHIFT_BYTES: u32 = 28; diff --git a/packages/rs-platform-version/src/version/mocks/v5_test.rs b/packages/rs-platform-version/src/version/mocks/v5_test.rs new file mode 100644 index 00000000000..8dc082b2208 --- /dev/null +++ b/packages/rs-platform-version/src/version/mocks/v5_test.rs @@ -0,0 +1,79 @@ +use crate::version::drive_versions::drive_contract_method_versions::{ + DriveContractFeePotMethodVersions, DriveContractMethodVersions, +}; +use crate::version::drive_versions::drive_identity_method_versions::{ + DriveIdentityCostEstimationMethodVersions, DriveIdentityMethodVersions, +}; +use crate::version::drive_versions::drive_token_method_versions::v3::DRIVE_TOKEN_METHOD_VERSIONS_V3; +use crate::version::drive_versions::v10::DRIVE_VERSION_V10; +use crate::version::drive_versions::{ + DriveInitializationMethodVersions, DriveMethodVersions, + DrivePrefundedSpecializedMethodVersions, DriveVersion, +}; +use crate::version::mocks::TEST_PROTOCOL_VERSION_SHIFT_BYTES; +use crate::version::protocol_version::PlatformVersion; +use crate::version::system_data_contract_versions::v4::SYSTEM_DATA_CONTRACT_VERSIONS_V4; +use crate::version::system_data_contract_versions::SystemDataContractVersions; +use crate::version::v15::PLATFORM_V15; + +pub const TEST_PROTOCOL_VERSION_5: u32 = (1 << TEST_PROTOCOL_VERSION_SHIFT_BYTES) + 5; + +/// Protocol version 15 with the token marketplace, which starts with protocol version 16 +/// (`TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION`). That version has no tables yet, so the +/// marketplace's code is tested under this one. No network runs it. What it selects on top of +/// protocol version 15 is what protocol version 16's tables take over: +/// +/// - `create_initial_state_structure` 5 creates the two escrow trees at genesis: +/// `[Tokens, TOKEN_ORDER_ESCROW_KEY]`, a BigSumTree of one SumTree per token of the tokens its +/// open listings hold, and `[PreFundedSpecializedBalances, +/// PREFUNDED_BALANCES_FOR_TOKEN_ORDERS]`, a SumTree of the credits open offers hold. An +/// upgrade inserts them through the same helper (`Drive::insert_token_order_escrow_trees`). +/// - `DRIVE_TOKEN_METHOD_VERSIONS_V3`: `calculate_total_tokens_balance` 2 counts the escrowed +/// tokens on the balance side of the token conservation check, and the escrow methods +/// (`order_escrow`), `None` in every other table, are active. +/// - The offers' escrow key sits a level below the other keys of the prefunded specialized +/// balances layer, so `estimated_cost_for_prefunded_specialized_balance_update` 2 and +/// `add_estimation_costs_for_contract_fee_pot_update` 1 keep a deeper description of that +/// layer another write of the batch registered, rather than lowering it to their keys' level. +/// Likewise the listings' escrow key sits deeper in the Tokens layer than the balances key, +/// and both escrows sit deeper in the root tree than the identity and token balances, so +/// `for_balances` 1 and `for_token_balances` 1 keep a deeper description of those layers. +/// - The token market contract v1 (`token_market: 1`), whose `ask` and `bid` types hold the open +/// orders, registered at genesis and stored without storage flags by an upgrade. +pub const TEST_PLATFORM_V5: PlatformVersion = PlatformVersion { + protocol_version: TEST_PROTOCOL_VERSION_5, + drive: DriveVersion { + methods: DriveMethodVersions { + initialization: DriveInitializationMethodVersions { + create_initial_state_structure: 5, + }, + token: DRIVE_TOKEN_METHOD_VERSIONS_V3, + contract: DriveContractMethodVersions { + fee_pots: DriveContractFeePotMethodVersions { + add_estimation_costs_for_contract_fee_pot_update: 1, + ..DRIVE_VERSION_V10.methods.contract.fee_pots + }, + ..DRIVE_VERSION_V10.methods.contract + }, + identity: DriveIdentityMethodVersions { + cost_estimation: DriveIdentityCostEstimationMethodVersions { + for_balances: 1, + for_token_balances: 1, + ..DRIVE_VERSION_V10.methods.identity.cost_estimation + }, + ..DRIVE_VERSION_V10.methods.identity + }, + prefunded_specialized_balances: DrivePrefundedSpecializedMethodVersions { + estimated_cost_for_prefunded_specialized_balance_update: 2, + ..DRIVE_VERSION_V10.methods.prefunded_specialized_balances + }, + ..DRIVE_VERSION_V10.methods + }, + ..DRIVE_VERSION_V10 + }, + system_data_contracts: SystemDataContractVersions { + token_market: 1, + ..SYSTEM_DATA_CONTRACT_VERSIONS_V4 + }, + ..PLATFORM_V15 +}; diff --git a/packages/rs-platform-version/src/version/protocol_version.rs b/packages/rs-platform-version/src/version/protocol_version.rs index a2df2e6fc87..97353402b69 100644 --- a/packages/rs-platform-version/src/version/protocol_version.rs +++ b/packages/rs-platform-version/src/version/protocol_version.rs @@ -10,6 +10,8 @@ use crate::version::mocks::v3_test::TEST_PLATFORM_V3; #[cfg(feature = "mock-versions")] use crate::version::mocks::v4_test::TEST_PLATFORM_V4; #[cfg(feature = "mock-versions")] +use crate::version::mocks::v5_test::TEST_PLATFORM_V5; +#[cfg(feature = "mock-versions")] use crate::version::mocks::TEST_PROTOCOL_VERSION_SHIFT_BYTES; use crate::version::system_data_contract_versions::SystemDataContractVersions; #[cfg(feature = "mock-versions")] @@ -71,8 +73,12 @@ pub const PLATFORM_VERSIONS: &[PlatformVersion] = &[ // We use OnceLock to be able to modify the version mocks pub static PLATFORM_TEST_VERSIONS: OnceLock> = OnceLock::new(); #[cfg(feature = "mock-versions")] -const DEFAULT_PLATFORM_TEST_VERSIONS: &[PlatformVersion] = - &[TEST_PLATFORM_V2, TEST_PLATFORM_V3, TEST_PLATFORM_V4]; +const DEFAULT_PLATFORM_TEST_VERSIONS: &[PlatformVersion] = &[ + TEST_PLATFORM_V2, + TEST_PLATFORM_V3, + TEST_PLATFORM_V4, + TEST_PLATFORM_V5, +]; pub const LATEST_PLATFORM_VERSION: &PlatformVersion = &PLATFORM_V15; @@ -88,7 +94,7 @@ impl PlatformVersion { // Init default set of test versions let versions = PLATFORM_TEST_VERSIONS - .get_or_init(|| vec![TEST_PLATFORM_V2, TEST_PLATFORM_V3, TEST_PLATFORM_V4]); + .get_or_init(|| Vec::from(DEFAULT_PLATFORM_TEST_VERSIONS)); return versions.get(test_version as usize - 2).ok_or( PlatformVersionError::UnknownVersionError(format!( @@ -116,7 +122,7 @@ impl PlatformVersion { // Init default set of test versions let versions = PLATFORM_TEST_VERSIONS - .get_or_init(|| vec![TEST_PLATFORM_V2, TEST_PLATFORM_V3, TEST_PLATFORM_V4]); + .get_or_init(|| Vec::from(DEFAULT_PLATFORM_TEST_VERSIONS)); return versions.get(test_version as usize - 2); } diff --git a/packages/rs-platform-version/src/version/system_data_contract_versions/mod.rs b/packages/rs-platform-version/src/version/system_data_contract_versions/mod.rs index 9423cdf4135..10717025443 100644 --- a/packages/rs-platform-version/src/version/system_data_contract_versions/mod.rs +++ b/packages/rs-platform-version/src/version/system_data_contract_versions/mod.rs @@ -18,7 +18,7 @@ pub struct SystemDataContractVersions { pub app_connect: FeatureVersion, pub moderation_charters: FeatureVersion, pub decision_proposals: FeatureVersion, - /// The token market contract (protocol version 15): the open listings and offers of the + /// The token market contract (protocol version 16): the open listings and offers of the /// token marketplace. 0 before it exists. pub token_market: FeatureVersion, } diff --git a/packages/rs-platform-version/src/version/system_data_contract_versions/v4.rs b/packages/rs-platform-version/src/version/system_data_contract_versions/v4.rs index d97bdccbae4..5eb9333890c 100644 --- a/packages/rs-platform-version/src/version/system_data_contract_versions/v4.rs +++ b/packages/rs-platform-version/src/version/system_data_contract_versions/v4.rs @@ -5,10 +5,9 @@ use crate::version::system_data_contract_versions::SystemDataContractVersions; // reveal and deletion of the writer's own preorder from an earlier block // (preorders unsalted, one per owner and name, the first valid one of a name // chosen), and the new domain's identity record held to its owner. Domains can -// no longer be deleted. The token market contract (token_market: 1), the open -// listings and offers of the token marketplace, is written to state by the -// upgrade to 15 and registered at genesis from 15 on. v3 (dpns: 2, no token -// market) remains for PROTOCOL_VERSION_14 chain replay. +// no longer be deleted. v3 (dpns: 2) remains for PROTOCOL_VERSION_14 chain +// replay. The token market contract does not exist yet (token_market: 0): the +// token marketplace starts with protocol version 16. // // The DashPay contract v3 states the checks of its two data triggers as schema // keywords: a contact request's `toUserId` refers to an identity other than the @@ -33,6 +32,6 @@ pub const SYSTEM_DATA_CONTRACT_VERSIONS_V4: SystemDataContractVersions = document_history: 1, app_connect: 1, moderation_charters: 1, - token_market: 1, + token_market: 0, decision_proposals: 1, }; diff --git a/packages/rs-platform-version/src/version/v15.rs b/packages/rs-platform-version/src/version/v15.rs index 6a0691f5044..4407188f234 100644 --- a/packages/rs-platform-version/src/version/v15.rs +++ b/packages/rs-platform-version/src/version/v15.rs @@ -115,8 +115,7 @@ pub const PROTOCOL_VERSION_15: ProtocolVersion = 15; /// the parent's subdomain rule. DPNS needs no new data trigger bindings: /// its `domain` Replace and Delete rejects are never reached, as /// `documentsMutable` and `canBeDeleted` false refuse both first (10404). -/// (The bindings move to 3 for the token market contract, note 17, and -/// DashPay, note 24, not for DPNS.) +/// (The bindings move to 3 for DashPay, note 24, not for DPNS.) /// /// 4. **`countOf` and `sumOf` match byte array keys**: `CONTRACT_VERSIONS_V7` /// selects `parse_property_constraints` 1, whose grammar binds a filter key @@ -128,13 +127,17 @@ pub const PROTOCOL_VERSION_15: ProtocolVersion = 15; /// consensus reads the total as it reads any other. `parse_property_constraints` /// 0 (protocol version 14) reads such a binding as an integer and refuses it. /// -/// 5. **Tradeable tokens**: `TokenTradeMode::Tradeable` -/// (`TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION`) lets a token's holders list it and make -/// offers for it. Before this version a contract whose token is tradeable, and a -/// `TokenConfigUpdate` that makes a token tradeable, are refused unpaid as not active -/// (`StateTransitionNotActiveError`, 10603), the refusal older software gives by failing to -/// decode the mode. A tradeable token must be transferable (`NonTransferableTokenTradeableError`, -/// 10281): contract create and update refuse it unpaid, and the batch `advanced_structure` 2 +/// 5. **Tradeable tokens, decoded and not yet admitted**: `TokenTradeMode::Tradeable` lets a +/// token's holders list it and make offers for it. This version decodes the mode and admits +/// no token that has it: a contract whose token is tradeable, and a `TokenConfigUpdate` that +/// makes a token tradeable, are refused unpaid as not active (`StateTransitionNotActiveError`, +/// 10603) below `TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION` (16), the refusal +/// software older than this version gives by failing to decode the mode. The transitions +/// that place and fill orders come with protocol version 16, and the stored form of the mode +/// is not final before them, so no contract stores it under this version. The rules a +/// tradeable token is held to are in place for the version that admits one: it must be +/// transferable (`NonTransferableTokenTradeableError`, 10281), which contract create and +/// update refuse unpaid, and the batch `advanced_structure` 2 /// (`DRIVE_ABCI_VALIDATION_VERSIONS_V11`) checks the trade mode an update proposes against the /// contract the action carries, charged, so check_tx refuses the update too. Protocol v14 and /// earlier keep the batch `advanced_structure` 1. @@ -430,26 +433,19 @@ pub const PROTOCOL_VERSION_15: ProtocolVersion = 15; /// the complete evidence policy at activation, including a zero byte budget. /// Protocol v14 and earlier retain their existing evidence limits. /// -/// 17. **The token marketplace's state**: `DRIVE_VERSION_V10` creates the two escrow trees at -/// genesis (`create_initial_state_structure` 5) and `transition_to_version_15` inserts them -/// through the same helper: `[Tokens, TOKEN_ORDER_ESCROW_KEY]`, a BigSumTree of one SumTree -/// per token of the tokens its open listings hold, and `[PreFundedSpecializedBalances, -/// PREFUNDED_BALANCES_FOR_TOKEN_ORDERS]`, a SumTree of the credits open offers hold. Its -/// `calculate_total_tokens_balance` 2 counts the escrowed tokens on the balance side of the -/// token conservation check; the credit check already counts every prefunded specialized -/// balance. The escrow methods (`order_escrow`) are `None` in every earlier table. The offers' -/// escrow key sits two levels into the prefunded specialized balances layer, below the keys -/// the voting balance and contract fee pot estimations describe, so their v2 and v1 keep a -/// deeper description of that layer another write of the batch registered, and -/// `apply_drive_operations` 2 (note 14) keeps it whatever the order of the batch's writes. -/// `SYSTEM_DATA_CONTRACT_VERSIONS_V4` selects the token market contract v1, whose -/// `ask` and `bid` types hold the open orders, each with the token's decimals when it was -/// placed, which prices its fills and keys its `book` and `depth` index entries -/// (`tokenId`, `decimals`, `price`) so prices of different scales never mix: registered at -/// genesis from this version and -/// stored without storage flags by `transition_to_version_15`. Users cannot write them: -/// `creationRestrictionMode` 2 refuses a create, and the data trigger `bindings` 3 -/// (`DRIVE_ABCI_VALIDATION_VERSIONS_V11`) refuse a replace or a delete. +/// 17. **No token marketplace yet**: the token marketplace starts with protocol version 16 +/// (`TOKEN_MARKETPLACE_INITIAL_PROTOCOL_VERSION`), and nothing of it is part of this version. +/// Its escrow trees are not created (`create_initial_state_structure` stays at 4 and +/// `transition_to_version_15` inserts none), the token conservation check does not read an +/// escrow (`calculate_total_tokens_balance` stays at 1), the escrow methods (`order_escrow`) +/// are `None`, the token market contract does not exist (`token_market: 0`, registered +/// neither at genesis nor by the upgrade, and absent from the system contract cache), and +/// no tradeable token is admitted (note 5). The code of all of it is present and selected by +/// no protocol version's tables; the test version `TEST_PLATFORM_V5` selects it on top of +/// this version's tables so it stays tested. The data trigger `bindings` 3 +/// (`DRIVE_ABCI_VALIDATION_VERSIONS_V11`), which this version selects for DashPay (note +/// 24), also list the rejects of a replace or a delete of a token market order: they match +/// the token market contract's id only, so nothing reaches them before that contract exists. /// /// 18. **Core fork activations recorded in state**: `update_core_info` 1 /// (`DRIVE_ABCI_METHOD_VERSIONS_V11`) asks Core, in a block that moves the chain locked @@ -565,7 +561,7 @@ pub const PROTOCOL_VERSION_15: ProtocolVersion = 15; /// trigger. Every property is stored as v2 stores it (DashPay keeps sized integer /// types off, so the key indexes stay i64), so documents written under v1 and v2 /// read back unchanged. The data trigger `bindings` 3 (`DRIVE_ABCI_VALIDATION_VERSIONS_V11`, -/// which also add note 17's order rejects) drop the DashPay contact request create and +/// which also list the token market order rejects, note 17) drop the DashPay contact request create and /// profile create and replace triggers, which made the identity, writer and type byte /// checks and refused with `DataTriggerConditionError` (40500). Protocol v14 keeps /// DashPay v2 and bindings 2, and earlier versions the contract and bindings they had. @@ -931,11 +927,11 @@ pub const PROTOCOL_VERSION_15: ProtocolVersion = 15; /// results. pub const PLATFORM_V15: PlatformVersion = PlatformVersion { protocol_version: PROTOCOL_VERSION_15, - drive: DRIVE_VERSION_V10, // changed: calculate_fee 1 prices a refund at the storing epoch's rate (note 27); apply_contract_with_serialization 1 writes nothing for a contract whose format version 1 bytes match the stored one's (note 8); vote method versions v4: register_identity_vote 1 registers a yes/no vote, remove_all_votes_given_by_identities 1 also removes the yes/no votes of a masternode that left the list, every yes_no method and remove_vote_poll_end_date_query_operations Some(0) make yes/no polls active, add_vote_poll_end_date_query_operations 1 adds only the entry when the batch already queues the end date's tree with other storage flags, and verify methods v4 make the yes/no proof verifiers active (note 10) and verify_private_document_entries Some(0) a page of a private type's store (note 13); state transition method versions v5: document_create_transition 1 deletes a consumed document from what its lookup read (note 11); document method versions v5: insert_empty_private_document_store_operation Some(0) creates a private document type's store, and fetch_private_document_entries and prove_private_document_entries Some(0) read and prove a page of it (note 13); apply_drive_operations 2 resolves a batch's estimate, remove_reference_for_index_level_for_contract_operations 2, add_reference_for_index_level_for_contract_operations 1, stateless_delete_of_non_tree_for_costs 1 and for_total_system_credits_update 1 describe their layers as they are (note 14); create_initial_state_structure 5 adds the token marketplace escrow trees; calculate_total_tokens_balance 2 counts escrowed tokens; the escrow primitives; the identity balance, token balance, prefunded specialized balance and contract fee pot estimations (for_balances 1, for_token_balances 1, estimated_cost_for_prefunded_specialized_balance_update 2, add_estimation_costs_for_contract_fee_pot_update 1) keep a deeper layer description (note 17); fetch_core_fork_activation_height and store_core_fork_activation_height Some(0) keep the Core fork activations (note 18); document method versions v5: append_private_document_entries_operations Some(0) appends a private document create's entries (note 25); grove_version GROVE_V5 (note 26); verify methods v4: verify_proof_keep_serialized 1 verifies a document that may be contested (note 29); document method versions v5: single_document_path_query 1 selects the latest retained revision at or before a block time, and verify_proof_keep_serialized 1 verifies it (note 31); retained-history writers, readers, estimates and verifiers select the per-type revision layout (note 35); add_new_keys_to_masternode_identity 1 adds a masternode key whose hash the identity already holds a reference for (note 32); document method versions v5: insert.add_document_for_contract_operations 2, delete.delete_document_for_contract_operations 1, delete.remove_document_from_primary_storage 1 and its estimate 1, query.fetch_document_lifecycle Some(0), and the erase/lifecycle estimate and erase_refund_recipient_cost selectors Some(0); batch_operations.convert_drive_operations_to_grove_operations 2; state transition method versions v5: document_delete_transition 1 and document_erase_transition Some(0); verify methods v4: single_document.verify_proof 1 extend retained history (note 41); document method versions v5: add_indices_for_top_index_level_for_contract_operations 3 writes no entry in an expired time range bucket (note 36) + drive: DRIVE_VERSION_V10, // changed: calculate_fee 1 prices a refund at the storing epoch's rate (note 27); apply_contract_with_serialization 1 writes nothing for a contract whose format version 1 bytes match the stored one's (note 8); vote method versions v4: register_identity_vote 1 registers a yes/no vote, remove_all_votes_given_by_identities 1 also removes the yes/no votes of a masternode that left the list, every yes_no method and remove_vote_poll_end_date_query_operations Some(0) make yes/no polls active, add_vote_poll_end_date_query_operations 1 adds only the entry when the batch already queues the end date's tree with other storage flags, and verify methods v4 make the yes/no proof verifiers active (note 10) and verify_private_document_entries Some(0) a page of a private type's store (note 13); state transition method versions v5: document_create_transition 1 deletes a consumed document from what its lookup read (note 11); document method versions v5: insert_empty_private_document_store_operation Some(0) creates a private document type's store, and fetch_private_document_entries and prove_private_document_entries Some(0) read and prove a page of it (note 13); apply_drive_operations 2 resolves a batch's estimate, remove_reference_for_index_level_for_contract_operations 2, add_reference_for_index_level_for_contract_operations 1, stateless_delete_of_non_tree_for_costs 1 and for_total_system_credits_update 1 describe their layers as they are (note 14); fetch_core_fork_activation_height and store_core_fork_activation_height Some(0) keep the Core fork activations (note 18); document method versions v5: append_private_document_entries_operations Some(0) appends a private document create's entries (note 25); grove_version GROVE_V5 (note 26); verify methods v4: verify_proof_keep_serialized 1 verifies a document that may be contested (note 29); document method versions v5: single_document_path_query 1 selects the latest retained revision at or before a block time, and verify_proof_keep_serialized 1 verifies it (note 31); retained-history writers, readers, estimates and verifiers select the per-type revision layout (note 35); add_new_keys_to_masternode_identity 1 adds a masternode key whose hash the identity already holds a reference for (note 32); document method versions v5: insert.add_document_for_contract_operations 2, delete.delete_document_for_contract_operations 1, delete.remove_document_from_primary_storage 1 and its estimate 1, query.fetch_document_lifecycle Some(0), and the erase/lifecycle estimate and erase_refund_recipient_cost selectors Some(0); batch_operations.convert_drive_operations_to_grove_operations 2; state transition method versions v5: document_delete_transition 1 and document_erase_transition Some(0); verify methods v4: single_document.verify_proof 1 extend retained history (note 41); document method versions v5: add_indices_for_top_index_level_for_contract_operations 3 writes no entry in an expired time range bucket (note 36) drive_abci: DriveAbciVersion { structs: DRIVE_ABCI_STRUCTURE_VERSIONS_V2, methods: DRIVE_ABCI_METHOD_VERSIONS_V11, // changed: perform_events_on_first_block_of_protocol_change 3 migrates retained history after operator-payout reconciliation and other activation work (note 35); the yes/no poll's tally, record, clean-up and finish hook are Some(0) (note 10); verify_chain_lock_locally 1 rejects a chain lock locally only when Platform holds the quorums active at its signing height, and verify_chain_lock_through_core 1 has Core's verifychainlock check the others before submitchainlock; consensus_params_update 2 installs the full evidence policy (note 16); update_core_info 1 records the chain locked height at which Core's V24 is first seen active (note 18); build_untied_withdrawal_transactions_from_documents 1 emits asset unlock payload version 2 once V24 is recorded as active (note 20); update_voter_identity 1 re-enables the voter key of the address a masternode returns to (note 22); update_masternode_list 2 and update_operator_identity 1 make operator payouts and the operator identities' TRANSFER keys follow Core's diffs (note 32) - validation_and_processing: DRIVE_ABCI_VALIDATION_VERSIONS_V11, // changed: identity update advanced_structure 1 refuses unpaid an identity update whose added key's proof of possession does not verify (note 2); create_domain_data_trigger 2 (note 3); contract update transform_into_action 1 holds an update to the compiled size cap in check_tx (note 8); batch advanced_structure 2 refuses a token config update on a read-only contract (note 9); masternode vote transform_into_action 1 looks up a masternode's previous answer on a yes/no poll (note 10); document_reference_validation 1 keeps what a consumed commitment's lookup read (note 11); document create structure_validation 2 holds a decision proposal to its fund, rule and end date (note 12); data trigger bindings 3 refuse a replace or a delete of a token market order (note 17) and drop the DashPay bindings (note 24); document create state_validation 3 keeps a create outside a contest off the values of a live one its index values do not decide (note 19); identity create basic_structure 1 checks the identity id before the asset lock proof and advanced_structure 2 no longer does (note 23); contract user moderation transform_into_action 1 writes a moderator's field change in the name of whoever holds the document's storage (note 28); validate_state_transition_identity_signed 2 refuses a contract create or update signed by a key with a budget or an expiry (note 34); batch_state_transition.document_delete_transition_structure_validation 2 and document_erase_transition_structure_validation/document_erase_transition_state_validation Some(0) admit the lifecycle (note 41) + validation_and_processing: DRIVE_ABCI_VALIDATION_VERSIONS_V11, // changed: identity update advanced_structure 1 refuses unpaid an identity update whose added key's proof of possession does not verify (note 2); create_domain_data_trigger 2 (note 3); contract update transform_into_action 1 holds an update to the compiled size cap in check_tx (note 8); batch advanced_structure 2 refuses a token config update on a read-only contract (note 9); masternode vote transform_into_action 1 looks up a masternode's previous answer on a yes/no poll (note 10); document_reference_validation 1 keeps what a consumed commitment's lookup read (note 11); document create structure_validation 2 holds a decision proposal to its fund, rule and end date (note 12); data trigger bindings 3 drop the DashPay bindings (note 24); document create state_validation 3 keeps a create outside a contest off the values of a live one its index values do not decide (note 19); identity create basic_structure 1 checks the identity id before the asset lock proof and advanced_structure 2 no longer does (note 23); contract user moderation transform_into_action 1 writes a moderator's field change in the name of whoever holds the document's storage (note 28); validate_state_transition_identity_signed 2 refuses a contract create or update signed by a key with a budget or an expiry (note 34); batch_state_transition.document_delete_transition_structure_validation 2 and document_erase_transition_structure_validation/document_erase_transition_state_validation Some(0) admit the lifecycle (note 41) withdrawal_constants: DRIVE_ABCI_WITHDRAWAL_CONSTANTS_V3, query: DRIVE_ABCI_QUERY_VERSIONS_V3, // changed: getDocumentHistory accepts V1 only checkpoints: DRIVE_ABCI_CHECKPOINT_PARAMETERS_V1, @@ -956,7 +952,7 @@ pub const PLATFORM_V15: PlatformVersion = PlatformVersion { methods: DPP_METHOD_VERSIONS_V3, factory_versions: DPP_FACTORY_VERSIONS_V1, }, - system_data_contracts: SYSTEM_DATA_CONTRACT_VERSIONS_V4, // changed: DPNS v3 checks a name's create with keywords (note 3); the decision proposals contract (note 12); the token market contract is selected (note 17); DashPay v3 states what its data triggers checked (note 24) + system_data_contracts: SYSTEM_DATA_CONTRACT_VERSIONS_V4, // changed: DPNS v3 checks a name's create with keywords (note 3); the decision proposals contract (note 12); DashPay v3 states what its data triggers checked (note 24) fee_version: FEE_VERSION4, // changed: decision proposals prefund their poll with 0.5 Dash (note 12); a private document entry pays its storage and 10,000,000 credits (note 25); a multiple choice proposal pays a 0.2 Dash processing fee on create (note 40) system_limits: SYSTEM_LIMITS_V5, // changed: max_compiled_contract_size caps a contract stored compiled at 1 MiB (note 8); max_private_document_entry_size caps a private type's entries at 4096 bytes, and the private document store limits size its store (note 13); max_private_document_entries_per_transition caps a private document create at 16 entries (note 25); max_document_revisions_erased_per_transition caps an erase at 100 revisions (note 41) consensus: ConsensusVersions { diff --git a/packages/rs-sdk-trusted-context-provider/Cargo.toml b/packages/rs-sdk-trusted-context-provider/Cargo.toml index b8f08291cfb..28636d7ef8f 100644 --- a/packages/rs-sdk-trusted-context-provider/Cargo.toml +++ b/packages/rs-sdk-trusted-context-provider/Cargo.toml @@ -108,6 +108,13 @@ reqwest = { version = "0.12", features = ["json"] } [target.'cfg(target_os = "android")'.dependencies] reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls-webpki-roots"] } +[dev-dependencies] +# The test platform versions: the token marketplace is tested under one until protocol version +# 16 has tables. +platform-version = { path = "../rs-platform-version", features = [ + "mock-versions", +] } + [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] tokio = { version = "1.40", features = ["macros", "rt-multi-thread"] } # The `refresh_checkpoints` example reads Platform's Core height from proved diff --git a/packages/rs-sdk-trusted-context-provider/src/local.rs b/packages/rs-sdk-trusted-context-provider/src/local.rs index 53fdfab72d6..65ced3be8be 100644 --- a/packages/rs-sdk-trusted-context-provider/src/local.rs +++ b/packages/rs-sdk-trusted-context-provider/src/local.rs @@ -193,6 +193,12 @@ impl ContractSource for LocalContextResolver { #[cfg(all(test, any(feature = "dpns-contract", feature = "all-system-contracts")))] mod tests { + /// The token marketplace starts with protocol version 16, which has no tables yet: the test + /// version that selects it stands in for it. + fn token_marketplace_version() -> &'static dpp::version::PlatformVersion { + &dpp::version::mocks::v5_test::TEST_PLATFORM_V5 + } + use std::sync::Arc; use dash_context_provider::ContractSource; @@ -255,26 +261,26 @@ mod tests { assert_eq!(resolver.token_configuration(&token_id), Some(config)); } - /// The token market contract does not exist before protocol version 15. + /// The token market contract does not exist before protocol version 16. /// The SPV and adaptive providers read contracts only from the resolver, /// so it must refuse a contract preloaded under that id there itself. #[test] - fn should_refuse_a_preloaded_token_market_contract_before_protocol_15() { + fn should_refuse_a_preloaded_token_market_contract_before_protocol_16() { let resolver = LocalContextResolver::new(); let mut contract = app_contract(); let id = SystemDataContract::TokenMarket.id(); contract.set_id(id); resolver.add_known_data_contract(Arc::new(contract)); - let pv14 = PlatformVersion::get(14).expect("protocol version 14"); let pv15 = PlatformVersion::get(15).expect("protocol version 15"); + let marketplace_version = token_marketplace_version(); - assert!(resolver.data_contract(&id, pv14).unwrap().is_none()); - assert!(ContractSource::get_data_contract(&resolver, &id, pv14) + assert!(resolver.data_contract(&id, pv15).unwrap().is_none()); + assert!(ContractSource::get_data_contract(&resolver, &id, pv15) .unwrap() .is_none()); assert_eq!( resolver - .data_contract(&id, pv15) + .data_contract(&id, marketplace_version) .unwrap() .map(|contract| contract.id()), Some(id) diff --git a/packages/rs-sdk-trusted-context-provider/src/provider.rs b/packages/rs-sdk-trusted-context-provider/src/provider.rs index 4b4104f555d..1c87cc692e0 100644 --- a/packages/rs-sdk-trusted-context-provider/src/provider.rs +++ b/packages/rs-sdk-trusted-context-provider/src/provider.rs @@ -1047,6 +1047,12 @@ impl ContextProvider for TrustedHttpContextProvider { #[cfg(all(test, not(target_arch = "wasm32")))] pub(crate) mod tests { + /// The token marketplace starts with protocol version 16, which has no tables yet: the test + /// version that selects it stands in for it. + fn token_marketplace_version() -> &'static dpp::version::PlatformVersion { + &dpp::version::mocks::v5_test::TEST_PLATFORM_V5 + } + use super::*; use crate::quorum_refresh::MIN_GAP; use dash_context_provider::ContextProviderMode; @@ -2510,7 +2516,7 @@ pub(crate) mod tests { /// The token market system contract is served only from its activation version on. #[cfg(any(feature = "token-market-contract", feature = "all-system-contracts"))] #[test] - fn should_serve_token_market_only_from_protocol_15() { + fn should_serve_token_market_only_from_protocol_16() { use dpp::data_contract::accessors::v0::DataContractV0Getters; use dpp::version::PlatformVersion; @@ -2524,38 +2530,38 @@ pub(crate) mod tests { let id = SystemDataContract::TokenMarket.id(); assert!(provider - .get_data_contract(&id, PlatformVersion::get(14).unwrap()) + .get_data_contract(&id, PlatformVersion::get(15).unwrap()) .expect("a pre-activation lookup must not error") .is_none()); let contract = provider - .get_data_contract(&id, PlatformVersion::get(15).unwrap()) - .expect("the lookup must succeed at protocol version 15") - .expect("the token market contract must be served at protocol version 15"); + .get_data_contract(&id, token_marketplace_version()) + .expect("the lookup must succeed at protocol version 16") + .expect("the token market contract must be served at protocol version 16"); assert_eq!(contract.id(), id); // A copy preloaded into the known contracts is not served before activation either. provider.add_known_contract((*contract).clone()); assert!(provider - .get_data_contract(&id, PlatformVersion::get(14).unwrap()) + .get_data_contract(&id, PlatformVersion::get(15).unwrap()) .expect("a pre-activation lookup must not error") .is_none()); assert!(provider - .get_data_contract(&id, PlatformVersion::get(15).unwrap()) - .expect("the lookup must succeed at protocol version 15") + .get_data_contract(&id, token_marketplace_version()) + .expect("the lookup must succeed at protocol version 16") .is_some()); } /// A build without the token market feature still refuses a contract preloaded under the - /// token market's id before protocol version 15, and serves it from 15. + /// token market's id before protocol version 16, and serves it from 16. #[test] - fn should_refuse_a_preloaded_token_market_id_before_protocol_15_in_any_build() { + fn should_refuse_a_preloaded_token_market_id_before_protocol_16_in_any_build() { use dpp::data_contract::config::DataContractConfig; use dpp::data_contract::v1::DataContractV1; use dpp::version::PlatformVersion; use std::collections::BTreeMap; - let platform_version = PlatformVersion::latest(); + let platform_version = token_marketplace_version(); let id = SystemDataContract::TokenMarket.id(); let contract = DataContract::V1(DataContractV1 { id, @@ -2586,12 +2592,12 @@ pub(crate) mod tests { .with_known_contracts(vec![contract]); assert!(provider - .get_data_contract(&id, PlatformVersion::get(14).unwrap()) + .get_data_contract(&id, PlatformVersion::get(15).unwrap()) .expect("a pre-activation lookup must not error") .is_none()); assert!(provider .get_data_contract(&id, platform_version) - .expect("the lookup must succeed from protocol version 15") + .expect("the lookup must succeed from protocol version 16") .is_some()); } @@ -2653,11 +2659,11 @@ pub(crate) mod tests { } } - /// The token market contract does not exist before protocol version 15, + /// The token market contract does not exist before protocol version 16, /// so no source may serve one under its id there: a fallback provider /// asked after the local contracts must not be able to supply it either. #[test] - fn should_refuse_a_token_market_contract_from_the_fallback_before_protocol_15() { + fn should_refuse_a_token_market_contract_from_the_fallback_before_protocol_16() { use dpp::version::PlatformVersion; // A numeric loopback URL avoids DNS; contract lookups make no HTTP requests. @@ -2668,12 +2674,12 @@ pub(crate) mod tests { ) .unwrap() .with_fallback_provider(ServesEveryContract); - let pv14 = PlatformVersion::get(14).unwrap(); + let pv15 = PlatformVersion::get(15).unwrap(); let app_contract = Identifier::new([0x5a; 32]); assert!( provider - .get_data_contract(&app_contract, pv14) + .get_data_contract(&app_contract, pv15) .expect("the fallback answers") .is_some(), "the fallback must be asked for a contract the provider does not hold" @@ -2681,12 +2687,12 @@ pub(crate) mod tests { let token_market = SystemDataContract::TokenMarket.id(); assert!(provider - .get_data_contract(&token_market, pv14) + .get_data_contract(&token_market, pv15) .expect("a pre-activation lookup must not error") .is_none()); assert!(provider - .get_data_contract(&token_market, PlatformVersion::get(15).unwrap()) - .expect("the lookup must succeed from protocol version 15") + .get_data_contract(&token_market, token_marketplace_version()) + .expect("the lookup must succeed from protocol version 16") .is_some()); } diff --git a/packages/rs-sdk-trusted-context-provider/src/system_contracts.rs b/packages/rs-sdk-trusted-context-provider/src/system_contracts.rs index b76e02d57f6..6714e2c73a0 100644 --- a/packages/rs-sdk-trusted-context-provider/src/system_contracts.rs +++ b/packages/rs-sdk-trusted-context-provider/src/system_contracts.rs @@ -36,7 +36,7 @@ use dpp::version::PlatformVersion; use std::sync::Arc; /// Whether `id` names a system data contract that does not exist yet at -/// `platform_version`: the token market contract before protocol version 15. A +/// `platform_version`: the token market contract before protocol version 16. A /// provider serves no contract under such an id, neither one preloaded into its /// known contracts nor one its build loads, whichever contract features it has, so /// each provider asks this before its known contracts. @@ -233,7 +233,7 @@ pub(crate) fn system_data_contract( } #[cfg(any(feature = "token-market-contract", feature = "all-system-contracts"))] - // Below protocol version 15 the token market contract is absent + // Below protocol version 16 the token market contract is absent // (`is_inactive_system_contract`). if *id == SystemDataContract::TokenMarket.id() && !is_inactive_system_contract(id, platform_version) @@ -254,36 +254,43 @@ pub(crate) fn system_data_contract( #[cfg(test)] mod tests { + /// The token marketplace starts with protocol version 16, which has no tables yet: the test + /// version that selects it stands in for it. + fn token_marketplace_version() -> &'static dpp::version::PlatformVersion { + &dpp::version::mocks::v5_test::TEST_PLATFORM_V5 + } + use super::*; - /// The shared loader serves the token market contract only from protocol version 15, + /// The shared loader serves the token market contract only from protocol version 16, /// whatever its caller checked: before, none, without an error. #[cfg(any(feature = "token-market-contract", feature = "all-system-contracts"))] #[test] - fn should_load_no_token_market_contract_before_protocol_15() { + fn should_load_no_token_market_contract_before_protocol_16() { let id = data_contracts::SystemDataContract::TokenMarket.id(); assert!( - system_data_contract(&id, PlatformVersion::get(14).expect("protocol version 14")) + system_data_contract(&id, PlatformVersion::get(15).expect("protocol version 15")) .expect("a pre-activation load does not error") .is_none() ); - assert!( - system_data_contract(&id, PlatformVersion::get(15).expect("protocol version 15")) - .expect("the load succeeds at protocol version 15") - .is_some() - ); + assert!(system_data_contract(&id, token_marketplace_version()) + .expect("the load succeeds at protocol version 16") + .is_some()); } #[test] - fn should_mark_only_the_token_market_inactive_before_protocol_15() { - let pv14 = PlatformVersion::get(14).expect("protocol version 14"); + fn should_mark_only_the_token_market_inactive_before_protocol_16() { let pv15 = PlatformVersion::get(15).expect("protocol version 15"); + let marketplace_version = token_marketplace_version(); let token_market = data_contracts::SystemDataContract::TokenMarket.id(); - assert!(is_inactive_system_contract(&token_market, pv14)); - assert!(!is_inactive_system_contract(&token_market, pv15)); + assert!(is_inactive_system_contract(&token_market, pv15)); + assert!(!is_inactive_system_contract( + &token_market, + marketplace_version + )); assert!(!is_inactive_system_contract( &data_contracts::SystemDataContract::DPNS.id(), - pv14 + pv15 )); } } diff --git a/packages/rs-sdk-trusted-context-provider/src/verified_provider.rs b/packages/rs-sdk-trusted-context-provider/src/verified_provider.rs index e1fe972f6ec..1605c2da65a 100644 --- a/packages/rs-sdk-trusted-context-provider/src/verified_provider.rs +++ b/packages/rs-sdk-trusted-context-provider/src/verified_provider.rs @@ -772,6 +772,12 @@ impl ContextProvider for VerifiedHttpContextProvider { #[cfg(all(test, not(target_arch = "wasm32")))] mod tests { + /// The token marketplace starts with protocol version 16, which has no tables yet: the test + /// version that selects it stands in for it. + fn token_marketplace_version() -> &'static dpp::version::PlatformVersion { + &dpp::version::mocks::v5_test::TEST_PLATFORM_V5 + } + use super::*; use crate::proof_fetches::{DKG_INTERVAL_BLOCKS, MAX_RECENT_STATES}; use dash_core_proof::bootstrap; @@ -3088,41 +3094,41 @@ mod tests { }) } - /// The token market contract does not exist before protocol version 15: no contract is + /// The token market contract does not exist before protocol version 16: no contract is /// served under its id then, not even one preloaded into the known contracts, whichever /// contract features the build has. From 15 the preloaded one is. #[test] - fn should_refuse_a_preloaded_token_market_id_before_protocol_15_in_any_build() { + fn should_refuse_a_preloaded_token_market_id_before_protocol_16_in_any_build() { let provider = with_sources(&["https://127.0.0.1"]).expect("a provider"); let id = data_contracts::SystemDataContract::TokenMarket.id(); provider.add_known_contract(empty_contract(id)); assert!(provider - .get_data_contract(&id, PlatformVersion::get(14).expect("protocol version 14")) + .get_data_contract(&id, PlatformVersion::get(15).expect("protocol version 15")) .expect("a pre-activation lookup does not error") .is_none()); assert!(provider - .get_data_contract(&id, PlatformVersion::get(15).expect("protocol version 15")) - .expect("the lookup succeeds at protocol version 15") + .get_data_contract(&id, token_marketplace_version()) + .expect("the lookup succeeds at protocol version 16") .is_some()); } /// A build loading the token market contract, with none preloaded, serves none before - /// protocol version 15, without an error, and the system contract from 15. + /// protocol version 16, without an error, and the system contract from 16. #[cfg(any(feature = "token-market-contract", feature = "all-system-contracts"))] #[test] - fn should_load_the_token_market_contract_only_from_protocol_15() { + fn should_load_the_token_market_contract_only_from_protocol_16() { let provider = with_sources(&["https://127.0.0.1"]).expect("a provider"); let id = data_contracts::SystemDataContract::TokenMarket.id(); assert!(provider - .get_data_contract(&id, PlatformVersion::get(14).expect("protocol version 14")) + .get_data_contract(&id, PlatformVersion::get(15).expect("protocol version 15")) .expect("a pre-activation lookup does not error") .is_none()); let contract = provider - .get_data_contract(&id, PlatformVersion::get(15).expect("protocol version 15")) - .expect("the lookup succeeds at protocol version 15") - .expect("the token market contract is served at protocol version 15"); + .get_data_contract(&id, token_marketplace_version()) + .expect("the lookup succeeds at protocol version 16") + .expect("the token market contract is served at protocol version 16"); assert_eq!(contract.id(), id); } } diff --git a/packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Types/TokenTypes.swift b/packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Types/TokenTypes.swift index cd22aefcdfe..1961a253a44 100644 --- a/packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Types/TokenTypes.swift +++ b/packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Types/TokenTypes.swift @@ -242,7 +242,7 @@ public enum TokenDistributionRecipient: String, CaseIterable, Codable, Sendable // MARK: - Token Trade Mode /// Trading modes for tokens. Raw values match rs-dpp's `TokenTradeMode` in -/// contract JSON. `tradeable` is valid from protocol version 15. +/// contract JSON. `tradeable` is valid from protocol version 16. /// /// Stored on `PersistentToken` as its raw string, so a new case leaves the /// entity hash unchanged. The frozen schema copies keep only `notTradeable`. diff --git a/packages/swift-sdk/SwiftTests/SwiftDashSDKTests/DataContractParserTradeModeTests.swift b/packages/swift-sdk/SwiftTests/SwiftDashSDKTests/DataContractParserTradeModeTests.swift index cfa9bc730e8..cec4a95c0a8 100644 --- a/packages/swift-sdk/SwiftTests/SwiftDashSDKTests/DataContractParserTradeModeTests.swift +++ b/packages/swift-sdk/SwiftTests/SwiftDashSDKTests/DataContractParserTradeModeTests.swift @@ -15,7 +15,7 @@ import SwiftData /// } /// ``` /// -/// "Tradeable" is valid from protocol version 15. The Swift enum used to +/// "Tradeable" is valid from protocol version 16. The Swift enum used to /// have only `notTradeable`, so the parser's `TokenTradeMode(rawValue:)` /// returned nil for it and the token kept the `notTradeable` default, which /// made `PersistentToken.isTradeable` report false for a tradeable token. diff --git a/packages/token-market-contract/Cargo.toml b/packages/token-market-contract/Cargo.toml index c338081d99c..13702d04936 100644 --- a/packages/token-market-contract/Cargo.toml +++ b/packages/token-market-contract/Cargo.toml @@ -13,3 +13,8 @@ serde_json = { version = "1.0" } platform-value = { path = "../rs-platform-value" } [dev-dependencies] base58 = "0.2.0" +# The test platform versions: the token marketplace is tested under one until protocol version +# 16 has tables. +platform-version = { path = "../rs-platform-version", features = [ + "mock-versions", +] } diff --git a/packages/token-market-contract/README.md b/packages/token-market-contract/README.md index 425fbc3fc50..b1a78e6f07e 100644 --- a/packages/token-market-contract/README.md +++ b/packages/token-market-contract/README.md @@ -2,10 +2,11 @@ The token market system contract holds the open orders of the token marketplace: the listings (`ask`) holders make to sell a tradeable token at a -price, and the offers (`bid`) anyone makes to buy one. It activates at protocol -version 15, registered at genesis by chains born at 15 and inserted by the -upgrade to 15, and has the same ID on every network: -`AE6yYq65VdfGCg2MSyV9vV7cWGiFWjbwBuy7THesDh4e`. +price, and the offers (`bid`) anyone makes to buy one. It activates with the +token marketplace at protocol version 16, registered at genesis by chains born +at 16 and inserted by the upgrade to 16, and has the same ID on every network: +`AE6yYq65VdfGCg2MSyV9vV7cWGiFWjbwBuy7THesDh4e`. It does not exist under +protocol version 15 or earlier. Only the token marketplace transitions write these documents. Users cannot create them (`creationRestrictionMode` 2), and a replace or delete sent as a diff --git a/packages/token-market-contract/src/lib.rs b/packages/token-market-contract/src/lib.rs index 436f487cd99..4bd96441636 100644 --- a/packages/token-market-contract/src/lib.rs +++ b/packages/token-market-contract/src/lib.rs @@ -17,7 +17,7 @@ pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES)); pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES)); /// The contract's definitions for `platform_version`. Version 0, the value the tables of -/// protocol versions below 15 carry, names no schema generation and is refused like any +/// protocol versions below 16 carry, names no schema generation and is refused like any /// unknown version: the contract does not exist before its activation. pub fn load_definitions(platform_version: &PlatformVersion) -> Result, Error> { match platform_version.system_data_contracts.token_market { @@ -56,10 +56,13 @@ mod tests { } #[test] - fn should_load_the_schema_at_the_latest_platform_version() { + fn should_load_the_schema_at_the_token_marketplace_test_version() { + use platform_version::version::mocks::v5_test::TEST_PLATFORM_V5; use v1::document_types::{ask, bid}; - let schema = load_documents_schemas(PlatformVersion::latest()).expect("schema loads"); + // The token marketplace starts with protocol version 16, which has no tables yet: the + // test version that selects it stands in for it. + let schema = load_documents_schemas(&TEST_PLATFORM_V5).expect("schema loads"); let declared = |name: &str, properties: &[&str], summed: &str| { let document_type = schema .get(name) @@ -126,14 +129,17 @@ mod tests { #[test] fn should_refuse_to_load_below_the_activation_version() { - let platform_version = PlatformVersion::get(14).expect("protocol version 14"); - assert!(matches!( - load_documents_schemas(platform_version), - Err(Error::UnknownVersionMismatch { received: 0, .. }) - )); - assert!(matches!( - load_definitions(platform_version), - Err(Error::UnknownVersionMismatch { received: 0, .. }) - )); + for protocol_version in [14, 15] { + let platform_version = + PlatformVersion::get(protocol_version).expect("expected the protocol version"); + assert!(matches!( + load_documents_schemas(platform_version), + Err(Error::UnknownVersionMismatch { received: 0, .. }) + )); + assert!(matches!( + load_definitions(platform_version), + Err(Error::UnknownVersionMismatch { received: 0, .. }) + )); + } } } diff --git a/packages/wasm-dpp2/src/tokens/configuration/trade_mode.rs b/packages/wasm-dpp2/src/tokens/configuration/trade_mode.rs index 43c6dba93bc..f541b43402b 100644 --- a/packages/wasm-dpp2/src/tokens/configuration/trade_mode.rs +++ b/packages/wasm-dpp2/src/tokens/configuration/trade_mode.rs @@ -25,7 +25,8 @@ impl TokenTradeModeWasm { TokenTradeModeWasm(TokenTradeMode::NotTradeable) } - /// Holders may list the token and make offers for it (protocol version 15). + /// Holders may list the token and make offers for it. Admitted from protocol version 16: + /// earlier versions refuse a contract or a configuration update that uses it. #[wasm_bindgen(js_name = "Tradeable")] pub fn tradeable() -> TokenTradeModeWasm { TokenTradeModeWasm(TokenTradeMode::Tradeable)