-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add SRC-7 helper functions #194
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
match metadata { | ||
Metadata::Int(data) => { | ||
write(hashed_key, 0, data); | ||
write(sha256((hashed_key, self.slot)), 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the last number in the second write
increment for each metadata type while the first write
seems to remain the same?
Doesn't the hashed key keep the collisions down to 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first write stores the data itself while the second write describes the type. This is needed as String
and Bytes
are pointer types and therefore cannot be stored, hence the use of the StorageMetadata
type in the first place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a better suggestion as to how to handle this case I'm all ears
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't considered a redesign for the 2 writes.
Type of change
Changes
The following changes have been made:
Metadata
type of the SRC-7 standardNotes