Skip to content

test(contracts): add missing unit test coverage#26

Merged
iap merged 2 commits into
devfrom
feat/unit-test-coverage-gaps
May 7, 2026
Merged

test(contracts): add missing unit test coverage#26
iap merged 2 commits into
devfrom
feat/unit-test-coverage-gaps

Conversation

@iap
Copy link
Copy Markdown
Contributor

@iap iap commented May 7, 2026

Summary

Fills coverage gaps identified during code review across all four contract test suites.

Changes

AttestedSettlementVerifier (+5 tests)

  • Zero intentId / settlementModule / account / amount → returns false
  • Wrong isMint flag → returns false

MARKSettlementModule (+2 tests)

  • totalSettledMint/Burn accumulates correctly across multiple intents
  • setVerifier rejects EOA address (no code)

RYLA (+4 tests)

  • supportsInterface returns correct values for ERC165 and IAccessControl
  • setMinter/setBurner revert on zero address
  • burn reverts on zero amount

MARKBridgeAdapter (+1 test)

  • setBridgeLimits resets epoch and accumulator mid-epoch

Scope

  • contracts

Verification

  • forge test — 71/71 pass (was 59)

Risk

None — test-only changes.

Summary by CodeRabbit

  • Tests
    • Added RYLA token tests for interface support, zero-address checks for minter/burner, and burn(0) rejection.
    • Added bridge test verifying daily-cap reset clears epoch accumulator mid-epoch and allows new-cap bridging.
    • Extended settlement verifier tests with invalid-parameter cases (zero intentId/module/account/amount and wrong isMint flag).
    • Added settlement module tests for cumulative settled totals and verifier rejection of invalid verifier accounts.

AttestedSettlementVerifier:
- zero intentId, settlementModule, account, amount return false
- wrong isMint flag returns false

MARKSettlementModule:
- totalSettledMint/Burn accumulates across multiple intents
- setVerifier rejects EOA address

RYLA:
- supportsInterface returns correct values
- setMinter/setBurner revert on zero address
- burn reverts on zero amount

MARKBridgeAdapter:
- setBridgeLimits resets epoch and accumulator mid-epoch

71 tests pass (was 59).
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6217f636-0bd6-4951-9e16-481a0d7a3f61

📥 Commits

Reviewing files that changed from the base of the PR and between 5c96d17 and d4870b9.

📒 Files selected for processing (1)
  • contracts/test/unit/RYLA.t.sol

Walkthrough

This pull request adds unit tests across RYLA token, MARK bridge adapter, AttestedSettlementVerifier, and MARKSettlementModule, covering interface checks, zero-value revert cases, epoch accumulator reset behavior, negative settlement verification cases, and settlement totals across intents.

Changes

Test Coverage Expansion for Core Contracts

Layer / File(s) Summary
RYLA Token Tests
contracts/test/unit/RYLA.t.sol
Adds testSupportsInterface to validate ERC165 and IAccessControl support, testSetMinterRevertsForZeroAddress and testSetBurnerRevertsForZeroAddress to verify role rejection of zero address, and testBurnRevertsForZeroAmount to validate burn amount validation.
Bridge Adapter Tests
contracts/test/unit/bridge/MARKBridgeAdapter.t.sol
Introduces testSetBridgeLimitsResetsEpochAccumulatorMidEpoch to confirm that setBridgeLimits clears bridgedInDailyCapEpoch and dailyCapEpoch state when invoked mid-epoch, allowing fresh accumulation from a reset state.
Settlement Verifier Tests
contracts/test/unit/settlement/AttestedSettlementVerifier.t.sol
Adds five negative test cases: testVerifySettlementReturnsFalseForZeroIntentId, testVerifySettlementReturnsFalseForZeroSettlementModule, testVerifySettlementReturnsFalseForZeroAccount, testVerifySettlementReturnsFalseForZeroAmount, and testVerifySettlementReturnsFalseForWrongIsMintFlag to validate rejection of invalid or mismatched inputs.
Settlement Module Tests
contracts/test/unit/settlement/MARKSettlementModule.t.sol
Adds testTotalSettledAccumulatesAcrossMultipleIntents to validate cumulative totalSettledMint and totalSettledBurn across distinct intent IDs, and testSetVerifierRejectsEOAAddress to confirm setVerifier reverts with SettlementErrors.VerifierRequired for non-contract addresses.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through tests before sunrise light,

checking interfaces, zeros, and epoch nights.
Bridges cleared and settlements told,
totals summed and verifiers bold,
a rabbit cheers for coverage tight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding missing unit test coverage to the contracts test suites.
Description check ✅ Passed The description covers all major required sections with clear details about changes, scope, and verification results; the template's checklist items are addressed substantively.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/unit-test-coverage-gaps

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

Copy link
Copy Markdown

@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

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

Inline comments:
In `@contracts/test/unit/RYLA.t.sol`:
- Around line 89-99: The tests testSetMinterRevertsForZeroAddress and
testSetBurnerRevertsForZeroAddress currently use a bare vm.expectRevert();
update them to assert the specific RYLA custom error selectors instead: use
vm.expectRevert(RYLA.ZeroAddress.selector) (and likewise pin
vm.expectRevert(RYLA.InvalidAmount.selector) for the burn zero-amount test if
present) so the suite verifies the exact ZeroAddress() (and InvalidAmount() for
burn) error is thrown by token.setMinter, token.setBurner (and token.burn)
rather than allowing any revert.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b09e53ae-a5d2-4e2d-9ba7-683ab0534cc5

📥 Commits

Reviewing files that changed from the base of the PR and between 280faa8 and 5c96d17.

📒 Files selected for processing (4)
  • contracts/test/unit/RYLA.t.sol
  • contracts/test/unit/bridge/MARKBridgeAdapter.t.sol
  • contracts/test/unit/settlement/AttestedSettlementVerifier.t.sol
  • contracts/test/unit/settlement/MARKSettlementModule.t.sol

Comment thread contracts/test/unit/RYLA.t.sol
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