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

[CT-755] implement logic for FIRST_STRIKE_CLOSE_ONLY mode #1372

Merged
merged 5 commits into from
Apr 10, 2024
Merged

Conversation

dydxwill
Copy link
Contributor

@dydxwill dydxwill commented Apr 10, 2024

Changelist

Context: If a previously compliant user connects from a geo-restricted country, they will first be put into FIRST_STRIKE_CLOSE_ONLY. They will then receive a survey where they will answer their place of residence. Based on their response, they can transition from FIRST_STRIKE_CLOSE_ONLY -> (FIRST_STRIKE, CLOSE_ONLY).

Test Plan

Unit tested.

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

Summary by CodeRabbit

  • New Features
    • Introduced a new compliance status "FIRST_STRIKE_CLOSE_ONLY" to enhance tracking capabilities.
  • Refactor
    • Updated test descriptions to reflect the new compliance status accurately.
  • Database Changes
    • Implemented a database migration to include the new compliance status in the "compliance_status" table.

Copy link

linear bot commented Apr 10, 2024

Copy link
Contributor

coderabbitai bot commented Apr 10, 2024

Walkthrough

The recent update introduces a new compliance status, FIRST_STRIKE_CLOSE_ONLY, to the system. This change involves updating the database schema to accommodate the new status, revising test cases to reflect the updated status, and adding the new status to the ComplianceStatus enum. This ensures that the system can handle this new status across various functionalities.

Changes

File Path Change Summary
indexer/packages/postgres/.../compliance-status-table.test.ts,
indexer/packages/postgres/.../20240410111632_add_compliance_status_status_first_strike_close_only.ts,
indexer/packages/postgres/.../compliance-status-types.ts
Updated test descriptions, added a new migration file, and included a new enum value for ComplianceStatus to support FIRST_STRIKE_CLOSE_ONLY status.
indexer/services/comlink/.../compliance-v2-controller.test.ts Updated descriptions and statuses in ComplianceV2Controller test file to reflect compliance status changes.
indexer/services/comlink/.../api-documentation.md,
indexer/services/comlink/.../swagger.json
Added FIRST_STRIKE_CLOSE_ONLY to the list of properties and Swagger definition for compliance status.
indexer/services/comlink/.../compliance-v2-controller.ts Added new enum values, updated mappings, and modified behavior for FIRST_STRIKE and FIRST_STRIKE_CLOSE_ONLY statuses.

Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between fdbcbcd and acb5d23.
Files selected for processing (1)
  • indexer/packages/postgres/src/db/migrations/migration_files/20240410111632_add_compliance_status_status_first_strike_close_only.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • indexer/packages/postgres/src/db/migrations/migration_files/20240410111632_add_compliance_status_status_first_strike_close_only.ts

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>.
    • 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 show all the console.log statements in this repository.
    • @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.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@dydxwill dydxwill changed the title [CT-755] add FIRST_STRIKE_CLOSE_ONLY enum [CT-755] implement logic for FIRST_STRIKE_CLOSE_ONLY mode Apr 10, 2024
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

Actionable comments outside the diff hunks (38)
indexer/services/comlink/public/api-documentation.md (38)

Line range hint 14-14: Consider correcting the possible spelling mistake found near line 14.

- v4</a>  # Authentication  # Default  ## GetAddress  <a id="opIdGetAddress"></a>  > Code sa...
+ v4</a>  # Authentication  # Default  ## GetAddress  <a id="opIdGetAddress"></a>  > Code samples...

Line range hint 137-137: Consider correcting the possible spelling mistake found near line 137.

- etf.org/html/rfc7231#section-6.3.1)|Ok|[AddressResponse](#schemaaddressresponse)|  <aside class...
+ ietf.org/html/rfc7231#section-6.3.1)|Ok|[AddressResponse](#schemaaddressresponse)|  <aside class...

Line range hint 143-143: Consider correcting the possible spelling mistake found near line 143.

- not require authentication </aside>  ## GetSubaccount  <a id="opIdGetSubaccount"></a>  > Code...
+ not require authentication </aside>  ## GetSubaccount  <a id="opIdGetSubaccount"></a>  > Code samples...

