-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[key-server] handle committee mode #358
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
base: main
Are you sure you want to change the base?
Conversation
0206f54 to
536076a
Compare
ec95e32 to
bcea534
Compare
246025c to
d9174d5
Compare
bcea534 to
74a77e9
Compare
74a77e9 to
022951b
Compare
9752b01 to
05a3799
Compare
adee3a1 to
4b433e7
Compare
crates/key-server/src/master_keys.rs
Outdated
| #[derive(Clone)] | ||
| pub(crate) enum CommitteeKeyState { | ||
| Active { | ||
| master_key: IbeMasterKey, |
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.
we can move master_share to Committee enum
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.
you mean collapse it into pub enum ServerMode?
i was considering this, KeyServerOptions that has ServerMode also has a bunch of "configurations", is it a good idea to move key materials there? (perhaps thats why it was set up separately before?)
9c53815 to
0cf46e3
Compare
|
cc @benr-ml i revised it to use the key server obj instead of committee. im still working on adding more tests, but see pr description and lmk if they make sense high level? |
4c7d38a to
e32447f
Compare
yes, the high level makes sense. perhaps we can use env variable MASTER_SHARE_X for version X to make it slightly more explicit |
6f2e360 to
83a6743
Compare
08fc13b to
5496c63
Compare
3f4620c to
e4303e1
Compare
e4303e1 to
8c2dbb1
Compare
| # - "0x3333333333333333333333333333333333333333333333333333333333333333" | ||
|
|
||
| # #### COMMITTEE MODE #### | ||
| # See step 7 in the member runbook for fresh DKG and key rotation in details. |
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.
| # See step 7 in the member runbook for fresh DKG and key rotation in details. | |
| # See the runbook for fresh DKG and key rotation in details. |
| # #### COMMITTEE MODE #### | ||
| # See step 7 in the member runbook for fresh DKG and key rotation in details. | ||
| # | ||
| # Environment variables use versioned naming: MASTER_SHARE_VX |
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.
| # Environment variables use versioned naming: MASTER_SHARE_VX | |
| # Environment variables use versioned naming: MASTER_SHARE_VX where X is a version of the committee (e.g. 1) |
| # Environment variables use versioned naming: MASTER_SHARE_VX | ||
| # | ||
| # - For active mode (onchain version = target version = X): | ||
| # Must provide MASTER_SHARE_VX where X matches both onchain and target versions. |
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.
| # Must provide MASTER_SHARE_VX where X matches both onchain and target versions. | |
| # Must set the env variable MASTER_SHARE_VX where X matches the onchain version. |
| # Example: For version 0, set MASTER_SHARE_V0, other versioned shares will be ignored. | ||
| # | ||
| # - For rotation mode (onchain version = X, target version = X+1): | ||
| # Must provide MASTER_SHARE_VX and MASTER_SHARE_VX+1. |
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.
| # Must provide MASTER_SHARE_VX and MASTER_SHARE_VX+1. | |
| # Must set the env variables MASTER_SHARE_VX and MASTER_SHARE_VY where Y = X+1 |
| # Must provide MASTER_SHARE_VX and MASTER_SHARE_VX+1. | ||
| # The server uses MASTER_SHARE_VX and automatically switches to MASTER_SHARE_VX+1 | ||
| # when the onchain version updates to X+1. | ||
| # Example: For rotation from v1 to v2, set both MASTER_SHARE_V1 and MASTER_SHARE_V2. |
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.
| # Example: For rotation from v1 to v2, set both MASTER_SHARE_V1 and MASTER_SHARE_V2. | |
| # Example: For rotation from version 1 to 2, set both MASTER_SHARE_V1 and MASTER_SHARE_V2. |
| # server_mode: !Committee | ||
| # member_address: '<MY_ADDRESS>' | ||
| # key_server_obj_id: '<KEY_SERVER_OBJ_ID>' | ||
| # target_key_server_version: 2 |
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.
abusing target_key_server_version for both cases confused me a bit, maybe we could make it more explicit - instead of target_key_server_version , use committee_state: enum { Active, Rotation(target_version) } - if Active, determine the version from the ks obj; if Rotation, determine both versions from target_version?
| let master_keys = MasterKeys::load(&options).unwrap_or_else(|e| { | ||
|
|
||
| // Fetch current version onchain. | ||
| let current_version = match &options.server_mode { |
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.
| let current_version = match &options.server_mode { | |
| let committee_version = match &options.server_mode { |
| // Derive KeyServerV2 dynamic field ID on KeyServer object. | ||
| // This is a regular dynamic_field, not dynamic_object_field. | ||
| // Key type: u64, Key value: EXPECTED_KEY_SERVER_VERSION | ||
| let v2_field_name_bcs = bcs::to_bytes(&EXPECTED_KEY_SERVER_VERSION)?; |
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.
| let v2_field_name_bcs = bcs::to_bytes(&EXPECTED_KEY_SERVER_VERSION)?; | |
| let v2_field_name_bcs = bcs::to_bytes(&EXPECTED_KEY_SERVER_VERSION).unwrap(); |
Description
Test plan
make the config file: crates/key-server/key-server-config.example
run with
output: