Skip to content

chore: refactor validator service in relay package for clarity and optimization #3891

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

Conversation

konstantinabl
Copy link
Contributor

@konstantinabl konstantinabl commented Jul 2, 2025

Description:

This PR rewrites the validation code in packages/relay/src/lib/validators by removing many custom “object-wrapper” classes and lots of repetitive boilerplate, and replacing them with two simple, reusable functions driven by shared schemas. It makes the code easier to read, cuts out duplicate logic, and lets you add new validation rules with minimal effort.

Key Changes

  • Remove Validator Classes
    Delete all *Object classes (TransactionObject, EthSubscribeLogsParamsObject, TracerConfigWrapper, etc.) and their factories.
    Collapse ∼300 lines of class-based code into two reusable functions.
  • Centralized Schemas & Types
    Use shared OBJECTS_VALIDATIONS and TYPES maps for every primitive and object type.
    Update IParamValidation and related types so that type is a literal union instead of string.
  • Streamlined Constants
  • Remove obsolete or duplicated error constants.

Related issue(s):

Fixes #3592

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@konstantinabl konstantinabl changed the title 3592 refactor validator service in relay package for clarity and optimization p3 chore: refactor validator service in relay package for clarity and optimization Jul 2, 2025
Copy link

github-actions bot commented Jul 2, 2025

Test Results

 20 files  ±0  276 suites  ±0   17m 56s ⏱️ -3s
701 tests ±0  696 ✅ +2  5 💤 ±0  0 ❌  - 2 
717 runs  ±0  712 ✅ +2  5 💤 ±0  0 ❌  - 2 

Results for commit 3efbd6d. ± Comparison against base commit 8bd3667.

♻️ This comment has been updated with latest results.

acuarica and others added 5 commits July 4, 2025 11:18
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
@konstantinabl konstantinabl force-pushed the 3592-refactor-validator-service-in-relay-package-for-clarity-and-optimization---p3 branch from e267230 to 381f8f2 Compare July 4, 2025 08:21
Signed-off-by: Konstantina Blazhukova <[email protected]>
@konstantinabl konstantinabl self-assigned this Jul 4, 2025
@konstantinabl konstantinabl added enhancement New feature or request internal For changes that affect the project's internal workings but not its outward-facing functionality. labels Jul 4, 2025
@konstantinabl konstantinabl added this to the 0.70.0 milestone Jul 4, 2025
@konstantinabl konstantinabl marked this pull request as ready for review July 4, 2025 09:47
@konstantinabl konstantinabl requested review from a team as code owners July 4, 2025 09:47
@konstantinabl konstantinabl requested a review from quiet-node July 4, 2025 09:47
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Copy link
Contributor

@acuarica acuarica left a comment

Choose a reason for hiding this comment

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

looking good.

konstantinabl and others added 4 commits July 7, 2025 15:41
Signed-off-by: Konstantina Blazhukova <[email protected]>
Co-authored-by: Luis Mastrangelo <[email protected]>
Signed-off-by: konstantinabl <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
Signed-off-by: Konstantina Blazhukova <[email protected]>
@simzzz simzzz self-requested a review July 8, 2025 10:15
simzzz
simzzz previously approved these changes Jul 8, 2025
Signed-off-by: Konstantina Blazhukova <[email protected]>
@konstantinabl konstantinabl merged commit f68c902 into main Jul 9, 2025
80 of 85 checks passed
@konstantinabl konstantinabl deleted the 3592-refactor-validator-service-in-relay-package-for-clarity-and-optimization---p3 branch July 9, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internal For changes that affect the project's internal workings but not its outward-facing functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Validator Service in Relay Package for Clarity and Optimization - P3
4 participants