-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[Object Ownership #1] Add Authenticator #292
Conversation
@@ -84,6 +84,21 @@ pub type AuthorityName = PublicKeyBytes; | |||
pub type ObjectID = AccountAddress; | |||
pub type ObjectRef = (ObjectID, SequenceNumber, ObjectDigest); | |||
|
|||
#[derive(Eq, PartialEq, Debug, Clone, Copy, Deserialize, PartialOrd, Ord, Serialize, Hash)] | |||
pub enum Authenticator { |
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.
Wondering: should we call this type Address
and the Address
variant Ed25519PublicKey
? E.g., say we support multiple signing schemes via extensions to the enum (e.g., ECDSA for compatibility with Eth/Bitcoin wallets, BLS to support tricks with aggregation), there will be several variants of the enum that look like addresses authenticated by a public key.
My mental model of an address (which may be wrong/different from what others think--please LMK!) is:
- Something you can send an object to
- Something that can (possibly) be the
signer
of a transaction
It seems like all current and future variants of Authenticator
probably satisfy both of these conditions (with the exception of ObjectID
and (2), which is somewhat of a special case).
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 Address
type is already taken though: https://github.com/MystenLabs/fastnft/blob/main/fastx_types/src/messages.rs#L20
It represents either an address on FastX or an external address on primary chain.
So maybe we could name this one FastXAddress?
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.
E.g., say we support multiple signing schemes via extensions to the enum, there will be several variants of the enum that look like addresses authenticated by a public key.
While there may be several signing schemes at play eventually, quoting from #99:
In the future, an address should be the hash of an authenticator, e.g.
If that's our north start, there are advantages (in terms of validity, UX, feasibility of error correction, ...) to having that has be normalized and universal, i.e. one single fixed-length byte string format - not that there aren't ways of embedding variants in this type.
IOW, I think even with several key variants, we may get away with a single variant for the Address concept.
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 Address type is already taken though: https://github.com/MystenLabs/fastnft/blob/main/fastx_types/src/messages.rs#L20
It represents either an address on FastX or an external address on primary chain.
So maybe we could name this one FastXAddress?
Makes sense to me. And reminds me: I think the notion of "primary" is a fastpay artifact and we should kill anything related to it.
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.
#310 for this
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.
Lets not block this for the sake of future potentially features. I think calling it Address
in this context is fine.
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
@@ -84,6 +84,21 @@ pub type AuthorityName = PublicKeyBytes; | |||
pub type ObjectID = AccountAddress; | |||
pub type ObjectRef = (ObjectID, SequenceNumber, ObjectDigest); | |||
|
|||
#[derive(Eq, PartialEq, Debug, Clone, Copy, Deserialize, PartialOrd, Ord, Serialize, Hash)] | |||
pub enum Authenticator { |
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.
E.g., say we support multiple signing schemes via extensions to the enum, there will be several variants of the enum that look like addresses authenticated by a public key.
While there may be several signing schemes at play eventually, quoting from #99:
In the future, an address should be the hash of an authenticator, e.g.
If that's our north start, there are advantages (in terms of validity, UX, feasibility of error correction, ...) to having that has be normalized and universal, i.e. one single fixed-length byte string format - not that there aren't ways of embedding variants in this type.
IOW, I think even with several key variants, we may get away with a single variant for the Address concept.
I think stating all the goals like this is helpful--we want a concept of "address" that:
The path I imagined to this was defining an Curious what you all think of these goals + different paths toward hitting all of 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.
I like the flexibility this change gives us with direct applicability to the next 3 PRs. Lets land it.
@@ -84,6 +84,21 @@ pub type AuthorityName = PublicKeyBytes; | |||
pub type ObjectID = AccountAddress; | |||
pub type ObjectRef = (ObjectID, SequenceNumber, ObjectDigest); | |||
|
|||
#[derive(Eq, PartialEq, Debug, Clone, Copy, Deserialize, PartialOrd, Ord, Serialize, Hash)] | |||
pub enum Authenticator { |
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.
Lets not block this for the sake of future potentially features. I think calling it Address
in this context is fine.
I think it's a relatively straightforward refactor to go from
|
Sounds like we're on the same page + thanks for the detailed plan! |
@sblackshear opened #318 |
7f779f7
to
b8f6ea7
Compare
Committing this as it is with Authenticator + Address variant. Added TODO to rename/extend it to support more. |
This is the first step to implement #99.
It adds a new
Authenticator
type that represent either a user account address or an object ID.The owner of an object is now
Authenticator
.This PR doesn't use it in anyway, but merely just try to get all code compile with this new type.