Repository navigation
Description
Problem
packages/rs-sdk/tests/fetch/contested_resource.rs::check_mn_voting_prerequisites requires the chain to contain manually-seeded test data:
- At least 3 different DPNS names under the
dashparent domain. - 3 identities each registering a contested-resource entry for the DPNS name
testname(i.e., a 3-way contest in-flight ondash/testname).
Three tests depend on this prereq and are gated with #[ignore = "requires manual DPNS names setup for masternode voting tests; …"]:
tests/fetch/contested_resource.rs:31test_contested_resourcestests/fetch/contested_resource.rs:68test_contested_resources_pagingtests/fetch/contested_resource.rs:148test_contested_resources_end_index_values
Today, running them against a freshly-built local devnet (even one built with SDK_TEST_DATA=true) errors out with:
ERROR main::fetch::contested_resource: Prerequisites for masternode voting tests not met, please configure the network accordingly,
errors: [
"Please create at least 3 different DPNS names for masternode voting tests, found 0",
"Please create 3 identities and create DPNS name `testname` for each of them, found 0"
]
Why the gap exists
- Contested-resource tests +
check_mn_voting_prerequisiteswere added in PR feat(sdk)!: impl Fetch/FetchMany for masternode voting endpoints #1864 (Jun 2024) and expanded in test(sdk): increase test coverage of masternode voting #1906 (Jul 2024), at a time when no automated seeding pipeline existed. create_sdk_test_data(theSDK_TEST_DATA=truecfg-gated seeder inrs-drive-abci) was added 9 months later by PR feat(sdk): token and group queries #2449 (Mar 2025). It currently seeds only:create_data_for_group_token_queriescreate_data_for_token_direct_pricescreate_data_for_addresses
- DPNS / contested-resource seeding was never wired in.
A confirming grep under packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/ returns zero matches for dpns/domain/contested.
Proposal — create_data_for_dpns_voting
Extend create_sdk_test_data with a fourth sibling seeder. New module:
packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/dpns.rs
Function signature mirrors the existing siblings:
pub(super) fn create_data_for_dpns_voting(
&self,
block_info: &BlockInfo,
transaction: TransactionArg,
platform_version: &PlatformVersion,
) -> Result<(), Error>Wire it from …/test/mod.rs::create_sdk_test_data after the three existing calls.
What it materializes at genesis
- 3 fresh identities — proTxHashes
[0x11; 32],[0x12; 32],[0x13; 32](distinct from the token-test identities attokens.rs:48-50). - Funding —
Drive::add_to_system_creditsper identity using the existingpub CREDITS_PER_IDENTITYconstant fromtokens.rs. - 5 DPNS
domaindocuments viaDrive::add_contested_document_for_contract:- 2 filler labels (
alice,bobby) — one contender each — socontested_resources.fetch_many()returns ≥ 3 distinct entries. - 3 contenders racing on
testname— fulfilling the 3-way contest requirement.
- 2 filler labels (
Implementation references
| Concern | File | Notes |
|---|---|---|
| Wire new seeder + call | packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/mod.rs |
Add mod dpns; and add a fourth call to create_data_for_dpns_voting |
| New seeder module | packages/rs-drive-abci/.../test/dpns.rs |
To create |
| Identity-registration template | packages/rs-drive-abci/.../test/tokens.rs |
CREDITS_PER_IDENTITY already pub |
| Load-bearing call | packages/rs-drive/src/drive/document/insert_contested/add_contested_document_for_contract/mod.rs |
Drive::add_contested_document_for_contract |
| Vote-poll struct | packages/rs-drive/src/drive/votes/resolved/vote_polls/contested_document_resource_vote_poll/mod.rs |
ContestedDocumentResourceVotePoll |
| System contract loader | packages/rs-drive/src/cache/system_contracts.rs:157 |
load_dpns() |
Document schema (incl. parentNameAndLabel contested index) |
packages/dpns-contract/schema/v1/dpns-contract-documents.json |
|
| DPNS-document construction reference | packages/rs-drive-abci/tests/strategy_tests/test_cases/voting_tests.rs:99-130 |
Existing pattern in strategy tests |
Risks / open questions
- Auto-init of vote-tally storage tree. Whether
add_contested_document_for_contractauto-creates the vote-tally tree for the poll, or whether the seeder must explicitly passSome(ContestedDocumentVotePollStoredInfo::default())for the first contender of each poll. Resolve by readingadd_contested_document_for_contract/v0/mod.rsbefore implementing — this decides whetherDocumentsAndVoteTallyqueries return contenders. - Single-contender filler polls. If the contested-resources enumeration only surfaces polls with ≥2 contenders, the
alice/bobbyfillers must each get a second contender (trivial duplication; same 3 identities can be reused as second contenders). - Idempotency on devnet restart. Genesis-only path so re-running with the same chain seed is naturally idempotent; verify with
dashmate reset && SDK_TEST_DATA=true dashmate start. - Network gate. Must remain
cfg(create_sdk_test_data)AND assertnetwork == Regtest(existing pattern).
Effort estimate
Medium, 6–10 developer-hours, including verification and lint. Dominant cost is figuring out the contested-document insertion contract (risks 1 and 2).
Test plan
After landing, on a freshly-built devnet with SDK_TEST_DATA=true:
- Lift the four
#[ignore]attributes attests/fetch/contested_resource.rs:31,68,148,290. - Run:
cd packages/rs-sdk ./scripts/connect_to_remote.sh <devnet> # if remote cargo test -p dash-sdk --features generate-test-vectors fetch::contested_resource -- --nocapture
- Expect
check_mn_voting_prerequisitesto returnOk(())and the three dependent tests to pass.
Origin of this issue
Surfaced during fix/rs-sdk-getdocuments-query-context (PR #3711) vector regeneration. Out of scope for that PR — separate follow-up to land on v3.1-dev. Architectural design report: /tmp/nagatha-dpns-seeding-design.md (Nagatha, 2026-05-21).
Co-authored by Claudius the Magnificent AI Agent
Activity
test(sdk): re-encode recorded V0 proof vectors as V1 envelopes