-
Notifications
You must be signed in to change notification settings - Fork 2
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
Key reshare addition #950
Key reshare addition #950
Changes from all commits
24de588
25f2ba1
f8e462d
3ee6614
ca6968b
b137a55
87e2390
9e6db22
eba2a82
bff3238
7ff8ba9
9d23d85
c3fa564
f11f95c
6957598
3827de0
41508bf
21ada12
4a1d936
de3822a
699f662
eb547e0
c1dd59d
0af6df2
b2129bf
912b596
d83f191
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,16 @@ pub struct OcwMessageDkg { | |
pub validators_info: Vec<ValidatorInfo>, | ||
} | ||
|
||
/// Offchain worker message for initiating a refresh | ||
#[cfg(not(feature = "wasm"))] | ||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] | ||
#[derive(Clone, Encode, Decode, Debug, Eq, PartialEq, TypeInfo)] | ||
pub struct OcwMessageReshare { | ||
// Stash address of new signer | ||
pub new_signer: Vec<u8>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If i've understood right, this is the stash address of the new member of the committee. I think we should put a doccomment to avoid stash address vs tss account confusion. |
||
pub block_number: BlockNumber, | ||
} | ||
|
||
/// Offchain worker message for initiating a proactive refresh | ||
#[cfg(not(feature = "wasm"))] | ||
#[derive( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ use crate::{ | |
use axum::{routing::IntoMakeService, Router}; | ||
use entropy_kvdb::{encrypted_sled::PasswordMethod, get_db_path, kv_manager::KvManager}; | ||
use entropy_protocol::PartyId; | ||
use entropy_shared::{DAVE_VERIFYING_KEY, EVE_VERIFYING_KEY}; | ||
use entropy_shared::{DAVE_VERIFYING_KEY, EVE_VERIFYING_KEY, NETWORK_PARENT_KEY}; | ||
use std::time::Duration; | ||
use subxt::{ | ||
backend::legacy::LegacyRpcMethods, ext::sp_core::sr25519, tx::PairSigner, | ||
|
@@ -118,7 +118,7 @@ pub async fn create_clients( | |
} | ||
|
||
/// Spawn 3 TSS nodes with pre-stored keyshares | ||
pub async fn spawn_testing_validators() -> (Vec<String>, Vec<PartyId>) { | ||
pub async fn spawn_testing_validators(add_parent_key: bool) -> (Vec<String>, Vec<PartyId>) { | ||
// spawn threshold servers | ||
let ports = [3001i64, 3002, 3003]; | ||
|
||
|
@@ -143,9 +143,9 @@ pub async fn spawn_testing_validators() -> (Vec<String>, Vec<PartyId>) { | |
|
||
let ids = vec![alice_id, bob_id, charlie_id]; | ||
|
||
put_keyshares_in_db("alice", alice_kv).await; | ||
put_keyshares_in_db("bob", bob_kv).await; | ||
put_keyshares_in_db("charlie", charlie_kv).await; | ||
put_keyshares_in_db("alice", alice_kv, add_parent_key).await; | ||
put_keyshares_in_db("bob", bob_kv, add_parent_key).await; | ||
put_keyshares_in_db("charlie", charlie_kv, add_parent_key).await; | ||
|
||
let listener_alice = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", ports[0])) | ||
.await | ||
|
@@ -175,9 +175,12 @@ pub async fn spawn_testing_validators() -> (Vec<String>, Vec<PartyId>) { | |
} | ||
|
||
/// Add the pre-generated test keyshares to a kvdb | ||
async fn put_keyshares_in_db(holder_name: &str, kvdb: KvManager) { | ||
let user_names_and_verifying_keys = [("eve", EVE_VERIFYING_KEY), ("dave", DAVE_VERIFYING_KEY)]; | ||
|
||
async fn put_keyshares_in_db(holder_name: &str, kvdb: KvManager, add_parent_key: bool) { | ||
let mut user_names_and_verifying_keys = | ||
vec![("eve", hex::encode(EVE_VERIFYING_KEY)), ("dave", hex::encode(DAVE_VERIFYING_KEY))]; | ||
if add_parent_key { | ||
user_names_and_verifying_keys.push(("eve", hex::encode(NETWORK_PARENT_KEY))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For clarity, we use a second copy of eve's keyshares as the parent key. I guess at some point we will remove per-user keyshares and this will be the only pre-configured keyshare. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup pretty much, why at a new key, If no objections Im happy with keeping less code here |
||
} | ||
for (user_name, user_verifying_key) in user_names_and_verifying_keys { | ||
let keyshare_bytes = { | ||
let project_root = | ||
|
@@ -188,7 +191,7 @@ async fn put_keyshares_in_db(holder_name: &str, kvdb: KvManager) { | |
)); | ||
std::fs::read(file_path).unwrap() | ||
}; | ||
let reservation = kvdb.kv().reserve_key(hex::encode(user_verifying_key)).await.unwrap(); | ||
let reservation = kvdb.kv().reserve_key(user_verifying_key).await.unwrap(); | ||
kvdb.kv().put(reservation, keyshare_bytes).await.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.
It seems strange to remove the term 'proactive refresh' here but keep it elsewhere.
My proposal would be to call it
reshare
but include anOption
with thenew_signer
field fromOcwMessageReshare
. Including that in the session Id ensures everyone is in agreement, and we can do a reshare with or without a change in the signing committee. (Whether we choose to do refreshes without a change is another question but i would like to keep the option open).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.
yes but I kinda wanna push on and handle this in the refactor