Skip to content

Add signedContext to clear3/4#456

Merged
rouzwelt merged 2 commits into
masterfrom
2026-07-07-clear-signed-context
Jul 7, 2026
Merged

Add signedContext to clear3/4#456
rouzwelt merged 2 commits into
masterfrom
2026-07-07-clear-signed-context

Conversation

@rouzwelt

@rouzwelt rouzwelt commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Solution

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • Bug Fixes
    • Updated trade simulation to include the correct signed context for both sides of an intra-orderbook order.
    • Calldata generated for clearing orders now carries the expected order-specific context instead of empty values.
    • Improved test coverage to reflect the updated calldata and context behavior.

@rouzwelt rouzwelt requested a review from Siddharth2207 July 7, 2026 10:41
@rouzwelt rouzwelt self-assigned this Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@rouzwelt, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0d641182-b09d-4bf2-8589-272d15b3c8e6

📥 Commits

Reviewing files that changed from the base of the PR and between 63ef21f and a8579e0.

📒 Files selected for processing (1)
  • src/core/modes/intra/simulation.test.ts

Walkthrough

This PR updates the IntraOrderbookTradeSimulator's clear3 calldata generation for V4 orders (on both Orderbook V5 and V6) to include actual signedContext values from order and counterparty order details, replacing previously hardcoded empty arrays. Test fixtures and assertions are updated accordingly.

Changes

SignedContext propagation in clear3 calldata

Layer / File(s) Summary
Populate signedContext in clear3 calldata
src/core/modes/intra/simulation.ts
getCalldataForV4OrderV6 and getCalldataForV4Order now set alice/bob signedContext fields in clear3 arguments from takeOrder.struct.signedContext and counterpartyOrderDetails.struct.signedContext instead of empty arrays.
Update test fixtures and expectations
src/core/modes/intra/simulation.test.ts
Test fixtures add signedContext: [] to order structs, reformat takeOrder.struct for V3, and update clear3 call assertions to expect signedContext values derived from tradeArgs instead of hardcoded empty arrays.

Estimated code review effort: 2 (Simple) | ~10 minutes

Related issues: None specified

Related PRs: None specified

Suggested labels: bug, tests

Suggested reviewers: None specified


🐰 A hop, a skip, signed context found,
No longer empty, no longer unbound,
Alice and bob now carry their say,
Through clear3's calldata, they hop away.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding signedContext to clear3/4 calldata handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-07-07-clear-signed-context

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/modes/intra/simulation.test.ts`:
- Line 107: The signedContext fixtures used in the intra simulation test are
both empty, so the toHaveBeenCalledWith assertion cannot detect if alice and bob
sources are swapped. Update the fixtures in simulation.test.ts for
counterpartyOrderDetails.struct.signedContext and
orderDetails.takeOrder.struct.signedContext to use distinct non-empty values,
then keep the existing assertion against the call made in the relevant
simulation path so the test verifies the correct side-specific signedContext is
passed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 47f153d0-f447-4f99-8971-996b7b8264e1

📥 Commits

Reviewing files that changed from the base of the PR and between 2ceec74 and 63ef21f.

📒 Files selected for processing (2)
  • src/core/modes/intra/simulation.test.ts
  • src/core/modes/intra/simulation.ts

Comment thread src/core/modes/intra/simulation.test.ts Outdated
@rouzwelt rouzwelt merged commit 62c725d into master Jul 7, 2026
12 checks passed
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@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:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

SIZE=S

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants