Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

test: add Moloch DAO-style systematic test suite (104 tests)#29

Open
jeremylongshore wants to merge 1 commit intomainfrom
test/moloch-dao-patterns
Open

test: add Moloch DAO-style systematic test suite (104 tests)#29
jeremylongshore wants to merge 1 commit intomainfrom
test/moloch-dao-patterns

Conversation

@jeremylongshore
Copy link
Contributor

@jeremylongshore jeremylongshore commented Feb 12, 2026

Summary

  • Add 104 new Moloch DAO-style tests covering every untested revert path, boundary condition, modifier pair, and state transition across all 6 protocol contracts
  • Test count increases from 448 to 552 with zero contract source changes
  • Add test README documenting testing philosophy, naming conventions, and directory structure

New Test Files

File Tests Category
test/moloch/RequireAudit.t.sol 51 Every untested revert path (SolverRegistry, IntentReceiptHub, DisputeModule, EscrowVault, WalletDelegate, X402Facilitator)
test/moloch/BoundaryTests.t.sol 28 Systematic 0/1/MAX-1/MAX/MAX+1 for bond amounts, challenge windows, batch sizes, deadlines, jail counts, slash amounts, cooldowns
test/moloch/ModifierTests.t.sol 17 Allow/reject pairs for onlyOperator, solverExists, receiptExists, onlyAuthorized, onlyHub, onlyArbitrator, onlyDisputeModule
test/moloch/StateTransitions.t.sol 8 Comprehensive post-condition assertions checking ALL fields after registration, bonding, slashing, finalization, disputes, escrow lifecycle

Helper Files

  • test/helpers/VerificationHelpers.sol — 5 reusable state-checking assertion functions
  • test/helpers/MockETHRejecter.sol — Contract without receive() for ETH transfer failure tests
  • test/README.md — Testing philosophy, naming conventions, run commands

Test plan

  • forge test — all 552 tests pass (448 existing + 104 new)
  • forge test --match-path "test/moloch/*" — 104/104 pass
  • No contract source files modified
  • No existing tests modified

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests

    • Added comprehensive test suites covering boundary conditions, modifier verification, state transitions, and requirement validation across core components.
    • Introduced test helper contracts and reusable verification utilities for assertions and mocking functionality.
  • Documentation

    • Added testing guide documenting philosophy, directory structure, naming conventions, and execution procedures.

Adopt Moloch DAO testing methodology: trigger every require, test every
modifier, verify all state transitions, and test boundary conditions
systematically. Increases test count from 448 to 552 with zero contract
source changes.

New files:
- test/moloch/RequireAudit.t.sol (51 tests) - every untested revert path
- test/moloch/BoundaryTests.t.sol (28 tests) - 0/1/MAX boundary conditions
- test/moloch/ModifierTests.t.sol (17 tests) - modifier allow/reject pairs
- test/moloch/StateTransitions.t.sol (8 tests) - comprehensive state verification
- test/helpers/VerificationHelpers.sol - reusable state-checking assertions
- test/helpers/MockETHRejecter.sol - ETH transfer failure helper
- test/README.md - testing philosophy and naming conventions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

This PR adds comprehensive test infrastructure for the IRSB Protocol, including test suite documentation, reusable verification helpers, and extensive test coverage for boundary conditions, modifiers, state transitions, and requirement audits across SolverRegistry, IntentReceiptHub, DisputeModule, and EscrowVault.

Changes

Cohort / File(s) Summary
Test Documentation & Helpers
test/README.md, test/helpers/MockETHRejecter.sol, test/helpers/VerificationHelpers.sol
Adds test suite documentation covering philosophy, structure, and conventions. Introduces MockETHRejecter contract to simulate ETH rejection for testing transfer failures. Provides VerificationHelpers abstract contract with internal assertion utilities (verifyPostDeposit, verifyPostSlash, verifyPostDispute, verifyPostFinalization, verifyEscrowState) for validating state transitions across components.
Moloch Test Suites
test/moloch/BoundaryTests.t.sol, test/moloch/ModifierTests.t.sol, test/moloch/RequireAudit.t.sol, test/moloch/StateTransitions.t.sol
Introduces four comprehensive test contracts covering: boundary conditions (bond amounts, challenge windows, deadlines, cooldowns), modifier authorization (onlyOperator, solverExists, receiptExists, onlyAuthorized, onlyHub, onlyDisputeModule), requirement audits (invalid inputs, edge cases, transfer failures across all modules), and state transitions (solver lifecycle, slash behaviors, dispute flows, escrow operations). All tests include setup, helper methods (_createSignedReceipt, _postReceipt, _openDispute), and extensive assertions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hoppy tests do hop along,
Boundary checks keep logic strong,
Modifiers guard with careful care,
State transitions everywhere!
With helpers verifying state,
Our protocol runs first-rate! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a systematic test suite with 104 tests for Moloch DAO-style testing, which is the primary purpose of the PR.
Description check ✅ Passed The description includes key sections (Summary, New Test Files, Helper Files, Test plan) with clear details about changes, but lacks several template sections (Type of Change, Risk Assessment, How Tested, Migration notes, Checklist items).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/moloch-dao-patterns

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

@gemini-code-assist
Copy link

Summary of Changes

Hello @jeremylongshore, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the protocol's test suite by integrating a robust set of 104 new tests inspired by the Moloch DAO testing methodology. These additions ensure critical contract logic, edge cases, and state transitions are thoroughly validated, covering all revert paths, boundary conditions, and modifier interactions. The improved test coverage aims to bolster the overall reliability and security of the system.

Highlights

  • Expanded Test Coverage: Added 104 new Moloch DAO-style tests, increasing total test count from 448 to 552, without modifying any existing contract source files.
  • Systematic Test Methodologies: Introduced comprehensive testing for every untested revert path, boundary condition, modifier pair, and state transition across all 6 core protocol contracts.
  • New Test Documentation: Included a new test/README.md file that documents the testing philosophy, directory structure, naming conventions, and instructions for running tests.
  • Enhanced Test Helpers: Added utility contracts MockETHRejecter.sol for simulating failed ETH transfers and VerificationHelpers.sol for reusable, comprehensive state-checking assertion functions.
Changelog
  • test/README.md
    • Documented the IRSB Protocol Test Suite's Moloch DAO-inspired testing philosophy.
    • Outlined the directory structure for various test categories.
    • Defined naming conventions for different test types (e.g., test_requireFail, test_boundary).
    • Provided instructions for running tests, including specific categories and verbose output.
    • Listed key parameters and their tested boundaries.
    • Detailed the security regression policy with examples.
  • test/helpers/MockETHRejecter.sol
    • Added a new contract MockETHRejecter that intentionally lacks receive() or fallback() functions to simulate failed ETH transfers.
  • test/helpers/VerificationHelpers.sol
    • Added an abstract contract VerificationHelpers providing reusable assertion functions for verifying contract state after various operations (e.g., verifyPostDeposit, verifyPostSlash, verifyPostDispute, verifyPostFinalization, verifyEscrowState).
  • test/moloch/BoundaryTests.t.sol
    • Added a new test suite BoundaryTestsTest to systematically verify boundary conditions for numeric parameters in SolverRegistry, IntentReceiptHub, and EscrowVault.
    • Included tests for bond deposit amounts (zero, one wei, minimum-1, minimum, minimum+1).
    • Added tests for challenge window durations (too short, minimum, maximum, too long).
    • Implemented tests for batch sizes in batchPostReceipts (zero, one, max, max+1).
    • Covered escrow deadline boundaries (current timestamp, current+1).
    • Tested finalization timing relative to the challenge window.
    • Verified jail count boundaries (MAX_JAILS-1, MAX_JAILS).
    • Included tests for slash amounts (zero, exact locked, locked+1, exact total, exceeding total).
    • Tested withdrawal cooldown periods (before expiry, after expiry).
    • Added tests for challenger bond amounts (exact minimum, below minimum).
  • test/moloch/ModifierTests.t.sol
    • Added a new test suite ModifierTestsTest to verify the behavior of custom modifiers across contracts.
    • Tested onlyOperator modifier in SolverRegistry for both allowed and rejected callers.
    • Verified solverExists modifier in SolverRegistry for existing and non-existent solvers.
    • Tested receiptExists modifier in IntentReceiptHub for existing and non-existent receipts.
    • Verified onlyAuthorized modifier in SolverRegistry for authorized callers and owner, and rejected unauthorized callers.
    • Tested onlyHub modifier in EscrowVault for authorized hub and owner, and rejected other callers.
    • Verified onlyArbitrator modifier in DisputeModule for arbitrator and non-arbitrator callers.
    • Tested onlyDisputeModule modifier in IntentReceiptHub for dispute module and owner, and rejected other callers.
  • test/moloch/RequireAudit.t.sol
    • Added a new test suite RequireAuditTest to cover every untested require/revert path across SolverRegistry, IntentReceiptHub, DisputeModule, EscrowVault, WalletDelegate, and X402Facilitator.
    • Included tests for SolverRegistry covering unauthorized deposits, insufficient bond withdrawals, failed ETH transfers during withdrawal/slash, insufficient total bond for slash, unjailing active/banned solvers, operator key registration conflicts, zero address operator, paused registration, locked bond withdrawal initiation, and unauthorized caller for setAuthorizedCaller/updateScore.
    • Added tests for IntentReceiptHub covering empty/too large batches, non-existent receipt disputes, unauthorized resolveEscalatedDispute calls, resolving already resolved disputes, failed treasury transfers during sweepForfeitedBonds, invalid challenge window durations, non-existent receipt finalization, and resolveEscalatedDispute on non-disputed receipts.
    • Included tests for DisputeModule covering resolving non-escalated disputes, zero address arbitrator/treasury, withdrawing zero fees, and unauthorized resolve calls.
    • Added tests for EscrowVault covering non-existent escrow release/refund, zero address/failed ETH transfers in emergencyWithdraw, failed ETH transfers during release/refund, zero recipient for release, releasing/refunding non-active escrows, zero/invalid amounts/receipt IDs for createEscrow, past deadlines for createEscrow, and unauthorized escrow release.
    • Included tests for WalletDelegate covering length mismatches in redeemDelegations, unsupported modes, delegation not found, double revocation, and executing delegated calls when paused.
    • Added tests for X402Facilitator covering invalid payment hash, zero amount, zero seller/buyer/token addresses, and expired payments.
  • test/moloch/StateTransitions.t.sol
    • Added a new test suite StateTransitionsTest to comprehensively verify state changes after key protocol actions.
    • Verified all fields of a solver after registration.
    • Confirmed bond deposit triggers activation at the minimum threshold.
    • Verified all fields after slashing from locked balance, including spill-over to available balance.
    • Confirmed all fields after posting and finalizing a receipt, including solver score updates.
    • Verified the full state during a dispute resolution leading to a slash.
    • Confirmed the full escrow lifecycle from creation to release and refund, including all field updates and balance transfers.
