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

fix(standards): redundancy and inaccuracy in nft storage measure #846

Closed
wants to merge 1 commit into from

Conversation

austinabell
Copy link
Contributor

  • Fixes bug with storage measurement
  • Removes redundant code and operations
  • Updates key for storage keys for tokens per owner to a 32 byte array. I have no explanations or guesses why there was asymmetry between the other storage key that was also a hash

closes #844

@BenKurrek would love your input on this

@@ -53,7 +51,7 @@ pub struct NonFungibleToken {

#[derive(BorshStorageKey, BorshSerialize)]
pub enum StorageKey {
TokensPerOwner { account_hash: Vec<u8> },
TokensPerOwner { account_id_hash: CryptoHash },
Copy link
Contributor

Choose a reason for hiding this comment

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

Still am advocating for this to be an AccountId. You charge for a full length account id, but it will reduce storage on average since most real users have shorter account ids, and it will not require a host call to produce a hash.

Copy link
Contributor

Choose a reason for hiding this comment

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

Furthermore a state dump will make it clear who the owner is.

Copy link
Contributor Author

@austinabell austinabell Jun 17, 2022

Choose a reason for hiding this comment

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

This would be a state-breaking change, though. This can come if there are breaking changes or if the standards were re-written.

Also, this makes it harder to find things based on a prefix because of the variable-length prefix, so not a clear win anyway.

@austinabell
Copy link
Contributor Author

oops, didn't see #843

will just use/build off that

@austinabell austinabell deleted the austin/nft_measure_fix branch September 20, 2022 17:28
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.

Confusing measure storage in NonFungibleToken
2 participants