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

contract: add my_derived_public_key() #691

Merged
merged 3 commits into from
Jul 18, 2024
Merged

contract: add my_derived_public_key() #691

merged 3 commits into from
Jul 18, 2024

Conversation

ppca
Copy link
Contributor

@ppca ppca commented Jul 18, 2024

No description provided.

@ppca ppca marked this pull request as ready for review July 18, 2024 17:24
@@ -373,6 +374,19 @@ impl VersionedMpcContract {
}
}

/// This is the derived key given path
pub fn my_derived_public_key(&self, path: String) -> PublicKey {
Copy link
Member

Choose a reason for hiding this comment

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

Don't think my adds any more info here, and we should just keep consistent with verbs in contract interfaces. How about we just rename to derive_public_key

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed it to derived_public_key() to be consistent with public_key()

@ppca ppca linked an issue Jul 18, 2024 that may be closed by this pull request
ChaoticTempest
ChaoticTempest previously approved these changes Jul 18, 2024
Comment on lines 378 to 379
pub fn derived_public_key(&self, path: String) -> PublicKey {
let predecessor = env::predecessor_account_id();
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add in an option where people can specify the predecessor account id since the one calling this function might or might not be the right one. Like in this case:

user.near calls nft.near
nft.near calls sign
predecessor_id = nft.near

user.near calls derived_public_key
predecessor_id = user.near
Suggested change
pub fn derived_public_key(&self, path: String) -> PublicKey {
let predecessor = env::predecessor_account_id();
pub fn derived_public_key(&self, path: String, predecessor: Option<AccountId>) -> PublicKey {
let predecessor = predecessor.unwrap_or_else(env::predecessor_account_id);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sweet. Will do.

@ppca ppca merged commit 2fefe64 into develop Jul 18, 2024
4 checks passed
@ppca ppca deleted the xiangyi/my_pk branch July 18, 2024 19:43
Copy link

Terraform Feature Environment Destroy (dev-691)

Terraform Initialization ⚙️success

Terraform Destroy success

Show Destroy Plan


No changes. No objects need to be destroyed.

Either you have not created any objects yet or the existing objects were
already deleted outside of Terraform.

Destroy complete! Resources: 0 destroyed.

Pusher: @ppca, Action: pull_request, Working Directory: ``, Workflow: Terraform Feature Env (Destroy)

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.

return derived user PK that was used in signing
2 participants