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

[TRA-572] Add handler for upsert vault events to ender. #2274

Merged
merged 3 commits into from
Sep 17, 2024

Conversation

vincentwschau
Copy link
Contributor

@vincentwschau vincentwschau commented Sep 17, 2024

Changelist

Add sql handler for upsert vault events.

Test Plan

Unit tests.

Author/Reviewer Checklist

  • If this PR has changes that result in a different app state given the same prior state and transaction list, manually add the state-breaking label.
  • If the PR has breaking postgres changes to the indexer add the indexer-postgres-breaking label.
  • If this PR isn't state-breaking but has changes that modify behavior in PrepareProposal or ProcessProposal, manually add the label proposal-breaking.
  • If this PR is one of many that implement a specific feature, manually label them all feature:[feature-name].
  • If you wish to for mergify-bot to automatically create a PR to backport your change to a release branch, manually add the label backport/[branch-name].
  • Manually add any of the following labels: refactor, chore, bug.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced VaultModel for enhanced SQL to JSON data handling.
    • Added support for UPSERT_VAULT event type, expanding event processing capabilities.
    • Implemented new SQL functions for vault upsert operations and status conversions.
    • Enhanced validation for vault events to ensure data integrity.
  • Bug Fixes

    • Renamed vault status from 'STANDBY' to 'STAND_BY' for consistency.
  • Tests

    • Added unit tests for vault upsert handling and validation to ensure functionality.
  • Documentation

    • Updated comments and documentation for new features and functions.

@vincentwschau vincentwschau requested a review from a team as a code owner September 17, 2024 15:32
Copy link

linear bot commented Sep 17, 2024

Copy link
Contributor

coderabbitai bot commented Sep 17, 2024

Warning

Rate limit exceeded

@vincentwschau has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 44 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 6179d2f and cac3433.

Walkthrough

This pull request introduces enhancements to the vault management system, focusing on the integration of the VaultModel, updates to SQL operations, and the introduction of validators and handlers for vault events. It also adds SQL functions to manage vault data, improving data handling and event processing related to vault operations.

Changes

File Change Summary
indexer/packages/postgres/src/constants.ts Added VaultModel to SQL_TO_JSON_DEFINED_MODELS.
indexer/packages/postgres/src/db/migrations/migration_files/... Renamed status enum value from 'STANDBY' to 'STAND_BY'.
indexer/packages/postgres/src/index.ts Added export for VaultTable from ./stores/vault-table.
indexer/packages/postgres/src/models/vault-model.ts Introduced static getter sqlToJsonConversions for JSON conversion types of vault fields.
indexer/packages/v4-protos/src/index.ts Added export for everything from ./codegen/dydxprotocol/vault/vault.
indexer/services/ender/__tests__/handlers/upsert-vault-handler.test.ts Introduced unit tests for upsertVaultHandler, validating vault upserts based on Kafka events.
indexer/services/ender/__tests__/validators/upsert-vault-validator.test.ts Introduced unit tests for UpsertVaultValidator, ensuring validation of UpsertVaultEventV1 events.
indexer/services/ender/src/handlers/upsert-vault-handler.ts Defined UpsertVaultHandler class for handling UpsertVaultEventV1 events.
indexer/services/ender/src/helpers/postgres/postgres-functions.ts Added SQL handler scripts for vault operations.
indexer/services/ender/src/lib/block-processor.ts Added UpsertVaultValidator to transaction and block event mappings.
indexer/services/ender/src/lib/helper.ts Added handling for UPSERT_VAULT event subtype in event processing function.
indexer/services/ender/src/lib/types.ts Introduced UPSERT_VAULT event subtype in DydxIndexerSubtypes enum.
indexer/services/ender/src/scripts/handlers/dydx_block_processor_ordered_handlers.sql Added handler for upsert_vault event type in SQL script.
indexer/services/ender/src/scripts/handlers/dydx_vault_upsert_handler.sql Created dydx_vault_upsert_handler function for upserting vault records.
indexer/services/ender/src/scripts/helpers/dydx_protocol_vault_status_to_vault_status.sql Created function to convert vault status JSONB to text format.
indexer/services/ender/src/validators/upsert-vault-validator.ts Introduced UpsertVaultValidator class for validating UpsertVaultEventV1 events.

Possibly related PRs

Suggested labels

protocol, proto

Poem

