Feat: Add Multisig Payment Channel Support#14
Merged
Conversation
…unctions for native/ERC20 payment channels
Contributor
There was a problem hiding this comment.
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.solwithcreateChannel,redeemChannel, andreclaimChannelfunctions. - Adds end-to-end tests in
test/multisigfor channel creation, redemption, and reclamation. - Updates Solidity pragmas to
^0.8.28and bumps the Foundry compiler to0.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:
lastNounceshould belastNonceto 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
sprefix (testsMultisig...) and won't be discovered by Forge; rename totestMultisigCannotRedeemWithIncorrectAmountHigher.
function testsMultisigCannotRedeemWithIncorrectAmountHigher() public {
test/multisig/ReclaimChannel.t.sol:78
- [nitpick] In
_assertChannelStateWhenFailedReclaim, the parameterpayeeBalanceBeforeactually refers to the payer's balance; consider renaming topayerBalanceBeforefor clarity.
uint256 payeeBalanceBefore,
src/Multisig_2of2.sol:92
- Solidity's
requireonly accepts a string error message. To use a custom error, replace thisrequirewith anifcheck andrevert ReclaimAfterMustBeAfterExpiration(...).
);
test/VerifyHashchain.t.sol:36
- Adding the
viewmodifier to a test function can prevent state modifications Forge expects; removeviewso 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"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Features
Multisig_2of2.solwith support for native and ERC20 payment channels.createChannel,redeemChannel, andreclaimChannel.Tests
createChannel,redeemChannel, andreclaimChannellogic.Chores
^0.8.28.foundry.tomlwith new solc version (0.8.30) and formatting fixes.