Line range hint 188-188: Consider adding a missing white space near line 188.

- true|none| |subaccountNumber|path|number(double)|true|none|  > Example responses ...
+ true|none| |subaccountNumber|path|number(double)|true|none|  > Example responses...

Line range hint 262-262: Consider correcting the possible spelling mistake found near line 262.

- etf.org/html/rfc7231#section-6.3.1)|Ok|[SubaccountResponseObject](#schemasubaccountresponseobject)|  <as...
+ ietf.org/html/rfc7231#section-6.3.1)|Ok|[SubaccountResponseObject](#schemasubaccountresponseobject)|  <aside...

Line range hint 268-268: Consider correcting the possible spelling mistake found near line 268.

- not require authentication </aside>  ## GetParentSubaccount  <a id="opIdGetParentSubaccount"></a>  ...
+ not require authentication </aside>  ## GetParentSubaccount  <a id="opIdGetParentSubaccount"></a>  > Code samples...

Line range hint 313-313: Consider adding a missing white space near line 313.

- one| |parentSubaccountNumber|path|number(double)|true|none|  > Example responses ...
+ one| |parentSubaccountNumber|path|number(double)|true|none|  > Example responses...

Line range hint 395-395: Consider correcting the possible spelling mistake found near line 395.

- etf.org/html/rfc7231#section-6.3.1)|Ok|[ParentSubaccountResponse](#schemaparentsubaccountresponse)|  <as...
+ ietf.org/html/rfc7231#section-6.3.1)|Ok|[ParentSubaccountResponse](#schemaparentsubaccountresponse)|  <aside...

Line range hint 401-401: Consider correcting the possible spelling mistake found near line 401.

- not require authentication </aside>  ## GetAssetPositions  <a id="opIdGetAssetPositions"></a>  > ...
+ not require authentication </aside>  ## GetAssetPositions  <a id="opIdGetAssetPositions"></a>  > Code samples...

Line range hint 448-448: Consider adding a missing white space near line 448.

- rue|none| |subaccountNumber|query|number(double)|true|none|  > Example responses ...
+ rue|none| |subaccountNumber|query|number(double)|true|none|  > Example responses...

Line range hint 472-472: Consider correcting the possible spelling mistake found near line 472.

- etf.org/html/rfc7231#section-6.3.1)|Ok|[AssetPositionResponse](#schemaassetpositionresponse)|  <aside...
+ ietf.org/html/rfc7231#section-6.3.1)|Ok|[AssetPositionResponse](#schemaassetpositionresponse)|  <aside class="success">

Line range hint 478-478: Consider correcting the possible spelling mistake found near line 478.

- not require authentication </aside>  ## GetAssetPositionsForParentSubaccount  <a id="opIdGetAssetPositionsForParentS...
+ not require authentication </aside>  ## GetAssetPositionsForParentSubaccount  <a id="opIdGetAssetPositionsForParentSubaccount"></a>  > Code samples...

Line range hint 525-525: Consider adding a missing white space near line 525.

- ne| |parentSubaccountNumber|query|number(double)|true|none|  > Example responses ...
+ ne| |parentSubaccountNumber|query|number(double)|true|none|  > Example responses...

Line range hint 549-549: Consider correcting the possible spelling mistake found near line 549.

- etf.org/html/rfc7231#section-6.3.1)|Ok|[AssetPositionResponse](#schemaassetpositionresponse)|  <aside...
+ ietf.org/html/rfc7231#section-6.3.1)|Ok|[AssetPositionResponse](#schemaassetpositionresponse)|  <aside class="success">

Line range hint 555-555: Consider correcting the possible spelling mistake found near line 555.

- not require authentication </aside>  ## GetCandles  <a id="opIdGetCandles"></a>  > Code sa...
+ not require authentication </aside>  ## GetCandles  <a id="opIdGetCandles"></a>  > Code samples...

Line range hint 602-602: Consider adding a missing white space near line 602.

- solution)|true|none| |limit|query|number(double)|false|none| |fromISO|query|strin...
+ solution)|true|none| |limit|query|number(double)|false|none| |fromISO|query|string...

