Skip to content

2025 07 20 gte#373

Merged
thedavidmeister merged 4 commits into
mainfrom
2025-07-20-gte
Jul 20, 2025
Merged

2025 07 20 gte#373
thedavidmeister merged 4 commits into
mainfrom
2025-07-20-gte

Conversation

@thedavidmeister
Copy link
Copy Markdown
Contributor

@thedavidmeister thedavidmeister commented Jul 20, 2025

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

  • New Features

    • Enhanced comparison operations to support decimal floating-point logic for "greater than or equal to" and "less than or equal to" checks.
  • Bug Fixes

    • Improved accuracy and consistency in comparison operations by updating internal logic and metadata.
  • Tests

    • Added comprehensive test coverage for the updated comparison operations.
    • Removed outdated tests for previous comparison operation implementations.
  • Chores

    • Updated internal references and dependencies to align with the new comparison logic.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 20, 2025

Walkthrough

This change replaces the "NP" (non-typed) variants of the "greater-than-or-equal-to" and "less-than-or-equal-to" operations with new type-safe, floating-point-based implementations throughout the codebase. It updates library imports, function pointers, metadata, and integrity checks, and replaces corresponding test contracts with new ones for the updated logic.

Changes

File(s) Change Summary
lib/rain.interpreter.interface Updated subproject commit reference.
src/lib/op/LibAllStandardOps.sol Replaced NP variants of greater-than-or-equal-to and less-than-or-equal-to ops with new typed versions; updated metadata and constants.
src/lib/op/logic/LibOpGreaterThanOrEqualTo.sol, src/lib/op/logic/LibOpLessThanOrEqualTo.sol Renamed libraries, switched to typed Float-based comparisons, updated function signatures to use StackItem arrays.
test/src/lib/op/logic/LibOpGreaterThanOrEqualTo.t.sol, test/src/lib/op/logic/LibOpLessThanOrEqualTo.t.sol Added new test contracts for the updated ops, covering integrity, runtime, and error cases.
test/src/lib/op/logic/LibOpGreaterThanOrEqualToNP.t.sol, test/src/lib/op/logic/LibOpLessThanOrEqualToNP.t.sol Removed old test contracts for the NP variants of the ops.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Interpreter
    participant LibOpGreaterThanOrEqualTo
    participant LibOpLessThanOrEqualTo
    participant LibDecimalFloat

    User->>Interpreter: Executes opcode (>= or <=)
    Interpreter->>LibOpGreaterThanOrEqualTo: For >= op, calls run()
    LibOpGreaterThanOrEqualTo->>LibDecimalFloat: Calls gte(Float a, Float b)
    LibDecimalFloat-->>LibOpGreaterThanOrEqualTo: Returns boolean result
    LibOpGreaterThanOrEqualTo-->>Interpreter: Returns result to stack

    Interpreter->>LibOpLessThanOrEqualTo: For <= op, calls run()
    LibOpLessThanOrEqualTo->>LibDecimalFloat: Calls lte(Float a, Float b)
    LibDecimalFloat-->>LibOpLessThanOrEqualTo: Returns boolean result
    LibOpLessThanOrEqualTo-->>Interpreter: Returns result to stack
Loading

Possibly related PRs

  • bump int #319: Updates the subproject commit reference in lib/rain.interpreter.interface, similar to this PR.
  • gt op #356: Refactors the greater-than op from NP to Float-based implementation and updates related tests, analogous to this PR's changes for >= and <=.
  • 2025 07 13 lt #357: Refactors the less-than op from NP to Float-based implementation and updates related tests, similar to this PR's approach for related comparison ops.

Suggested reviewers

  • findolor
  • hardyjosh

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a10a9f8 and f1179b6.

