Skip to content

refactor(platform)!: document creation/update/deletion does not refetch contract - #1840

Merged
QuantumExplorer merged 2 commits into
v1.0-devfrom
refactor/documentCreationDoesNotRefetchContract
May 7, 2024
Merged

refactor(platform)!: document creation/update/deletion does not refetch contract#1840
QuantumExplorer merged 2 commits into
v1.0-devfrom
refactor/documentCreationDoesNotRefetchContract

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Document creation, update and deletion all told drive about the contract by setting the contract id. Drive would then refetch the contract from disk.

Even though most of the time it would fetch it from cache, this still was not ideal, because the processing cost of a fetch from cache is the same as a fetch from disk.

What was done?

A new type was created that encapsulates all types on data contract info, and we made the document operations in drive more straightforward hiding away most of the complexity. Now there are just a single operation allowed for adding, updating, or deleting.

How Has This Been Tested?

Tests continue to pass.

Breaking Changes

Since we no longer fetch the contract in drive, drive will report less processing costs, this means that this is a breaking change.

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

@QuantumExplorer
QuantumExplorer requested a review from shumkov as a code owner May 7, 2024 17:03

@PastaPastaPasta PastaPastaPasta 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.

light utACK; generally seems to be a fine and correct refactor; there are a few things I wish were done in other PRs to make this more trivial to review. I find it is unlikely there are issues introduced here that wouldn't be caught by tests.

See comments

Comment thread packages/rs-drive/src/drive/batch/drive_op_batch/document.rs
Comment thread packages/rs-drive/src/drive/document/delete/mod.rs
Comment thread packages/rs-drive/src/drive/object_size_info/mod.rs
@QuantumExplorer
QuantumExplorer merged commit 2b56263 into v1.0-dev May 7, 2024
@QuantumExplorer
QuantumExplorer deleted the refactor/documentCreationDoesNotRefetchContract branch May 7, 2024 17:42
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