Line range hint 604-604: Consider correcting the possible spelling mistake found near line 604.

- limit|query|number(double)|false|none| |fromISO|query|string|false|none| |toISO|query|s...
+ limit|query|number(double)|false|none| |fromISO|query|string|false|none| |toISO|query|string...

Line range hint 605-605: Consider correcting the possible spelling mistake found near line 605.

- one| |fromISO|query|string|false|none| |toISO|query|string|false|none|  #### Enumerat...
+ one| |fromISO|query|string|false|none| |toISO|query|string|false|none|  #### Enumerated Values...

Line range hint 611-611: Consider adding a missing space between the number and word (or unit) near line 611.

- |Parameter|Value| |---|---| |resolution|1MIN| |resolution|5MINS| |resolution|15MINS|...
+ |Parameter|Value| |---|---| |resolution|1 MIN| |resolution|5 MINS| |resolution|15 MINS|...

Line range hint 615-615: Consider adding a missing space between the number and word (or unit) near line 615.

- 15MINS| |resolution|30MINS| |resolution|1HOUR| |resolution|4HOURS| |resolution|1DAY| ...
+ 15 MINS| |resolution|30 MINS| |resolution|1 HOUR| |resolution|4 HOURS| |resolution|1 DAY| ...

Line range hint 617-617: Consider adding a missing space between the number and word (or unit) near line 617.

- |1HOUR| |resolution|4HOURS| |resolution|1DAY|  > Example responses  > 200 Response  ...
+ |1 HOUR| |resolution|4 HOURS| |resolution|1 DAY|  > Example responses  > 200 Response  ...

Line range hint 648-648: Consider correcting the possible spelling mistake found near line 648.

- etf.org/html/rfc7231#section-6.3.1)|Ok|[CandleResponse](#schemacandleresponse)|  <aside class=...
+ ietf.org/html/rfc7231#section-6.3.1)|Ok|[CandleResponse](#schemacandleresponse)|  <aside class="success">

Line range hint 722-722: Consider correcting the possible spelling mistake found near line 722.

- not require authentication </aside>  ## GetFills  <a id="opIdGetFills"></a>  > Code samp...
+ not require authentication </aside>  ## GetFills  <a id="opIdGetFills"></a>  > Code samples...

Line range hint 769-769: Consider adding a missing white space near line 769.

- rue|none| |subaccountNumber|query|number(double)|true|none| |market|query|string|...
+ rue|none| |subaccountNumber|query|number(double)|true|none| |market|query|string...

Line range hint 771-771: Consider correcting the possible spelling mistake found near line 771.

- none| |market|query|string|false|none| |marketType|query|[MarketType](#schemamarkettype)|f...
+ none| |market|query|string|false|none| |marketType|query|[MarketType](#schemamarkettype)|false|none| |limit|...

Line range hint 772-772: Consider adding a missing white space near line 772.

- kettype)|false|none| |limit|query|number(double)|false|none| |createdBeforeOrAtHe...
+ kettype)|false|none| |limit|query|number(double)|false|none| |createdBeforeOrAtHeight...

Line range hint 773-773: Consider correcting the possible spelling mistake found near line 773.

- limit|query|number(double)|false|none| |createdBeforeOrAtHeight|query|number(double)|false|none| |creat...
+ limit|query|number(double)|false|none| |createdBeforeOrAtHeight|query|number(double)|false|none| |createdBeforeOrAt...

Line range hint 773-773: Consider adding a missing white space near line 773.

- e| |createdBeforeOrAtHeight|query|number(double)|false|none| |createdBeforeOrAt|q...
+ e| |createdBeforeOrAtHeight|query|number(double)|false|none| |createdBeforeOrAt|query...

Line range hint 774-774: Consider correcting the possible spelling mistake found near line 774.

- eight|query|number(double)|false|none| |createdBeforeOrAt|query|[IsoString](#schemaisostring)|fal...
+ eight|query|number(double)|false|none| |createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none|  #### En...

Line range hint 774-774: Consider correcting the possible spelling mistake found near line 774.

- )|false|none| |createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none|  #### En...
+ )|false|none| |createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none|  #### Enumerated Values...

