Skip to content

Commit

Permalink
Release/1.0.0 beta (#96)
Browse files Browse the repository at this point in the history
* update factory, add more factories and foundry test cases

* module manager tests

* refactor meta factory

* test + ignore ModeLib + comment unused methods

* added tests for account access + smart account.nonce

* refactor + natspecs + logs

* added test for K1Validator.validateUserOp

* testing isValidSignature

* 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]>

* update factories + refactor + working foundry tests + update hardhat tests with K1 factory

* refactor

* resolve conflicts with helper contract

* refactor: update imports in TestHelper.t.sol, remove unused and reorder

* refactor: update Stakeable contract with natspecs

* refactor: update IStakeable interface with natspecs

* refactor: rename to test_DeployAccount_CreateAccount function + natspecs

* refactor: update TestAccountFactory_Deployments contract with natspecs

* typo fix + update Bootstrap functions to comply with styleguide

* refactor: Update natspecs and refactor names

* refactor: Update K1ValidatorFactory to use correct function name for getting init nexus calldata

* refactor: Update ArbitrumSmartAccountUpgradeTest.t.sol to use updated BOOTSTRAPPER.getInitNexusScopedCalldata function

* refactor: Update func names, remove unused and reorder

* refactor: Update BootstrapUtil.sol to comply with styleguide

* lint fix

* refactor: Update Stakeable contract with constructor parameter name change

* lint fix

* refactor: Update K1ValidatorFactory to use correct function name for getting init nexus calldata

* fix typo FactoryNotWhotelisted to FactoryNotWhitelisted in

* gas optimization, remove memory var + named returns

* refactor: Update DEFAULT_ARBITRUM_RPC_URL in ArbitrumSettings contract

* Update Stakeable Natspec

* refactor: Update IStakeable.sol with improved natspec and consistency

* refactor: Add unit tests for module support in TestModuleManager_SupportsModule.t.sol

* chore: Update Solidity version to 0.8.24

* refactor: Remove unnecessary imports in TestModuleManager_UninstallModule.t.sol

* Add test_RevertIf_UninstallNonInstalledFallbackHandler test + support calltypes

* Add Fallback testcases

* remove unrreachable condition on uninstall for unsupported module type error

* refactor: Improve module support unit tests in TestModuleManager_SupportsModule.t.sol

* chore: Update Solidity version to 0.8.24

* Add new test cases + coverage

* fix bug where additional iszero check make the success to not returns properly

* Update Solidity version to 0.8.24 + remove unused imports

* refactor: Remove unused imports in TestHelper.t.sol

* Add withdrawDepositTo tests

* test: Add test for addDeposit function with wrong entry point

* fix tests + Add test for TryExecuteBatch_RevertIf_HandleFailure_WithPrank function

* test: Add batch execution tests with failure scenarios

* test: Add test for unauthorized access during smart account upgrade

* refactor: Remove unused test function in K1Validator.sol

* fix fallback handler onuninstall

* Update Solidity version to 0.8.24

* remove unused imports

* Add new functions for testing purpose + Remove unused imports and update Solidity version to 0.8.24

* remove compiler warnings

* Remove compiler warnings

* remove compiler warnings

* [tmp] Refactor invariant tests

* fix whitelist factory test

* refactor + act on PR

* chore: Remove unused _mint function call in NFT.sol

* chore: Update BUNDLER_ADDRESS to be payable in TestHelper contract

* chore: Add MockPaymaster import in Imports.sol

* chore: Add ERC20 and Uniswap interfaces

* chore: Add TestNexusERC721Integration contract for testing Nexus smart account functionalities with ERC721 token transfers

* chore: Refactor code for testing Nexus smart account functionalities with uniswap swap tx

* chore: Refactor code for testing Nexus smart account functionalities with uniswap swap tx

* chore: Add MockPaymaster contract for testing Nexus smart account functionalities

* chore: Update MockPaymaster instantiation in integration tests

* chore: Refactor TestFuzz_ERC4337Account contract to use ENTRYPOINT.handleOps for withdrawUserOps

