-
Notifications
You must be signed in to change notification settings - Fork 24
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
Call blockprod::find_timestamps_for_staking directly from wallet cli #1748
Call blockprod::find_timestamps_for_staking directly from wallet cli #1748
Conversation
d6fabf2
to
9cc49cf
Compare
4692e08
to
e4040af
Compare
let mut rng = make_true_rng(); | ||
let our_private_key = EndToEndPrivateKey::new_from_rng(&mut rng); | ||
let our_public_key = our_private_key.public_key(); | ||
|
||
let wallet = self.wallet().await?; | ||
|
||
let callee_public_key = wallet.e2e_public_key().await?.take(); | ||
|
||
let encrypted_input_data = wallet | ||
.get_timestamp_search_input_data( | ||
HexEncoded::new(our_public_key.clone()), | ||
pool_id, | ||
) | ||
.await?; | ||
let shared_secret = our_private_key.shared_secret(&callee_public_key); | ||
let secret_input_data = shared_secret | ||
.decrypt_then_decode::<PoSTimestampSearchInputData>(&encrypted_input_data)?; | ||
|
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.
Can't we pack all this in one function or something, instead of doing it here inline?
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 think this is a good idea. We should attempt to do it through tower first.
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.
Obviously, this isn't a priority. I'm OK with putting this in the backlog.
9cc49cf
to
e480095
Compare
e4040af
to
22bbbb1
Compare
I've added an issue for this - #1749 |
Closing this for now. It can be re-visited after #1749 is implemented. |
This addresses the problem from #1747 where the timestamp search RPC call from wallet-cli to wallet-rpc-daemon would timeout if the search takes a long time.
To solve the problem, the call to
blockprod::find_timestamps_for_staking
was moved from the wallet controller to wallet-cli itself. Since the call needsPoSTimestampSearchInputData
, I had to add theget_timestamp_search_input_data
function to wallet RPC that returns the data. And since the data contains the private vrf key, I had to use e2e encryption for it.In the end, I'm not sure it's worth the added complexity, because the timeout problem only exists if wallet-cli connects to wallet-rpc-daemon.
Given that
FindTimestampsForStaking
is a "niche" (and hidden) command, probably no one will ever use it in this scenario.