-
Notifications
You must be signed in to change notification settings - Fork 355
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
refactor(stdlibs): remove Hash, GetTimestamp, FormatTimestamp from std #657
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.
It looks good to me, however, I’d like to ask @jaekwon if he sees good reasons to still keep this, because he was the original author.
Merged master and pinging @jaekwon to review this |
reading |
I think this might be the right thing to do, but it's a bit weird. One, we need to make sure that the declaration of type Location is safe, for when Location is ever set (now or in the future). So for example, Location shouldn't be modifiable, otherwise any user can modify a *Location for all users, a bad security breach. Not only should we scan the stdlibs/time code, but also I guess everything about the current implementation, including functions that haven't been ported yet, to make sure it will always be safe to completely port it and maintain it. Also, it seems a bit unnecessary to support this time implementation because (a) it is a struct, which is more expensive than a primary value, (b) at least in the blockchain context we don't need to support that weird "wall timer" thing, (c) it honestly seems way too complex even in Go because of the "wall timer" thing. So I imagine we may want to implement another "time" package for gno in the future that is simpler. But anyways, the stdlibs/time.Format is already used for boards, so seems fine to go ahead for now. |
GetTimestamp
andFormatTimestamp
have been deprecated a while ago, and since the language is still changing and these are used nowhere in the source except for a test, it makes sense to remove them.std.Hash comes from a discussion in #580.
rg std.Hash
returns nothing in the gno source, and in a bit of an obscure way, is not just a call toSha256Sum
, but a 20-byte version of that (seepkgs/gnolang/hash_image.go
). I also removed some dead code in hash_image.go.