-
Notifications
You must be signed in to change notification settings - Fork 115
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
update subaccountId to address #1947
Conversation
WalkthroughThe recent changes focus on replacing 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
Outside diff range, codebase verification and nitpick comments (4)
indexer/packages/postgres/src/stores/leaderboard-pnl-table.ts (1)
29-29
: Parameter change: Ensure consistency with other parts of the system.The parameter
subaccountId
has been changed toaddress
in thefindAll
function. However, there are still instances wheresubaccountId
is used. Please update all occurrences to useaddress
to maintain consistency.
- Files with
subaccountId
usage:
indexer/services/comlink/src/controllers/api/v4/transfers-controller.ts
indexer/services/comlink/src/controllers/api/v4/fills-controller.ts
indexer/services/comlink/src/controllers/api/v4/historical-pnl-controller.ts
indexer/services/comlink/src/controllers/api/v4/asset-positions-controller.ts
indexer/services/comlink/src/controllers/api/v4/addresses-controller.ts
indexer/services/comlink/src/controllers/api/v4/perpetual-positions-controller.ts
indexer/services/roundtable/src/helpers/pnl-validation-helpers.ts
indexer/services/roundtable/src/tasks/update-compliance-data.ts
indexer/services/roundtable/__tests__/helpers/pnl-ticks-helper.test.ts
indexer/services/roundtable/__tests__/tasks/update-compliance-data.test.ts
indexer/packages/postgres/src/stores/transfer-table.ts
indexer/packages/postgres/src/stores/pnl-ticks-table.ts
indexer/packages/postgres/src/stores/order-table.ts
indexer/packages/postgres/src/stores/perpetual-position-table.ts
e2e-testing/__tests__/transfers.test.ts
e2e-testing/__tests__/orders.test.ts
Analysis chain
Parameter change: Ensure consistency with other parts of the system.
The parameter
subaccountId
has been changed toaddress
. Verify that all function calls tofindAll
use the updated parameter name.
Parameter change: Ensure consistency with other parts of the system.
The parameter
subaccountId
has been changed toaddress
. Verify that all function calls tofindAll
use the updated parameter name.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `findAll` use the updated parameter name `address`. # Test: Search for the function usage. Expect: Only occurrences of the new parameter name `address`. rg --type typescript -A 5 $'findAll'Length of output: 70
Script:
#!/bin/bash # Description: Verify all function calls to `findAll` use the updated parameter name `address`. # Test: Search for the function usage. Expect: Only occurrences of the new parameter name `address`. rg --type ts -A 5 $'findAll'Length of output: 201777
indexer/packages/postgres/src/types/query-types.ts (1)
320-320
: Field update: Ensure consistency with other parts of the system.The field
SUBACCOUNT_ID
has not been fully replaced byADDRESS
across the codebase. The following files still contain references toSUBACCOUNT_ID
:
indexer/services/comlink/src/controllers/api/v4/addresses-controller.ts
indexer/services/comlink/src/controllers/api/v4/asset-positions-controller.ts
indexer/packages/postgres/src/types/query-types.ts
Please update all instances of
SUBACCOUNT_ID
toADDRESS
in these files to ensure consistency.Analysis chain
Field update: Ensure consistency with other parts of the system.
The field
SUBACCOUNT_ID
has been changed toADDRESS
. Verify that all references to this interface use the updated field name.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all references to the `LeaderboardPnlQueryConfig` interface use the updated field name `ADDRESS`. # Test: Search for the interface usage. Expect: Only occurrences of the new field name `ADDRESS`. rg --type typescript -A 5 $'LeaderboardPnlQueryConfig'Length of output: 88
Script:
#!/bin/bash # Description: Verify that all references to the `LeaderboardPnlQueryConfig` interface use the updated field name `ADDRESS`. # Test: Search for the interface usage. Expect: Only occurrences of the new field name `ADDRESS`. rg --type ts -A 5 $'LeaderboardPnlQueryConfig'Length of output: 1513
Script:
#!/bin/bash # Description: Verify that all references to the `LeaderboardPnlQueryConfig` interface use the updated field name `ADDRESS` instead of `SUBACCOUNT_ID`. # Test: Search for occurrences of `SUBACCOUNT_ID` and `ADDRESS` in `leaderboard-pnl-table.ts`. rg 'SUBACCOUNT_ID|ADDRESS' indexer/packages/postgres/src/stores/leaderboard-pnl-table.tsLength of output: 90
Script:
#!/bin/bash # Description: Verify that the field name `SUBACCOUNT_ID` has been replaced by `ADDRESS` across all TypeScript files. # Test: Search for occurrences of `SUBACCOUNT_ID` in all TypeScript files. rg 'SUBACCOUNT_ID' --type tsLength of output: 1907
indexer/packages/postgres/__tests__/helpers/constants.ts (2)
888-888
: Field update required: Ensure consistency with other parts of the system.The
address
field in thedefaultLeaderboardPnlOneDayToUpsert
constant still usesdefaultAddress
. Update this field todefaultAddress2
to maintain consistency across the system.
- File:
indexer/packages/postgres/__tests__/helpers/constants.ts
- Line: 888
Analysis chain
Field update: Ensure consistency with other parts of the system.
The field
address
indefaultLeaderboardPnlOneDayToUpsert
has been updated to usedefaultAddress2
. Verify that all references to this constant use the updated field name.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all references to the `defaultLeaderboardPnlOneDayToUpsert` constant use the updated field name `address`. # Test: Search for the constant usage. Expect: Only occurrences of the new field name `address`. rg --type typescript -A 5 $'defaultLeaderboardPnlOneDayToUpsert'Length of output: 98
Script:
#!/bin/bash # Description: Verify that all references to the `defaultLeaderboardPnlOneDayToUpsert` constant use the updated field name `address`. # Test: Search for the constant usage. Expect: Only occurrences of the new field name `address`. rg --glob '*.ts' -A 5 'defaultLeaderboardPnlOneDayToUpsert'Length of output: 2548
880-880
: Field update: Ensure consistency with other parts of the system.The field
address
indefaultLeaderboardPnl1AllTime
has not been updated to usedefaultAddress2
as suggested. Please update theaddress
field indefaultLeaderboardPnl1AllTime
todefaultAddress2
and ensure consistency across the codebase.
indexer/packages/postgres/__tests__/helpers/constants.ts:880
Analysis chain
Field update: Ensure consistency with other parts of the system.
The field
address
indefaultLeaderboardPnl1AllTime
has been updated to usedefaultAddress2
. Verify that all references to this constant use the updated field name.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all references to the `defaultLeaderboardPnl1AllTime` constant use the updated field name `address`. # Test: Search for the constant usage. Expect: Only occurrences of the new field name `address`. rg --type typescript -A 5 $'defaultLeaderboardPnl1AllTime'Length of output: 92
Script:
#!/bin/bash # Description: Verify that all references to the `defaultLeaderboardPnl1AllTime` constant use the updated field name `address`. # Test: Search for the constant usage. Expect: Only occurrences of the new field name `address`. rg --type ts -A 5 $'defaultLeaderboardPnl1AllTime'Length of output: 2509
Script:
#!/bin/bash # Description: Verify that all references to `defaultAddress` are updated to `defaultAddress2`. # Test: Search for the usage of `defaultAddress`. Expect: No occurrences where `defaultAddress2` should be used. rg --type ts $'defaultAddress'Length of output: 35624
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- indexer/packages/postgres/tests/helpers/constants.ts (2 hunks)
- indexer/packages/postgres/tests/stores/leaderboard-pnl-table.test.ts (2 hunks)
- indexer/packages/postgres/src/db/migrations/migration_files/20240717160024_create_leaderboard_pnl_table.ts (2 hunks)
- indexer/packages/postgres/src/models/leaderboard-pnl-model.ts (2 hunks)
- indexer/packages/postgres/src/stores/leaderboard-pnl-table.ts (5 hunks)
- indexer/packages/postgres/src/types/db-model-types.ts (1 hunks)
- indexer/packages/postgres/src/types/leaderboard-pnl-types.ts (1 hunks)
- indexer/packages/postgres/src/types/query-types.ts (1 hunks)
Additional comments not posted (19)
indexer/packages/postgres/src/types/leaderboard-pnl-types.ts (2)
4-4
: Change fromsubaccountId
toaddress
is appropriate.This change aligns with the PR objective of using
address
instead ofsubaccountId
.
12-12
: Change fromsubaccountId
toaddress
in the enum is appropriate.This change aligns with the PR objective of using
address
instead ofsubaccountId
.indexer/packages/postgres/src/db/migrations/migration_files/20240717160024_create_leaderboard_pnl_table.ts (2)
5-5
: Change fromsubaccountId
toaddress
in column definition is appropriate.This change aligns with the PR objective and ensures the schema uses
address
instead ofsubaccountId
.
19-19
: Change in primary key definition to useaddress
is appropriate.This change aligns with the PR objective and ensures the schema uses
address
instead ofsubaccountId
.indexer/packages/postgres/src/models/leaderboard-pnl-model.ts (5)
16-16
: Change inidColumn
method to useaddress
is appropriate.This change aligns with the PR objective and ensures the model uses
address
instead ofsubaccountId
.
19-19
: Verify the removal of relation mappings.The
relationMappings
property is emptied. Ensure this change is intentional and does not affect functionality.
25-25
: Change injsonSchema
method to requireaddress
is appropriate.This change aligns with the PR objective and ensures the model uses
address
instead ofsubaccountId
.
32-32
: Change inproperties
definition to useaddress
is appropriate.This change aligns with the PR objective and ensures the model uses
address
instead ofsubaccountId
.
41-41
: Change in class property to useaddress
is appropriate.This change aligns with the PR objective and ensures the model uses
address
instead ofsubaccountId
.indexer/packages/postgres/__tests__/stores/leaderboard-pnl-table.test.ts (2)
48-48
: Change in test description to useaddress
is appropriate.This change aligns with the PR objective and ensures the test description uses
address
instead ofsubaccountId
.
57-57
: Change in test query to useaddress
is appropriate.This change aligns with the PR objective and ensures the test query uses
address
instead ofsubaccountId
.indexer/packages/postgres/src/stores/leaderboard-pnl-table.ts (4)
39-39
: Verify all required fields.Ensure that all required fields, including the updated
address
field, are correctly verified.
138-138
: Unique identifiers update: Ensure correctness.The unique identifiers have been updated to use
address
instead ofsubaccountId
. Verify that the logic for unique identifiers remains consistent and correct.
52-53
: Query condition update: Ensure correctness.The query condition has been updated to use
address
instead ofsubaccountId
. Verify that the column nameLeaderboardPnlColumns.address
is correct and exists in the database schema.Verification successful
Column name verification successful.
The column
LeaderboardPnlColumns.address
is correctly defined and exists in the database schema.
indexer/packages/postgres/src/types/leaderboard-pnl-types.ts
:export enum LeaderboardPnlColumns { address = 'address', timeSpan = 'timeSpan', pnl = 'pnl', currentEquity = 'currentEquity', rank = 'rank', }Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the column `LeaderboardPnlColumns.address` exists in the database schema. # Test: Search for the column definition. Expect: Column `address` should be defined in the schema. rg --type typescript -A 5 $'LeaderboardPnlColumns.address'Length of output: 92
Script:
#!/bin/bash # Description: Verify that the column `LeaderboardPnlColumns.address` exists in the database schema. # Test: Search for the definition of `LeaderboardPnlColumns` and check if it contains the `address` property. rg 'LeaderboardPnlColumns' --type ts -A 10Length of output: 6601
127-127
: Column update: Ensure correctness.The column
subaccountId
has been replaced withaddress
. Verify that the column nameLeaderboardPnlColumns.address
is correct and exists in the database schema.Verification successful
Column update: Verification successful.
The column
LeaderboardPnlColumns.address
is correctly defined in the codebase as part of theLeaderboardPnlColumns
enum inindexer/packages/postgres/src/types/leaderboard-pnl-types.ts
.
- Definition found:
indexer/packages/postgres/src/types/leaderboard-pnl-types.ts: export enum LeaderboardPnlColumns { address = 'address', ... }
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the column `LeaderboardPnlColumns.address` exists in the database schema. # Test: Search for the column definition. Expect: Column `address` should be defined in the schema. rg --type typescript -A 5 $'LeaderboardPnlColumns.address'Length of output: 92
Script:
#!/bin/bash # Description: Verify that the column `LeaderboardPnlColumns.address` exists in the database schema. # Test: Search for the column definition. Expect: Column `address` should be defined in the schema. rg --type ts -A 5 $'LeaderboardPnlColumns.address'Length of output: 1767
Script:
#!/bin/bash # Description: Verify that the column `LeaderboardPnlColumns.address` is defined in the codebase. # Test: Search for the definition of `LeaderboardPnlColumns.address`. Expect: The column should be defined in the codebase. rg --type ts 'address' | grep 'LeaderboardPnlColumns'Length of output: 437
Script:
#!/bin/bash # Description: Verify that the column `LeaderboardPnlColumns.address` is defined in the codebase. # Test: Search for the definition of `LeaderboardPnlColumns` to locate the `address` column. rg --type ts 'LeaderboardPnlColumns' -A 10Length of output: 6601
indexer/packages/postgres/src/types/db-model-types.ts (1)
264-264
: Field update: Ensure consistency with other parts of the system.The field
subaccountId
has been changed toaddress
. Verify that all references to this interface use the updated field name.Verification successful
Field update verified: Consistency maintained with the updated field name.
The field
subaccountId
has been successfully updated toaddress
in theLeaderboardPnlFromDatabase
interface, and all references in the codebase reflect this change.
indexer/packages/postgres/__tests__/stores/leaderboard-pnl-table.test.ts
indexer/packages/postgres/src/stores/leaderboard-pnl-table.ts
indexer/packages/postgres/src/types/db-model-types.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all references to the `LeaderboardPnlFromDatabase` interface use the updated field name `address`. # Test: Search for the interface usage. Expect: Only occurrences of the new field name `address`. rg --type typescript -A 5 $'LeaderboardPnlFromDatabase'Length of output: 89
Script:
#!/bin/bash # Description: Verify that all references to the `LeaderboardPnlFromDatabase` interface use the updated field name `address`. # Test: Search for the interface usage. Expect: Only occurrences of the new field name `address`. rg --type ts -A 5 $'LeaderboardPnlFromDatabase'Length of output: 5887
indexer/packages/postgres/__tests__/helpers/constants.ts (3)
68-68
: New constant: Ensure usage consistency.A new constant
defaultAddress2
has been added. Verify that this constant is used consistently and correctly throughout the codebase.
872-872
: Field update: Ensure consistency with other parts of the system.The field
address
indefaultLeaderboardPnl2OneDay
has been updated to usedefaultAddress2
. Verify that all references to this constant use the updated field name.Verification successful
Field update verified: Consistency maintained.
The
address
field in thedefaultLeaderboardPnl2OneDay
constant has been updated to usedefaultAddress2
. This update is consistent across the codebase as theaddress
field is only defined within the constant and not explicitly referenced elsewhere.
indexer/packages/postgres/__tests__/helpers/constants.ts
: Theaddress
field is correctly updated.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all references to the `defaultLeaderboardPnl2OneDay` constant use the updated field name `address`. # Test: Search for the constant usage. Expect: Only occurrences of the new field name `address`. rg --type typescript -A 5 $'defaultLeaderboardPnl2OneDay'Length of output: 91
Script:
#!/bin/bash # Description: Verify that all references to the `defaultLeaderboardPnl2OneDay` constant use the updated field name `address`. # Test: Search for the constant usage. Expect: Only occurrences of the new field name `address`. rg --glob '*.ts' --glob '*.tsx' -A 5 'defaultLeaderboardPnl2OneDay'Length of output: 3565
Script:
#!/bin/bash # Description: Verify that the `address` field in the `defaultLeaderboardPnl2OneDay` constant is consistently updated across all references. # Test: Search for the usage of the `address` field within the `defaultLeaderboardPnl2OneDay` references. rg --glob '*.ts' --glob '*.tsx' -A 5 'defaultLeaderboardPnl2OneDay' | rg 'address'Length of output: 165
864-864
: Field update: Ensure consistency with other parts of the system.The field
address
indefaultLeaderboardPnlOneDay
has been updated to usedefaultAddress2
. Verify that all references to this constant use the updated field name.
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 (1)
- indexer/packages/postgres/src/models/leaderboard-pnl-model.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- indexer/packages/postgres/src/models/leaderboard-pnl-model.ts
...es/postgres/src/db/migrations/migration_files/20240717160024_create_leaderboard_pnl_table.ts
Show resolved
Hide resolved
...es/postgres/src/db/migrations/migration_files/20240717160024_create_leaderboard_pnl_table.ts
Show resolved
Hide resolved
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 (2)
- indexer/packages/postgres/src/db/migrations/migration_files/20240717160024_create_leaderboard_pnl_table.ts (2 hunks)
- indexer/packages/postgres/src/models/leaderboard-pnl-model.ts (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- indexer/packages/postgres/src/db/migrations/migration_files/20240717160024_create_leaderboard_pnl_table.ts
- indexer/packages/postgres/src/models/leaderboard-pnl-model.ts
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 (2)
- indexer/packages/postgres/tests/helpers/constants.ts (3 hunks)
- indexer/packages/postgres/tests/stores/leaderboard-pnl-table.test.ts (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- indexer/packages/postgres/tests/helpers/constants.ts
- indexer/packages/postgres/tests/stores/leaderboard-pnl-table.test.ts
b3aa602
to
81f56e7
Compare
Changelist
Test Plan
updated tests
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
Bug Fixes
subaccountId
withaddress
in leaderboard data, ensuring correct user identification.Tests
address
property.This update enhances data consistency and integrity by using a more accurate identifier for leaderboard entries.