Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/sma 828 fuzz invariant tests (#67)
* chore: update .solhintignore to exclude contracts/mocks directory * lint fix * test: add test for AccountFactory deployment consistency * chore: Add test for ERC4337Account deposit balance consistency * invariant test for ERC4337Account ValidateUserOp invariant * add TestInvariant_ModuleManager to test module management functionality * test: add fuzz test for AccountFactory deployment * chore: Add fuzz tests for ERC4337Account and ModuleManager * Lint fix SmartAccountTestLab.t.sol for readability * chore: Refactor test setup for Foundry invariant testing * chore: Add InvariantModuleManagementHandler for module installation and uninstallation tests * chore: Update solhint npm dependency to version 5.0.0 * Update solhint npm dependency to version 5.0.0 * Add ExecutionInvariantTests contract for testing execution-related invariants * Add AccountInvariantTests contract for testing account creation invariants * chore: Add InvariantModuleManagementHandler for module installation and uninstallation tests * chore: Add InvariantExecutionHandler for testing execution-related invariants * chore: Add InvariantDepositManagementHandler for testing deposit-related invariants * feat: Add InvariantAccountCreationHandler for testing account creation invariants * Add BaseInvariantTest contract for foundational test setup * chore: Add TestInvariantNexus contract for testing invariant consistency * Add TestInvariantExecutor contract for testing invariant execution * Add TestInvariantExecutionHelper contract for testing authorized executor invariants * feat: Add TestInvariantBaseAccount contract for testing base account invariants * chore: Refactor TestInvariant_ModuleManager.t.sol for improved readability and consistency * feat: Refactor TestInvariant_ERC4337Account_ValidateUserOp for improved readability and consistency * chore: Add ActorManager contract for coordinating test actions across different actors * feat: Refactor TestInvariant_AccountFactory_Deployment.t.sol for improved readability and consistency * Refactor TestInvariant_ERC4337Account_DepositBalance.t.sol for improved readability and consistency * Import IExecutor and MockToken contracts for testing * 🔥 remove unused test files * 🔥 Remove unused test files * Refactor test files for improved readability and consistency * Add Tests + Invariants + Refactor test files for improved readability and consistency * BaseInvariantTest.t.sol for improved testing * ✅ add Handlers for Invariantstest files * ✅ Add ActorManager for invariant testing * chore: Update solhint dependency to version 5.0.1 * 🔥 remove unused tests * Refactor ActorManager test file * Refactor AccountCreationHandler test file * Add fuzz testing on TestFuzz_ValidateUserOp contract * feat: Add TestFuzz_ExecuteFromExecutor contract for fuzz testing * chore: Exclude VALIDATOR_MODULE in AccountValidateUserOpInvariantTests setup * refactor: Improve test file structure and naming conventions * refactor: Update TestAccountFactory_CreateAndGetCounterFactualAddress.t.sol * refactor: Add fuzz testing for ERC4337Account withdrawal and signature validation * refactor: Add execute fuzz testing with mocks * ✅ add fuzz testing on module manager + edge cases * ✅ add new Uninstall test cases * refactor: Improve isContract function in Helpers.sol and testFuzz_TokenTransfer in TestFuzz_Execute.t.sol * refactor: Fix formatting * 🖼️ fix lint + reorder * 📄 update Natspec security message * refactor: Fix module msg installation test case * chore: Update .solcover.js to skip "contracts/mocks" file in code coverage * chore: Add hardhat-foundry plugin for Nexus project * chore: Update post-checkout hook to include forge install command * chore: Update comment.js to include details in a collapsible section * chore: Update slither-action to v0.4.0 and node-version to 20 * Rename variable to remove shadowed var * 🔥 remove unused variables in Nexus.sol * chore: Add defender.config.json for contract inspector configuration * ⚙️Update slither-action to exclude additional checks in ci.yml * 🚀 gas optimization: Improve execution mode decoding in Nexus.sol * 🔥 Remove unused delegate functions in ExecutionHelper.sol * chore: Update BaseAccount.sol header comments * Update ModuleManager.sol slither fix * Add check for non-zero address slither fix * chore: Add error handling for zero implementation address * Add IValidator interface to K1Validator contract - slither fix * use assertTrue for balance check * lint fix * add tests validate user operation from entry point * add accesscontrol+unauthorized access tests * refactor: add InvalidSignature error to EventsAndErrors.sol * add tests cases + fix wrong asserts * chore: Update deployment account funding amount in test * Remove unnecessary code in TestERC4337Account_ValidateUserOp.t.sol * add test for validation of user operation nonce * Merge branch 'dev' of https://github.com/bcnmy/erc7579-modular-smart-account into dev * 🖼️ Refactor project architecture / and rename files * chore: Remove unused functions, improve comments and formatting in CheatCodes.sol * chore: Update account balance initialization with default method * chore: Update contract deployment and account labeling in Helpers.sol with default method * Renamed preparePackedUserOperation to buildPackedUserOperation for consistancy * Refactor project architecture and rename functions * Update function name from preparePackedUserOperation to buildPackedUserOperation for consistency * move functions to helpers * Refactor helpers and rename functions * chore: Refactor code and update function names for consistency * Refactor NexusTest contract and update function names for consistency * Refactor NexusTest contract and update function names for consistency * Refactor Imports.sol and update import statement for TestHelper.t.sol * Refactor SmartAccountTestLab contract and remove unused code * Refactor imports and update test contracts for consistency * Refactor NexusTest_Base contract and remove unused code * Refactor code and remove unused imports and functions * ✅ fix solc warning compiler * ✅ Refactor code add negative tests * chore: Refactor code and update function names for consistency * Refactor code and add prefunding for smart account in TestFuzz_ValidateUserOp.t.sol * Refactor code and remove inline comments * Refactor code and improve inline comments * Refactor code and improve inline comments add additional tests * Refactor code, add natspecs, and improve inline comments in InvariantBaseTest contract * Refactor AccountCreationHandlerTest contract, improve comments, and add validation for account creation * Refactor DepositManagementHandlerTest contract, improve comments, and update Solidity version to ^0.8.0 * feat: Add ExecutionHandlerTest contract for executing operations on Nexus account and add natspec * add natspecs * feat: Add test for AccountDepositBalanceInvariantTest * refactor: Improve comments and update Solidity version in AccountValidateUserOpInvariantTest * chore: Update BaseAccountInvariantTest with natspec comments and improve code readability * chore: Refactor ExecutorInvariantTest for improved code readability and maintainability * refactor: Improve comments and update natspec in ModuleManagerInvariantTest * refactor: Improve comments and update natspec in NexusInvariantTest * refactor: Update TestAccountExecution_Base contract with natspec comments and improve code readability * refactor: Update TestModuleManagement_Base contract with natspec comments and improve code readability * refactor: Improve comments and update natspec in TestAccountConfig_AccountId.t.sol * refactor: Improve comments and update natspec in TestAccountConfig_SupportsExecutionMode.t.sol * refactor: Improve comments and update natspec in TestAccountExecution_TryExecuteSingle.t.sol * refactor: Improve comments and update natspec * renamed file * refactor: Add missing events and update natspec * refactor: Update Solidity version to 0.8.24 in multiple files * refactor: improve and categorize events and errors * add check on onUninstall hook * fix test on invariants and fuzz * fix test on invariants and fuzz * fix invariant by adding check for installed module in onInstall function * refactor: Skip precompiles in testFuzz_WithdrawDepositTo function * fix warning and remove unused variables * remove empty file * add accountImplementationAddress test on ArbitrumSmartAccountUpgradeTest * refactor: Add getImplementation function to IBiconomySmartAccountV2 interface * refactor: Add UpgradeSmartAccountTest to test smart account implementation upgrade * refactor: Rename tests * refactor: Improve UpgradeSmartAccountTest with additional tests * refactor: Exclude FACTORY contract from BaseAccountInvariantTest * refactor: Exclude unnecessary contracts from AccountDepositBalanceInvariantTest setup * fix invariant by ensuring signer has enough ether before adding deposit * Renamed .t.sol test files + Exclude unnecessary contracts from NexusInvariantTest setup * refactor: Add givenTheAccountConfiguration modifier to TestAccountConfig_AccountId * add .tree to comply with BTT testing * Update Solidity version to >=0.8.0 <0.9.0 * Chore/remove unused funcs (#77) * refactor: Remove onlyValidatorModule modifier from ModuleManager.sol * refactor: Add test cases for unsupported call types in TestAccountExecution_ExecuteSingle * refactor: Update MockExecutor to support tryExecuteViaAccount and customExecuteViaAccount methods * feat: Add MockInvalidModule contract for testing purposes * refactor: Update MockExecutor to support tryExecuteViaAccount and customExecuteViaAccount methods * refactor: Update TestAccountExecution_ExecuteFromExecutor.tree with descriptive test cases * refactor: Update TestAccountExecution_ExecuteSingle.t.sol with more descriptive test cases * refactor: Update TestAccountExecution_ExecuteSingle.tree with descriptive test cases for unsupported call types * refactor: Add test case for installing a module as an invalid module type ID * refactor: Add test case for installing a module with an invalid module type ID * refactor: Update Imports.sol to import MockInvalidModule for testing purposes * refactor: Update EventsAndErrors.sol to add error messages for unsupported module and call types * Improve Natspecs in invariants *⚠️ fix compiler warning *⚠️ fix compilers / lint warnings * 🖼️ lint fix * chore: Update foundry-gas-diff workflow to continue on error * chore: Skip posting comment if Slither report is empty * chore: add warning comment on privatekey * chore: Update CI workflow to include ARBITRUM_RPC_URL environment variable * chore: Update ArbitrumSmartAccountUpgradeTest to use environment variable for RPC URL * chore: Update ArbitrumSettings with default Arbitrum RPC URL --------- Co-authored-by: livingrockrises <[email protected]>
- Loading branch information