* chore: Add BaseSettings contract for setting up constants required for Base fork tests

* chore: Refactor Invariant tests

* remove invariants temp

* handle additional context length in fallback handler check, which revert

* chore: Update gas report command to include test_Gas match and fixed fuzz seed

* feat: Add gas benchmark tests

* lint fix

* Rename NFT.sol -> MockNFT.sol

* lint fixes

* refactor and fix conflicts

* chore: Update BASE_RPC_URL in CI configuration

* coverage: Add unsupported exec type revert tests

* chore: Add script to generate coverage report

* chore: Update lcov command in generate_coverage_report.sh

* chore: Update generate_coverage_report.sh to use forge coverage command with lcov report

* chore: Update coverage report script to use new generate_coverage_report.sh script

* chore: Update changed-files action to latest version

* chore: Update actions/checkout to v4.1.6 in ci.yml

* chore: Update actions/checkout to v4.1.6

* chore: Remove unused `test()` functions

* chore: Update generate_coverage_report.sh to use forge coverage command with lcov report

* clean+attempt to fix

* dev notes

* chore: Update skipFiles in .solcover.js to exclude more directories

* chore: Update generate_coverage_report.sh to create necessary directories if they do not exist

* chore: Update file path for Foundry Coverage Report in ci.yml

* compiler warning: Update test_SupportsModule functions to be view functions

* fix compiler warnings

* warning fix

* chore: Update ci.yml to enable verbose mode and fail CI on error

* chore: Update ci.yml to enable verbose mode and fail CI on error

* chore: Update ci.yml to enable verbose mode and fail CI on error

* chore: Update generate_coverage_report.sh to check if coverage file is created and list generated files

* update the tests

* revert solc warning

* lint fixes

* chore: Refactor TestAccountExecution_ExecuteFromExecutor.t.sol

* chore: Remove hardhat-foundry import from hardhat.config.ts

* chore: Update ci.yml to enable verbose mode and fail CI on error

* chore: Update codecov-action configuration to use the correct file path for coverage report

* chore: Update ci.yml to exclude additional Slither checks

* chore: Update ci.yml to include coverage/foundry directory for Codecov upload

* chore: Update comment.js to handle empty Slither reports

* chore: Refactor comment.js to handle empty Slither reports more efficiently

* Refactor comment.js to handle empty Slither reports more efficiently

* lint fix + Refactor comment.js to handle empty Slither reports more efficiently

* chore: Update ci.yml to only trigger on pull requests

* Refactor comment.js to handle empty Slither reports more efficiently

* Refactor comment.js to handle empty Slither reports more efficiently

* fix comment.js

* Refactor comment.js to handle empty Slither reports more efficiently

* Refactor comment.js to handle empty Slither reports more efficiently

* Refactor comment.js to handle empty Slither reports more efficiently

* Refactor comment.js to handle empty Slither reports more efficiently

* revert changes

* refactor wording in 1271

* handle upgrade case for getImplementation

* chore: Refactor contracts names

* refactor: Update MockPaymaster to extend VerifyingPaymaster

* feat: Add NexusTest_Base import to ArbitrumSettings

* refactor: Remove unused function getArbitrumRpcUrl

* refactor: Update BaseSettings to include NexusTest_Base import and getBaseRpcUrl function

* lint fix

* refactor: Update BaseSettings to include NexusTest_Base import and getBaseRpcUrl function

* refactor: Update BaseSettings to include NexusTest_Base import and getBaseRpcUrl function

* refactor: Update MockPaymaster to extend VerifyingPaymaster

* refactor: Adjust preVerificationGas in buildPackedUserOp function

* remove duplicate test

* refactor: Add MockPaymaster import to TestHelper.t.sol

* refactor: Add checkPaymasterBalance modifier to NexusTest_Base

* refactor paymaster tests, fix issues

* refactor: Generate Gas Report script

* refactor: Add generate-and-push-gas-report script

* refactor: Add gas consumption test for swapping ETH for USDC with deployed Nexus account and Paymaster

* refactor: Remove unused Husky hooks

* refactor: Add gas consumption test for swapping WETH for USDC with deployed Nexus account and Paymaster

* refactor: Remove unused Husky hooks

* refactor: Update prepare script in package.json

* refactor: Add gas consumption test for transferring ERC20 tokens from an already deployed Nexus smart account using a paymaster

* refactor: Remove unused Husky hooks

* refactor: Update pre-push Husky hook to include lint-fix and generate-and-push-gas-report scripts

* refactor: Add gas consumption test for transferring ERC20 tokens from an already deployed Nexus smart account using a paymaster

* refactor: Add gas consumption test for transferring ERC721 tokens from an already deployed Nexus smart account using a paymaster

* refactor: Add gas consumption test for transferring ETH from an already deployed Nexus smart account using a paymaster

* refactor: Add gas consumption test for transferring ERC721 tokens from an already deployed Nexus smart account using a paymaster

* refactor: Update pre-push Husky hook to include lint:fix and generate-and-push-gas-report scripts

* refactor: Add gas consumption test for transferring ETH from an already deployed Nexus smart account using a paymaster

* refactor: Update gas consumption test for transferring ERC20 tokens from an already deployed Nexus smart account using a paymaster

* Update gas report

* fix lint

* Update gas report

* refactor: Update fallback function tests to use successFunction instead of staticFunction and singleFunction

* refactor: Update MockHandler contract to remove unused functions and improve code readability

* Update gas report

* refactor: Remove gasIntensiveFunction from MockHandler contract

* Update gas report

* Update gas report

* Update gas report

* Update gas report

* merge and fix

* slot reads + ready for review

* chore: Fix indentation

* 🔒 Improve security on fallback handler installation process

* factory and module manager basic tests

* Update gas report file name to uppercase + run prettier

* feat: Update gas report file name to uppercase

* refactor

* chore: Update CI workflow to trigger only on pull requests

* chore: Refactor TestNexusSwapWETH_Integration.t.sol

* refactor: Add K1Validator to Imports.sol

* chore: Add EntryPointCannotBeZero error to EventsAndErrors.sol

* add k1 validator tests

* lint fix

* remove branch coverage option (not working properly)

* lint fix (indent)

* coverage: Add ERC-6492 signature validation tests (need check)

* Use K1Validator module instead of MockValidator

* feat: Add test for Nexus contract constructor with zero entry point address

* update gas report

* rename to Nexus

* stakeable contract tests + utils

* fix typos in MetaFactory and change path for Stakeable

* check and update two slots

* improved testing, implemented more factory tests

* skip files

* added missing import

* refactor: Add TestStakeable contract for unit testing Stakeable contract

* chore: Add Unauthorized error to EventsAndErrors.sol

* respond to PR comments

* lint and rename

* refactor: Update BaseAccount.sol natspec

* fix lint

* chore: Improve fallback handler comments

