-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[framework] Adds publisher module #7196
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
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.
I like it! Just waiting to finish the conversation about a home for things that should eventually belong in move stdlib before final stamp.
@amnn @sblackshear on the topic: do you think we should rename it into |
I think technically it's a witness (i.e. it witnessed the package being published), rather than a capability. |
I've addressed your comments above. Few changes:
|
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 Publisher changes look good to me, but unless I'm missing something (very possible), I think type_name::get_address
and type_name::get_module
produce reversed outputs compared to what I would expect (and could benefit from some tests) -- could you take a look at those?
let str_bytes = ascii::as_bytes(&self.name); | ||
let addr_bytes = vector[]; | ||
|
||
// Reverse-read string from the last byte pushing the value |
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.
I don't understand why we are reverse reading the address here? IIUC, this means addr_bytes
will be the reverse of the address prefix of str_bytes
.
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.
yrros esrever ni gnikniht saw daeh ym
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.
Thanks @damirka !
@@ -103,6 +111,10 @@ module sui::test_publisher { | |||
assert!(publisher::is_package<CustomType>(&pub), 0); | |||
assert!(publisher::is_package<Scenario>(&pub), 0); | |||
|
|||
assert!(&ascii::string(b"0000000000000000000000000000000000000002") == publisher::package(&pub), 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.
nit: These tests probably belong in the stdlib rather than here, as that's where most of the logic is -- but very happy to see them!
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.
That's a tricky part. We don't have tests in the stdlib and I never dared to add one. Guess it's a bigger question on whether it's okay to have tests for stdlib or there's a better place for them where they live?
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.
Yeah, interesting -- maybe @sblackshear / @tnowacki has context on why there seems to not be #[test]
s in the stdlib?
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.
(Any case, not a blocker for this PR)
Finalizes the experiment myself and @amnn started; and proposes a
publisher
module.The goal of this module is to enable recognition of the Publisher authority. Potentially it could be used for: