-
Notifications
You must be signed in to change notification settings - Fork 0
wip on v6 #44
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
wip on v6 #44
Conversation
WalkthroughAdds IO index fields and maximumIORatio across multiple orderbook interfaces; adjusts import paths and lint suppressions; introduces a new IOrderBookV6 interface suite (with OrderTaker/ArbOrderTaker), many new structs, errors, events, and public API for vaultless, interpreter-driven orders. Changes
Sequence Diagram(s)sequenceDiagram
participant Taker as Taker (caller)
participant Book as IOrderBookV6
participant Eval as EvaluableV4 / Interpreter
participant Flash as IERC3156FlashLender
participant Vault as Vault (owner vaults)
Taker->>Book: takeOrders4(TakeOrdersConfigV5)
Book->>Eval: evaluate orders (evaluate EvaluableV4 per OrderV4)
Eval-->>Book: evaluation result (input/output amounts, IO indices)
alt requires flash liquidity
Book->>Flash: flashLoan(...)
Flash-->>Book: funds provided
end
Book->>Vault: transfer/mutate vault balances (deposit/withdraw semantics)
Book->>Book: enforce maximumIORatio, aggregate totals
Book-->>Taker: return (totalTakerInput, totalTakerOutput)
Note right of Book: emit events (TakeOrderV3, OrderExceedsMaxRatio, ClearV3, AfterClearV2) as applicable
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related issues
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (6)
Comment |
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: 6
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (12)
src/interface/IOrderBookV5.solsrc/interface/IOrderBookV5ArbOrderTaker.solsrc/interface/IOrderBookV5OrderTaker.solsrc/interface/deprecated/v1/IOrderBookV1.solsrc/interface/deprecated/v2/IOrderBookV2.solsrc/interface/deprecated/v3/IOrderBookV3.solsrc/interface/deprecated/v4/IOrderBookV4.solsrc/interface/deprecated/v4/IOrderBookV4ArbOrderTaker.solsrc/interface/deprecated/v4/IOrderBookV4OrderTaker.solsrc/interface/unstable/IOrderBookV6.solsrc/interface/unstable/IOrderBookV6ArbOrderTaker.solsrc/interface/unstable/IOrderBookV6OrderTaker.sol
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
🔇 Additional comments (12)
src/interface/deprecated/v1/IOrderBookV1.sol (2)
5-14: LGTM: Import reformatting and lint suppression look good.The named imports are more explicit and the
unused-importsuppression forLibEvaluableis appropriate if it's re-exported for external consumers.
52-57: LGTM: Consistent lint suppressions for mixed-case variables.The
mixed-case-variablesuppressions are appropriate for fields containing the "IO" acronym (e.g.,handleIO,inputIOIndex,outputIOIndex,maximumIORatio) which follow a common Solidity naming pattern for acronyms in camelCase identifiers.Also applies to: 93-94, 118-119, 134-137, 152-159
src/interface/deprecated/v3/IOrderBookV3.sol (1)
53-56: LGTM: Lint suppressions added consistently.The mixed-case variable suppressions align with the pattern established across all interface versions for IO-related field names.
Also applies to: 76-77, 101-102
src/interface/deprecated/v2/IOrderBookV2.sol (1)
49-54: LGTM: Lint suppressions consistent with other deprecated interfaces.The
pascal-case-structsuppression for theIOstruct andmixed-case-variablesuppressions for IO-related fields maintain consistency across the interface versions.Also applies to: 90-91, 115-116, 131-134, 149-156
src/interface/IOrderBookV5ArbOrderTaker.sol (1)
6-12: LGTM: Import reformatting with appropriate lint suppression.The multi-line import format improves readability. The
unused-importsuppression forEvaluableV4is appropriate if this type is re-exported for consumers of this interface.src/interface/deprecated/v4/IOrderBookV4.sol (2)
5-17: LGTM: Import path reorganization for deprecated interface structure.The updated import paths correctly reflect the new directory structure for deprecated interfaces. The lint suppressions for unused imports (
IInterpreterV3,IInterpreterStoreV2) are appropriate for re-exporting.
60-63: LGTM: Lint suppressions for IO-related fields.Consistent with the lint suppression pattern across all interface versions.
Also applies to: 109-110, 136-139
src/interface/unstable/IOrderBookV6OrderTaker.sol (1)
1-32: LGTM: Well-documented order taker callback interface.The
onTakeOrders2callback is well-defined with clear NatSpec documentation explaining:
- The debt deduction precedence before the callback
- Input/output direction semantics relative to the taker contract
- The expected token flow after the callback returns
The use of
Floattype for amounts aligns with the floating-point value system in V5/V6.src/interface/IOrderBookV5.sol (2)
5-23: LGTM: Import reorganization for V5 interface.The import paths correctly reference the deprecated V4 interface and the lint suppressions for unused imports (
NoOrders,ZeroMaximumInput,IInterpreterV4,IInterpreterStoreV3) are appropriate for re-exporting these symbols.
57-67: LGTM: Consistent lint suppressions across V5 structs.The
mixed-case-variableandpascal-case-structsuppressions are consistently applied to all IO-related fields (aliceInputIOIndex,aliceOutputIOIndex,bobInputIOIndex,bobOutputIOIndex,inputIOIndex,outputIOIndex,maximumIORatio) and theIOV2struct.Also applies to: 89-93, 154-159, 179-183, 193-198
src/interface/unstable/IOrderBookV6ArbOrderTaker.sol (1)
1-12: LGTM: New V6 arb order taker interface follows established patterns.The interface correctly extends
IOrderBookV6OrderTakerand thearb5function signature follows the established pattern fromarb4in V5. The use ofTakeOrdersConfigV4is intentional—it matches the config type used byIOrderBookV6itself, and noTakeOrdersConfigV5exists in the codebase.src/interface/unstable/IOrderBookV6.sol (1)
1-631: Overall interface design looks solid.The IOrderBookV6 interface is well-structured with comprehensive NatSpec documentation. The new additions (IO index fields,
maximumIORatio,Floattypes) are properly integrated. The error and event definitions follow good patterns for debugging and observability.A few documentation updates are needed (flagged separately), but the interface itself is technically sound.
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: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/interface/IOrderBookV5.sol (1)
52-63: Breaking change: Adding fields and changing types inClearConfigV2struct.Adding
aliceInputIOIndex,aliceOutputIOIndex,bobInputIOIndex, andbobOutputIOIndextoClearConfigV2changes the struct's memory layout. Additionally,aliceBountyVaultIdandbobBountyVaultIdchanged type fromuint256tobytes32, which is also a breaking change. Any existing code that constructs this struct will need to be updated.V6 imports
ClearConfigV2from V5, so dependent code has been updated accordingly.
♻️ Duplicate comments (2)
src/interface/unstable/IOrderBookV6.sol (2)
288-290: Fix typo in NatSpec (flagged in previous review).Line 289 contains "An error rather than an error" which should be "An event rather than an error" to match similar comments and correctly describe that this is an emitted event.
🔎 Proposed fix
/// Emitted when an order evaluates to a ratio exceeding the counterparty's -/// maximum limit. An error rather than an error so that we allow attempting +/// maximum limit. An event rather than an error so that we allow attempting /// many orders in a loop and NOT rollback on a "best effort" basis to clear.
359-362: Fix typo in NatSpec (flagged in previous review).Line 360 contains "withrawer" which should be "withdrawer".
🔎 Proposed fix
/// Allows the sender to withdraw any tokens from their own vaults. If the -/// withrawer has an active flash loan debt denominated in the same token +/// withdrawer has an active flash loan debt denominated in the same token /// being withdrawn then Orderbook will merely reduce the debt and NOT send
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
src/interface/IOrderBookV5.solsrc/interface/unstable/IOrderBookV6.solsrc/interface/unstable/IOrderBookV6ArbOrderTaker.sol
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
🔇 Additional comments (7)
src/interface/unstable/IOrderBookV6ArbOrderTaker.sol (1)
1-12: LGTM!The interface is well-structured and follows the established pattern for arb order takers. The imports are correct and the function signature appropriately extends the V6 ecosystem.
src/interface/unstable/IOrderBookV6.sol (2)
184-186: Documentation correctly describes V5 vs V6 differences.The differences between V5 and V6 are clearly stated: vaultless orders support and take order configuration based on taker output rather than input. Well documented!
348-349: The documented asymmetry between deposit and withdraw for vault ID 0 is intentional and properly explained in the interface: vault ID 0 is disallowed for deposits to prevent collision with vaultless orders, but supported for withdrawals to enable accessing vaultless order balances. The interface specifications are consistent with this design. Note that this repository contains interface definitions only; validation implementation details would be in the corresponding implementation repository.src/interface/IOrderBookV5.sol (4)
5-5: The import path is correct. The fileIERC3156FlashLender.solexists atsrc/interface/ierc3156/, making the relative import./ierc3156/IERC3156FlashLender.solfromIOrderBookV5.solvalid.
14-14: Import path change is correct and properly configured.The import path correctly changed from
../../../lib/...to../../lib/.... The path structure is valid, as verified by:
- Submodule configuration in
.gitmodulespoints tohttps://github.com/rainlanguage/rain.interpreter.interface- Directory structure
lib/rain.interpreter.interface/is properly set up as a git submodule- The relative path from
src/interface/IOrderBookV5.solcorrectly resolves to../../lib/rain.interpreter.interface/src/interface/unstable/IInterpreterCallerV4.solThe import statement will resolve correctly once the submodule is initialized during the build/deployment process.
172-179: Breaking change: Adding field to existing struct.Adding
maximumIORatiotoTakeOrdersConfigV4is a breaking change that requires all implementations and call sites constructing this struct to include the new field. This change affects any implementation ofIOrderBookV5ArbOrderTaker.arb4()and any code passingTakeOrdersConfigV4values.
148-155: The structTakeOrderConfigV4already contains theinputIOIndexandoutputIOIndexfields in its current definition. Since this is an interface-only repository with no implementing contracts, there are no call sites within this codebase to update. The responsibility for handling these struct fields correctly lies with external contracts that implement this interface.Likely an incorrect or invalid review comment.
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: 1
♻️ Duplicate comments (1)
src/interface/unstable/IOrderBookV6.sol (1)
38-41: Fix NatSpec parameter names to match struct fields.The documentation references
@param minimumInputand@param maximumInput, but the actual struct fields are namedminimumIOandmaximumIO.🔎 Proposed fix
-/// @param minimumInput Minimum input/output from the perspective of the order +/// @param minimumIO Minimum input/output from the perspective of the order /// taker. -/// @param maximumInput Maximum input/output from the perspective of the order +/// @param maximumIO Maximum input/output from the perspective of the order /// taker.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/interface/unstable/IOrderBookV6.sol
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
- GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
|
@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment: S/M/L PR Classification Guidelines:This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed. Small (S)Characteristics:
Review Effort: Would have taken 5-10 minutes Examples:
Medium (M)Characteristics:
Review Effort: Would have taken 15-30 minutes Examples:
Large (L)Characteristics:
Review Effort: Would have taken 45+ minutes Examples:
Additional Factors to ConsiderWhen deciding between sizes, also consider:
Notes:
|
|
Tip For best results, initiate chat on the files or code changes. SIZE=L |
Motivation
Solution
Checks
By submitting this for review, I'm confirming I've done the following:
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.