Line range hint 780-780: Consider correcting the possible spelling mistake found near line 780.

- ed Values  |Parameter|Value| |---|---| |marketType|PERPETUAL| |marketType|SPOT|  > Example...
+ ed Values  |Parameter|Value| |---|---| |marketType|PERPETUAL| |marketType|SPOT|  > Example responses...

Line range hint 781-781: Consider correcting the possible spelling mistake found near line 781.

- alue| |---|---| |marketType|PERPETUAL| |marketType|SPOT|  > Example responses  > 200 Respo...
+ alue| |---|---| |marketType|PERPETUAL| |marketType|SPOT|  > Example responses  > 200 Response...

Line range hint 814-814: Consider correcting the possible spelling mistake found near line 814.

- etf.org/html/rfc7231#section-6.3.1)|Ok|[FillResponse](#schemafillresponse)|  <aside class="s...
+ ietf.org/html/rfc7231#section-6.3.1)|Ok|[FillResponse](#schemafillresponse)|  <aside class="success">

Line range hint 820-820: Consider correcting the possible spelling mistake found near line 820.

- not require authentication </aside>  ## GetFillsForParentSubaccount  <a id="opIdGetFillsForParentSubaccount...
+ not require authentication </aside>  ## GetFillsForParentSubaccount  <a id="opIdGetFillsForParentSubaccount"></a>  > Code samples...

Line range hint 867-867: Consider adding a missing white space near line 867.

- ne| |parentSubaccountNumber|query|number(double)|true|none| |market|query|string|...
+ ne| |parentSubaccountNumber|query|number(double)|true|none| |market|query|string...

Line range hint 869-869: Consider correcting the possible spelling mistake found near line 869.

- none| |market|query|string|false|none| |marketType|query|[MarketType](#schemamarkettype)|f...
+ none| |market|query|string|false|none| |marketType|query|[MarketType](#schemamarkettype)|false|none| |limit|...

Line range hint 870-870: Consider adding a missing white space near line 870.

- kettype)|false|none| |limit|query|number(double)|false|none| |createdBeforeOrAtHe...
+ kettype)|false|none| |limit|query|number(double)|false|none| |createdBeforeOrAtHeight...

Line range hint 871-871: Consider correcting the possible spelling mistake found near line 871.

- limit|query|number(double)|false|none| |createdBeforeOrAtHeight|query|number(double)|false|none| |creat...
+ limit|query|number(double)|false|none| |createdBeforeOrAtHeight|query|number(double)|false|none| |createdBeforeOrAt...

import * as Knex from 'knex';

export async function up(knex: Knex): Promise<void> {
return knex.schema.raw(`
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Can use this function instead, which changes the constraints w/o locking the table.
Non-blocking as the version with this table isn't released yet.

@dydxwill dydxwill merged commit 37d99ef into main Apr 10, 2024
11 checks passed
@dydxwill dydxwill deleted the wl/add_fsco branch April 10, 2024 19:07
@affanv14
Copy link
Contributor

affanv14 commented May 8, 2024

https://github.com/Mergifyio backport release/indexer/v5.x

Copy link
Contributor

mergify bot commented May 8, 2024

backport release/indexer/v5.x

✅ Backports have been created

@affanv14
Copy link
Contributor

affanv14 commented May 8, 2024

https://github.com/Mergifyio backport release/indexer/v5.x

Copy link
Contributor

mergify bot commented May 8, 2024

backport release/indexer/v5.x

✅ Backports have been created

@affanv14
Copy link
Contributor

affanv14 commented May 8, 2024

https://github.com/Mergifyio backport release/indexer/v5.x

Copy link
Contributor

mergify bot commented May 8, 2024

backport release/indexer/v5.x

✅ Backports have been created

affanv14 pushed a commit that referenced this pull request May 8, 2024
)

(cherry picked from commit 37d99ef)

Co-authored-by: dydxwill <119354122+dydxwill@users.noreply.github.com>
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.

4 participants