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

Storage refactoring docs #1592

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Artemka374
Copy link

No description provided.

@HCastano
Copy link
Contributor

@Artemka374 are you going to continue driving this forward?

@ivan770
Copy link

ivan770 commented Mar 24, 2023

@Artemka374 are you going to continue driving this forward?

Hi! Yes, we would like to drive this forward. I've updated the documentation to link to existing chapters on ink!'s website. We think that this documentation can serve as a more "deep dive" guide, with comparison of ink! 4 storage to ink! 3, and can be a companion to the documentation served on use.ink.

@Artemka374 Artemka374 marked this pull request as ready for review March 24, 2023 11:08
Mapping,
};

/// Non-packed type with
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// Non-packed type with
/// Non-packed type

Comment on lines 3 to 5
In ink! v4.0.0-beta the way storage works was refactored.

## Pre-ink! v4.0.0-beta storage
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you remove the section on how it was done before?

It was fine when you created the PR, but we have the migration guide from 3.x to 4.x by now, which covers it.

@@ -0,0 +1,340 @@
# Storage refactoring
Copy link
Collaborator

Choose a reason for hiding this comment

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

The examples folder was renamed to integration-tests by now, can you do it in this PR as well?

@@ -0,0 +1,30 @@
[package]
name = "complex_storage_structures"
version = "4.0.0-beta"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
version = "4.0.0-beta"
version = "4.1"

Comment on lines 47 to 51
pub trait BalancesStateManagement {
fn increase_balance_state(&mut self, amount: u128);
fn decrease_balance_state(&mut self, amount: u128);
fn get_balance_state(&self) -> u128;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need this for the example

derive(scale_info::TypeInfo, ink::storage::traits::StorageLayout)
)]
pub struct TokenManagement<
KEY: StorageKey,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the KEY here to demonstrate what you're trying to get at?

Mapping,
};

/// Non-packed type with
Copy link
Contributor

Choose a reason for hiding this comment

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

with...?

@ivan770
Copy link

ivan770 commented Apr 12, 2023

I've rebased this branch and applied the above suggestions. BalancesStateManagement trait was used to demonstrate generic packed structs, and the KEY generic was meant to demonstrate how to write structs for upgradeable contracts, but both can be removed from this example.

@varex83
Copy link
Contributor

varex83 commented Jul 31, 2023

Hi @HCastano @cmichi @hychen

Any updates on that? Should we continue / close this PR?

@Artemka374 Artemka374 requested a review from cmichi August 31, 2023 15:32
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

5 participants