refactor(tests): update builder codes error code#2160
refactor(tests): update builder codes error code#2160ChesterSim wants to merge 1 commit intomasterfrom
Conversation
WalkthroughThis PR updates the Drift protocol IDL schema and test assertions. It removes legacy Pyth pull-oracle instruction definitions, introduces a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@sdk/src/idl/drift.json`:
- Around line 18967-18972: The new error entry
"InvalidInsuranceFundWithdrawalRecipient" was inserted with code 6146 which
shifts all subsequent numeric mappings; revert this by either appending
"InvalidInsuranceFundWithdrawalRecipient" to the end of the existing published
error list (so it gets a new unused code) or, if you must insert here, renumber
only the new entry to an unused code and leave all existing codes unchanged;
ensure the mapping for "InvalidInsuranceFundWithdrawalRecipient" is referenced
by its name (not a shifted numeric) in any schema or docs and run any error-code
consistency checks to confirm no other codes changed.
- Around line 19156-19160: The JSON entry for the error with code 6184 (name:
MaxIFWithdrawReached) has an incorrect message value
"InvalidSpotPositionDetected"; update the "msg" field for the error object
identified by code 6184 / name MaxIFWithdrawReached to a clear, accurate message
such as "MaxIFWithdrawReached" or "MaxInsuranceFundWithdrawReached" so
clients/operators receive a descriptive, relevant error when the insurance fund
withdrawal cap is reached.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: db8d7efa-6908-494e-947d-ffb11827aaa0
📒 Files selected for processing (2)
sdk/src/idl/drift.jsontests/builderCodes.ts
| "code": 6146, | ||
| "name": "InvalidInsuranceFundWithdrawalRecipient", | ||
| "msg": "Insurance fund withdrawal recipient must be the designated treasury address" | ||
| }, | ||
| { | ||
| "code": 6147, |
There was a problem hiding this comment.
Preserve existing error codes.
Adding InvalidInsuranceFundWithdrawalRecipient at 6146 shifts every subsequent numeric mapping. That breaks any client, test, or indexer keyed on error numbers. Please allocate new codes at the end of the published list instead, or treat this as a deliberate breaking API change.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sdk/src/idl/drift.json` around lines 18967 - 18972, The new error entry
"InvalidInsuranceFundWithdrawalRecipient" was inserted with code 6146 which
shifts all subsequent numeric mappings; revert this by either appending
"InvalidInsuranceFundWithdrawalRecipient" to the end of the existing published
error list (so it gets a new unused code) or, if you must insert here, renumber
only the new entry to an unused code and leave all existing codes unchanged;
ensure the mapping for "InvalidInsuranceFundWithdrawalRecipient" is referenced
by its name (not a shifted numeric) in any schema or docs and run any error-code
consistency checks to confirm no other codes changed.
| { | ||
| "code": 6183, | ||
| "code": 6184, | ||
| "name": "MaxIFWithdrawReached", | ||
| "msg": "InvalidSpotPositionDetected" | ||
| }, |
There was a problem hiding this comment.
Fix the message for MaxIFWithdrawReached.
This error currently surfaces InvalidSpotPositionDetected, which is unrelated and will mislead clients and operators when the IF withdrawal cap is hit.
💡 Proposed fix
{
"code": 6184,
"name": "MaxIFWithdrawReached",
- "msg": "InvalidSpotPositionDetected"
+ "msg": "MaxIFWithdrawReached"
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| "code": 6183, | |
| "code": 6184, | |
| "name": "MaxIFWithdrawReached", | |
| "msg": "InvalidSpotPositionDetected" | |
| }, | |
| { | |
| "code": 6184, | |
| "name": "MaxIFWithdrawReached", | |
| "msg": "MaxIFWithdrawReached" | |
| }, |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sdk/src/idl/drift.json` around lines 19156 - 19160, The JSON entry for the
error with code 6184 (name: MaxIFWithdrawReached) has an incorrect message value
"InvalidSpotPositionDetected"; update the "msg" field for the error object
identified by code 6184 / name MaxIFWithdrawReached to a clear, accurate message
such as "MaxIFWithdrawReached" or "MaxInsuranceFundWithdrawReached" so
clients/operators receive a descriptive, relevant error when the insurance fund
withdrawal cap is reached.
Summary by CodeRabbit
New Features
Chores