Skip to content

2025 04 28 int - #322

Merged
thedavidmeister merged 4 commits into
mainfrom
2025-04-28-int
Apr 29, 2025
Merged

thedavidmeister merged 4 commits into
mainfrom
2025-04-28-int

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Apr 29, 2025 •

Copy link
Copy Markdown
Contributor

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

  • Refactor
    • Replaced all usage of the PackedFloat type with the new Float type for floating-point operations, simplifying float handling across parsing, opcode, and external operation logic.
    • Updated module and library names to remove the NPE2 suffix for improved clarity.
    • Streamlined float packing and equality logic in opcodes and parsing routines.
  • Tests
    • Updated all tests to use the new Float type and related packing methods, ensuring consistency with refactored float handling.
    • Adjusted expected values in tests to reflect the new float representation.
    • Updated test group names and run counts in benchmark snapshots.
  • Chores
    • Updated subproject references and internal benchmarks to reflect latest performance metrics and test results.

@coderabbitai

coderabbitai Bot commented Apr 29, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This change refactors the handling of floating-point values across the codebase by replacing the use of the PackedFloat type with the Float type and associated methods from the LibDecimalFloat library. It updates imports, variable declarations, and method calls in both implementation and test files to use Float and its direct packing, unpacking, and arithmetic methods. The PR also updates the .gas-snapshot to reflect new gas and performance metrics, introduces a new test group LibOpMaxValueTest replacing LibOpMaxUint256Test, and updates the subproject commit of lib/rain.interpreter.interface. All changes are internal and do not alter public or external function signatures.

Changes

Files/Areas Change Summary
.gas-snapshot Updated gas and performance metrics, test run counts, and replaced LibOpMaxUint256Test with LibOpMaxValueTest.
lib/rain.interpreter.interface Subproject commit reference updated; no code changes.
src/concrete/extern/RainterpreterReferenceExtern.sol Replaced PackedFloat and NPE2-suffixed module usage with Float and updated modules; updated decimal float parsing logic.
src/lib/extern/reference/op/LibExternOpContextCallingContract.sol
src/lib/extern/reference/op/LibExternOpIntInc.sol
Renamed libraries to remove NPE2 suffix; updated to use Float and direct methods.
src/lib/op/evm/LibOpBlockNumber.sol
src/lib/op/evm/LibOpChainId.sol
src/lib/op/evm/LibOpTimestamp.sol
src/lib/op/math/LibOpMaxValue.sol
src/lib/op/logic/LibOpEqualTo.sol
Replaced PackedFloat usage with Float; simplified packing/unpacking and arithmetic using direct Float methods.
src/lib/parse/LibParseOperand.sol
src/lib/parse/literal/LibParseLiteralDecimal.sol
Replaced PackedFloat with Float in parsing logic; removed deprecated parseDecimalFloat function.
test/src/concrete/Rainterpreter.stateOverlay.t.sol
test/src/concrete/RainterpreterReferenceExtern.intInc.t.sol
Updated tests to use Float and packLossless for float values; replaced old module references.
test/src/lib/op/00/LibOpConstant.t.sol
test/src/lib/op/00/LibOpExternNP.t.sol
test/src/lib/op/00/LibOpStackNP.t.sol
test/src/lib/op/call/LibOpCall.t.sol
test/src/lib/op/crypto/LibOpHashNP.t.sol
test/src/lib/op/math/LibOpMaxValue.t.sol
Updated tests to use Float and packLossless for expected values; replaced PackedFloat usage.
test/src/lib/parse/LibParse.literalIntegerDecimal.t.sol
test/src/lib/parse/LibParse.namedLHS.t.sol
test/src/lib/parse/LibParseOperand.parseOperand.t.sol
test/src/lib/parse/literal/LibParseLiteralDecimal.parseDecimalFloat.t.sol
Updated parsing tests to use Float and packLossless; replaced PackedFloat usage and updated assertions accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Suite
    participant LibDecimalFloat as LibDecimalFloat
    participant Float as Float Type
    participant Implementation as Contract/Library

    Test->>Implementation: Provide float input (as bytes32/int)
    Implementation->>Float: Wrap input as Float
    Implementation->>LibDecimalFloat: Call packLossless/add/eq on Float
    LibDecimalFloat-->>Implementation: Return Float result
    Implementation->>Float: Unwrap Float to bytes32/int
    Implementation-->>Test: Return result for assertion
Loading

Possibly related PRs

  • rainlanguage/rain.interpreter#320: Introduces the new LibOpMaxValue opcode and corresponding tests, directly related to the replacement of LibOpMaxUint256Test with LibOpMaxValueTest in this PR.
  • rainlanguage/rain.interpreter#318: Modifies RainterpreterStateOverlayTest with changes to float packing, related to the similar test updates in this PR.
  • rainlanguage/rain.interpreter#319: Updates the subproject commit reference for lib/rain.interpreter.interface, related as both PRs involve commit pointer changes for the same subproject.

📜 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 92b2ebe and ea37501.

📒 Files selected for processing (1)
  • src/lib/parse/literal/LibParseLiteralDecimal.sol (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-artifacts)
  • GitHub Check: rainix (macos-latest, rainix-rs-test)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-test)
  • GitHub Check: git-clean
🔇 Additional comments (2)
src/lib/parse/literal/LibParseLiteralDecimal.sol (2)

7-7: Import statement updated for Float type

The import statement has been appropriately updated to use Float from the LibParseDecimalFloat module instead of the previous PackedFloat type, which aligns with the broader refactoring approach across the codebase.


17-17: Successfully migrated from PackedFloat to Float type

The implementation now correctly uses the Float type and its associated unwrapping method. This maintains the same function signature while updating the internal implementation to use the new type system, ensuring backward compatibility with existing callers.

Also applies to: 19-19


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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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.

@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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3207433 and 92b2ebe.