📒 Files selected for processing (1)
  • test/src/lib/op/logic/LibOpGreaterThanOrEqualTo.t.sol (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#360
File: src/lib/op/erc20/LibOpERC20Allowance.sol:0-0
Timestamp: 2025-07-15T11:31:28.010Z
Learning: In the rainlanguage/rain.interpreter project, forge (Foundry's formatting tool) handles code formatting automatically, so formatting-related suggestions are not actionable.
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#360
File: src/lib/op/erc20/LibOpERC20Allowance.sol:0-0
Timestamp: 2025-07-15T11:31:35.645Z
Learning: In the rain.interpreter codebase, the team uses forge for automatic code formatting, so manual formatting suggestions are not needed as the tool will handle formatting automatically.
Learnt from: 0xgleb
PR: rainlanguage/rain.interpreter#333
File: .github/workflows/git-clean.yaml:4-7
Timestamp: 2025-06-07T11:15:44.415Z
Learning: In GitHub workflows for the rainlanguage/rain.interpreter repository, maintain consistency between workflow files when implementing concurrency controls. The user prefers using `${{ github.ref }}` over `${{ github.ref_name }}` for concurrency group naming to ensure consistency across all workflow files (git-clean.yaml and rainix.yaml).
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#360
File: src/lib/op/erc20/LibOpERC20Allowance.sol:35-36
Timestamp: 2025-07-15T11:39:30.188Z
Learning: When providing code review feedback in the rain.interpreter codebase, always check and apply existing learnings consistently. Do not suggest approaches that contradict established preferences already documented in the learnings, such as suggesting error handling with default values when the preference is to let calls fail explicitly.
test/src/lib/op/logic/LibOpGreaterThanOrEqualTo.t.sol (1)
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#368
File: test/src/lib/op/math/uint256/LibOpUint256Mul.t.sol:56-69
Timestamp: 2025-07-17T14:15:14.886Z
Learning: In multiplication overflow detection tests like LibOpUint256MulTest, when performing sequential multiplication (a * b * c * d...), encountering a zero value means the final result will always be zero regardless of subsequent values. Since zero multiplied by any value (including MAX_UINT256) cannot overflow, it's safe and correct to break out of the overflow detection loop early when zero is encountered.
⏰ 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). (10)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-static)
  • GitHub Check: rainix (macos-latest, rainix-rs-test)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-test)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-test)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-artifacts)
  • GitHub Check: rainix (macos-latest, rainix-rs-artifacts)
  • GitHub Check: rainix (ubuntu-latest, test-wasm-build)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-static)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-artifacts)
  • GitHub Check: git-clean
🔇 Additional comments (10)
test/src/lib/op/logic/LibOpGreaterThanOrEqualTo.t.sol (10)

21-28: LGTM! Proper integrity validation test.

The test correctly validates that the greater-than-or-equal-to operation enforces exactly 2 inputs and 1 output regardless of the operand input values. The fuzzing approach with uint8 inputs provides good coverage.


30-45: LGTM! Comprehensive runtime testing with correct naming.

The runtime test properly validates the operation against the reference implementation using opReferenceCheck with arbitrary StackItem inputs. Good to see the function name no longer contains "NP" which was correctly addressed from previous feedback.


47-51: LGTM! Correct evaluation test for equal zero inputs.

The test correctly verifies that 0 >= 0 returns true (1), which is the expected mathematical behavior.


53-57: LGTM! Correct evaluation test for false comparison.

The test correctly verifies that 0 >= 1 returns false (0), which is the expected mathematical behavior.


59-63: LGTM! Correct evaluation test for true comparison.

The test correctly verifies that 1 >= 0 returns true (1), which is the expected mathematical behavior.


65-69: LGTM! Correct evaluation test for equal non-zero inputs.

The test correctly verifies that 1 >= 1 returns true (1), which is the expected mathematical behavior.


71-76: LGTM! Proper failure test for zero inputs.

The test correctly verifies that providing zero inputs to the greater-than-or-equal-to operation fails with BadOpInputsLength, enforcing the requirement for exactly 2 inputs.


78-83: LGTM! Proper failure test for single input.

The test correctly verifies that providing only one input to the greater-than-or-equal-to operation fails with BadOpInputsLength, enforcing the requirement for exactly 2 inputs.


85-90: LGTM! Proper failure test for three inputs.

The test correctly verifies that providing three inputs to the greater-than-or-equal-to operation fails with BadOpInputsLength, enforcing the requirement for exactly 2 inputs.


92-98: LGTM! Comprehensive output validation tests.

Both tests correctly validate that the greater-than-or-equal-to operation must produce exactly 1 output, testing both zero outputs and two outputs as invalid cases using the checkBadOutputs helper.


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
🪧 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

Copy link
Copy Markdown
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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35b82f0 and 52e19df.

