change modifier onlyVerified to onlyValidProof and unit tests #14
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.
PR Description
This PR introduces several key updates and improvements to enhance the security and functionality of our wallet system, with a particular focus on integrating zero-knowledge (ZK) proof verification. The changes span across the wallet contract, its related tests, and the World ID interface.
Changes
Wallet Contract (
src/Wallet.sol
)Changed
owner
andworldID
toimmutable
for improved efficiency.Introduced the
nullifierHashes
mapping to store used nullifier hashes.Replaced the
onlyVerified
modifier withonlyValidProof
to ensure that a valid ZK proof is provided.Modified the
transfer
function to accept a ZK proof as an additional parameter.Removed the
createWorldId
function since it was empty.Removed the
usdt
state variable and added USDT as a supported token in the constructor.Wallet Test (
test/Wallet.t.sol
)Renamed
worldID
tomockWorldID
for clarity.Updated the
setUp
function to usemockWorldID
.transfer
function.Wallet Factory Test (
test/WalletFactory.t.sol
)Changed
mockWorldID
to a hardcoded address.Updated the
test_CreateWallet
function to use the new hardcodedmockWorldID
address.Transfer Test (
test/Transfer.t.sol
)Removed the
MockWorldIDContract
and replaced it withMockWorldID
.transfer
function.Mock World ID (
test/mocks/MockWorldID.sol
)Implemented the
verifyProof
andgenerateZkProof
functions to simulate ZK proof verification and generation.World ID Interface (
src/IWorldID.sol
)Updated the interface to include the
verifyProof
function, ensuring compatibility with the new ZK proof verification process.Summary
This PR improves the wallet contract by:
Please review the changes and provide any feedback or suggestions for further improvement.