Skip to content

Commit

Permalink
Multisig tests + slight adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
joYyHack committed Aug 20, 2024
1 parent 726bf7e commit 5142f62
Show file tree
Hide file tree
Showing 4 changed files with 411 additions and 5 deletions.
17 changes: 16 additions & 1 deletion contracts/ZKMultisig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,17 @@ contract ZKMultisig is UUPSUpgradeable, IZKMultisig {
return
uint256(
PoseidonUnit1L.poseidon(
[uint256(keccak256(abi.encode(block.chainid, address(this), proposalId_)))]
[
uint256(
uint248(
uint256(
keccak256(
abi.encode(block.chainid, address(this), proposalId_)
)
)
)
)
]
)
);
}
Expand Down Expand Up @@ -265,6 +275,11 @@ contract ZKMultisig is UUPSUpgradeable, IZKMultisig {

function _updateParticipantVerifier(address participantVerifier_) internal {
require(participantVerifier_ != address(0), "ZKMultisig: Invalid verifier address");
require(
participantVerifier_ != participantVerifier,
"ZKMultisig: The same verifier address"
);
require(participantVerifier_.code.length > 0, "ZKMultisig: Not a contract");

participantVerifier = participantVerifier_;
}
Expand Down
6 changes: 4 additions & 2 deletions contracts/ZKMultisigFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ contract ZKMultisigFactory is EIP712, IZKMultisigFactory {
address participantVerifier_
) EIP712("ZKMultisigFactory", "1") {
require(
zkMultisigImplementation_ != address(0) && participantVerifier_ != address(0),
zkMultisigImplementation_ != address(0) &&
zkMultisigImplementation_.code.length > 0 &&
participantVerifier_ != address(0) &&
participantVerifier_.code.length > 0,
"ZKMultisigFactory: Invalid implementation or verifier address"
);

Expand All @@ -43,7 +46,6 @@ contract ZKMultisigFactory is EIP712, IZKMultisigFactory {
address zkMultisigAddress_ = address(
new ERC1967Proxy{salt: keccak256(abi.encode(msg.sender, salt_))}(ZK_MULTISIG_IMPL, "")
);

IZKMultisig(zkMultisigAddress_).initialize(
participants_,
quorumPercentage_,
Expand Down
4 changes: 2 additions & 2 deletions contracts/mock/VerifierMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ contract PositiveVerifierMock {
uint256[2] calldata,
uint256[2][2] calldata,
uint256[2] calldata,
uint256[24] calldata
uint256[3] calldata
) public pure returns (bool) {
return true;
}
Expand All @@ -17,7 +17,7 @@ contract NegativeVerifierMock {
uint256[2] calldata,
uint256[2][2] calldata,
uint256[2] calldata,
uint256[24] calldata
uint256[3] calldata
) public pure returns (bool) {
return false;
}
Expand Down
Loading

0 comments on commit 5142f62

Please sign in to comment.