-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
203a22b
commit 04f73f7
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# How to use Alto in CI/CD testing | ||
|
||
To effectively integrate Alto, a performant and type-safe ERC-4337 bundler developed by Pimlico, into your CI/CD testing pipeline, we recommend utilizing Prool, a library that provides programmatic HTTP testing instances for Ethereum.rool facilitates the creation of isolated Ethereum environments, enabling efficient testing of smart contracts and related components. | ||
**Installation Steps:** | ||
|
||
:::::steps | ||
|
||
### Install Anvil | ||
You can find detailed instructions in the [Anvil documentation](https://book.getfoundry.sh/getting-started/installation). | ||
|
||
Quickstart: | ||
```bash | ||
curl -L https://foundry.paradigm.xyz | bash | ||
``` | ||
|
||
Source the bashrc file: | ||
::::code-group | ||
```bash [bashrc] | ||
source $HOME/.bashrc | ||
``` | ||
```bash [zshrc] | ||
source $HOME/.zshrc | ||
``` | ||
:::: | ||
|
||
Install Foundry: | ||
```bash | ||
foundryup | ||
``` | ||
|
||
### Install Prool and Alto: | ||
Use npm to install the Prool and Alto packages: | ||
|
||
```bash | ||
npm install @pimlico/alto prool | ||
``` | ||
|
||
|
||
### Set Up Prool with Anvil: | ||
|
||
Prool offers pre-configured instances, including Anvil, which can be used to simulate a local Ethereum execution environment. By using the `fork` option, you can avoid deploying an entry point manually. If you opt for a bare-bones Anvil server, deploying the entry point yourself will be necessary. | ||
|
||
```ts | ||
import { createServer } from 'prool'; | ||
import { anvil } from 'prool/instances'; | ||
|
||
const anvilPort = 8545; | ||
|
||
const server = createServer({ | ||
instance: anvil({ | ||
port: anvilPort, // The port to run the Anvil server on | ||
forkUrl: 'https://mainnet.base.org', | ||
forkBlockNumber: 26008827, // This can be any block number | ||
}), | ||
}); | ||
|
||
await server.start(); | ||
``` | ||
### Integrate Alto with Prool: | ||
|
||
Prool also provides an instance for Alto, enabling seamless integration into your testing environment. | ||
```ts | ||
import { createServer } from 'prool'; | ||
import { anvil, alto } from 'prool/instances'; | ||
import { entryPoint06Address, entryPoint07Address } from "viem/account-abstraction" | ||
|
||
const anvilRpc = `http://localhost:${anvilPort}` | ||
const anvilPrivateKey = | ||
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" // Choose any private key | ||
const altoPort = 4337 | ||
|
||
const altoServer = createServer({ | ||
instance: (key) => | ||
alto({ | ||
port: altoPort, // The port to run the Alto server on | ||
entrypoints: [entryPoint06Address, entryPoint07Address], | ||
rpcUrl: anvilRpc, | ||
executorPrivateKeys: [anvilPrivateKey], | ||
}), | ||
}); | ||
|
||
await altoServer.start(); | ||
``` | ||
|
||
::::: | ||
By following these steps, you can effectively incorporate Alto into your CI/CD testing pipeline using Prool, ensuring a robust and efficient testing environment for your Ethereum applications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters