Skip to content

Feat: Add Multisig Payment Channel Support#14

Merged
pali101 merged 10 commits intomainfrom
feature/2-of-2-multisig-option
Jul 5, 2025
Merged

Feat: Add Multisig Payment Channel Support#14
pali101 merged 10 commits intomainfrom
feature/2-of-2-multisig-option

Conversation

@pali101
Copy link
Collaborator

@pali101 pali101 commented Jul 5, 2025

Features

  • Implemented Multisig_2of2.sol with support for native and ERC20 payment channels.
  • Added core functions: createChannel, redeemChannel, and reclaimChannel.

Tests

  • Added base test helpers to streamline multisig test setup.
  • Comprehensive test coverage for createChannel, redeemChannel, and reclaimChannel logic.

Chores

  • Updated Solidity version across contracts and scripts to ^0.8.28.
  • Updated foundry.toml with new solc version (0.8.30) and formatting fixes.

@pali101 pali101 requested a review from Copilot July 5, 2025 13:13
@pali101 pali101 self-assigned this Jul 5, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces 2-of-2 multisig payment channel support, including native and ERC20 channels, along with comprehensive tests and tooling updates.

  • Implements Multisig_2of2.sol with createChannel, redeemChannel, and reclaimChannel functions.
  • Adds end-to-end tests in test/multisig for channel creation, redemption, and reclamation.
  • Updates Solidity pragmas to ^0.8.28 and bumps the Foundry compiler to 0.8.30.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Multisig_2of2.sol Core multisig payment channel contract implementation
foundry.toml Bumped solc version to 0.8.30
test/multisig/CreateChannel.t.sol Tests for createChannel behavior
test/multisig/RedeemChannel.t.sol Tests for redeemChannel scenarios
test/multisig/ReclaimChannel.t.sol Tests for reclaimChannel logic
test/VerifyHashchain.t.sol Pragma change and test modifier update
Comments suppressed due to low confidence (6)

src/Multisig_2of2.sol:24

  • [nitpick] Typo in identifier: lastNounce should be lastNonce to match common terminology and improve readability.
        uint256 lastNounce; // Last used nonce to prevent replay attacks and ensure order

test/multisig/RedeemChannel.t.sol:109

  • Test function name has an extra s prefix (testsMultisig...) and won't be discovered by Forge; rename to testMultisigCannotRedeemWithIncorrectAmountHigher.
    function testsMultisigCannotRedeemWithIncorrectAmountHigher() public {

test/multisig/ReclaimChannel.t.sol:78

  • [nitpick] In _assertChannelStateWhenFailedReclaim, the parameter payeeBalanceBefore actually refers to the payer's balance; consider renaming to payerBalanceBefore for clarity.
        uint256 payeeBalanceBefore,

src/Multisig_2of2.sol:92

  • Solidity's require only accepts a string error message. To use a custom error, replace this require with an if check and revert ReclaimAfterMustBeAfterExpiration(...).
        );

test/VerifyHashchain.t.sol:36

  • Adding the view modifier to a test function can prevent state modifications Forge expects; remove view so the test is executed normally.
    function testInvalidHashchainWrongDepth() public view {

foundry.toml:5

  • Configuration parsing typically expects a space around the = (i.e., solc = "0.8.30"). Without spaces, Foundry may fail to read this setting.
solc="0.8.30"

@pali101 pali101 merged commit 3bace17 into main Jul 5, 2025
2 checks passed
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