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

feat: add conversion from Account to AccountDelta #983

Merged
merged 9 commits into from
Dec 2, 2024

Conversation

polydez
Copy link
Contributor

@polydez polydez commented Nov 25, 2024

Related to 0xPolygonMiden/miden-node#527

In this PR we implement conversion from account details to account "initial" delta. We need it in order to simplify DB requests which get delta's nonce/storage/storage-maps previous values.

Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Ideally we would be implementing impl From<Account> instead of impl From<&Account> but it seems that all the recursive inner types all the way to miden crypto do not support into_* methods that consume the type and return the inner values. I think that would be overall more efficient, especially when one already has an Account and wants to convert to a delta without cloning.

Since this isn't an easy fix here, I think this PR is fine.

objects/src/accounts/delta/storage.rs Outdated Show resolved Hide resolved
objects/src/accounts/delta/storage.rs Outdated Show resolved Hide resolved
objects/src/accounts/delta/vault.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you for addressing the comments so thoroughly!

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left just one minor nit inline.

objects/src/accounts/mod.rs Outdated Show resolved Hide resolved
@polydez polydez merged commit 11de9e1 into next Dec 2, 2024
9 checks passed
@polydez polydez deleted the polydez-conv-acc-to-delta branch December 2, 2024 08:06
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.

3 participants