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

[DDW-796] Implement catalyst state snapshot phase #2771

Merged

Conversation

lucas-barros
Copy link
Contributor

@lucas-barros lucas-barros commented Dec 3, 2021

This PR adds the catalyst fund snapshot, voting and tallying phase and the logic to change the text based on the fund phase.

This includes tasks:
DDW-796
DDW-801
DDW-802
DDW-845

To force switch between phases during tests:
window.daedalus.stores.voting._checkFundPhase(new Date('Feb 28, 2022, 11:00 UTC'))
*change the date accordingly

Phases

  • Snapshot: Jan 6, 2022, 11:00 UTC
  • Voting: Jan 13, 2022, 11:00 UTC - Jan 27, 2022, 11:00 UTC
  • Tallying: Jan 27, 2022, 11:01 UTC - Feb 2, 2022
  • Results: Feb 3, 2022

Todos

  • Todo

Screenshots

  • Screenshot

Snapshot
image
image

Voting
image
image

Tallying
image
image

Results
image
image


Testing Checklist


Test Scenarios

Scenario 1 - Validate voting screen on ETI phase

Given that Daedalus is synced
And it has at least one Shelley wallet
And the registration to vote in fund N is open
When I validate the voting screen
Then I can see I can register to vote for fund N
And the date of the snapshot for fund N is displayed
And the ending date and link to results for fund N-1 are displayed

Scenario 2 - Validate voting screen on Snapshot phase

Given that Daedalus is synced
And it has at least one Shelley wallet
And the user no longer can register to vote for Fund N
And the voting date for fund N hasn't arrived yet
When I validate the voting screen
Then I can see I can register to vote for fund N+1
And the date of the snapshot and the voting date for fund N are displayed

Scenario 3 - Validate voting screen on Voting phase

Given that Daedalus is synced
And it has at least one Shelley wallet
And the voting is enabled for fund N
When I validate the voting screen
Then I can see I can register to vote for fund N+1
And the starting and ending dates for the voting on fund N are displayed
And there is a call to action to vote on fund N

Scenario 4 - Validate voting screen on Tallying phase

Given that Daedalus is synced
And it has at least one Shelley wallet
And the voting has closed for fund N
When I validate the voting screen
Then I can see I can register to vote for fund N+1
And the ending date for the voting on fund N is displayed
And a message indicated the tallying is in progress
And the date when the results will be available is displayed

Review Checklist

Basics

  • PR has been assigned and has appropriate labels (feature/bug/chore, release-x.x.x)
  • PR is updated to the most recent version of the target branch (and there are no conflicts)
  • PR has a good description that summarizes all changes
  • PR has default-sized Daedalus window screenshots or animated GIFs of important UI changes:
    • In English
    • In Japanese
  • CHANGELOG entry has been added to the top of the appropriate section (Features, Fixes, Chores) and is linked to the correct PR on GitHub
  • Automated tests: All acceptance and unit tests are passing (yarn test)
  • Manual tests (minimum tests should cover newly added feature/fix): App works correctly in development build (yarn dev)
  • Manual tests (minimum tests should cover newly added feature/fix): App works correctly in production build (yarn package / CI builds)
  • There are no flow errors or warnings (yarn flow:test)
  • There are no lint errors or warnings (yarn lint)
  • There are no prettier errors or warnings (yarn prettier:check)
  • There are no missing translations (running yarn manage:translations produces no changes)
  • Text changes are proofread and approved (Jane Wild / Amy Reeve)
  • Japanese text changes are proofread and approved (Junko Oda)
  • UI changes look good in all themes (Alexander Rukin)
  • Storybook works and no stories are broken (yarn storybook)
  • In case of dependency changes yarn.lock file is updated

Code Quality

  • Important parts of the code are properly commented and documented
  • Code is properly typed with flow
  • React components are split-up enough to avoid unnecessary re-renderings
  • Any code that only works in main process is neatly separated from components

Testing

  • New feature/change is covered by acceptance tests
  • New feature/change is manually tested and approved by QA team
  • All existing acceptance tests are still up-to-date
  • New feature/change is covered by Daedalus Testing scenario
  • All existing Daedalus Testing scenarios are still up-to-date

After Review

  • Merge the PR
  • Delete the source branch
  • Move the ticket to done column on the YouTrack board
  • Update Slack QA thread by marking it with a green checkmark

@@ -86,6 +86,10 @@ mainnet-genesis-dryrun-with-stakeholders.json

# nix-build results
result*
!result*.js
Copy link
Contributor Author

@lucas-barros lucas-barros Dec 3, 2021

Choose a reason for hiding this comment

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

result* was ignoring any files that start with result (ResultsPhase.js).
The following file globs are excluding js/ts files

