Skip to content

Commit

Permalink
Add ci/cd testing guide
Browse files Browse the repository at this point in the history
  • Loading branch information
plusminushalf committed Feb 10, 2025
1 parent 203a22b commit 04f73f7
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
86 changes: 86 additions & 0 deletions docs/pages/infra/bundler/testing.mdx
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.
4 changes: 4 additions & 0 deletions vocs.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export const bundlerSidebar = [
text: "How to use the bundler",
link: "/infra/bundler/usage",
},
{
text: "How to use Alto in CI/CD testing",
link: "/infra/bundler/testing",
},
{
text: "Self host guide",
link: "/infra/bundler/self-host",
Expand Down

0 comments on commit 04f73f7

Please sign in to comment.