Activity
  • jeremylongshore created the pull request.
  • jeremylongshore provided a detailed summary of the changes, including new test files and their coverage.
  • jeremylongshore outlined the testing philosophy, directory structure, naming conventions, and running instructions in the new test/README.md.
  • jeremylongshore confirmed all 552 tests pass, with 104 new tests, and no contract source or existing tests were modified.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an impressive and comprehensive test suite following the Moloch DAO testing methodology, significantly increasing test coverage with 104 new tests. The new tests for revert paths, boundary conditions, modifiers, and state transitions are well-structured and greatly enhance the robustness of the protocol. I've provided a few suggestions to improve the accuracy of the test documentation and the precision of a couple of test cases.

Comment on lines +33 to +36
│ ├── RequireAudit.t.sol # Every untested revert path (~43 tests)
│ ├── StateTransitions.t.sol # Comprehensive state verification (~10 tests)
│ ├── BoundaryTests.t.sol # 0/1/MAX boundary conditions (~27 tests)
│ └── ModifierTests.t.sol # Modifier allow/reject pairs (~17 tests)

Choose a reason for hiding this comment

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

medium

The test counts mentioned in the Directory Structure section are inconsistent with the actual number of tests in the new files and the PR description. This can be misleading for developers looking at the documentation.

  • RequireAudit.t.sol: README says ~43, but there are 51 tests.
  • StateTransitions.t.sol: README says ~10, but there are 8 tests.
  • BoundaryTests.t.sol: README says ~27, but there are 28 tests.

Please update these counts to be accurate for better documentation clarity.

Suggested change
│ ├── RequireAudit.t.sol # Every untested revert path (~43 tests)
│ ├── StateTransitions.t.sol # Comprehensive state verification (~10 tests)
│ ├── BoundaryTests.t.sol # 0/1/MAX boundary conditions (~27 tests)
│ └── ModifierTests.t.sol # Modifier allow/reject pairs (~17 tests)
│ ├── RequireAudit.t.sol # Every untested revert path (51 tests)
│ ├── StateTransitions.t.sol # Comprehensive state verification (8 tests)
│ ├── BoundaryTests.t.sol # 0/1/MAX boundary conditions (28 tests)
│ └── ModifierTests.t.sol # Modifier allow/reject pairs (17 tests)