@@ -1,132 +1,30 @@
// @flow
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the voting registration is always open now, the voting closed logic was removed.

@lucas-barros lucas-barros force-pushed the feature/ddw-796-Implement-catalyst-state-snapshot-phase branch from 7b894a8 to ad76db3 Compare December 3, 2021 19:32
export const VOTING_REGISTRATION_NEW_START_DATE = new Date(
'Nov 11, 2021, 11:00 UTC'
);
export const VOTING_PHASE_CHECK_INTERVAL = 60000; // 60 seconds | unit: milliseconds
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Increased the check interval to 60 seconds to be able to force different phases for tests. We can change back to 3 seconds after QA review.

Copy link
Contributor

Choose a reason for hiding this comment

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

3 seconds? I would even do this every 10 mins?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It used to be 3 seconds for voting registration end check. I increased so QA would have a longer interval to test, but I agree 3 seconds is too short of interval for this

[FundPhases.RESULTS]: (date: Date) => date >= VOTING_RESULTS_DATE,
};
this.fundPhase =
Object.keys(FundPhases)
Copy link
Contributor Author

@lucas-barros lucas-barros Dec 6, 2021

Choose a reason for hiding this comment

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

I had to use this:
Object.keys(FundPhases).map((phase) => FundPhases[phase])
Instead of:
Object.values(FundPhases)
Due to flow not inferring the type correctly

facebook/flow#2221

Copy link
Contributor

Choose a reason for hiding this comment

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

I had solved it with a switch case maybe, but your solution is also OK.

@lucas-barros lucas-barros removed the WIP label Dec 6, 2021
@lucas-barros lucas-barros requested review from a team and alexander-rukin December 6, 2021 14:19
@dkijania
Copy link

dkijania commented Dec 6, 2021

Hey, I wonder what is the reasoning behind hard-coding below dates instead of read them from catalyst backend:

export const VOTING_SNAPSHOT_DATE = new Date('Jan 6, 2022, 11:00 UTC');
export const VOTING_CAST_START_DATE = new Date('Jan 13, 2022, 11:00 UTC');
export const VOTING_CAST_END_DATE = new Date('Jan 27, 2022, 11:00 UTC');
export const VOTING_NEW_SNAPSHOT_DATE = new Date('Apr 7, 2022, 11:00 UTC');

I think all above dates can be easily retrieved from Catalyst servicing station. The only problem I see is with VOTING_RESULTS_DATE.

@lucas-barros
Copy link
Contributor Author

Hey, I wonder what is the reasoning behind hard-coding below dates instead of read them from catalyst backend:

export const VOTING_SNAPSHOT_DATE = new Date('Jan 6, 2022, 11:00 UTC');
export const VOTING_CAST_START_DATE = new Date('Jan 13, 2022, 11:00 UTC');
export const VOTING_CAST_END_DATE = new Date('Jan 27, 2022, 11:00 UTC');
export const VOTING_NEW_SNAPSHOT_DATE = new Date('Apr 7, 2022, 11:00 UTC');

I think all above dates can be easily retrieved from Catalyst servicing station. The only problem I see is with VOTING_RESULTS_DATE.

Hi @dkijania, I'm not aware of catalyst backend. Could you point me to some documentation?

Copy link
Contributor

@alexander-rukin alexander-rukin left a comment

Choose a reason for hiding this comment

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

visually looks good

@renanvalentin
Copy link
Contributor

@lucas-barros great work! I added a few suggestions in case you find them useful. It would also be interesting to add a few ui or unit tests in case you have time.

@lucas-barros
Copy link
Contributor Author

@lucas-barros great work! I added a few suggestions in case you find them useful. It would also be interesting to add a few ui or unit tests in case you have time.

@renanvalentin I will, thanks!

Copy link

@ManusMcCole ManusMcCole left a comment

Choose a reason for hiding this comment

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

Looks good to me. Good work @lucas-barros 👍

Copy link

@miorsufianiohk miorsufianiohk left a comment

Choose a reason for hiding this comment

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

LGTM. Great work @lucas-barros 👍

@lucas-barros lucas-barros force-pushed the feature/ddw-796-Implement-catalyst-state-snapshot-phase branch from 3140b65 to 8303429 Compare December 8, 2021 14:49
Copy link
Contributor

@danielmain danielmain left a comment

Choose a reason for hiding this comment

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

Clean and elegant implemented, nothing to complain. Great job!

@danielmain danielmain merged commit f7c80d3 into develop Dec 8, 2021
@iohk-bors iohk-bors bot deleted the feature/ddw-796-Implement-catalyst-state-snapshot-phase branch December 8, 2021 17:27
@danielmain danielmain added release-4.6.0 Daedalus Mainnet and removed ⏳release-vNext labels Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature release-4.6.0 Daedalus Mainnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants