Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
791be79
feat(dpp): parser generation 4 checks document schemas natively at pr…
QuantumExplorer Oct 22, 2026
47c7e5c
feat(dpp): port the index rules to parser generation 4, held to 255-b…
QuantumExplorer Oct 22, 2026
b16d1b0
feat(dpp): port the document-type keywords and reference and constrai…
QuantumExplorer Oct 22, 2026
acca811
test(dpp): compare parser generation 4 with generation 3 and the meta…
QuantumExplorer Oct 22, 2026
a832dc2
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 22, 2026
0e06f34
docs(platform): note native registration checks among protocol versio…
QuantumExplorer Oct 22, 2026
7991a1d
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 22, 2026
787904e
refactor(dpp): select the native schema checks through a version tabl…
QuantumExplorer Oct 22, 2026
a878446
fix(dpp): report a nested property without position at its own path
QuantumExplorer Oct 22, 2026
98c16d1
fix(dpp): give native schema errors the meta-schema check's keywords …
QuantumExplorer Oct 22, 2026
9736463
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 22, 2026
d8fc8a4
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 22, 2026
b13a8be
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 22, 2026
23c99b2
fix(dpp): give the summableOffCountIndex exclusion its negated schema
QuantumExplorer Oct 22, 2026
6cdb12a
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 23, 2026
fd05f7b
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 23, 2026
5feadcb
docs(dpp): list the uniqueness rule among the native checks' own rules
QuantumExplorer Oct 23, 2026
499a190
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 23, 2026
117e7bd
docs(platform-version): name the uniqueness rule in protocol version …
QuantumExplorer Oct 23, 2026
352f01b
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 23, 2026
da6818e
docs(dpp): state the registration uniqueness rule of protocol version…
QuantumExplorer Oct 23, 2026
9a351dd
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 23, 2026
123e550
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 23, 2026
4fd4fab
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 23, 2026
619ff22
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 23, 2026
fa7401d
fix(dpp): refuse at registration a type whose native validator does n…
QuantumExplorer Oct 23, 2026
bfe0d73
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 23, 2026
aa1b1df
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 24, 2026
b5babc6
refactor(dpp): build the registration check's validator through the v…
QuantumExplorer Oct 24, 2026
e8d1186
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 24, 2026
3d0157d
fix(dpp): compare numbers exactly in the native registration checks
QuantumExplorer Oct 24, 2026
f0395bf
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 24, 2026
0172da0
refactor(dpp): hold the index property name cap in `SystemLimits`
QuantumExplorer Oct 24, 2026
7b675a5
test(dpp): pin how registration reads a `contains` that is no schema
QuantumExplorer Oct 24, 2026
ac49b75
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 24, 2026
369c2b0
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 24, 2026
ae07137
Merge claude/native-document-validator into claude/native-registratio…
QuantumExplorer Oct 24, 2026
8a6d712
test(dpp): pin what the meta-schema leaves unchecked, the native chec…
QuantumExplorer Oct 24, 2026
9de9be5
test(dpp): pin the token cost contract id bytes against the meta-sche…
QuantumExplorer Oct 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ use crate::tokens::token_amount_on_contract_token::{
};
use indexmap::IndexMap;

#[cfg(feature = "validation")]
use super::native_schema;
use super::{insert_values, insert_values_nested};

#[cfg(feature = "validation")]
Expand Down Expand Up @@ -683,8 +685,8 @@ pub(super) fn parse_document_type_core(

/// Everything `full_validation` asks of the schema before anything is parsed
/// out of it: the document type's name, the enriched schema's depth (and the
/// fee for its size), and the schema itself against this generation's document
/// meta-schema — which also primes the document validator.
/// fee for its size), and the schema itself, as `check_document_type_schema`
/// checks it.
#[cfg(feature = "validation")]
fn validate_document_type_schema(
ctx: &CoreParseContext<'_>,
Expand All @@ -702,15 +704,69 @@ fn validate_document_type_schema(
ctx.platform_version,
)?;

validate_against_meta_schema_and_compile(
root_schema,
ctx.generation.document_type_schema_version,
ctx.generation.meta_schema_method_name,
json_schema_validator,
ctx.platform_version,
)?;
check_document_type_schema(ctx, root_schema, json_schema_validator)
}

Ok(())
/// The schema check of full validation, versioned on `check_document_type_schema`: 0 checks
/// the enriched schema against the document meta-schema through the `jsonschema` crate and
/// compiles it; 1 (protocol version 15) checks it natively ([`native_schema`]), with the
/// rules of document meta-schema v3.
#[cfg(feature = "validation")]
fn check_document_type_schema(
ctx: &CoreParseContext<'_>,
root_schema: &Value,
json_schema_validator: &StatelessJsonSchemaLazyValidator,
) -> Result<(), ProtocolError> {
match ctx
.platform_version
.dpp
.contract_versions
.document_type_versions
.schema
.check_document_type_schema
{
0 => validate_against_meta_schema_and_compile(
root_schema,
ctx.generation.document_type_schema_version,
ctx.generation.meta_schema_method_name,
json_schema_validator,
ctx.platform_version,
),
1 => native_schema::check_document_type_schema(root_schema, ctx.platform_version),
version => Err(ProtocolError::UnknownVersionMismatch {
method: "DocumentType::check_document_type_schema".to_string(),
known_versions: vec![0, 1],
received: version,
}),
}
}

/// Under full validation, the requirement `check_document_type_schema` 1 (protocol version
/// 15) adds once a document type is parsed: the type, whose expanded schema is `schema`, with
/// the contract's expanded `$defs`, must have a typed validation schema, which its documents
/// are checked against natively. Version 0 requires nothing. Run last, so that a schema the
/// parser refuses is refused with the parser's error.
#[cfg(feature = "validation")]
pub(super) fn require_validation_schema(
schema: &Value,
schema_defs: Option<&BTreeMap<String, Value>>,
platform_version: &PlatformVersion,
) -> Result<(), ProtocolError> {
match platform_version
.dpp
.contract_versions
.document_type_versions
.schema
.check_document_type_schema
{
0 => Ok(()),
1 => native_schema::check_validation_schema(schema, schema_defs, platform_version),
version => Err(ProtocolError::UnknownVersionMismatch {
method: "DocumentType::require_validation_schema".to_string(),
known_versions: vec![0, 1],
received: version,
}),
}
}

/// The document-type level switches, read straight off the schema map.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ use platform_version::version::PlatformVersion;
use std::collections::{BTreeMap, BTreeSet};

mod common;
#[cfg(feature = "validation")]
mod native_schema;
mod v0;
mod v1;
mod v2;
Expand Down
Loading
Loading