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

Decentralizing the validation domain #573

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

CMCDragonkai
Copy link
Member

@CMCDragonkai CMCDragonkai commented Oct 12, 2023

Description

This PR decentralizes the validation domain avoiding a nexus point SPOF. Some changes to import paths will be expected.

Issues Fixed

Tasks

  • 1. Move all parseX inside src/validation/utils.ts into their respective domains.
  • 2. In each domain/utils.ts they should import the src/validation/errors.ts as validationErrors, see src/claims/utils.ts to see how to do this.
  • 3. All users of src/validation/utils.ts should now be using domainUtils.parseX instead avoiding a centralised import on validation domain as a "many to many" nexus in our codebase.
  • [ ] 4. We can move the src/validation/index.ts functions into src/validation/utils.ts and re-export it unscoped inside src/validation, allowing one to import { validate, validateSync } from '../validation';. - not going to do this, it's fine the way it is

Final checklist

  • Domain specific tests
  • Full tests
  • Updated inline-comment documentation
  • Lint fixed
  • Squash and rebased
  • Sanity check the final build

@ghost
Copy link

ghost commented Oct 12, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@CMCDragonkai CMCDragonkai force-pushed the feature-decentralize-validation branch 4 times, most recently from 4395764 to 46ae3dd Compare October 12, 2023 07:32
@CMCDragonkai
Copy link
Member Author

This is weirdly breaking NodeConnectionManager.general.test.ts.

@CMCDragonkai CMCDragonkai force-pushed the feature-decentralize-validation branch from 46ae3dd to 1b7358e Compare October 12, 2023 07:46
@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Oct 12, 2023

This is done. The validation/utils.ts is now reduced to only parseInteger and parseNumber.

Everything else is moved into specific domains.

And of course all the parse Ids is in src/ids.

This will affect downstream PK CLI.

So now we have finally removed this big nexus point! Imports should be faster.

@CMCDragonkai CMCDragonkai merged commit 74e2bb2 into staging Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Decentralize the Input Validation Domain
1 participant