How eth-infinitism/bundler works
Main Components
• Bundler Service: The core service is implemented in the "packages/bundler" directory. It includes configuration files, server setup (BundlerServer.ts), method handlers for different RPC calls (e.g., MethodHandlerERC4337.ts, MethodHandlerRIP7560.ts), and several modules (BundleManager, DepositManager, ExecutionManager, etc.). This component is the heart of the application.
• SDK Package: Found under "packages/sdk", this package provides APIs (like ERC4337EthersProvider, ERC4337EthersSigner, etc.) to interact with the bundler and to create/send UserOperations.
• Utilities: The "packages/utils" delivers internal methods, helper utilities, and shared contracts that support bundler operations.
• Validation Manager: The "packages/validation-manager" package includes components for checking the correctness of user operations and managing the state (with references to parsing, rule enforcement, and even custom tracing via Geth).
• Smart Contracts: There are contracts under various packages (for instance, "packages/bundler/contracts"). These contracts are essential for wallet deployment and the underlying account abstraction.
• Test Infrastructure and Scripts: The repository includes an extensive suite of tests for different modules and scripts for deployment and operation (found in “packages/bundler/test”, “packages/sdk/test”, and the “scripts” folder).
Interactions and Relationships
• Deployment Context: Represent Docker containers and orchestration. For instance, illustrate separate Docker containers for:
• Bundler service
• Geth node for production/development support (as provided via docker run command)
• Test environments (dockers/test)
• Contract Interactions: Indicate a connection between the Bundler and deployed smart contracts (used for wallet creation and deployments), which are deployed using Hardhat scripts (shown in “packages/bundler/deploy” and the hardhat config files).
Architectural Patterns and Design Principles
• External Integration: Emphasize how the bundler integrates with third-party networks and services via both Docker-based deployment and an HTTP RPC interface.
• Continuous Integration/Deployment: Include a component for CI/CD that is hinted by the GitHub workflows (".github/workflows/build.yml").
Relevant Technologies and Frameworks
• Hardhat: Since “hardhat.config.ts” files appear in multiple packages, note the usage of Hardhat for deployments and testing.
• Docker Containers: Highlight Docker’s role for bundler, test environments, and dependency (Geth).
• TypeScript: Emphasize that the codebase is written in TypeScript (e.g., tsconfig files throughout the repository).
Summing Up
• The main internal components of the bundler and its modular sub-components
• The relationship of the bundler to Ethereum network components (via Geth)
• The supporting SDK and utility packages that interact with the bundler
• The CI/CD and Dockerized deployment strategy, highlighting both production and test configurations