Skip to content

fix!: data contract transition validation issues - #1835

Merged
shumkov merged 52 commits into
v1.0-devfrom
fix/data-contract-validation
May 15, 2024
Merged

fix!: data contract transition validation issues#1835
shumkov merged 52 commits into
v1.0-devfrom
fix/data-contract-validation

Conversation

@shumkov

@shumkov shumkov commented May 3, 2024

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Before production release we need to review and fix if necessary all critical paths in Platform. State transition validation and execution logic, specifically Data Contract Create and Update transitions are one of them.

What was done?

  • Fixed misuse of encryption bounded key rules instead of decryption
  • Introduced assert_matches to simplify testing
  • Moved index update validation to IndexLevel.validate_update
  • Moved schema compatibility validation to DocumentTypeRef and perform complete update validation in DocumentTypeRef.validate_update.
  • Fixed missing document type configuration options validation
  • Optimised schema compatibility validation in case if schemas are the same
  • Moved data contact update validation to DataContract.validate_update
  • Fixed missing data contract owner validation
  • Fixed missing removed document type validation
  • Optimised $defs compatibility validation in case if it's not changed
  • Fixed invalid data contract missing document type consensus error
  • Fixed non-handled internal error in check tx handler
  • Fixed skipping non expected state transition results instead of block rejection
  • Fixed inconsistent state transition decoding logic on check tx
  • Do not verify fees on check tx for invalid ST
  • Fixed CheckTxResult is missing in case of asset lock based transition on check tx
  • Fixed missing data contract initial version validation
  • Optimised data contract validation before state validation for Data Contract Create Transition

How Has This Been Tested?

Covered Data Contract Create and Update transitions validation with tests

Breaking Changes

Data Contract Create and Update transitions validation logic is changed so previously created block chain data might not be valid anymore.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

shumkov added 26 commits May 3, 2024 13:28
@shumkov
shumkov marked this pull request as ready for review May 10, 2024 16:08
@shumkov
shumkov requested a review from QuantumExplorer as a code owner May 10, 2024 16:08
Comment thread packages/rs-dpp/src/data_contract/config/methods/mod.rs
Comment thread packages/rs-dpp/src/errors/consensus/codes.rs Outdated
@shumkov shumkov changed the title fix: misc data contract validation issues fix!: data contract transition validation issues May 13, 2024
@shumkov shumkov added this to the v1.0.0 milestone May 13, 2024
Comment thread packages/rs-dpp/src/errors/consensus/codes.rs Outdated
Comment thread packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs

@QuantumExplorer QuantumExplorer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

Comment thread packages/rs-dpp/src/data_contract/document_type/methods/validate_update/v0/mod.rs Outdated
Comment thread packages/rs-dpp/src/data_contract/document_type/methods/validate_update/v0/mod.rs Outdated
Comment thread packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs Outdated
@shumkov
shumkov merged commit c04d6ac into v1.0-dev May 15, 2024
@shumkov
shumkov deleted the fix/data-contract-validation branch May 15, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants