Skip to content

Commit e7034a7

Browse files
committed
mitch/tmnt-168-create-test-network-scenariosyml
1 parent a658ea6 commit e7034a7

13 files changed

Lines changed: 383 additions & 3 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
cluster:
5+
description: The cluster to deploy to, e.g. aztec-gke-private or kind
6+
required: true
7+
type: string
8+
namespace:
9+
description: The namespace to deploy to
10+
required: true
11+
type: string
12+
ref:
13+
description: The ref to checkout
14+
required: true
15+
type: string
16+
17+
jobs:
18+
test_network_scenarios:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Test network scenarios
22+
run: |
23+
echo "Testing network scenarios"
24+
25+
- name: Check if directory exists
26+
id: check_dir
27+
shell: bash
28+
run: |
29+
if [ -d ".git" ]; then
30+
echo "exists=true" >> $GITHUB_OUTPUT
31+
else
32+
echo "exists=false" >> $GITHUB_OUTPUT
33+
fi
34+
35+
- name: Checkout code
36+
if: ${{ steps.check_dir.outputs.exists != 'true' }}
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
38+
with:
39+
ref: ${{ inputs.ref }}
40+
41+
- name: Build
42+
shell: bash
43+
run: |
44+
./bootstrap.sh

spartan/terraform/deploy-aztec-infra/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,4 @@ resource "google_compute_address" "rpc_ingress" {
188188
provider = google
189189
name = "${var.NAMESPACE}-${var.RELEASE_PREFIX}-rpc-ingress"
190190
address_type = "EXTERNAL"
191-
192-
193191
}

spartan/terraform/deploy-aztec-infra/values/rpc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ node:
1515
startCmd:
1616
- --node
1717
- --archiver
18+
- --pxe
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Epoch Cache
2+
3+
Stores the current validator set.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import config from '@aztec/foundation/eslint';
2+
3+
export default config;
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"name": "@aztec/network-tests",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"exports": {
6+
".": "./src/index.ts"
7+
},
8+
"typedocOptions": {
9+
"entryPoints": [
10+
"./src/index.ts"
11+
],
12+
"name": "Network Tests",
13+
"tsconfig": "./tsconfig.json"
14+
},
15+
"scripts": {
16+
"build": "yarn clean && tsc -b",
17+
"build:dev": "tsc -b --watch",
18+
"clean": "rm -rf ./dest .tsbuildinfo",
19+
"start:dev": "tsc-watch -p tsconfig.json --onSuccess 'yarn start'",
20+
"start": "node ./dest/index.js",
21+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
22+
},
23+
"inherits": [
24+
"../package.common.json"
25+
],
26+
"dependencies": {
27+
"@aztec/aztec.js": "2.0.0-nightly.20250821",
28+
"@aztec/ethereum": "2.0.0-nightly.20250821",
29+
"@viem/anvil": "^0.0.10",
30+
"dotenv": "^16.0.3",
31+
"get-port": "^7.1.0",
32+
"jest-mock-extended": "^4.0.0",
33+
"tslib": "^2.4.0",
34+
"viem": "2.23.7",
35+
"zod": "^3.23.8"
36+
},
37+
"devDependencies": {
38+
"@jest/globals": "^30.0.0",
39+
"@types/jest": "^30.0.0",
40+
"@types/node": "^22.15.17",
41+
"jest": "^30.0.0",
42+
"ts-node": "^10.9.1",
43+
"typescript": "^5.3.3"
44+
},
45+
"files": [
46+
"dest",
47+
"src",
48+
"!*.test.*"
49+
],
50+
"types": "./dest/index.d.ts",
51+
"jest": {
52+
"moduleNameMapper": {
53+
"^(\\.{1,2}/.*)\\.[cm]?js$": "$1"
54+
},
55+
"testRegex": "./src/.*\\.test\\.(js|mjs|ts)$",
56+
"rootDir": "./src",
57+
"transform": {
58+
"^.+\\.tsx?$": [
59+
"@swc/jest",
60+
{
61+
"jsc": {
62+
"parser": {
63+
"syntax": "typescript",
64+
"decorators": true
65+
},
66+
"transform": {
67+
"decoratorVersion": "2022-03"
68+
}
69+
}
70+
}
71+
]
72+
},
73+
"extensionsToTreatAsEsm": [
74+
".ts"
75+
],
76+
"reporters": [
77+
"default"
78+
],
79+
"testTimeout": 120000,
80+
"setupFiles": [
81+
"../../foundation/src/jest/setup.mjs"
82+
],
83+
"testEnvironment": "../../foundation/src/jest/env.mjs",
84+
"setupFilesAfterEnv": [
85+
"../../foundation/src/jest/setupAfterEnv.mjs"
86+
]
87+
},
88+
"engines": {
89+
"node": ">=20.10"
90+
}
91+
}

yarn-project/network-tests/src/hello.ts

Whitespace-only changes.

yarn-project/network-tests/src/index.ts

Whitespace-only changes.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { type PXE, createCompatibleClient } from '@aztec/aztec.js';
2+
import { RollupContract, getPublicClient } from '@aztec/ethereum';
3+
import { createLogger } from '@aztec/foundation/log';
4+
5+
import type { ChildProcess } from 'child_process';
6+
import { foundry } from 'viem/chains';
7+
8+
// import { isK8sConfig, setupEnvironment, startPortForward } from './utils.js';
9+
10+
// const config = setupEnvironment(process.env);
11+
12+
const debugLogger = createLogger('e2e:spartan-test:smoke');
13+
14+
describe('smoke test', () => {
15+
let pxe: PXE;
16+
const forwardProcesses: ChildProcess[] = [];
17+
beforeAll(async () => {
18+
pxe = await createCompatibleClient('http://localhost:8080', debugLogger);
19+
});
20+
21+
afterAll(() => {
22+
forwardProcesses.forEach(p => p.kill());
23+
});
24+
25+
it('should be able to get node enr', async () => {
26+
const info = await pxe.getNodeInfo();
27+
28+
debugLogger.info(`info: ${JSON.stringify(info)}`);
29+
expect(info).toBeDefined();
30+
// expect enr to be a string starting with 'enr:-'
31+
expect(info.enr).toMatch(/^enr:-/);
32+
});
33+
34+
// Leaving this test skipped commented out because it requires the ethereum node
35+
// to be running and forwarded, e.g.
36+
// kubectl port-forward -n smoke service/spartan-aztec-network-eth-execution 8545:8545
37+
// also because it assumes foundry.
38+
39+
it.skip('should be able to get rollup info', async () => {
40+
// docs:start:get_node_info_pub_client
41+
const info = await pxe.getNodeInfo();
42+
const publicClient = getPublicClient({
43+
l1RpcUrls: ['http://localhost:8545'],
44+
l1ChainId: foundry.id,
45+
});
46+
// docs:end:get_node_info_pub_client
47+
48+
const rollupContract = new RollupContract(publicClient, info.l1ContractAddresses.rollupAddress);
49+
50+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
51+
const [pendingBlockNum, pendingArchive, provenBlockNum, provenArchive, myArchive, provenEpochNumber] =
52+
await rollupContract.status(60n);
53+
// console.log('pendingBlockNum', pendingBlockNum.toString());
54+
// console.log('pendingArchive', pendingArchive.toString());
55+
// console.log('provenBlockNum', provenBlockNum.toString());
56+
// console.log('provenArchive', provenArchive.toString());
57+
// console.log('myArchive', myArchive.toString());
58+
// console.log('provenEpochNumber', provenEpochNumber.toString());
59+
});
60+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "..",
3+
"compilerOptions": {
4+
"outDir": "dest",
5+
"rootDir": "src",
6+
"tsBuildInfoFile": ".tsbuildinfo"
7+
},
8+
"include": ["src"],
9+
"references": []
10+
}

0 commit comments

Comments
 (0)