⛔ Files ignored due to path filters (3)
  • src/generated/Rainterpreter.pointers.sol is excluded by !**/generated/**
  • src/generated/RainterpreterParser.pointers.sol is excluded by !**/generated/**
  • src/generated/RainterpreterReferenceExtern.pointers.sol is excluded by !**/generated/**
📒 Files selected for processing (24)
  • .gas-snapshot (4 hunks)
  • lib/rain.interpreter.interface (1 hunks)
  • src/concrete/extern/RainterpreterReferenceExtern.sol (7 hunks)
  • src/lib/extern/reference/op/LibExternOpContextCallingContract.sol (1 hunks)
  • src/lib/extern/reference/op/LibExternOpIntInc.sol (1 hunks)
  • src/lib/op/evm/LibOpBlockNumber.sol (2 hunks)
  • src/lib/op/evm/LibOpChainId.sol (2 hunks)
  • src/lib/op/evm/LibOpTimestamp.sol (2 hunks)
  • src/lib/op/logic/LibOpEqualTo.sol (3 hunks)
  • src/lib/op/math/LibOpMaxValue.sol (2 hunks)
  • src/lib/parse/LibParseOperand.sol (7 hunks)
  • src/lib/parse/literal/LibParseLiteralDecimal.sol (2 hunks)
  • test/src/concrete/Rainterpreter.stateOverlay.t.sol (3 hunks)
  • test/src/concrete/RainterpreterReferenceExtern.intInc.t.sol (6 hunks)
  • test/src/lib/op/00/LibOpConstant.t.sol (2 hunks)
  • test/src/lib/op/00/LibOpExternNP.t.sol (3 hunks)
  • test/src/lib/op/00/LibOpStackNP.t.sol (3 hunks)
  • test/src/lib/op/call/LibOpCall.t.sol (3 hunks)
  • test/src/lib/op/crypto/LibOpHashNP.t.sol (2 hunks)
  • test/src/lib/op/math/LibOpMaxValue.t.sol (2 hunks)
  • test/src/lib/parse/LibParse.literalIntegerDecimal.t.sol (5 hunks)
  • test/src/lib/parse/LibParse.namedLHS.t.sol (3 hunks)
  • test/src/lib/parse/LibParseOperand.parseOperand.t.sol (5 hunks)
  • test/src/lib/parse/literal/LibParseLiteralDecimal.parseDecimalFloat.t.sol (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-static)
  • GitHub Check: rainix (ubuntu-latest, test-wasm-build)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-artifacts)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-static)
  • GitHub Check: rainix (ubuntu-latest, rainix-rs-test)
  • GitHub Check: rainix (macos-latest, rainix-rs-artifacts)
  • GitHub Check: rainix (macos-latest, rainix-rs-test)
🔇 Additional comments (64)
lib/rain.interpreter.interface (1)

1-1:

Details

✅ Verification successful

Approve submodule pointer bump with verification

Updating the lib/rain.interpreter.interface subproject reference to commit b27b40dd48e41247c644068cb330ce235a0236ef aligns with the float-handling refactor. Ensure the commit exists in the submodule and that CI/tests pass against this interface version.


🏁 Script executed:

#!/bin/bash
# Verify that the new submodule commit exists
git submodule update --init lib/rain.interpreter.interface
cd lib/rain.interpreter.interface
git rev-parse --verify b27b40dd48e41247c644068cb330ce235a0236ef

Length of output: 594


✅ Submodule Commit Verified – Ready to Merge
The submodule at lib/rain.interpreter.interface has been updated to commit b27b40dd48e41247c644068cb330ce235a0236ef, and the commit exists in the remote repository. All that remains is to confirm that CI and existing tests pass against this interface version before merging.

src/lib/op/evm/LibOpTimestamp.sol (2)

8-8: Import statement updated to use Float instead of PackedFloat

The import has been appropriately updated to import Float directly instead of PackedFloat, aligning with the broader refactoring across the codebase.


33-33: Simplified floating-point conversion with direct packing

The implementation has been streamlined by using the more direct Float.unwrap(LibDecimalFloat.fromFixedDecimalLosslessPacked()) approach. This eliminates intermediate steps by directly converting the timestamp to a packed float representation.

src/lib/op/math/LibOpMaxValue.sol (2)

8-8: Import statement updated to use Float instead of PackedFloat

The import has been appropriately updated to import Float directly instead of PackedFloat, aligning with the broader refactoring across the codebase.


36-36: Simplified maximum float value construction

The implementation has been improved by directly using LibDecimalFloat.packLossless with maximum values for int224 and int32. This replaces a likely multi-step packing and unwrapping process with a single direct packing call, resulting in cleaner code.

src/lib/parse/literal/LibParseLiteralDecimal.sol (2)

7-7: Import statement updated to use Float instead of PackedFloat

The import has been appropriately updated to import Float directly instead of PackedFloat, aligning with the broader refactoring across the codebase.


17-19: Updated parseDecimalFloatPacked to use Float instead of PackedFloat

The function now correctly uses the Float type instead of PackedFloat for the return value and local variable, maintaining consistency with the rest of the codebase.

test/src/lib/parse/literal/LibParseLiteralDecimal.parseDecimalFloat.t.sol (1)

27-29: Updated test helper to use parseDecimalFloatPacked

The checkParseDecimalRevert helper function has been correctly updated to call parseDecimalFloatPacked instead of the now-commented-out parseDecimalFloat method, ensuring the tests match the updated implementation.

src/lib/extern/reference/op/LibExternOpContextCallingContract.sol (1)

12-15: Library rename aligns with broader NPE2 suffix removal refactoring.

The library has been renamed from LibExternOpContextCallingContractNPE2 to LibExternOpContextCallingContract, which aligns with the broader refactoring that removes the NPE2 suffix from several external operation libraries as mentioned in the AI summary.

src/lib/op/evm/LibOpBlockNumber.sol (2)

8-8: Updated import statement to use Float type.

The import has been updated to use Float instead of PackedFloat, which aligns with the broader refactoring to use Float type from LibDecimalFloat across the codebase.


33-33: Simplified float conversion with direct packed method.

The implementation has been streamlined by replacing the previous two-step process (calling fromFixedDecimalLosslessMem followed by .pack()) with a direct call to fromFixedDecimalLosslessPacked. This simplification might improve gas efficiency by reducing intermediate memory operations while maintaining the same functionality.

test/src/lib/parse/LibParse.namedLHS.t.sol (3)

18-18: Updated import statement to use Float type.

The import has been updated to use Float instead of PackedFloat, which aligns with the broader refactoring to use Float type from LibDecimalFloat across the codebase.


163-165: Updated float assertion to use packLossless method.

The constant assertions now use Float.unwrap(LibDecimalFloat.packLossless(1, 0)) instead of the previous PackedFloat.unwrap(LibDecimalFloat.pack(1e37, -37)). Both represent the same value of 1.0, but the new approach uses a more direct and lossless packing method, which is consistent with the refactoring pattern across the codebase.


217-220: Updated float assertions to use packLossless method.

Similar to the previous float assertions, these constants now use the packLossless method instead of the pack method, while maintaining the same actual test values. This change is consistent with the broader refactoring pattern for float handling across the codebase.

test/src/lib/op/call/LibOpCall.t.sol (2)

21-21: Updated import statement to use Float type.

The import has been updated to use Float instead of PackedFloat, which aligns with the broader refactoring to use Float type from LibDecimalFloat across the codebase.


166-166: Updated stack trace values to use packLossless method.

The expected stack trace values now use Float.unwrap(LibDecimalFloat.packLossless(1, 0)) instead of the previous PackedFloat approach. This maintains the same numeric values in the tests while using the new float type and packing method, consistent with the codebase-wide refactoring.

Also applies to: 176-176

test/src/lib/op/00/LibOpExternNP.t.sol (4)

21-21: Import change from PackedFloat to Float

The import statement has been updated to use Float instead of PackedFloat from the LibDecimalFloat library, aligning with the codebase-wide refactoring of floating-point value handling.


228-232: Updated floating-point value handling in test cases

The test data preparation has been updated to use the Float.unwrap(LibDecimalFloat.packLossless()) pattern instead of the previous PackedFloat.unwrap(LibDecimalFloat.pack()). This change is consistent with the codebase's shift toward a more direct floating-point handling approach.


239-240: Updated expected stack item construction

The expected stack item construction now uses the new Float.unwrap(LibDecimalFloat.packLossless()) pattern, maintaining consistency with the rest of the floating-point handling changes.


281-294: Simplified floating-point value handling in multiple inputs/outputs test

The multiple inputs/outputs test has been updated to use the new Float.unwrap(LibDecimalFloat.packLossless()) pattern consistently across all test data preparation. This change simplifies the floating-point representation by using direct lossless packing with zero exponents rather than the previous approach using explicit exponents.

src/lib/op/evm/LibOpChainId.sol (2)

8-8: Updated import to use Float instead of PackedFloat

The import statement has been modified to import Float instead of PackedFloat, consistent with the codebase-wide refactoring of floating-point handling.


33-33: Simplified floating-point conversion in referenceFn

The conversion of block.chainid to a floating-point value has been simplified by using fromFixedDecimalLosslessPacked directly with Float.unwrap instead of the previous approach. This change streamlines the code by using a more direct conversion method.

test/src/lib/op/00/LibOpStackNP.t.sol (3)

25-25: Updated import to use Float instead of PackedFloat

The import statement has been modified to use Float instead of PackedFloat, consistent with the codebase-wide refactoring of floating-point handling.


147-149: Updated assertion to use the new Float pattern

Test assertions have been updated to use Float.unwrap(LibDecimalFloat.packLossless()) for comparing stack values, maintaining consistency with the codebase's new approach to floating-point handling.


169-175: Updated multiple stack value assertions to use the new Float pattern

All assertions in the multiple stack evaluation test have been updated to use the Float.unwrap(LibDecimalFloat.packLossless()) pattern consistently. This change simplifies floating-point representation by using lossless packing with zero exponents.

test/src/lib/op/math/LibOpMaxValue.t.sol (2)

19-19: Updated import to use Float instead of PackedFloat

The import statement has been modified to import Float instead of PackedFloat, consistent with the codebase-wide refactoring of floating-point handling.


52-52: Simplified max value construction in test

The construction of the max value test case has been significantly simplified. Instead of manually creating a Float struct with signedCoefficient and exponent fields, the code now directly uses Float.unwrap(LibDecimalFloat.packLossless()) with the maximum values for int224 and int32. This improves code readability and maintainability.

test/src/lib/op/crypto/LibOpHashNP.t.sol (2)

27-27: LGTM! Import updated to use Float instead of PackedFloat

The import statement is correctly updated to use Float instead of PackedFloat from the LibDecimalFloat library, which aligns with the broader refactoring effort across the codebase.


107-107: LGTM! Float handling refactored correctly

The assertion code has been properly updated to:

  1. Use Float.unwrap() instead of PackedFloat.unwrap()
  2. Switch from LibDecimalFloat.pack() with large exponent values to LibDecimalFloat.packLossless() with simpler arguments

This change maintains the same test logic while using the new Float type implementation consistently.

Also applies to: 112-112

test/src/lib/op/00/LibOpConstant.t.sol (2)

22-22: LGTM! Import updated to use Float instead of PackedFloat

The import statement is correctly updated to use Float instead of PackedFloat from the LibDecimalFloat library, aligning with the broader refactoring effort across the codebase.


101-102: LGTM! Assertions properly updated to use Float

Test assertions have been correctly updated to use the new Float type with LibDecimalFloat.packLossless(), maintaining the same test logic while adapting to the refactored floating-point implementation.

test/src/lib/parse/LibParse.literalIntegerDecimal.t.sol (5)

11-11: LGTM! Import updated to use Float instead of PackedFloat

The import statement is correctly updated to use Float instead of PackedFloat from the LibDecimalFloat library, aligning with the broader refactoring effort.


51-51: LGTM! Updated to use Float and packLossless

Assertion properly updated to use Float.unwrap() with LibDecimalFloat.packLossless() instead of the previous PackedFloat approach.


88-89: LGTM! Assertions correctly updated

Test assertions are correctly updated to use the new Float type and packLossless method, maintaining test validity while using the refactored floating-point representation.


128-129: LGTM! Properly refactored assertions

The assertions for the test case with duplicate values are correctly updated to use the new Float type implementation.


285-289: LGTM! E-notation test assertions properly updated

The test for e-notation decimal literals has been correctly updated to use the new Float type with packLossless while maintaining the proper exponent values for scientific notation testing.

src/lib/parse/LibParseOperand.sol (8)

19-19: LGTM! Import updated to use Float instead of PackedFloat

The import statement is correctly updated to use Float instead of PackedFloat from the LibDecimalFloat library.


26-26: LGTM! Using directive added for Float

Added the appropriate using directive for LibDecimalFloat for Float to support the refactored floating-point operations.


162-163: LGTM! Updated to use Float.wrap and unpack

The code has been correctly updated to use Float.wrap(OperandV2.unwrap(operand)).unpack() for unpacking operands, which is consistent with the new floating-point representation approach.


182-183: LGTM! Float unpacking updated

Similar to the previous update, the operand handling now correctly uses the Float type for unpacking values.


200-202: LGTM! Variable types updated to Float

Variable types are correctly changed from PackedFloat to Float, maintaining consistency with the library-wide refactoring.


230-232: LGTM! Variable types updated to Float

Variable types in handleOperand8M1M1 are correctly updated to use the Float type.


242-242: LGTM! Default initialization updated to use Float.wrap

Default initializations now correctly use Float.wrap(0) instead of the previous PackedFloat approach.

Also applies to: 250-250


278-279: LGTM! Variable types and initialization updated

In the handleOperandM1M1 function, all variable declarations and initializations are correctly updated to use the Float type, maintaining consistency with the library-wide refactoring.

Also applies to: 286-286, 294-294

test/src/concrete/RainterpreterReferenceExtern.intInc.t.sol (4)

10-11: Migration to new Float type and updated library names.

The code has been updated to use the Float type from LibDecimalFloat and references the renamed library LibExternOpIntInc (previously LibExternOpIntIncNPE2). These changes are part of a larger refactoring effort in the codebase to standardize the floating-point representation.

Also applies to: 23-23, 27-27


43-45: Improved floating-point handling in test expectations.

The test now uses Float.unwrap(LibDecimalFloat.packLossless()) for test expectations instead of the previous PackedFloat approach. This is consistent with the codebase-wide migration to the Float type.

Also applies to: 61-62


138-140: Cleaner float value manipulation using new Float APIs.

The code now leverages the Float type's methods for float arithmetic, making the code more readable and consistent with the broader refactoring approach. Using Float.wrap, Float.unwrap, and the add method provides a cleaner, more object-oriented approach to float manipulation.


143-143: Updated library reference to match renamed implementation.

References to LibExternOpIntIncNPE2 have been updated to LibExternOpIntInc to match the renamed implementation library, ensuring consistency across the codebase.

Also applies to: 157-157

test/src/concrete/Rainterpreter.stateOverlay.t.sol (2)

9-9: Updated import for Float type.

This change correctly imports the Float type from LibDecimalFloat, replacing the previous PackedFloat import as part of the codebase-wide migration to the new floating-point representation.


16-16: Improved floating-point handling using Float type.

The test now uses Float.unwrap(LibDecimalFloat.packLossless()) for state overlay keys and values, replacing the previous PackedFloat approach. This improves consistency with the rest of the codebase and aligns with the broader refactoring efforts.

Also applies to: 45-46, 63-63

src/lib/extern/reference/op/LibExternOpIntInc.sol (2)

7-7: Updated library name and Float type integration.

The library has been renamed from LibExternOpIntIncNPE2 to LibExternOpIntInc (removing the NPE2 suffix), and now imports and uses the Float type with the appropriate using directive to enable method calls on Float instances. This change aligns with the codebase's standardization on the Float type for floating-point operations.

Also applies to: 14-17, 18-18


26-28: Cleaner floating-point arithmetic using Float methods.

The implementation now leverages the Float type's methods for float arithmetic instead of manual unpacking and repacking. This shift to a more object-oriented approach with Float.wrap, Float.unwrap, and the add method improves code readability and maintainability.

test/src/lib/parse/LibParseOperand.parseOperand.t.sol (2)

13-13: Updated import for Float type and implementation.

This change correctly imports the Float type and LibDecimalFloatImplementation from LibDecimalFloat, replacing the previous PackedFloat import to align with the codebase-wide migration to the new floating-point representation.


84-84: Consistent Float packing approach for test expectations.

The test now uses Float.unwrap(LibDecimalFloat.packLossless()) for expected operand values, replacing the previous PackedFloat approach. This change is consistent across all test cases (single, two, three, and four decimal literals) and aligns with the broader refactoring of the codebase's float handling.

Also applies to: 122-124, 183-187, 248-249

src/lib/op/logic/LibOpEqualTo.sol (5)

8-8: Import updated to use Float instead of PackedFloat

This change aligns with the broader refactoring in the codebase to simplify float handling by using the Float type directly.


25-26: Updated variable types to Float

Variable types have been changed from PackedFloat to Float to use the new type system for floating-point values.


34-34: Simplified equality check using Float.eq()

The equality comparison is now performed using the eq() method on the Float type, which is cleaner than the previous manual unpacking and component-wise equality check.


49-50: Updated reference function to use Float

The reference implementation also uses Float.wrap() to handle the stack items, maintaining consistency with the main implementation.


53-53: Simplified reference function equality check

The reference implementation now uses the same eq() method as the main implementation, ensuring consistency and simplifying the code.

src/concrete/extern/RainterpreterReferenceExtern.sol (4)

18-18: Updated imports to use renamed libraries without the NPE2 suffix

Updated the imports to use the new library names without the NPE2 suffix, which is part of a broader standardization effort across the codebase.

Also applies to: 21-21


35-35: Added Float type import and usage directive

Added the LibDecimalFloat and Float imports and the corresponding usage directive to support the updated float handling approach.

Also applies to: 150-151


242-253: Updated float parsing to use Float type

The decimal float parsing logic now:

  1. Uses parseDecimalFloatPacked to directly get a packed float
  2. Wraps it with Float for type safety
  3. Uses Float.gt for comparison instead of manually comparing components

This aligns with the broader refactoring to simplify float handling.


316-316: Updated references to renamed libraries

Function references throughout the file have been updated to use the new library names without the NPE2 suffix, ensuring consistency with the import changes.

Also applies to: 319-319, 351-351, 381-381

.gas-snapshot (1)

1-637: Updated gas measurements and replaced LibOpMaxUint256Test with LibOpMaxValueTest

The gas snapshot has been updated to reflect the refactored code's performance metrics. Key changes include:

  1. Updated run counts across tests (mostly from 2048 to 2051)
  2. Minor gas usage fluctuations, which are expected from the float handling refactoring
  3. Added LibOpMaxValueTest (lines 189-194) to replace LibOpMaxUint256Test

These changes align with the codebase's shift from specific uint256 max handling to a more generic value approach, consistent with the float type system updates.

Comment thread src/lib/parse/literal/LibParseLiteralDecimal.sol Outdated
@thedavidmeister
thedavidmeister merged commit 279c34e into main Apr 29, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Feb 18, 2026
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