Comment on lines +190 to +199
function test_modifier_onlyHub_allows_hub() public {
bytes32 escrowId = keccak256("escrow");
vault.createEscrow{ value: 1 ether }(
escrowId, keccak256("receipt"), address(this), uint64(block.timestamp + 1 hours)
);

// Test contract is authorized hub (set in setUp)
vault.release(escrowId, address(this));
// Success - no revert
}

Choose a reason for hiding this comment

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

medium

The test test_modifier_onlyHub_allows_hub is intended to verify that an authorized hub can call a function with the onlyHub modifier. However, the test currently passes because the caller (address(this)) is the contract owner, which is also permitted by the modifier. The comment on line 196 is incorrect as address(this) is not configured as an authorized hub in the setUp function.

To correctly test the intended scenario, you should use vm.prank to make the call from the hub address, which is configured as an authorized hub. The test_modifier_onlyHub_allows_owner test already covers the owner path, so this change will make this test correctly target the authorized hub path.

    function test_modifier_onlyHub_allows_hub() public {
        bytes32 escrowId = keccak256("escrow");
        vault.createEscrow{ value: 1 ether }(
            escrowId, keccak256("receipt"), address(this), uint64(block.timestamp + 1 hours)
        );

        // Test that the authorized hub (set in setUp) can release the escrow
        vm.prank(address(hub));
        vault.release(escrowId, address(this));
        // Success - no revert
    }

/// @notice setAuthorizedCaller reverts for non-owner
function test_requireFail_SolverRegistry_setAuthorizedCaller_nonOwner() public {
vm.prank(unauthorized);
vm.expectRevert();

Choose a reason for hiding this comment

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

medium

The test test_requireFail_SolverRegistry_setAuthorizedCaller_nonOwner uses a generic vm.expectRevert() to check for the revert from the onlyOwner modifier. While this works, it's less precise. For Solidity ^0.8.20, OpenZeppelin's Ownable contract reverts with the custom error OwnableUnauthorizedAccount(address account).

To make the test more specific and robust, you should expect this specific custom error. This ensures that the test fails if the revert reason changes unexpectedly.

You will also need to import Ownable at the top of the file:

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
        vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, unauthorized));

Copy link

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

🤖 Fix all issues with AI agents
In `@test/moloch/ModifierTests.t.sol`:
- Around line 189-198: The test test_modifier_onlyHub_allows_hub is currently
calling vault.release as the test owner instead of as the authorized hub; update
the test to invoke the call under vm.prank(address(hub)) so the release call
exercises the onlyHub modifier path (locate the test_modifier_onlyHub_allows_hub
function and wrap the vault.release(escrowId, address(this)) invocation with
vm.prank(address(hub)) to simulate the hub caller).

In `@test/moloch/StateTransitions.t.sol`:
- Around line 124-138: The test call lines exceed the configured line_length;
reformat the long verifyPostDeposit invocation arguments onto multiple lines to
satisfy forge fmt (line_length = 120). Locate the two verifyPostDeposit calls
(after registry.depositBond and vm.prank) and split their argument list so each
parameter (registry, solverId, MINIMUM_BOND - 1, Types.SolverStatus.Inactive,
totalBondedBefore + MINIMUM_BOND - 1) and the second call's parameters each
appear on their own or logically wrapped lines, preserving the same values and
order and keeping surrounding vm.prank/registry.depositBond calls unchanged.

In `@test/README.md`:
- Line 16: Update the markdown code fence that currently reads just ``` to
include a language identifier (e.g., change the opening fence to ```text) so the
directory tree block has a specified language; locate the plain code fence in
README.md and replace the opening backticks with ```text to satisfy
markdownlint.
- Around line 33-36: The test counts in test/README.md for RequireAudit.t.sol,
StateTransitions.t.sol, BoundaryTests.t.sol, and ModifierTests.t.sol are
outdated; update the approximate test numbers next to those filenames to match
the current PR totals (replace the stale counts ~43, ~10, ~27, ~17 with the
actual counts from the test suite run) so the README reflects the real suite
size and avoids confusion.

Comment on lines +189 to +198
/// @notice onlyHub allows authorized hub
function test_modifier_onlyHub_allows_hub() public {
bytes32 escrowId = keccak256("escrow");
vault.createEscrow{ value: 1 ether }(
escrowId, keccak256("receipt"), address(this), uint64(block.timestamp + 1 hours)
);

// Test contract is authorized hub (set in setUp)
vault.release(escrowId, address(this));
// Success - no revert
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, locate and read the test file
find . -name "ModifierTests.t.sol" -type f

Repository: intent-solutions-io/irsb-protocol

Length of output: 110


🏁 Script executed:

# Check the structure of the repository
git ls-files | head -20

Repository: intent-solutions-io/irsb-protocol

Length of output: 639


🏁 Script executed:

# Read the test file around lines 189-198 and surrounding context
wc -l ./test/moloch/ModifierTests.t.sol

Repository: intent-solutions-io/irsb-protocol

Length of output: 114


🏁 Script executed:

# Read the relevant section of the test file
sed -n '180,210p' ./test/moloch/ModifierTests.t.sol

Repository: intent-solutions-io/irsb-protocol

Length of output: 1263


🏁 Script executed:

# Search for the vault.release() implementation to understand onlyHub modifier
find . -name "*.sol" -type f | grep -v test | grep -v node_modules

Repository: intent-solutions-io/irsb-protocol

Length of output: 1521


🏁 Script executed:

# Read the EscrowVault.sol file to find the onlyHub modifier and release() function
wc -l ./src/EscrowVault.sol

Repository: intent-solutions-io/irsb-protocol

Length of output: 102


🏁 Script executed:

# Search for the onlyHub modifier definition
rg "modifier onlyHub" ./src/EscrowVault.sol -A 10

Repository: intent-solutions-io/irsb-protocol

Length of output: 393


🏁 Script executed:

# Search for the release function in EscrowVault
rg "function release" ./src/EscrowVault.sol -B 3 -A 15

Repository: intent-solutions-io/irsb-protocol

Length of output: 772


🏁 Script executed:

# Now let's check the setUp function to understand how the test is initialized
sed -n '1,100p' ./test/moloch/ModifierTests.t.sol

Repository: intent-solutions-io/irsb-protocol

Length of output: 3752


🏁 Script executed:

# Search for authorizedHubs setup in the test
rg "authorizedHubs" ./test/moloch/ModifierTests.t.sol

Repository: intent-solutions-io/irsb-protocol

Length of output: 59


🏁 Script executed:

# Check EscrowVault initialization and authorizedHubs setup
rg "authorizedHubs" ./src/EscrowVault.sol -B 2 -A 2

Repository: intent-solutions-io/irsb-protocol

Length of output: 747


🏁 Script executed:

# Let me verify one more detail - check the second onlyHub test to confirm pattern
sed -n '199,210p' ./test/moloch/ModifierTests.t.sol

Repository: intent-solutions-io/irsb-protocol

Length of output: 508


onlyHub "allows hub" test isn't invoking as the hub.
This call currently executes as the owner, so it doesn't validate the hub authorization path. Add a vm.prank(address(hub)) to exercise the modifier properly.

🔧 Suggested fix
-        // Test contract is authorized hub (set in setUp)
-        vault.release(escrowId, address(this));
+        vm.prank(address(hub));
+        vault.release(escrowId, address(this));
🤖 Prompt for AI Agents
In `@test/moloch/ModifierTests.t.sol` around lines 189 - 198, The test
test_modifier_onlyHub_allows_hub is currently calling vault.release as the test
owner instead of as the authorized hub; update the test to invoke the call under
vm.prank(address(hub)) so the release call exercises the onlyHub modifier path
(locate the test_modifier_onlyHub_allows_hub function and wrap the
vault.release(escrowId, address(this)) invocation with vm.prank(address(hub)) to
simulate the hub caller).

Comment on lines +124 to +138
// Deposit below minimum — stays Inactive
vm.prank(operator);
registry.depositBond{ value: MINIMUM_BOND - 1 }(solverId);

verifyPostDeposit(
registry, solverId, MINIMUM_BOND - 1, Types.SolverStatus.Inactive, totalBondedBefore + MINIMUM_BOND - 1
);

// Deposit 1 more wei — activates
vm.prank(operator);
registry.depositBond{ value: 1 }(solverId);

verifyPostDeposit(
registry, solverId, MINIMUM_BOND, Types.SolverStatus.Active, totalBondedBefore + MINIMUM_BOND
);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Find the file
find . -name "StateTransitions.t.sol" -type f

Repository: intent-solutions-io/irsb-protocol

Length of output: 113


🏁 Script executed:

# Check if foundry.toml exists and review forge fmt settings
find . -name "foundry.toml" -o -name ".prettierrc" -type f | head -20

Repository: intent-solutions-io/irsb-protocol

Length of output: 91


🏁 Script executed:

# Read the specific file to see the current state
if [ -f "test/moloch/StateTransitions.t.sol" ]; then
  sed -n '120,145p' test/moloch/StateTransitions.t.sol
fi

Repository: intent-solutions-io/irsb-protocol

Length of output: 1176


🏁 Script executed:

# Check foundry.toml for forge fmt settings
cat foundry.toml

Repository: intent-solutions-io/irsb-protocol

Length of output: 931


🏁 Script executed:

# Verify the exact line numbers match the review comment
wc -l test/moloch/StateTransitions.t.sol

Repository: intent-solutions-io/irsb-protocol

Length of output: 115


🏁 Script executed:

# Check if forge fmt would report this as a violation
# First, let's see what the exact formatting rules are
cd . && forge fmt --help 2>&1 | head -50

Repository: intent-solutions-io/irsb-protocol

Length of output: 120


🏁 Script executed:

# Try to locate forge or check if it's installed elsewhere
which forge || find /usr -name forge -type f 2>/dev/null | head -5

Repository: intent-solutions-io/irsb-protocol

Length of output: 120


🏁 Script executed:

# Let's check the exact character count of the problematic lines
python3 << 'EOF'
lines = [
    "            registry, solverId, MINIMUM_BOND - 1, Types.SolverStatus.Inactive, totalBondedBefore + MINIMUM_BOND - 1",
    "            registry, solverId, MINIMUM_BOND, Types.SolverStatus.Active, totalBondedBefore + MINIMUM_BOND"
]
for i, line in enumerate(lines, 1):
    print(f"Line {i}: {len(line)} chars")
    print(f"  Content: {line}")
EOF

Repository: intent-solutions-io/irsb-protocol

Length of output: 356


🏁 Script executed:

# Check if there are other similar function calls in the file to see formatting patterns
rg "verifyPostDeposit" test/moloch/StateTransitions.t.sol -A 1

Repository: intent-solutions-io/irsb-protocol

Length of output: 355


🏁 Script executed:

# Look for other multi-argument function calls in test files to see how they're formatted
rg -A 2 "^\s+\w+\(" test/moloch/StateTransitions.t.sol | head -40

Repository: intent-solutions-io/irsb-protocol

Length of output: 2010


Apply forge fmt to split verifyPostDeposit arguments across lines.

The configured line_length = 120 in foundry.toml is exceeded by the current argument formatting. Split arguments to separate lines as shown:

🧹 Suggested formatting
-        verifyPostDeposit(
-            registry, solverId, MINIMUM_BOND - 1, Types.SolverStatus.Inactive, totalBondedBefore + MINIMUM_BOND - 1
-        );
+        verifyPostDeposit(
+            registry,
+            solverId,
+            MINIMUM_BOND - 1,
+            Types.SolverStatus.Inactive,
+            totalBondedBefore + MINIMUM_BOND - 1
+        );
@@
-        verifyPostDeposit(
-            registry, solverId, MINIMUM_BOND, Types.SolverStatus.Active, totalBondedBefore + MINIMUM_BOND
-        );
+        verifyPostDeposit(
+            registry,
+            solverId,
+            MINIMUM_BOND,
+            Types.SolverStatus.Active,
+            totalBondedBefore + MINIMUM_BOND
+        );
📝 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.

Suggested change
// Deposit below minimum — stays Inactive
vm.prank(operator);
registry.depositBond{ value: MINIMUM_BOND - 1 }(solverId);
verifyPostDeposit(
registry, solverId, MINIMUM_BOND - 1, Types.SolverStatus.Inactive, totalBondedBefore + MINIMUM_BOND - 1
);
// Deposit 1 more wei — activates
vm.prank(operator);
registry.depositBond{ value: 1 }(solverId);
verifyPostDeposit(
registry, solverId, MINIMUM_BOND, Types.SolverStatus.Active, totalBondedBefore + MINIMUM_BOND
);
// Deposit below minimum — stays Inactive
vm.prank(operator);
registry.depositBond{ value: MINIMUM_BOND - 1 }(solverId);
verifyPostDeposit(
registry,
solverId,
MINIMUM_BOND - 1,
Types.SolverStatus.Inactive,
totalBondedBefore + MINIMUM_BOND - 1
);
// Deposit 1 more wei — activates
vm.prank(operator);
registry.depositBond{ value: 1 }(solverId);
verifyPostDeposit(
registry,
solverId,
MINIMUM_BOND,
Types.SolverStatus.Active,
totalBondedBefore + MINIMUM_BOND
);
🧰 Tools
🪛 GitHub Actions: CI

[error] 136-138: forge fmt --check: formatting mismatch in verifyPostDeposit call.

🤖 Prompt for AI Agents
In `@test/moloch/StateTransitions.t.sol` around lines 124 - 138, The test call
lines exceed the configured line_length; reformat the long verifyPostDeposit
invocation arguments onto multiple lines to satisfy forge fmt (line_length =
120). Locate the two verifyPostDeposit calls (after registry.depositBond and
vm.prank) and split their argument list so each parameter (registry, solverId,
MINIMUM_BOND - 1, Types.SolverStatus.Inactive, totalBondedBefore + MINIMUM_BOND
- 1) and the second call's parameters each appear on their own or logically
wrapped lines, preserving the same values and order and keeping surrounding
vm.prank/registry.depositBond calls unchanged.


## Directory Structure

```
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Specify a language for the directory tree fence.
markdownlint flags this fence because it lacks a language identifier.