🐇 In the land of vaults, so grand and bright,
A handler hops in, ready for flight.
With models and scripts, they dance and play,
Upserting events in a joyful array.
So let’s cheer for changes, both big and small,
For vaults now stand tall, embracing them all! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (3)
indexer/services/ender/src/handlers/upsert-vault-handler.ts (1)

7-18: LGTM! The class structure is set up correctly.

The UpsertVaultHandler class extends the Handler base class with the appropriate generic type parameter UpsertVaultEventV1. The eventType property is correctly set to identify the type of event this handler processes.

The getParallelizationIds method returns an empty array, indicating that no parallelization identifiers are used for event processing. This is acceptable if parallelization is not required for this specific handler.

The internalHandle method is prepared to handle incoming data of type pg.QueryResultRow and returns a promise that resolves to an empty array of type ConsolidatedKafkaEvent[]. While the method is set up correctly, the actual event processing logic has yet to be implemented.

As a next step, consider implementing the necessary logic within the internalHandle method to process the incoming UpsertVaultEventV1 events and perform any required data transformations or operations. This may involve interacting with the database, validating data, or emitting new events based on the business requirements.

indexer/services/ender/src/scripts/helpers/dydx_protocol_vault_status_to_vault_status.sql (1)

1-2: Add a comment to explain the function's purpose.

Consider adding a brief comment above the function definition to explain its purpose and the meaning of the mapped statuses. This will help future maintainers understand the function's role in the codebase.

+/**
+ * Converts a JSONB representation of vault status to a human-readable text format.
+ * The function maps the following JSONB values to their corresponding statuses:
+ * - '1': DEACTIVATED
+ * - '2': STAND_BY
+ * - '3': QUOTING
+ * - '4': CLOSE_ONLY
+ * @param vaultStatus The JSONB representation of the vault status.
+ * @return The corresponding human-readable text status.
+ * @throws If the provided vault status is invalid.
+ */
 CREATE OR REPLACE FUNCTION dydx_protocol_vault_status_to_vault_status(vaultStatus jsonb)
     RETURNS text AS $$
indexer/packages/postgres/src/models/vault-model.ts (1)

35-49: LGTM! The sqlToJsonConversions method is a valuable addition to the VaultModel class.

The new static getter method sqlToJsonConversions provides a clear mapping from column names to their expected JSON conversion types. This mapping can improve data handling and validation processes by ensuring that the fields are converted to the expected data types.

The comment block and TODO note are also helpful for developers working with this code, promoting code maintainability and consistency.

A few suggestions:

  1. Address the TODO note to ensure consistency between the JSON schema, SQL conversions, and model fields. This will help maintain a cohesive and reliable data model.
  2. Consider adding unit tests to verify the functionality of the sqlToJsonConversions method. This will ensure that the mapping behaves as expected and catches any potential issues early in the development process.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2ec1ade and 28fcadf.

Files selected for processing (16)
  • indexer/packages/postgres/src/constants.ts (2 hunks)
  • indexer/packages/postgres/src/db/migrations/migration_files/20240912180829_create_vaults_table.ts (1 hunks)
  • indexer/packages/postgres/src/index.ts (1 hunks)
  • indexer/packages/postgres/src/models/vault-model.ts (1 hunks)
  • indexer/packages/v4-protos/src/index.ts (1 hunks)
  • indexer/services/ender/tests/handlers/upsert-vault-handler.test.ts (1 hunks)
  • indexer/services/ender/tests/validators/upsert-vault-validator.test.ts (1 hunks)
  • indexer/services/ender/src/handlers/upsert-vault-handler.ts (1 hunks)
  • indexer/services/ender/src/helpers/postgres/postgres-functions.ts (2 hunks)
  • indexer/services/ender/src/lib/block-processor.ts (2 hunks)
  • indexer/services/ender/src/lib/helper.ts (2 hunks)
  • indexer/services/ender/src/lib/types.ts (3 hunks)
  • indexer/services/ender/src/scripts/handlers/dydx_block_processor_ordered_handlers.sql (1 hunks)
  • indexer/services/ender/src/scripts/handlers/dydx_vault_upsert_handler.sql (1 hunks)
  • indexer/services/ender/src/scripts/helpers/dydx_protocol_vault_status_to_vault_status.sql (1 hunks)
  • indexer/services/ender/src/validators/upsert-vault-validator.ts (1 hunks)
Additional context used
Biome
indexer/services/ender/src/validators/upsert-vault-validator.ts

[error] 10-12: The function should not return a value because its return type is void.

The function is here:

'void' signals the absence of value. The returned value is likely to be ignored by the caller.

