Repository navigation
dash: opt-out for the v24 provider special txs (types 10-12) and v3 ProTx payloads in embedded templates - #2352
Merged
Merged
Conversation
…ded templates New flag --embedded-include-v24-provider-txs[=false], default ON (the template is unchanged). With the special-tx superset armed (--embedded-include-mn-special-txs) and Dash Core v24 active, =false keeps ProDisTx, ProUpShareTx and ProUpSharedRegTx (types 10-12) out of template selection, while provider types 1-4 and MNHF signals still ride. - embedded_gbt.hpp: build_embedded_workdata takes include_v24_provider_txs (trailing, default true); allow_v24_provider in the selection mask is false when it is off, so selection refuses types 10-12 and the shared-collateral input of a ProDisTx, and the ProDisTx collateral-spend exemption is never taken. A pooled ProDisTx is left out with its in-pool descendants; the committed merkleRootMNList is the fold of the body served. - work_source.hpp / node_coin_state.hpp: EmbeddedWorkInputs and NodeCoinState carry the flag (set_include_v24_provider_txs) to the builder. The emit gate refuses a body carrying a type 10-12 tx while it is off (emit-v24-provider-tx-opted-out), and no longer exempts a ProDisTx from the collateral-spend check. - main_dash.cpp: parses --embedded-include-v24-provider-txs and --embedded-include-v24-provider-txs=false (any other spelling is an unknown argument and the node exits 1), applies a settings-file value (only an explicit true keeps 10-12 on), and the startup line states v24-provider-txs=on|off. - param_catalog.inc: embedded.include_v24_provider_txs (TRISTATE_BOOL, RESTART, FLAG_OPT_EQFALSE). README flag table row. KATs in test_dash_v24_alltx.cpp (test_dash_govvote_bls): V24ProviderOptOutLeavesOutTypes10To12AndKeepsTypes1To4, V24ProviderOptInDefaultIsTheTemplateBeforeTheFlag, V24ProviderOptOutChangesNothingBeforeActivation, V24ProviderOptOutKeepsAType1SharedRegistration, V24ProviderOptOutEmitGateRefusesTypes10To12, V24ProviderOptOutCatalogRowAndOffToken.
With --embedded-include-v24-provider-txs=false and Dash Core v24 active, a type-1 ProRegTx in the v24 shared-registration format is now held from the template together with types 10-12. Every other type 1-4 tx, including legacy-format ProRegTx, rides as before. With the flag ON (the default), and before v24 activation, the template is unchanged. - mempool.hpp: is_v24_shared_registration(tx), the format marker: a type-1 payload that decodes as CProRegTx with ProTx version >= EXT_ADDR and a non-empty share table (CProRegTx::IsShared, vendor/providertx.hpp). The selection mask gains hold_v24_shared_registration (default false); when set, such a tx is refused as a package member, so its package and any in-pool child are left out. The shared-collateral template guard honours the same hold. - embedded_gbt.hpp: hold_v24_shared_registration = v24_active && !include_v24_provider_txs. - node_coin_state.hpp: the emit gate refuses a body carrying a v24 shared registration while the opt-out is set (emit-v24-provider-tx-opted-out, value type=1-shared-registration). - main_dash.cpp --help line and startup line, param_catalog.inc help text and the README flag row now say "types 10-12 and v24 shared registrations". KATs in test_dash_v24_alltx.cpp: V24ProviderOptOutHoldsASharedRegistrationAndKeepsALegacyProRegTx (replaces V24ProviderOptOutKeepsAType1SharedRegistration) and V24ProviderOptInKeepsASharedRegistrationAsBefore; the emit-gate KAT also covers the shared registration.
ProTx version 3 (ExtAddr) is itself valid only once Dash Core v24 is active: Core refuses nVersion above ProTxVersion::GetMax as bad-protx-version, and GetMax is ExtAddr only with v24 active (our port: protx_check.hpp max_version). With --embedded-include-v24-provider-txs=false and v24 active, every type 1-4 tx whose payload parses with version >= 3 (ProRegTx, ProUpServTx, ProUpRegTx, ProUpRevTx; shared registrations are version 3) is now held from the template together with types 10-12. Version 1/2 ProTx ride as before. With the flag ON, and before v24 activation, the template is unchanged. - mempool.hpp: is_v24_format_protx(tx) replaces is_v24_shared_registration: types 1-4 whose payload parses (parse_protx_payload) with nVersion >= ProTxVersion::EXT_ADDR; a payload that does not parse is not a match. The mask field becomes hold_v24_format_protx; the selection check and the shared-collateral guard use it. - embedded_gbt.hpp: hold_v24_format_protx = v24_active && !include_v24_provider_txs. - node_coin_state.hpp: the emit gate refuses such a body with emit-v24-provider-tx-opted-out, value type=N-v3-protx. - main_dash.cpp --help line and startup line, param_catalog.inc help text and the README flag row now say "types 10-12 and v3 (ExtAddr) ProTx payloads, including shared registrations". KATs in test_dash_v24_alltx.cpp: V24ProviderOptOutHoldsEveryV3ProTxInSelection (real testnet v3 types 1, 2 and 4, synthetic v3 types 2, 3 and 4, v1/v2 types 1-4 selected either way), V24ProviderOptOutHoldsV3ProTxTypes2To4InTheTemplate (synthetic v3 types 2-4 through the builder, ON byte-identical, pre-v24 OFF = ON); the emit-gate KAT covers every v3 type and the v2 ones.
…oes not parse With --embedded-include-v24-provider-txs=false and Dash Core v24 active, a type 1-4 tx is now held from the template unless its payload parses with ProTx version 1 or 2. Until now a payload that did not parse counted as "not version 3" and was selected (the builder's fold then refused it with bad-protx-payload). Version 1/2 payloads always parse, so no valid tx is lost. With the flag ON, and before v24 activation, the template is unchanged. - mempool.hpp: protx_payload_version(tx) (the parsed ProTx version of a type 1-4 tx, or nullopt), is_legacy_format_protx(tx) (parses, version <= BASIC_BLS) and is_v24_opt_out_protx(tx) (type 1-4 and not legacy) replace is_v24_format_protx. The mask field becomes hold_non_legacy_protx; the selection check and the shared-collateral guard use it. - embedded_gbt.hpp: hold_non_legacy_protx = v24_active && !include_v24_provider_txs. - node_coin_state.hpp: the emit gate refuses such a body with emit-v24-provider-tx-opted-out, value type=N-v3-protx for a parsed version-3 payload and type=N-unparsed-protx for one that does not parse. Mempool admission does not parse provider payloads (an unparsed one is left to the Dash Core checks), so such a tx can reach selection. KAT in test_dash_v24_alltx.cpp: V24ProviderOptOutHoldsAnUnparsedProTxPayload (truncated, trailing-byte, version-4 and garbage payloads of types 1-4, fed to selection and the builder: held OFF, unchanged ON, pre-v24 OFF = ON); the emit-gate KAT covers the unparsed values.
frstrtr
added a commit
that referenced
this pull request
Nov 28, 2026
… read budget (#2357) Test only: src/impl/ltc/test/merged_aux_hardening_test.cpp. - After mining.subscribe or mining.authorize, the session tests read the socket for a fixed budget (2 x 50 ms receive timeouts after a 0.5 s build poll). Under ASan on a loaded runner the job notify can arrive later, and `MergedAuxStratumSession.AJobBuiltBeforeTheLoginKeepsItsSplitThroughTheAuthorize` saw an empty job id after subscribe (two consecutive linux-asan runs of #2352, 1 of 6932). - `LineClient::wait_new_job(prev)` reads until a mining.notify sets a job id other than `prev`, up to 10 s. It is used at the four subscribe sites that assert a job and at that test's authorize site. vm905, ASan+UBSan share_test: `MergedAuxStratumSession.*` x20 serial and 8 parallel copies x10 under load, all PASSED.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dash: opt-out for the v24 provider special txs (types 10-12) and v3 (ExtAddr) ProTx payloads in embedded templates
What it does
New flag
--embedded-include-v24-provider-txs[=false], default ON.Several kinds of provider tx are valid only once Dash Core v24 (DEPLOYMENT_V24) is ACTIVE. Today they ride the same lever as provider types 1-4 (
--embedded-include-mn-special-txs) and enter embedded templates automatically at activation:ProTx version 3 is itself gated on v24 in Dash Core v24.0.3:
src/evo/specialtxman.cpp:1180:if (opt_ptx->nVersion > ProTxVersion::GetMax(is_v19_active, is_v24_active))givesbad-protx-version.src/evo/types.h:23-34:GetMaxreturns ExtAddr (3) only whenis_extended_addr, that is, with v24 active.GetMaxismax_versioninsrc/impl/dash/coin/protx_check.hpp:369-373.This change gives an operator a separate switch for all of them:
--embedded-include-v24-provider-txs=false): with the superset armed and v24 active, types 10-12 are never selected. A type 1-4 tx is selected only if its payload parses with ProTx version 1 or 2; anything else is held. That covers version 3, and it fails closed: a payload that does not parse is held too. Version 1/2 ProTx always parse, so no valid tx is lost. MNHF signals (type 7) still ride. Before v24 activation the flag changes nothing: none of these are valid before v24.Format marker (
src/impl/dash/coin/mempool.hpp):protx_payload_version(tx)(line 99) gives the parsed ProTx version of a type 1-4 tx, usingparse_protx_payloadforCProRegTx,CProUpServTx,CProUpRegTxorCProUpRevTx. It gives nullopt when the payload does not parse.is_legacy_format_protx(tx)(line 118, test at line 121) is true when that version exists and is at mostProTxVersion::BASIC_BLS(2).is_v24_opt_out_protx(tx)(line 132) is true for a type 1-4 tx that is not legacy. That is version 3, shared registrations included, and any payload that does not parse.Where it is used:
mempool.hpp:3124;mempool.hpp:3170;src/impl/dash/coin/embedded_gbt.hpp:934;src/impl/dash/coin/node_coin_state.hpp:1963.Can an unparseable ProTx reach selection today? Yes. Mempool admission does not parse provider payloads:
provider_admission_conflict_lockedreturns no conflict for a payload that does not parse (mempool.hpp:1455, "the Core checks refuse it later"). Admission's contextual check only reads the version and type. The builder's MN-list fold then refuses it (bad-protx-payload, ON or OFF), so it never reached a served template. The selection-level hold is therefore a safeguard on top of the fold, kept because it fails closed.How our Dash Core check treats these payloads today (
protx_check.hpp):codec_version_refusal:proreg_v3_refusal, orprovider_payload_refusalfor ProUpServTx and ProUpRegTx.bad-protx-version(max_version= BASIC_BLS).So under v24 the hold is a real change in what OFF serves, not only a second safeguard.
The OFF form is one exact, greppable token:
--embedded-include-v24-provider-txs=false.=0,=off,=no,=true,=FALSE, an empty value, a typo of the flag name) is an unknown argument: the node printsunknown argument: ...and exits 1. It never falls back to ON silently.embedded.include_v24_provider_txsis applied too, and the command line wins. There, only an explicittruekeeps them on; any other value turns them off.How
embedded_gbt.hpp:build_embedded_workdatatakesinclude_v24_provider_txsas a new trailing parameter, defaulttrue, so every existing caller is unchanged.allow_v24_providerisallow_mn_types && v24_active && include_v24_provider_txs, andhold_non_legacy_protxisv24_active && !include_v24_provider_txs.mempool.hpp:hold_non_legacy_protxis set, a tx matchingis_v24_opt_out_protxis refused as a package member. Its whole package goes with it, so an in-pool child spending one of its outputs never rides either.v24_dissolveexemption is never taken and nothing lands in the excluded-collateral list (the GBT-xcheck label aid).merkleRootMNListis the fold of the body actually served.work_source.hpp,node_coin_state.hpp:EmbeddedWorkInputs::include_v24_provider_txsandNodeCoinState::set_include_v24_provider_txscarry the flag to the builder.emit-v24-provider-tx-opted-out). The value istype=10|11|12,type=N-v3-protxfor a parsed version 3, ortype=N-unparsed-protxfor a payload that does not parse. In that mode it also no longer exempts a ProDisTx from the collateral-spend check.main_dash.cpp: option parsing,--helpline, run_node wiring, settings-file overlay, and the startup line. The superset line now ends withv24-provider-txs=on|off:... ; v24-provider-txs=on (types 10-12 ProDisTx/ProUpShareTx/ProUpSharedRegTx and v3 (ExtAddr) ProTx payloads, including shared registrations, ride from Dash Core v24 activation; opt out: --embedded-include-v24-provider-txs=false)... ; v24-provider-txs=off (--embedded-include-v24-provider-txs=false: types 10-12 and v3 (ExtAddr) ProTx payloads, including shared registrations, never selected; v1/v2 ProTx still ride)... ; v24-provider-txs=off (the superset is off)param_catalog.inc:embedded.include_v24_provider_txs(TRISTATE_BOOL, RESTART, alias--embedded-include-v24-provider-txs, FLAG_OPT_EQFALSE), help text "types 10-12 and v3 (ExtAddr) ProTx payloads, including shared registrations".ci/check_param_catalog.pypasses.Mempool admission is unchanged: these txs are still admitted and kept in the pool under v24 rules; only template selection is affected.
KATs
In
test/test_dash_v24_alltx.cpp(targettest_dash_govvote_bls, the BLS-backend target):DashV24AllTx.V24ProviderOptOutLeavesOutTypes10To12AndKeepsTypes1To4DashV24AllTx.V24ProviderOptInDefaultIsTheTemplateBeforeTheFlagtruecall give the same template field by field. The assertions ofBuilderCarriesSharedTypesAtV24AndCommitsTheBlockConnectRoothold: all three shared types ride, CbTx v4, block-connect root, S removed by the dissolution. The work source forwards the flag unchanged.DashV24AllTx.V24ProviderOptOutChangesNothingBeforeActivationDashV24AllTx.V24ProviderOptOutHoldsEveryV3ProTxInSelectionDashV24AllTx.V24ProviderOptOutHoldsV3ProTxTypes2To4InTheTemplateDashV24AllTx.V24ProviderOptOutHoldsAnUnparsedProTxPayloadDashV24AllTx.V24ProviderOptOutHoldsASharedRegistrationAndKeepsALegacyProRegTxDashV24AllTx.V24ProviderOptInKeepsASharedRegistrationAsBeforetruecall give the same template. The assertions ofBuilderCarriesARealSharedRegistrationOnlyAtV24hold. The legacy ProRegTx gives the same template either way, before and after v24.DashV24AllTx.V24ProviderOptOutEmitGateRefusesTypes10To12type=N-v3-protx), or any of the unparsed payloads (type=N-unparsed-protx). It does not apply the opt-out to the version 1/2 ones. Back ON, the same ProDisTx body passes.DashV24AllTx.V24ProviderOptOutCatalogRowAndOffToken=falseas false and the bare flag as true; main_dash parses exactly these spellings into the default-ON local and the unknown-argument exit stays in place.Synthetic fixtures (well-formed payloads, signed with test keys, checked in full by our Dash Core port): v3 ProUpServTx, ProUpRegTx and ProUpRevTx of the test world's regular masternode, plus the v2 ProUpServTx, ProUpRegTx and ProUpRevTx. Real fixtures: testnet v3 ProRegTx (unshared and shared), testnet v3 ProUpServTx (Regular a356adb8, EvoNode 763ca29f), testnet v3 ProUpRevTx (EvoNode 044d20aa), mainnet v2 ProRegTx. No real version-3 ProUpRegTx is in the fixtures, so type 3 v3 is synthetic only.
All ten pass (3 repeats). Each mutant below turns the named KATs RED, and the clean tree is green again after the mutants. KAT names are shortened: the
DashV24AllTx.V24Providerprefix is dropped.OptOutLeavesOutTypes10To12AndKeepsTypes1To4,OptInDefaultIsTheTemplateBeforeTheFlagOptOutLeavesOutTypes10To12AndKeepsTypes1To4,OptInDefaultIsTheTemplateBeforeTheFlagOptInDefaultIsTheTemplateBeforeTheFlag,OptInKeepsASharedRegistrationAsBefore,OptOutHoldsV3ProTxTypes2To4InTheTemplate,OptOutEmitGateRefusesTypes10To12; also the existingBuilderCarriesARealSharedRegistrationOnlyAtV24,BuilderCarriesSharedTypesAtV24AndCommitsTheBlockConnectRoot,BuilderLeavesOutAnInvalidOrDuplicateDissolution,EmitGateFoldsAProDisTxInsteadOfRefusingItsCollateralSpend,P2FoldMemoServesTheFoldedRootForAListChangingProviderTxOptInDefaultIsTheTemplateBeforeTheFlagOptOutEmitGateRefusesTypes10To12OptOutEmitGateRefusesTypes10To12OptOutLeavesOutTypes10To12AndKeepsTypes1To4,OptOutChangesNothingBeforeActivation,OptOutHoldsASharedRegistrationAndKeepsALegacyProRegTx=falseas ONOptOutCatalogRowAndOffTokenOptOutCatalogRowAndOffTokenOptOutHoldsV3ProTxTypes2To4InTheTemplate,OptOutHoldsASharedRegistrationAndKeepsALegacyProRegTxOptInKeepsASharedRegistrationAsBefore,OptOutHoldsV3ProTxTypes2To4InTheTemplate,OptOutHoldsASharedRegistrationAndKeepsALegacyProRegTx; also the existingBuilderCarriesARealSharedRegistrationOnlyAtV24OptOutEmitGateRefusesTypes10To12OptOutHoldsEveryV3ProTxInSelection,OptOutHoldsV3ProTxTypes2To4InTheTemplate,OptOutHoldsAnUnparsedProTxPayloadOptOutHoldsASharedRegistrationAndKeepsALegacyProRegTxOptOutHoldsEveryV3ProTxInSelection,OptOutHoldsV3ProTxTypes2To4InTheTemplate,OptOutHoldsASharedRegistrationAndKeepsALegacyProRegTx,OptOutEmitGateRefusesTypes10To12IsShared()onlyOptOutHoldsEveryV3ProTxInSelection,OptOutHoldsV3ProTxTypes2To4InTheTemplate,OptOutHoldsAnUnparsedProTxPayload,OptOutEmitGateRefusesTypes10To12OptOutHoldsEveryV3ProTxInSelection,OptOutHoldsV3ProTxTypes2To4InTheTemplate,OptOutHoldsAnUnparsedProTxPayload,OptOutEmitGateRefusesTypes10To12OptOutHoldsAnUnparsedProTxPayload,OptOutEmitGateRefusesTypes10To12Removing only the selection check leaves the shared-registration KAT green: the shared-collateral guard also holds a valid shared registration. Every other version-3 payload and every unparsed payload, though, depends on the selection check.
Suites (Release, BLS backend on):
ci/check_param_catalog.pypasses. No new compiler warnings.The built binary:
--embedded-include-v24-provider-txs=false --dump-resolved-configprintsembedded.include_v24_provider_txs=false source=cli.=true source=cli.=0,=off,=no,=FALSE,=False,=true,=1,=garbage,=and a misspelt flag name each exit 1 withunknown argument: ....--helplists the flag with "types 10-12 and v3 (ExtAddr) ProTx payloads, including shared registrations".Flip criterion (proposal)
Proposed condition for turning these txs back ON on a node that runs with
--embedded-include-v24-provider-txs=false. It is measured on a node that keeps them ON and checks its templates against dashd. The counted txs are types 10-12 and version-3 (ExtAddr) ProTx payloads of types 1-4, shared registrations included.getblocktemplatewithmode=proposal) of our templates that contain at least one counted tx;The flip card lists explicitly any kind not yet seen in an accepted proposal, so the flip is made knowing which kinds are still unobserved. The kinds are type 10, 11 and 12, a shared registration, and v3 types 1 (unshared), 2, 3 and 4.