📝 Suggested change
-```
+```text
📝 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.

Suggested change
```
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 16-16: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In `@test/README.md` at line 16, Update the markdown code fence that currently
reads just ``` to include a language identifier (e.g., change the opening fence
to ```text) so the directory tree block has a specified language; locate the
plain code fence in README.md and replace the opening backticks with ```text to
satisfy markdownlint.

Comment on lines +33 to +36
│ ├── RequireAudit.t.sol # Every untested revert path (~43 tests)
│ ├── StateTransitions.t.sol # Comprehensive state verification (~10 tests)
│ ├── BoundaryTests.t.sol # 0/1/MAX boundary conditions (~27 tests)
│ └── ModifierTests.t.sol # Modifier allow/reject pairs (~17 tests)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update the Moloch test counts to match the new suite size.
The listed approximate counts look stale relative to the PR totals; aligning them avoids confusion.

📝 Suggested change
-│   ├── RequireAudit.t.sol         # Every untested revert path (~43 tests)
-│   ├── StateTransitions.t.sol     # Comprehensive state verification (~10 tests)
-│   ├── BoundaryTests.t.sol        # 0/1/MAX boundary conditions (~27 tests)
-│   └── ModifierTests.t.sol        # Modifier allow/reject pairs (~17 tests)
+│   ├── RequireAudit.t.sol         # Every untested revert path (~51 tests)
+│   ├── StateTransitions.t.sol     # Comprehensive state verification (~8 tests)
+│   ├── BoundaryTests.t.sol        # 0/1/MAX boundary conditions (~28 tests)
+│   └── ModifierTests.t.sol        # Modifier allow/reject pairs (~17 tests)
📝 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.

Suggested change
│ ├── RequireAudit.t.sol # Every untested revert path (~43 tests)
│ ├── StateTransitions.t.sol # Comprehensive state verification (~10 tests)
│ ├── BoundaryTests.t.sol # 0/1/MAX boundary conditions (~27 tests)
│ └── ModifierTests.t.sol # Modifier allow/reject pairs (~17 tests)
│ ├── RequireAudit.t.sol # Every untested revert path (~51 tests)
│ ├── StateTransitions.t.sol # Comprehensive state verification (~8 tests)
│ ├── BoundaryTests.t.sol # 0/1/MAX boundary conditions (~28 tests)
│ └── ModifierTests.t.sol # Modifier allow/reject pairs (~17 tests)
🤖 Prompt for AI Agents
In `@test/README.md` around lines 33 - 36, The test counts in test/README.md for
RequireAudit.t.sol, StateTransitions.t.sol, BoundaryTests.t.sol, and
ModifierTests.t.sol are outdated; update the approximate test numbers next to
those filenames to match the current PR totals (replace the stale counts ~43,
~10, ~27, ~17 with the actual counts from the test suite run) so the README
reflects the real suite size and avoids confusion.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant