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

fix: set numPeers correctly #386

Merged
merged 1 commit into from
Mar 18, 2024
Merged

Conversation

Kodylow
Copy link
Member

@Kodylow Kodylow commented Mar 1, 2024

fixes #385

We weren't properly loading the state from localStorage, and we were setting numPeers from connected Peers not from stateNumPeers. This lets the setup leader refresh and maintain state and connections to peers, and doesn't kick to DKG immediately on refresh.

@Kodylow Kodylow requested review from a team as code owners March 1, 2024 21:10
flake.lock Outdated Show resolved Hide resolved
Copy link
Collaborator

@okjodom okjodom left a comment

Choose a reason for hiding this comment

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

tACK. Looks good, but I wish it was just a super small change that only includes the changes in SetupContext.tsx. We can append the other changes as extra opportunistic commits to clean up the code.

apps/guardian-ui/src/components/SetConfiguration.tsx Outdated Show resolved Hide resolved
flake.lock Outdated Show resolved Hide resolved
@@ -31,7 +31,6 @@ export const ConnectGuardians: React.FC<Props> = ({ next }) => {
const {
state: { role, peers, numPeers, configGenParams, ourCurrentId },
} = useSetupContext();

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: unnecessary change in file

@@ -23,19 +23,7 @@ const LOCAL_STORAGE_SETUP_KEY = 'setup-guardian-ui-state';
* Creates the initial state using loaded state from local storage.
*/
function makeInitialState(loadFromStorage = true): SetupState {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey @Kodylow , this is the actual fix to the bug! Nice fix. Could we just scope the PR to changes in this file and we land it?

Copy link
Collaborator

@okjodom okjodom left a comment

Choose a reason for hiding this comment

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

@okjodom okjodom requested a review from EthnTuttle March 18, 2024 21:40
@Kodylow Kodylow merged commit b9bd211 into fedimint:master Mar 18, 2024
1 check passed
@Kodylow Kodylow deleted the fix-context-refresh branch March 18, 2024 22:27
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.

Refreshing the setup leader kicks off DKG as solo or with any connected guardians
3 participants