⛔ Files ignored due to path filters (3)
  • src/generated/Rainterpreter.pointers.sol is excluded by !**/generated/**
  • src/generated/RainterpreterExpressionDeployer.pointers.sol is excluded by !**/generated/**
  • src/generated/RainterpreterParser.pointers.sol is excluded by !**/generated/**
📒 Files selected for processing (8)
  • lib/rain.interpreter.interface (1 hunks)
  • src/lib/op/LibAllStandardOps.sol (7 hunks)
  • src/lib/op/logic/LibOpGreaterThanOrEqualTo.sol (2 hunks)
  • src/lib/op/logic/LibOpLessThanOrEqualTo.sol (2 hunks)
  • test/src/lib/op/logic/LibOpGreaterThanOrEqualTo.t.sol (1 hunks)
  • test/src/lib/op/logic/LibOpGreaterThanOrEqualToNP.t.sol (0 hunks)
  • test/src/lib/op/logic/LibOpLessThanOrEqualTo.t.sol (1 hunks)
  • test/src/lib/op/logic/LibOpLessThanOrEqualToNP.t.sol (0 hunks)
💤 Files with no reviewable changes (2)
  • test/src/lib/op/logic/LibOpGreaterThanOrEqualToNP.t.sol
  • test/src/lib/op/logic/LibOpLessThanOrEqualToNP.t.sol
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#360
File: src/lib/op/erc20/LibOpERC20Allowance.sol:0-0
Timestamp: 2025-07-15T11:31:28.010Z
Learning: In the rainlanguage/rain.interpreter project, forge (Foundry's formatting tool) handles code formatting automatically, so formatting-related suggestions are not actionable.
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#360
File: src/lib/op/erc20/LibOpERC20Allowance.sol:0-0
Timestamp: 2025-07-15T11:31:35.645Z
Learning: In the rain.interpreter codebase, the team uses forge for automatic code formatting, so manual formatting suggestions are not needed as the tool will handle formatting automatically.
Learnt from: 0xgleb
PR: rainlanguage/rain.interpreter#333
File: .github/workflows/git-clean.yaml:4-7
Timestamp: 2025-06-07T11:15:44.415Z
Learning: In GitHub workflows for the rainlanguage/rain.interpreter repository, maintain consistency between workflow files when implementing concurrency controls. The user prefers using `${{ github.ref }}` over `${{ github.ref_name }}` for concurrency group naming to ensure consistency across all workflow files (git-clean.yaml and rainix.yaml).
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#360
File: src/lib/op/erc20/LibOpERC20Allowance.sol:35-36
Timestamp: 2025-07-15T11:39:30.188Z
Learning: When providing code review feedback in the rain.interpreter codebase, always check and apply existing learnings consistently. Do not suggest approaches that contradict established preferences already documented in the learnings, such as suggesting error handling with default values when the preference is to let calls fail explicitly.
lib/rain.interpreter.interface (2)

undefined

<retrieved_learning>
Learnt from: thedavidmeister
PR: #360
File: src/lib/op/erc20/LibOpERC20Allowance.sol:0-0
Timestamp: 2025-07-15T11:31:28.010Z
Learning: In the rainlanguage/rain.interpreter project, forge (Foundry's formatting tool) handles code formatting automatically, so formatting-related suggestions are not actionable.
</retrieved_learning>

<retrieved_learning>
Learnt from: thedavidmeister
PR: #360
File: src/lib/op/erc20/LibOpERC20Allowance.sol:0-0
Timestamp: 2025-07-15T11:31:35.645Z
Learning: In the rain.interpreter codebase, the team uses forge for automatic code formatting, so manual formatting suggestions are not needed as the tool will handle formatting automatically.
</retrieved_learning>

src/lib/op/LibAllStandardOps.sol (1)
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#368
File: test/src/lib/op/math/uint256/LibOpUint256Mul.t.sol:56-69
Timestamp: 2025-07-17T14:15:14.886Z
Learning: In multiplication overflow detection tests like LibOpUint256MulTest, when performing sequential multiplication (a * b * c * d...), encountering a zero value means the final result will always be zero regardless of subsequent values. Since zero multiplied by any value (including MAX_UINT256) cannot overflow, it's safe and correct to break out of the overflow detection loop early when zero is encountered.
test/src/lib/op/logic/LibOpGreaterThanOrEqualTo.t.sol (1)
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#368
File: test/src/lib/op/math/uint256/LibOpUint256Mul.t.sol:56-69
Timestamp: 2025-07-17T14:15:14.886Z
Learning: In multiplication overflow detection tests like LibOpUint256MulTest, when performing sequential multiplication (a * b * c * d...), encountering a zero value means the final result will always be zero regardless of subsequent values. Since zero multiplied by any value (including MAX_UINT256) cannot overflow, it's safe and correct to break out of the overflow detection loop early when zero is encountered.
test/src/lib/op/logic/LibOpLessThanOrEqualTo.t.sol (1)
Learnt from: thedavidmeister
PR: rainlanguage/rain.interpreter#368
File: test/src/lib/op/math/uint256/LibOpUint256Mul.t.sol:56-69
Timestamp: 2025-07-17T14:15:14.886Z
Learning: In multiplication overflow detection tests like LibOpUint256MulTest, when performing sequential multiplication (a * b * c * d...), encountering a zero value means the final result will always be zero regardless of subsequent values. Since zero multiplied by any value (including MAX_UINT256) cannot overflow, it's safe and correct to break out of the overflow detection loop early when zero is encountered.
⏰ 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). (10)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-static)
  • GitHub Check: rainix (ubuntu-latest, test-wasm-build)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-artifacts)
  • GitHub Check: rainix (macos-latest, rainix-rs-artifacts)
  • GitHub Check: rainix (macos-latest, rainix-rs-test)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-test)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-static)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-artifacts)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-test)
  • GitHub Check: git-clean
🔇 Additional comments (24)
lib/rain.interpreter.interface (1)

1-1: Confirm the submodule bump is deliberate and tested

Only the submodule pointer changed. Please double-check that:

  1. 342fd08… is pushed to the rain.interpreter repo and not a dangling WIP commit.
  2. CI/forge test has been run after git submodule update --init --recursive to ensure the new typed-float comparison ops pass all existing suites.

If both points are green, nothing else to flag here.

src/lib/op/logic/LibOpGreaterThanOrEqualTo.sol (3)

8-14: LGTM! Proper imports and library renaming for typed implementation.

The addition of StackItem and Float/LibDecimalFloat imports aligns with the migration from raw uint256 comparisons to typed decimal floating-point operations. The library name change from LibOpGreaterThanOrEqualToNP to LibOpGreaterThanOrEqualTo correctly reflects the removal of the "NP" (non-typed) suffix.


22-35: LGTM! Correctly migrated to typed decimal floating-point comparison.

The run function properly implements the migration from raw uint256 comparisons to typed Float comparisons using LibDecimalFloat.gte. The assembly code correctly loads operands as Float values and stores the boolean result back to the stack, maintaining the expected stack behavior while adding type safety.


38-48: LGTM! Reference function correctly adapted to new type system.

The referenceFn function properly implements the signature change from uint256[] to StackItem[] and correctly unwraps inputs to Float types for comparison using LibDecimalFloat.gte. The boolean result is appropriately wrapped back as a StackItem, maintaining consistency with the run function logic.

src/lib/op/logic/LibOpLessThanOrEqualTo.sol (3)

8-14: LGTM! Consistent imports and library renaming.

The changes mirror those in LibOpGreaterThanOrEqualTo.sol with proper imports for StackItem and Float/LibDecimalFloat, and the library name correctly updated from LibOpLessThanOrEqualToNP to LibOpLessThanOrEqualTo.


22-35: LGTM! Correctly implements less-than-or-equal-to with typed comparison.

The run function properly uses LibDecimalFloat.lte for the less-than-or-equal-to comparison, which is the correct function for this operation. The implementation follows the same pattern as LibOpGreaterThanOrEqualTo with appropriate Float type usage and assembly code.


38-48: LGTM! Reference function correctly implements less-than-or-equal-to logic.

The referenceFn function properly implements the new type system with StackItem[] parameters and correctly uses LibDecimalFloat.lte for the less-than-or-equal-to comparison. The implementation is consistent with the pattern established in LibOpGreaterThanOrEqualTo.sol.

src/lib/op/LibAllStandardOps.sol (6)

56-60: LGTM! Import statements correctly updated for non-NP variants.

The imports properly reference the new LibOpGreaterThanOrEqualTo and LibOpLessThanOrEqualTo libraries, removing the "NP" suffix and aligning with the refactored implementations.


111-111: LGTM! Correctly updated ops count for two new operations.

The ALL_STANDARD_OPS_LENGTH constant is properly incremented from 49 to 51 to account for the addition of the greater-than-or-equal-to and less-than-or-equal-to operations.


222-237: LGTM! Proper metadata entries for the new operations.

The AuthoringMetaV2 entries for both greater-than-or-equal-to and less-than-or-equal-to operations provide clear and accurate descriptions, properly documenting that they return 1 if the condition is true, 0 otherwise.


447-456: LGTM! Correct operand handlers for comparison operations.

Both operations correctly use LibParseOperand.handleOperandDisallowed since they are simple comparison operations that don't require operands, consistent with other logic operations in the codebase.


602-606: LGTM! Integrity function pointers correctly reference new libraries.

The integrity function pointers properly reference LibOpGreaterThanOrEqualTo.integrity and LibOpLessThanOrEqualTo.integrity from the updated non-NP libraries.


717-721: LGTM! Opcode function pointers correctly reference new implementations.

The opcode function pointers properly reference LibOpGreaterThanOrEqualTo.run and LibOpLessThanOrEqualTo.run from the updated libraries, ensuring the new typed Float comparison logic is used at runtime.

test/src/lib/op/logic/LibOpGreaterThanOrEqualTo.t.sol (5)

1-20: LGTM! Proper test contract setup with correct imports.

The test contract setup properly imports all necessary dependencies including the LibOpGreaterThanOrEqualTo library and StackItem type, correctly extending OpTest for standardized operation testing.


24-31: LGTM! Correct integrity test implementation.

The integrity test properly verifies that the operation always requires exactly 2 inputs and produces 1 output, regardless of operand values. The test correctly calls LibOpGreaterThanOrEqualTo.integrity and validates the expected constraints.


52-72: LGTM! Comprehensive evaluation tests with correct expected results.

The evaluation tests properly cover all basic input combinations for the greater-than-or-equal-to operation:

  • 0 >= 0 → 1 (true)
  • 0 >= 1 → 0 (false)
  • 1 >= 0 → 1 (true)
  • 1 >= 1 → 1 (true)

The expected results are mathematically correct and the tests use appropriate string parsing to validate end-to-end functionality.


75-93: LGTM! Proper negative tests for invalid input counts.

The negative tests correctly verify that the operation fails integrity checks with BadOpInputsLength errors when provided with invalid input counts (0, 1, or 3 inputs instead of the required 2). The error parameters in the expectations are accurate.


95-101: LGTM! Correct output validation tests.

The output validation tests properly verify that the operation fails when configured with invalid output counts (0 or 2 outputs) instead of the required single output.

test/src/lib/op/logic/LibOpLessThanOrEqualTo.t.sol (6)

1-20: LGTM! Comprehensive test contract setup.

The test contract properly imports all necessary dependencies including LibOpLessThanOrEqualTo, StackItem, and context-related functionality for thorough testing.


24-38: LGTM! Comprehensive integrity test with fuzz testing.

The integrity test is more thorough than the corresponding test in LibOpGreaterThanOrEqualTo.t.sol, using bounded fuzz inputs to test various operand combinations while correctly verifying the required 2 inputs and 1 output constraint.


41-55: LGTM! Proper runtime testing implementation.

The runtime test correctly validates the operation's execution against the reference implementation using arbitrary StackItem inputs with the opReferenceCheck function.


59-139: LGTM! Comprehensive evaluation tests with correct less-than-or-equal-to logic.

The evaluation tests properly cover all input combinations for the less-than-or-equal-to operation with correct expected results:

  • 0 <= 0 → 1 (true)
  • 0 <= 1 → 1 (true)
  • 1 <= 0 → 0 (false)
  • 1 <= 1 → 1 (true)

The tests use explicit eval4 calls which provide more thorough validation than the checkHappy approach, ensuring proper stack and key-value store behavior.


142-161: LGTM! Proper negative tests for input validation.

The negative tests correctly verify that the operation fails integrity checks with appropriate BadOpInputsLength errors when provided with invalid input counts (0, 1, or 3 inputs instead of the required 2).


163-169: LGTM! Correct output validation tests.

The output validation tests properly verify that the operation fails when configured with invalid output counts (0 or 2 outputs) instead of the required single output, maintaining consistency with the testing pattern.

Comment thread test/src/lib/op/logic/LibOpGreaterThanOrEqualTo.t.sol Outdated
@thedavidmeister thedavidmeister merged commit c086ff1 into main Jul 20, 2025
11 checks passed
This was referenced Jul 23, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Aug 12, 2025
4 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Oct 20, 2025
4 tasks
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.

1 participant