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

[LW-12241] Update index.ts to cater for the cleardown of ledger state if not alr… #3276

Merged
merged 4 commits into from
Feb 25, 2025

Conversation

hegaleon
Copy link
Collaborator

@hegaleon hegaleon commented Feb 13, 2025

LW-12241

Code Changes

Update index.ts to cater for the cleardown of ledger state if not already flagged as done, this involved creating a routine for the cleardown, creating a flag indicating it was completed

check if v10 state clear flag created
if not the remove files under chain/ledger
create non-reentrant flag

Todos

  • Review the routing clearLedger - I chose the option of spitting out the files cleared down 'hskpg'

Screenshots

Testing Checklist


Review Checklist

Basics

  • PR assigned to the PR author(s)
  • input-output-hk/daedalus-dev and input-output-hk/daedalus-qa assigned as PR reviewers
  • If there are UI changes, Alexander Rukin assigned as an additional reviewer
  • PR has appropriate labels (release-vNext, feature/bug/chore, WIP)
  • PR link is added to a Jira ticket, ticket moved to In Review
  • 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 contains screenshots (in case of UI changes)
  • CHANGELOG entry has been added to the top of the appropriate section (Features, Fixes, Chores) and is linked to the correct PR on GitHub
  • 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)
  • 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 typescript types
  • 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

  • Update Slack QA thread by marking it with a green checkmark

…eady flagged as done

Update index.ts to cater for the cleardown of ledger state if not already flagged as done
@hegaleon
Copy link
Collaborator Author

hegaleon commented Feb 13, 2025

I have applied the moving of the imports and the build was as clean as it was before changes applied

@hegaleon hegaleon closed this Feb 13, 2025
@hegaleon hegaleon reopened this Feb 13, 2025
@hegaleon hegaleon force-pushed the chore/LW-12241-ledger-state-clean-v10 branch from c3508e0 to 4e7f3b0 Compare February 14, 2025 12:18
Copy link
Contributor

@szymonmaslowski szymonmaslowski left a comment

Choose a reason for hiding this comment

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

GJ!

Co-authored-by: Szymon Masłowski <[email protected]>

// Check if the flag file exists
if (fs.existsSync(flagFileLongName)) {
logger.log(`${flagFileLongName} found. NoHskpg.`);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems there is no log method on logger. Please use info instead.

Suggested change
logger.log(`${flagFileLongName} found. NoHskpg.`);
logger.info(`${flagFileLongName} found. NoHskpg.`);

if (fs.lstatSync(filePath).isFile()) {
// ?it's a file
fs.unlinkSync(filePath);
console.log(`HskpgDone: ${filePath}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
console.log(`HskpgDone: ${filePath}`);
logger.info(`HskpgDone: ${filePath}`);

// Create v10-upgraded completed marker
fs.writeFileSync(flagFileLongName, 'HskpgNwFlag');
} catch (err) {
console.error(`Error removing files: ${err}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
console.error(`Error removing files: ${err}`);
logger.error(`Error removing files: ${err}`);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have applied those changes and committed

Copy link
Contributor

@szymonmaslowski szymonmaslowski left a comment

Choose a reason for hiding this comment

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

GJ!

@szymonmaslowski szymonmaslowski merged commit b54a34e into develop Feb 25, 2025
5 checks passed
@szymonmaslowski szymonmaslowski deleted the chore/LW-12241-ledger-state-clean-v10 branch February 25, 2025 09:52
michalrus added a commit that referenced this pull request Feb 26, 2025
…er state if not alr… (#3276)"

This reverts commit b54a34e.

The ledger team say it’s unnecessary.
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.

3 participants