-
Notifications
You must be signed in to change notification settings - Fork 17
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
Determine Participant Id automatically #400
Conversation
Terraform Feature Environment (dev-400)Terraform Initialization ⚙️
|
use near_sdk::{AccountId, PublicKey}; | ||
use std::collections::{BTreeMap, HashSet}; | ||
|
||
pub mod hpke { |
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.
What is hpke
?
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's used to determine the public key type used for encrypting messages.
Crate: https://docs.rs/crate/hpke/latest
(it is not added by this PR)
)] | ||
pub struct CandidateInfo { | ||
pub account_id: AccountId, | ||
pub url: String, |
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.
If this is a URL, could it be a parsed one so a type like Url?
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 was avoiding it because such a check can be heavy for a contract. But it may be a good idea.
I might need a call to work out everything that's going on here. What issues does this PR close? |
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 had a session with @volovyks where he walked me through this PR and I think everything here makes sense to me. Except for one point, which is important but can be handled in the future.
let me = contract_state | ||
.participants | ||
.find_participant(ctx.my_account_id()) | ||
.unwrap(); |
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.
This is going to be a brittle pattern going forward. me()
does not exist in all contexts so we should strive to make this type safe and ensure we can only use it in the contexts where it exists. One potential solution to this is #416
Terraform Feature Environment Destroy (dev-400)Terraform Initialization ⚙️
|
me()
function because the participant id is not available at that moment.