Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Simplify InterpreterStorage #683

Merged
merged 3 commits into from
Feb 22, 2024

Conversation

bvrooman
Copy link
Contributor

@bvrooman bvrooman commented Feb 22, 2024

Related issues:

Currently, the InterpreterStorage trait has two issues:

  • It imposes an unnecessary constraint on MerkleRootStorage which can be removed.
  • The getter and setter methods for assets and state are prefixed with merkle_; however, implementations of these methods do not necessarily need to Merklize the data, and it is the responsibility of specific implementations to understand when Merklization is needed.

By removing the merkle_ prefix, we make it more clear that the methods are simply methods to query or mutate data in interpreter storage. Any Merklization is an internal detail. Additionally, this means that implementations of these methods that do not apply Merklization, i.e. for MemoryStorage, are more congruent with the method name.

This enables future interface changes to be done more easily and with greater confidence in their correctness.

@bvrooman bvrooman changed the title chore: Simplify InterpreterStorage chore: Simplify InterpreterStorage Feb 22, 2024
@bvrooman bvrooman self-assigned this Feb 22, 2024
@bvrooman bvrooman requested a review from a team February 22, 2024 03:49
@bvrooman bvrooman marked this pull request as ready for review February 22, 2024 03:50
@@ -248,23 +242,6 @@ impl StorageMutate<ContractsAssets> for MemoryStorage {
}
}

impl MerkleRootStorage<ContractId, ContractsAssets> for MemoryStorage {
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit surprised that this can just be removed.

Copy link
Member

@Dentosal Dentosal left a comment

Choose a reason for hiding this comment

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

Seem like this is just renaming and removals. Correctly marked as breaking change, although it's mostly internal.

@xgreenx xgreenx added this pull request to the merge queue Feb 22, 2024
Merged via the queue into master with commit de18292 Feb 22, 2024
37 checks passed
@xgreenx xgreenx deleted the bvrooman/chore/simplify-interpreter-storage branch February 22, 2024 09:27
@xgreenx xgreenx mentioned this pull request Feb 29, 2024
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.

None yet

3 participants