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

Decouple SuiAddress and PublicKeyBytes #467

Merged
merged 1 commit into from
Feb 18, 2022
Merged

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented Feb 16, 2022

This is the next step for #318.
Currently we are using SuiAddress and PublicKeyBytes interchangeably. But they are different concept. Most of the time we should only be dealing with SuiAddress, which is a hash of PublicKeyBytes (or a hash of ObjectID when we represent object owners).
There should only be two places where PublicKeyBytes are used:

  1. Signer/Signature: public key will be needed for signing and signature checking. And eventually the use of any public key should be hidden inside Signer/Signature so no outside code should even refer to it.
  2. Authority name will be defined using PublicKeyBytes. There is no reason to use SuiAddress for Authority name. In the future we could consider supporting different schemas for authority as well but for now we will stick with what we have.

This PR does the following:
Base Types:

  1. Created a new type SuiAddress, which is similar to PublicKeyBytes in many ways, but different.
  2. Removed Authenticator. We no longer need this.

Authority:

  1. AuthorityInfo struct should contain AuthorityName, instead of SuiAddress
  2. AuthorityPrivateInfo doesn't need address field.

Client:

  1. ClientState now has a separate address field and pub_key field. This is a temporary state. Once we have a version of StableSyncSigner that can expose public key, we will remove the pub_key field.
  2. SafeClient's address needs to be PublicKeyBytes, instead of SuiAddress.

All over the code base:
Change the use from PublicKeyBytes to SuiAddress as much as I can (except in Authority config and cases where I need it for signing/validating)

Copy link
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

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

This is awesome and greatly speeds up #318, I'm fixing the few nits I have by building on top.
TYSVM!

Base automatically changed from generic-hex-encode to main February 18, 2022 01:29
@lxfind lxfind force-pushed the decouple-suiaddress-publickey branch from 8ced661 to fc7a5b6 Compare February 18, 2022 03:09
@lxfind lxfind merged commit 1b66bf5 into main Feb 18, 2022
@lxfind lxfind deleted the decouple-suiaddress-publickey branch February 18, 2022 03:43
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.

2 participants