Skip to content

Expose fresh-contract position validation through DPP #6113

Open

Description

@thepastaclaw

PastaClaw flagged this while reviewing #6013, where it was deferred to a follow-up instead of being fixed in that pull request. This issue tracks the follow-up.

Expose fresh-contract position validation through DPP (suggestion)

Where: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/basic_structure/v3/mod.rs:43-54 at 48cee32ab822:

// Nothing is stored yet, so every object is one the contract gains
let data_contract = self.data_contract();
let judge = MemberPositionOrder::new(data_contract.schema_defs());
let error = data_contract
.document_schemas()
.values()
.find_map(|schema| judge.first_error_of_document_type(None, schema))
.or_else(|| {
judge
.first_error_of_definitions(None)
.map(|(_, error)| error)
});

The PV15 registration check is assembled only in the ABCI basic-structure validator. DataContractFactoryV0::create_with_id constructs a contract with try_from_platform_versioned(..., true, ...), but the DPP full-validation path does not invoke MemberPositionOrder; consequently a client-side DataContractFacade::create can accept a fully validated contract that the node deterministically rejects. Put the whole-contract registration check behind a versioned DPP entry point and call it from both fresh contract construction and ABCI validation, while keeping it out of generic historical deserialization.

Origin

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions