-
Notifications
You must be signed in to change notification settings - Fork 104
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
Add subaccount id as kafka key for subaccount messages #2149
Conversation
WalkthroughThe changes involve the introduction of Changes
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- indexer/services/ender/src/lib/kafka-publisher.ts (2 hunks)
- indexer/services/vulcan/src/handlers/order-place-handler.ts (2 hunks)
- indexer/services/vulcan/src/handlers/order-remove-handler.ts (4 hunks)
Additional comments not posted (8)
indexer/services/vulcan/src/handlers/order-place-handler.ts (2)
20-20
: New Import:IndexerSubaccountId
.The addition of
IndexerSubaccountId
is appropriate for encoding subaccount IDs.
120-122
: Ensure Proper Encoding ofsubaccountId
.The encoding of
subaccountId
usingIndexerSubaccountId.encode
is correctly implemented. Ensure that all subaccount IDs are valid and non-null before encoding.Run the following script to verify that all subaccount IDs used in this context are valid:
indexer/services/ender/src/lib/kafka-publisher.ts (2)
13-13
: New Import:IndexerSubaccountId
.The addition of
IndexerSubaccountId
is necessary for encoding subaccount IDs.
229-232
: Conditional Encoding ofsubaccountId
.The conditional encoding of
subaccountId
ensures that only defined IDs are encoded. This is a good practice for handling optional fields.indexer/services/vulcan/src/handlers/order-remove-handler.ts (4)
37-37
: New Import:IndexerSubaccountId
.The addition of
IndexerSubaccountId
is appropriate for encoding subaccount IDs.
224-226
: Ensure Proper Encoding ofsubaccountId
.The encoding of
subaccountId
usingIndexerSubaccountId.encode
is correctly implemented. Ensure that all subaccount IDs are valid and non-null before encoding.Run the following script to verify that all subaccount IDs used in this context are valid:
331-333
: Ensure Proper Encoding ofsubaccountId
.The encoding of
subaccountId
usingIndexerSubaccountId.encode
is correctly implemented. Ensure that all subaccount IDs are valid and non-null before encoding.Run the following script to verify that all subaccount IDs used in this context are valid:
289-291
: Ensure Proper Encoding ofsubaccountId
.The encoding of
subaccountId
usingIndexerSubaccountId.encode
is correctly implemented. Ensure that all subaccount IDs are valid and non-null before encoding.Run the following script to verify that all subaccount IDs used in this context are valid:
f321bd3
to
85661c3
Compare
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- indexer/services/ender/tests/lib/kafka-publisher.test.ts (3 hunks)
- indexer/services/ender/src/lib/kafka-publisher.ts (2 hunks)
- indexer/services/vulcan/src/handlers/order-place-handler.ts (2 hunks)
- indexer/services/vulcan/src/handlers/order-remove-handler.ts (4 hunks)
Files skipped from review as they are similar to previous changes (3)
- indexer/services/ender/src/lib/kafka-publisher.ts
- indexer/services/vulcan/src/handlers/order-place-handler.ts
- indexer/services/vulcan/src/handlers/order-remove-handler.ts
Additional comments not posted (3)
indexer/services/ender/__tests__/lib/kafka-publisher.test.ts (3)
30-30
: Import addition is appropriate.The addition of
defaultSubaccountId
is consistent with the changes made to handle subaccount IDs in Kafka messages.
427-430
: Conditional handling of subaccount ID in Kafka messages is robust.The logic ensures that the
key
is only set when a subaccount ID is present, accommodating both scenarios effectively.
73-75
: Inclusion of subaccount ID as Kafka key is correct.The changes ensure that the subaccount ID is included as a key in Kafka messages, which aligns with the PR objectives. The conditional handling of the
key
ensures robustness.Run the following script to verify the correctness of the encoding logic:
Verification successful
Inclusion of subaccount ID as Kafka key is correct.
The encoding logic for the subaccount ID using
IndexerSubaccountId.encode
is correctly implemented in the codebase, including in the test filekafka-publisher.test.ts
. The use of.finish()
confirms the completion of the encoding process. The changes align with the PR objectives and ensure robustness in handling Kafka messages.
- Verified usage in
indexer/services/ender/__tests__/lib/kafka-publisher.test.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the encoding logic for subaccount ID. # Test: Search for the encoding logic. Expect: Correct usage of `IndexerSubaccountId.encode`. rg --type typescript -A 5 $'IndexerSubaccountId.encode'Length of output: 89
Script:
#!/bin/bash # Description: Verify the encoding logic for subaccount ID. # Test: Search for the encoding logic. Expect: Correct usage of `IndexerSubaccountId.encode`. rg --type ts -A 5 $'IndexerSubaccountId.encode'Length of output: 9764
Changelist
[Describe or list the changes made in this PR]
Test Plan
[Describe how this PR was tested (if applicable)]
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.Summary by CodeRabbit
New Features
Bug Fixes