Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Apr 30, 2024
1 parent f67478d commit 71a8e06
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ runs:
with:
node-version: 21

- name: Set up foundry
- name: Set up Foundry
uses: foundry-rs/foundry-toolchain@v1

# TODO(3074): Remove this when 3074 supported natively in Anvil.
- name: Set up Docker
uses: docker-practice/actions-setup-docker@master

- name: Install dependencies
shell: bash
run: bun install
Binary file modified bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"changeset:version": "changeset version && bun install --lockfile-only && bun scripts/updateVersion.ts",
"clean": "rimraf src/_esm src/_cjs src/_types",
"contracts:build": "forge build --config-path ./test/foundry.toml && bun run contracts:build:invoker && bun ./scripts/generateTypedArtifacts.ts",
"contracts:build:invoker": "cd test/invokers && ./bin/forge build",
"contracts:build:invoker": "cd test/invokers && docker run --rm -v $(pwd):/app/foundry -u $(id -u):$(id -g) ghcr.io/jxom/foundry-alphanet:latest --foundry-directory /app/foundry --foundry-command 'forge build'",
"docs:dev": "cd site && bun run dev",
"docs:build": "cd site && bun run build",
"docs:preview": "cd site && bun run preview",
Expand Down Expand Up @@ -51,7 +51,7 @@
"@ethereumjs/rlp": "^5.0.0",
"@size-limit/preset-big-lib": "^8.2.4",
"@types/fs-extra": "^9.0.13",
"@viem/anvil": "0.0.5",
"@viem/anvil": "0.0.10",
"@vitest/coverage-v8": "^1.0.4",
"@vitest/ui": "^1.0.4",
"bun-types": "^1.0.1",
Expand Down
2 changes: 2 additions & 0 deletions test/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export default async function () {
const shutdownMainnet = await anvilMainnet.start()
const shutdownOptimism = await anvilOptimism.start()
const shutdownZkSync = await anvilZkSync.start()

// TODO(3074): remove when 3074 supported natively in Anvil.
const shutdown3074 = await anvil3074.start()

// TODO(fault-proofs): remove when fault proofs deployed to mainnet.
Expand Down
34 changes: 30 additions & 4 deletions test/src/anvil.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { resolve } from 'node:path'
import { type CreateAnvilOptions, startProxy } from '@viem/anvil'
import {
mainnet,
Expand Down Expand Up @@ -72,12 +71,39 @@ export const anvilZkSync = defineAnvil({
})

export const anvil3074 = defineAnvil({
anvilBinary: resolve(import.meta.dirname, '../invokers/bin/anvil'),
execArgs(defaultArgs) {
const [_, args_, options] = defaultArgs

const args = [...args_]

const hostIndex = args.findIndex((arg) => arg === '--host')
if (hostIndex !== -1) args.splice(hostIndex, 2)

const portIndex = args.findIndex((arg) => arg === '--port')
const port = args[portIndex + 1]
if (portIndex !== -1) args.splice(portIndex, 2)

return [
'docker',
[
'run',
'-p',
`${port}:8545`,
'--rm',
'-v',
`${process.cwd()}:/app/foundry`,
'-u',
`${process.getuid()}:${process.getgid()}`,
'ghcr.io/jxom/foundry-alphanet:latest',
'--foundry-command',
`anvil ${args.join(' ')}`,
],
options,
]
},
chain: mainnet,
forkUrl: getEnv('VITE_ANVIL_FORK_URL', 'https://cloudflare-eth.com'),
forkBlockNumber: 16280770n,
// @ts-expect-error
hardfork: 'prague',
port: 9045,
})

Expand Down

0 comments on commit 71a8e06

Please sign in to comment.