(lint/correctness/noVoidTypeReturn)

Additional comments not posted (23)
indexer/services/ender/src/scripts/helpers/dydx_protocol_vault_status_to_vault_status.sql (1)

6-9: LGTM!

The CASE statement correctly maps the expected JSONB values to their corresponding text statuses. The logic is clear and concise.

indexer/packages/postgres/src/db/migrations/migration_files/20240912180829_create_vaults_table.ts (1)

9-9: Verify the impact of the enum value change across the codebase.

The status enum value has been changed from 'STANDBY' to 'STAND_BY'. This change could have the following impact:

  • Existing records with the old enum value would become invalid, leading to data integrity issues.
  • Any code that relies on the old enum value would break, leading to runtime errors.
  • Inconsistent naming conventions could lead to confusion and maintainability issues.

Please run the following script to verify the enum value usage across the codebase:

If the above tests fail, please update the codebase and database records to use the new enum value consistently.

Verification successful

Enum value change has been consistently applied across the codebase

The comprehensive search for 'STANDBY' and 'STAND_BY' usage in the codebase has revealed that the enum value change has been consistently applied. Here are the key findings:

  • No occurrences of the old 'STANDBY' value were found in any files.
  • The new 'STAND_BY' value is used consistently across TypeScript, Go, SQL, and protocol definition files.
  • The migration file (20240912180829_create_vaults_table.ts) correctly uses the new 'STAND_BY' value.

Based on these results, it appears that the enum value change has been thoroughly implemented throughout the codebase. There is no evidence of any remaining usage of the old 'STANDBY' value, which suggests that there are likely no data integrity issues or broken code related to this change.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the old enum value 'STANDBY' across the codebase.

# Test 1: Search for the old enum value usage in TypeScript files.
# Expect: No occurrences of the old enum value.
rg --type ts 'STANDBY'

# Test 2: Search for the old enum value usage in the database.
# Expect: No occurrences of the old enum value.
echo "SELECT COUNT(*) FROM vaults WHERE status = 'STANDBY';" | psql <database_name>

Length of output: 251


Script:

#!/bin/bash
# Description: Comprehensive search for 'STANDBY' and 'STAND_BY' usage in the codebase

# Search for 'STANDBY' in all files
echo "Searching for 'STANDBY' in all files:"
rg 'STANDBY'

echo "\nSearching for 'STAND_BY' in all files:"
rg 'STAND_BY'

# Search for enum declarations containing 'STANDBY' or 'STAND_BY'
echo "\nSearching for enum declarations with 'STANDBY' or 'STAND_BY':"
ast-grep --lang typescript --pattern 'enum $_ { $$$ STANDBY $$$ }'
ast-grep --lang typescript --pattern 'enum $_ { $$$ STAND_BY $$$ }'

# Search for string literals 'STANDBY' or 'STAND_BY' in TypeScript files
echo "\nSearching for string literals 'STANDBY' or 'STAND_BY' in TypeScript files:"
ast-grep --lang typescript --pattern '"STANDBY"'
ast-grep --lang typescript --pattern "'STANDBY'"
ast-grep --lang typescript --pattern '"STAND_BY"'
ast-grep --lang typescript --pattern "'STAND_BY'"

Length of output: 4889

indexer/services/ender/src/validators/upsert-vault-validator.ts (3)

7-31: LGTM!

The UpsertVaultValidator class is well-structured and aligns with the PR objectives of introducing a validator specifically designed for handling UpsertVaultEventV1 events. The class extends the Validator class and provides a clear validation mechanism and a method to create handlers for the events.

Tools
Biome

[error] 10-12: The function should not return a value because its return type is void.

The function is here:

'void' signals the absence of value. The returned value is likely to be ignored by the caller.

(lint/correctness/noVoidTypeReturn)


8-14: LGTM!

The validate method correctly checks if the address field is an empty string and throws an error if it is. This aligns with the purpose of the validator class to ensure that the address field is populated.

Regarding the static analysis hint:

The logAndThrowParseMessageError method likely throws an error, which would prevent the function from returning a value. Therefore, the static analysis hint can be safely ignored in this case.

Tools
Biome

[error] 10-12: The function should not return a value because its return type is void.

The function is here:

'void' signals the absence of value. The returned value is likely to be ignored by the caller.

(lint/correctness/noVoidTypeReturn)


16-30: LGTM!