* Feat/improve gas report (#90)

* chore: numbered tests for gas report

* Update gas report

* chore: Update gas report script and add gas report comparison

* chore: Update gas report script and improve gas report generation

* chore: Update gas report script paths for gas report generation and comparison

* chore: Update gas report script paths and improve gas report generation

* chore: Improve gas report workflow

* chore: Add error handling for missing previous gas report

* chore: Update gas report workflow and script paths

* chore: Update gas report workflow and script paths

* chore: Update gas report workflow and script paths

* chore: Update gas report workflow and script paths

* chore: Update gas report workflow and script paths

* chore: Update gas report workflow and script paths

* negative test cases

* refactor: Update gas report script paths and improve generation

* Feat/fix gas ci (#91)

* chore: Update gas report script paths and improve gas report generation

* chore: Update gas report script paths and improve gas report generation

* chore: Update gas report script paths and improve gas report generation

* feat: Update gas report script paths and improve generation

* refactor: Update gas report script paths and improve generation

* negative test + refactor

* Feat/refactor factory and tests (#92)

* feat: Add AbstractNexusFactory contract

This commit adds the `AbstractNexusFactory` contract, which provides common functionality for Nexus factories. It enables the creation and management of Modular Smart Accounts. The contract includes a constructor to set the smart account implementation address and the factory owner. It also includes functions to create a new Nexus with initialization data and compute the expected address of a Nexus contract using the factory's deterministic deployment algorithm.

* Refactor the Nexus contract to improve code readability and maintainability. Also, fix the revert message from "EntryPointCannotBeZero" to "EntryPointCanNotBeZero" for consistency.

* feat: Whitelist factory address in BiconomyMetaFactory

This commit adds functionality to whitelist factory addresses in the BiconomyMetaFactory contract. It ensures that only whitelisted factories can be used for deployment. Additionally, it includes error handling for invalid factory addresses and zero owner addresses in the constructor.

* feat: Improve K1ValidatorFactory contract

This commit improves the K1ValidatorFactory contract by making the following changes:
- Renaming the contract to "K1ValidatorFactory for Nexus Account" for clarity.
- Removing the dependency on the BootstrapUtil library and updating the import statement accordingly.
- Adding error handling for zero addresses in the constructor.
- Refactoring the createAccount function to compute the actual salt for deterministic deployment.
- Using the BootstrapLib library to create the validator configuration.
- Initializing the account only if it was not already deployed.
- Updating the computeAccountAddress function to compute the actual salt for deterministic deployment.
- Predicting the deterministic address using the LibClone library.

These changes enhance the readability, maintainability, and functionality of the K1ValidatorFactory contract.

* feat: Improve K1ValidatorFactory contract

* feat: Refactor NexusAccountFactory contract for improved readability and maintainability

This commit refactors the NexusAccountFactory contract to enhance its readability and maintainability. The following changes were made:
- Renamed the contract to "Nexus Account Factory" for clarity.
- Removed unnecessary comments and unused imports.
- Inherited from the AbstractNexusFactory contract to leverage common functionality.
- Updated the constructor to set the smart account implementation address and owner using the AbstractNexusFactory constructor.
- Updated the createAccount function to compute the actual salt for deterministic deployment.
- Removed the unused computeAccountAddress function.
- Improved code formatting and documentation.

These changes improve the overall quality and maintainability of the NexusAccountFactory contract.

* feat: Fix typo in INexus contract error message

* feat: Add IAbstractNexusFactory interface

This commit adds the `IAbstractNexusFactory` interface, which defines the essential structure for Nexus factories. It includes functions to create a new Nexus with initialization data and compute the expected address of a Nexus contract using the factory's deterministic deployment algorithm. The interface also includes events and error handling for the creation of Smart Accounts.

* feat: Add BootstrapLib library for creating and managing BootstrapConfig structures

This commit adds the `BootstrapLib` library, which provides utility functions for creating and managing `BootstrapConfig` structures. The library includes functions to create a single `BootstrapConfig` structure, an array with a single `BootstrapConfig` structure, and an array of `BootstrapConfig` structures. These functions allow for easy configuration of modules and their initialization data. The library enhances the readability and maintainability of the code by providing a standardized way to create and manage `BootstrapConfig` structures.

* feat: Refactor NexusAccountFactory contract for improved readability and maintainability

* refactor: Update NexusAccountUpgradeTest contract to use BootstrapLib for creating BootstrapConfig structures

This commit updates the NexusAccountUpgradeTest contract to utilize the newly added BootstrapLib library for creating and managing BootstrapConfig structures. By using the library's utility functions, the code becomes more readable and maintainable. This change enhances the overall quality of the contract and improves the developer experience.

* lint fix

* refactor: Remove unused code in UpgradeSmartAccountTest.t.sol

* refactor: Rename variable in TestStakeable contract for clarity

This commit renames the variable `stakeable` to `_stakeable` in the TestStakeable contract. The new name provides better clarity and improves the readability of the code.

* feat: Add TestBiconomyMetaFactory_Deployments contract for managing factory whitelist and deploying accounts

This commit adds the TestBiconomyMetaFactory_Deployments contract, which is responsible for managing the factory whitelist and deploying accounts using the BiconomyMetaFactory. The contract includes functions to add and remove factories from the whitelist, deploy accounts using whitelisted factories, and validate factory addresses. Additionally, it tests various scenarios related to factory whitelisting and account deployment. This new contract enhances the functionality and flexibility of the system.

* feat: Add TestK1ValidatorFactory_Deployments contract for deploying accounts using the K1ValidatorFactory

This commit adds the TestK1ValidatorFactory_Deployments contract, which is responsible for deploying accounts using the K1ValidatorFactory. The contract includes functions to set up the testing environment, test the constructor's functionality, and validate the deployment of accounts. This new contract enhances the testing capabilities and ensures the correct deployment of accounts using the K1ValidatorFactory.

* feat: Add TestK1ValidatorFactory_Deployments contract for deploying accounts using the K1ValidatorFactory

* feat: Add TestK1ValidatorFactory_Deployments contract for deploying accounts using the K1ValidatorFactory

* rename lib

* refactor: add error message in EventsAndErrors.sol + new imports

* fix fuzz test for account factory

* feat: Add input validation for random function selector in fuzz test

* refactor: Rename BootstrapUtil to BootstrapLib for clarity

* add libraries and fixed tests

* feat: Add Nexus contracts for Modular Smart Account compliance

This commit adds the Nexus contracts for Modular Smart Account compliance. These contracts are developed by Biconomy and are compliant with ERC-7579 and ERC-4337. The Nexus contracts provide a suite of contracts for creating modular smart accounts. They include the AbstractNexusFactory, ModuleWhitelistFactory, and NexusAccountFactory contracts. These contracts enhance the functionality and flexibility of the system. Learn more at https://biconomy.io.

* refactor: Add error message in EventsAndErrors.sol

* refactor: Organize imports in Imports.sol

* refactor: Backup current gas report before generating a new one

* refactor:   current gas report before generating a new one

* refactor: Backup current gas report before generating a new one

* refactor: Update gas report generation process and file names

* Feat/missing coverage (#93)

* refactor: Add unit tests for TestAccountExecution_ExecuteUserOp contract

* refactor: Update gas report generation process and file names

* refactor: Improve executeUserOp function in Nexus.sol

* refactor: Remove  errors in INexus.sol

* refactor: moved Nexus Errors / Events to INexusEventsAndErrors.sol

* remove compiler warnings

* refactor and improve style of tests and namings

* refactor: Improve executeUserOp function and comments in Nexus.sol

* refactor: Remove original lcov.info and coverage.json files

* refactor: Add codecov configuration file

* Remove gas logging + fix pr comment

* refactor: Improve test coverage and naming conventions

* refactor: Update codecov configuration to ignore scripts and test directories

* Chore/clean repo update comments (#94)

* remove todo

* Add natspec + inline comments + description

* feat: Refactor test tree descriptions for improved readability and clarity

* fix natspecs+ Refactor NexusAccountFactory constructor parameter names

* update report

* feat: Refactor codecov.yml

* feat: Fix uninitialized variable in Nexus.sol

* feat: Refactor NexusAccountFactory contract for improved readability and maintainability

* Refactor NexusAccountFactory contract for improved readability and maintainability

* Feat/solidity 0.8.26 (#81)

* chore: Update solc version to 0.8.26

* chore: Update solc version to 0.8.26

* chore: Update solc version to 0.8.26

* chore: Update solc version to 0.8.26

* refactor: Change external functions to internal in TestNexusERC721Integration contract

* refactor: Change function visibility from external to internal in TestHelper contract

* chore: Update npm dependencies to latest versions

* chore: Update solidity version to 0.8.26 with viaIR optimization

* chore: Update solidity version to 0.8.26 with viaIR optimization

* lint fix

* refactor: Update coverage script to use --ir-minimum flag

* refactor: Update coverage script to use --ir-minimum flag

* refactor: Update coverage script to use --ir-minimum flag

* chore: Update CI workflow to include git pull before committing gas report changes

* chore: Update CI workflow to include git pull before committing gas report changes

* refactor: Update coverage script to remove --ir-minimum flag

* chore: Update CI workflow to work on pr only

* feat: Update ModuleWhitelistFactory to use isModuleWhitelisted instead of isWhitelisted

The commit updates the ModuleWhitelistFactory contract to use the isModuleWhitelisted function instead of the deprecated isWhitelisted function. This change ensures that all modules are properly whitelisted before execution.

* push new gas report

* feat: Update solidity version to 0.8.26 in AbstractNexusFactory.sol

* Update solidity version to 0.8.26 in AbstractNexusFactory.sol

* feat: Update solidity version to 0.8.26 in BootstrapLib.sol

* feat: Add error messages for new events in EventsAndErrors.sol

* feat: Update TestBiconomyMetaFactory_Deployments contract to handle revert message change

* refactor: Update NexusAccountFactory contract for improved readability and maintainability

* refactor: Restrict fallback handler manipulation in ModuleManager.sol

The commit restricts the manipulation of the fallback handler in the ModuleManager contract to ensure the account's security and integrity. It prevents unauthorized uninstallation and reinstallation of the validator module, which could compromise the account's security. Additionally, it checks for the presence of an existing fallback handler to avoid overwriting it and causing unexpected behavior.

* feat: Add error handling for invalid EntryPoint address

The commit adds error handling for an invalid EntryPoint address in the Stakeable contract. This ensures that only valid addresses can be used when adding, unlocking, or withdrawing stakes.

* refactor: Update AbstractNexusFactory constructor to use require instead of revert

The commit updates the constructor of the AbstractNexusFactory contract to use the require statement instead of revert. This change improves code readability and follows best practices for error handling.

* refactor: Update BiconomyMetaFactory constructor to use require instead of revert

The commit updates the constructor of the BiconomyMetaFactory contract to use the require statement instead of revert. This change improves code readability and follows best practices for error handling.

* refactor: Use require instead of revert in ModuleWhitelistFactory constructor and addModuleToWhitelist function

The commit updates the constructor of the ModuleWhitelistFactory contract to use the require statement instead of revert. This change improves code readability and follows best practices for error handling.

It also updates the addModuleToWhitelist function to use require instead of revert. This ensures that the module address being added to the whitelist is not a zero address.

Refactor the ModuleWhitelistFactory contract to improve code readability and maintainability.

* refactor: Update Stakeable contract error handling for invalid EntryPoint address

* remove natspec

* refactor: Add InnerCallFailed error to INexusEventsAndErrors.sol

The commit adds the InnerCallFailed error to the INexusEventsAndErrors.sol interface. This error is thrown when an inner call fails. This addition enhances the error handling capabilities of the interface.

Refactor the INexusEventsAndErrors.sol interface to include the InnerCallFailed error.

* refactor: Use require instead of revert in K1ValidatorFactory constructor

The commit updates the constructor of the K1ValidatorFactory contract to use the require statement instead of revert. This change improves code readability and follows best practices for error handling.

* Update  GAS_REPORT.md and gas_report.json

* lint fix

* lint fix

* refactor: Update Stakeable contract error handling for invalid EntryPoint address

* update versions nexus to 1.0.0-beta

* lint fix

* fix conflicts

* remove Husky hooks and gas report generation + lint fix + clean + badge update

---------

Co-authored-by: livingrockrises <[email protected]>
Co-authored-by: GabiDev <[email protected]>
  • Loading branch information
3 people authored Jun 4, 2024
1 parent 877c6bf commit ab9616b
Show file tree
Hide file tree
Showing 234 changed files with 20,632 additions and 2,335 deletions.
607 changes: 607 additions & 0 deletions .github/gas_report.json

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions .github/scripts/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ module.exports = async ({ github, context, header, body }) => {
## :robot: Slither Analysis Report :mag_right:
${uniqueSlitherHeader}
<details>
${header}
${processedBody}
</details>
_This comment was automatically generated by the GitHub Actions workflow._
`;

// Check if the workflow is triggered by a pull request event
if (!context.payload.pull_request) {
console.log(
Expand All @@ -57,15 +56,17 @@ _This comment was automatically generated by the GitHub Actions workflow._
});

// Delete all Slither comments before posting a new one
for (const comment of comments.filter(comment => comment.user.type === "Bot" && comment.body.includes(uniqueSlitherHeader))) {
for (const comment of comments.filter(
(comment) =>
comment.user.type === "Bot" && comment.body.includes(uniqueSlitherHeader),
)) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
});
}


// After deleting, post a new comment
const response = await github.rest.issues.createComment({
owner: context.repo.owner,
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/automation_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
check-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.1.6

- name: Check package.json
uses: tj-actions/changed-files@v42.0.4
uses: tj-actions/changed-files@v44.5.1
id: package-json
with:
files: |
package.json
- name: Check CHANGELOG.md
uses: tj-actions/changed-files@v42.0.4
uses: tj-actions/changed-files@v44.5.1
id: changelog
with:
files: |
Expand Down
75 changes: 56 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ name: Unified CI Workflow

on: pull_request

permissions:
contents: read
pull-requests: write
permissions: write-all

jobs:
setup:
setup:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-keys.outputs.cache-key }}
outputs:
cache-key: ${{ steps.cache-keys.outputs.cache-key }}
steps:
- name: Checkout
uses: actions/[email protected].1
uses: actions/[email protected].6

- name: Get cache key
id: cache-keys
Expand All @@ -35,14 +36,22 @@ jobs:
needs: setup
steps:
- name: Checkout
uses: actions/[email protected].1
uses: actions/[email protected].6

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1.1.1
uses: foundry-rs/foundry-toolchain@v1.2.0
with:
version: nightly
cache: true

- name: Cache node modules
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ needs.setup.outputs.cache-key }}
cache: true

- name: Cache node modules
uses: actions/cache@v4
with:
Expand All @@ -57,9 +66,10 @@ jobs:
name: Unit tests
runs-on: ubuntu-latest
needs: setup
needs: setup
steps:
- name: Checkout
uses: actions/[email protected].1
uses: actions/[email protected].6

- name: Cache node modules
uses: actions/cache@v4
Expand All @@ -68,10 +78,11 @@ jobs:
**/node_modules
key: ${{ needs.setup.outputs.cache-key }}
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1.1.1
uses: foundry-rs/foundry-toolchain@v1.2.0
with:
version: nightly
cache: true
cache: true

- name: Install foundry dependencies
run: forge install
Expand All @@ -81,12 +92,15 @@ jobs:

- name: Run Forge and Hardhat Tests
run: yarn test
env:
ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}

coverage:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected].1
- uses: actions/[email protected].6

- name: Cache node modules
uses: actions/cache@v4
Expand All @@ -99,27 +113,36 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y lcov

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1.1.1
uses: foundry-rs/foundry-toolchain@v1.2.0
with:
version: nightly
cache: true

- name: Generate Hardhat & Foundry Coverage Report
run: yarn coverage:report
env:
ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}

- name: Upload Foundry Coverage Report to Codecov
uses: codecov/codecov-action@v4.0.1
uses: codecov/codecov-action@v4.4.1
with:
file: ./coverage/foundry/lcov.info
directory: coverage/foundry
file: coverage/foundry/forge-pruned-lcov.info
flags: foundry
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Upload Hardhat Coverage Report to Codecov
uses: codecov/codecov-action@v4.0.1
uses: codecov/codecov-action@v4.4.1
with:
file: ./coverage/lcov.info
directory: coverage
file: lcov.info
flags: hardhat
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -130,21 +153,35 @@ jobs:
uses: actions/checkout@v4

- name: Run Slither
uses: crytic/slither-action@v0.3.1
uses: crytic/slither-action@v0.4.0
id: slither
with:
slither-version: "0.10.0"
node-version: "18"
node-version: "20"
fail-on: "none"
slither-args: '--exclude assembly --exclude solc-version --filter-paths "contracts/mock|node_modules" --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/contracts/'
slither-args: '--exclude "assembly|solc-version|low-level-calls|naming-convention|controlled-delegatecall|write-after-write|divide-before-multiply|incorrect-shift" --exclude-informational --exclude-low --filter-paths "contracts/mock|node_modules" --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/contracts/'

- name: Check if Slither report is empty
id: check_report
run: |
if [ -z "${{ steps.slither.outputs.stdout }}" ]; then
echo "report_empty=true" >> $GITHUB_ENV
else
echo "report_empty=false" >> $GITHUB_ENV
fi
- name: Create/update checklist as PR comment
uses: actions/github-script@v7
if: env.report_empty == 'false'
uses: actions/[email protected]
env:
REPORT: ${{ steps.slither.outputs.stdout }}
with:
script: |
const script = require('.github/scripts/comment')
const header = '# Slither report'
const body = process.env.REPORT
const body = process.env.REPORT.trim()
if (!body) {
console.log("Slither report is empty. No comment will be posted.");
return;
}
await script({ github, context, header, body })
60 changes: 60 additions & 0 deletions .github/workflows/foundry-gas-diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Report gas diff

on:
push:
branches:
- main
- dev
pull_request:
# Optionally configure to run only for changes in specific files. For example:
# paths:
# - src/**
# - test/**
# - foundry.toml
# - remappings.txt
# - .github/workflows/foundry-gas-diff.yml

jobs:
compare_gas_reports:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/[email protected]
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/[email protected]
with:
version: nightly
- name: Install dependencies
run: yarn install --frozen-lockfile

# Add any step generating a gas report to a temporary file named gasreport.ansi. For example:
- name: Run tests
run: forge test --gas-report --match-test test_Gas > gasreport.ansi # <- this file name should be unique in your repository!
env:
# make fuzzing semi-deterministic to avoid noisy gas cost estimation
# due to non-deterministic fuzzing (but still use pseudo-random fuzzing seeds)
FOUNDRY_FUZZ_SEED: 42
ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
continue-on-error: true

- name: Compare gas reports
uses: Rubilmax/[email protected]
with:
summaryQuantile: 0.95 # only display the 5% most significant gas diffs in the summary (defaults to 20%)
sortCriteria: avg,max # sort diff rows by criteria
sortOrders: desc,asc # and directions
ignore: test-foundry/**/* # filter out gas reports from specific paths (test/ is included by default)
id: gas_diff
continue-on-error: true

- name: Add gas diff to sticky comment
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
uses: marocchino/[email protected]
with:
# delete the comment in case changes no longer impact gas costs
delete: ${{ !steps.gas_diff.outputs.markdown }}
message: ${{ steps.gas_diff.outputs.markdown }}
16 changes: 0 additions & 16 deletions .husky/_/post-checkout

This file was deleted.

16 changes: 0 additions & 16 deletions .husky/_/pre-commit

This file was deleted.

12 changes: 0 additions & 12 deletions .husky/_/pre-push

This file was deleted.

27 changes: 27 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
*.env
*.secret
hardhat.config.ts
scripts
test/hardhat
artifacts
cache
out
coverage
.env
.secret
.sol*
.eslint*
walletUtils.*
coverage.json
arguments.js
audits
cache_forge
deployments
typings/
typechain
typechain-types
.husky/pre-commit
.prettierignore
.prettierrc
.github/
deployments/localhost
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"files": "*.sol",
"options": {
"printWidth": 120,
"printWidth": 150,
"tabWidth": 4,
"proseWrap": "always",
"useTabs": false,
Expand Down
10 changes: 9 additions & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
module.exports = {
skipFiles: ["test", "lib/ModuleTypeLib"],
skipFiles: [
"test",
"/lib",
"/utils",
"/mocks",
"contracts/mocks",
"lib/ModuleTypeLib",
"contracts/mocks",
],
};
Loading

0 comments on commit ab9616b

Please sign in to comment.