-
Notifications
You must be signed in to change notification settings - Fork 0
fix: minor cleanups from grant review (COW-996, COW-999, COW-1003) #80
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
Changes from all commits
07478fc
8645868
ff2338b
4834738
04181ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tbh I don't think this tests are relevant. Instead, we should properly handle types related to order types and deterministic order types. Two things that would make it better:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my understanding, the |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { | ||
| DETERMINISTIC_ORDER_TYPE, | ||
| type OrderType, | ||
| } from "../../src/utils/order-types"; | ||
|
|
||
| describe("DETERMINISTIC_ORDER_TYPE", () => { | ||
| it("covers every OrderType (exhaustive record)", () => { | ||
| // If a new OrderType is added to the union without updating the record, | ||
| // TypeScript will catch it at compile time. This test documents the intent. | ||
| const types = Object.keys(DETERMINISTIC_ORDER_TYPE) as OrderType[]; | ||
| expect(types.length).toBeGreaterThan(0); | ||
| }); | ||
|
|
||
| it("marks TWAP, StopLoss, CirclesBackingOrder as deterministic", () => { | ||
| expect(DETERMINISTIC_ORDER_TYPE["TWAP"]).toBe(true); | ||
| expect(DETERMINISTIC_ORDER_TYPE["StopLoss"]).toBe(true); | ||
| // Regression guard for COW-1003: CirclesBackingOrder must be deterministic | ||
| expect(DETERMINISTIC_ORDER_TYPE["CirclesBackingOrder"]).toBe(true); | ||
| }); | ||
|
|
||
| it("marks non-deterministic types as false", () => { | ||
| expect(DETERMINISTIC_ORDER_TYPE["PerpetualSwap"]).toBe(false); | ||
| expect(DETERMINISTIC_ORDER_TYPE["GoodAfterTime"]).toBe(false); | ||
| expect(DETERMINISTIC_ORDER_TYPE["TradeAboveThreshold"]).toBe(false); | ||
| expect(DETERMINISTIC_ORDER_TYPE["SwapOrderHandler"]).toBe(false); | ||
| expect(DETERMINISTIC_ORDER_TYPE["ERC4626CowSwapFeeBurner"]).toBe(false); | ||
| expect(DETERMINISTIC_ORDER_TYPE["Unknown"]).toBe(false); | ||
| }); | ||
| }); |
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.
Actually the new contract:
https://github.com/nullislabs/composable-cow/pull/1/changes#diff-140eef3ba41bdcf401d507408084181f2c0ac627532b61e0f7906ea7cc926782
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.
Maybe it worth to log this on a issue