The createHandlers method correctly creates a new UpsertVaultHandler with the necessary parameters and returns an array of Handler instances. This structure allows for the processing of upsert vault events in a modular and organized manner, facilitating the handling of these events in the broader indexing system. The method aligns with the PR objectives and the AI-generated summary.

indexer/packages/v4-protos/src/index.ts (1)

19-19: LGTM!

The change to export everything from the ./codegen/dydxprotocol/vault/vault module is straightforward and enhances the module's interface by including additional functionality related to the vault. It does not alter any existing exports or the overall structure of the file.

indexer/services/ender/src/scripts/handlers/dydx_vault_upsert_handler.sql (1)

1-37: Excellent implementation of the dydx_vault_upsert_handler function!

The function effectively handles the upsert operation for vault records in the database. Here are some key highlights:

  • The function signature and parameters are well-defined and documented, making it clear what the function expects and returns.
  • The use of the DECLARE block to define variables is a good practice for readability and maintainability.
  • The function correctly extracts relevant data from event_data to populate the vault_record, ensuring that the latest information is stored in the database.
  • The INSERT statement with the ON CONFLICT clause efficiently handles both new records and updates to existing records, maintaining data integrity and preventing duplicates.
  • Returning the upserted vault as a JSON object using jsonb_build_object and dydx_to_jsonb functions provides flexibility for further processing or integration with other systems.

Overall, this implementation ensures that vault records are accurately maintained in the database, reflecting the latest status and timestamps based on incoming event data.

indexer/services/ender/__tests__/validators/upsert-vault-validator.test.ts (2)

19-57: LGTM!

The test suite follows the standard structure of setup, teardown, and test cases. It covers the happy path scenario of validating a valid UpsertVaultEventV1 event using the UpsertVaultValidator class.

The test suite ensures that the UpsertVaultValidator behaves as expected when processing valid events.


59-75: LGTM!

The createBlock function is a helper that simplifies the creation of an IndexerTendermintBlock for testing purposes. It ensures that the provided UpsertVaultEventV1 event is properly encoded and associated with default parameters such as height, time, and transaction hash.

The function is used in the test case to create a block corresponding to the valid event, making the test setup more concise and readable.

indexer/services/ender/src/scripts/handlers/dydx_block_processor_ordered_handlers.sql (1)

67-68: LGTM! The new event handler enhances vault management capabilities.

The addition of the "upsert_vault" event handling in the CASE statement allows the dydx_block_processor_ordered_handlers function to process vault upsert events. When this event type is encountered, the dydx_vault_upsert_handler function is called with the block_time and event_data as arguments, which suggests that it is responsible for updating or inserting vault-related data based on the provided event data.

This enhancement expands the script's capabilities to accommodate additional event types related to vault management, improving the overall functionality of the system.

Please ensure that the implementation of the dydx_vault_upsert_handler function is thoroughly tested to confirm that it correctly processes vault upsert events and updates the relevant data structures as expected. Consider running the following script to verify the function's usage and behavior:

Verification successful

LGTM with a note on testing. The dydx_vault_upsert_handler function is correctly implemented and used.

The dydx_vault_upsert_handler function in dydx_vault_upsert_handler.sql is correctly defined with the expected signature (block_time timestamp, event_data jsonb). It properly handles both insertion of new vault records and updating existing ones, which aligns with its usage in the dydx_block_processor_ordered_handlers.sql file.

The function implementation looks sound, processing the input data and performing the upsert operation on the vaults table as expected. It also returns the upserted vault data in the required format.

However, it's worth noting that we couldn't find any specific unit tests for this function. While this doesn't necessarily indicate a problem with the implementation, it might be beneficial to add targeted tests to ensure the function behaves correctly under various scenarios.

To further improve the codebase:

  • Consider adding unit tests specifically for the dydx_vault_upsert_handler function to ensure its behavior is verified under different input conditions.
  • If there's a general testing strategy for similar handler functions, it might be helpful to document it for consistency across the project.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of the `dydx_vault_upsert_handler` function.

# Test: Search for the function definition.
# Expect: The function should be defined with the correct signature.
ast-grep --lang sql --pattern $'def dydx_vault_upsert_handler(block_time, event_data)'

# Test: Search for the function usage within the `dydx_block_processor_ordered_handlers` function.
# Expect: The function should be called with the correct arguments when the `"upsert_vault"` event type is encountered.
rg --type sql -A 5 $'dydx_vault_upsert_handler\(block_time, event_data\)'

# Test: Search for unit tests related to the `dydx_vault_upsert_handler` function.
# Expect: There should be unit tests covering various scenarios and edge cases.
fd 'test_dydx_vault_upsert_handler' --exec rg --type sql $'def test_dydx_vault_upsert_handler'

Length of output: 27777


Script:

#!/bin/bash
# Search for the function definition with a more flexible pattern
ast-grep --lang sql --pattern 'def dydx_vault_upsert_handler'

# Search for any file containing the function name (might catch the definition)
rg --type sql 'dydx_vault_upsert_handler'

# Search for test files that might include tests for this function
fd test --type sql --exec rg --type sql 'dydx_vault_upsert_handler'

# Search for any documentation or comments about testing strategy
rg --type sql 'test.*strategy|testing.*approach'

Length of output: 1031


Script:

#!/bin/bash
# Examine the content of dydx_vault_upsert_handler.sql
cat indexer/services/ender/src/scripts/handlers/dydx_vault_upsert_handler.sql

# Search for test files that might include tests for this function (corrected command)
fd -e sql | xargs grep -i 'test.*dydx_vault_upsert_handler'

# Broader search for testing-related comments or documentation
rg --type sql -i 'test|spec|assert|verify|validate'

Length of output: 2718

indexer/services/ender/src/helpers/postgres/postgres-functions.ts (2)

49-49: LGTM!

The addition of the 'dydx_vault_upsert_handler.sql' script to the HANDLER_SCRIPTS array is a valid enhancement to handle vault upsert events. The naming convention is consistent with the existing scripts.


95-95: Looks good!

The addition of the 'dydx_protocol_vault_status_to_vault_status.sql' script to the HELPER_SCRIPTS array is a valid enhancement to facilitate the conversion or mapping of protocol vault statuses to a standardized format. The naming convention is consistent with the existing scripts.

indexer/packages/postgres/src/index.ts (1)

51-51: LGTM!

The export statement is consistent with the existing export statements in the file and allows other parts of the application to access the VaultTable functionality.

indexer/services/ender/__tests__/handlers/upsert-vault-handler.test.ts (3)

50-91: LGTM!

The test case for upserting new vaults in a single block looks good. It correctly sets up the test data, sends the Kafka message, and verifies the expected behavior.


93-125: LGTM!

The test case for upserting an existing vault looks good. It correctly sets up the test data, sends the Kafka message, and verifies the expected behavior.


128-150: LGTM!

The createBlockFromEvents helper function looks good. It correctly creates an IndexerTendermintBlock object from the provided vault events.

indexer/packages/postgres/src/constants.ts (2)

25-25: LGTM!

The import statement for VaultModel is syntactically correct and the import path is valid.


107-107: Looks good!

The addition of VaultModel to the SQL_TO_JSON_DEFINED_MODELS array is correct and consistent with the existing pattern. This enables the conversion of VaultModel from SQL to JSON format, extending the module's data handling capabilities.

indexer/services/ender/src/lib/types.ts (2)

63-63: LGTM!

The addition of the UPSERT_VAULT enum value to DydxIndexerSubtypes is consistent with the existing structure and naming convention. It will enable the system to handle events related to vault operations.


178-183: Looks good!

The new case added to the EventProtoWithTypeAndVersion type for the UPSERT_VAULT event subtype is consistent with the existing structure and correctly associates it with the UpsertVaultEventV1 protocol buffer message. This will enable type-safe handling of vault-related events.

indexer/services/ender/src/lib/helper.ts (1)

255-263: LGTM!

The new case for handling the UPSERT_VAULT event subtype is implemented correctly and consistently with the existing cases in the function. It enhances the functionality of the event processing logic by enabling it to decode and process UpsertVaultEventV1 events.

indexer/services/ender/src/lib/block-processor.ts (2)

33-33: LGTM!

The import statement for UpsertVaultValidator follows the existing naming convention and import pattern.


59-59: Looks good!

The addition of UpsertVaultValidator to the TXN_EVENT_SUBTYPE_VERSION_TO_VALIDATOR_MAPPING and BLOCK_EVENT_SUBTYPE_VERSION_TO_VALIDATOR_MAPPING mappings enables the validation and processing of vault upsert events for both transaction and block events.

This change expands the functionality of the block processor to handle the UPSERT_VAULT subtype, with the validator being invoked when a corresponding event is encountered.

Also applies to: 67-67

@vincentwschau vincentwschau merged commit f2fb2b9 into main Sep 17, 2024
23 checks passed
@vincentwschau vincentwschau deleted the vincentc/tra-572-handle-vault-upsert branch September 17, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants