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

Delete old keyshare if not in next_signers #999

Merged
merged 8 commits into from
Aug 13, 2024

Conversation

JesseAbram
Copy link
Member

@JesseAbram JesseAbram commented Aug 10, 2024

Related #941

  • Delete old key if not a new signer (includes making the test for reshare in TSS actually rotate the signers not just do a reshare)

@JesseAbram JesseAbram marked this pull request as ready for review August 12, 2024 16:57
@JesseAbram JesseAbram requested review from ameba23 and HCastano and removed request for ameba23 August 12, 2024 16:57
Comment on lines 375 to 377
if kv_manager.kv().exists(&hex::encode(NETWORK_PARENT_KEY)).await? {
kv_manager.kv().delete(&hex::encode(NETWORK_PARENT_KEY)).await?
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would say it's misleading to have an is_() function which has a side effect - and especially in this case where it's deleting a key from the DB.

Since this function is only called once, I would just inline it at the call site so it's at least transparent to any reader that there are side effects in the case that the validator isn't a "proper" signer.

Copy link
Member Author

Choose a reason for hiding this comment

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

that was my first instinct however since this is a simple test for functionality, I moved it out for testing.

To move it in I would have to rewrite the state of the mock_signers (breaking an earlier test......or put it in the dev chain init state.......or I could manually swap out the TSS key by accessing the kvdb directly)

which I could do, but it would like bloat the test code plus require a chain spin up and at least add 60 seconds to the test which seemed a lot worse

I could change the function name to account for the secondary effects tho like is_signer_or_delete_parent_key

Copy link
Collaborator

Choose a reason for hiding this comment

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

Even in the function name you're proposal it seems like you're trying to couple two different concepts. I do see what you mean about the ease of testing though.

I would try and think about a few other options here, but I'll approve to unblock you.

Comment on lines 375 to 377
if kv_manager.kv().exists(&hex::encode(NETWORK_PARENT_KEY)).await? {
kv_manager.kv().delete(&hex::encode(NETWORK_PARENT_KEY)).await?
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Even in the function name you're proposal it seems like you're trying to couple two different concepts. I do see what you mean about the ease of testing though.

I would try and think about a few other options here, but I'll approve to unblock you.

crates/threshold-signature-server/src/validator/api.rs Outdated Show resolved Hide resolved
crates/threshold-signature-server/src/validator/api.rs Outdated Show resolved Hide resolved
JesseAbram and others added 5 commits August 13, 2024 10:02
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
@JesseAbram JesseAbram merged commit a3ca47e into master Aug 13, 2024
14 checks passed
@JesseAbram JesseAbram deleted the delete-old-keyshare-if-not-in-next-signers branch August 13, 2024 16:57
ameba23 added a commit that referenced this pull request Aug 15, 2024
* master:
  Bump serde_json from 1.0.124 to 1.0.125 in the patch-dependencies group (#1007)
  Signing flow with derived accounts (#990)
  Add `network-jumpstart` command to `entropy-test-cli` (#1004)
  Refactor reshare (#994)
  Migrate circle-ci workflow to github actions (#991)
  Delete old keyshare if not in next_signers (#999)
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.

2 participants