You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+28-10Lines changed: 28 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ We really appreciate and value contributions to OpenZeppelin Contracts for Compa
26
26
[Running Tests](#running-tests)
27
27
28
28
*[Unit Tests](#unit-tests)
29
+
*[Integration Tests](#integration-tests)
29
30
*[Live Tests](#live-tests)
30
31
31
32
[Styleguides](#styleguides)
@@ -169,6 +170,14 @@ Unit tests run against an in-process mock backend (no network, ZK proving skippe
169
170
yarn test
170
171
```
171
172
173
+
### Integration Tests
174
+
175
+
Composed-contract specs (`contracts/test/integration/specs`): several modules assembled into one contract under `test/integration/_mocks`, then deployed and driven as a unit. Same mock backend as the unit tests.
176
+
177
+
```bash
178
+
yarn test:integration
179
+
```
180
+
172
181
### Live Tests
173
182
174
183
Live tests run against a local Midnight network (node, indexer, and proof server) defined in [`local-env.yml`](./local-env.yml). They require [Docker](https://docs.docker.com/get-docker/) and a completed `yarn install`.
@@ -179,29 +188,37 @@ One command runs everything — it compiles, resets the stack, runs a quick harn
179
188
yarn test:live
180
189
```
181
190
182
-
Currently `multisig` is the only live-ready category; the others still assume dry-only semantics and are skipped (listed in the run banner). Each category joins the run — with its own `test:live:<category>` script — as its specs are refactored for the live backend.
191
+
Currently `multisig` is the only live-ready category. The others still assume dry-only semantics and are skipped, and the run banner lists them. Each joins the run as its specs are refactored for the live backend, with its own `test:live:<category>` script.
192
+
193
+
`integration` is a target of its own, not a category, so an unscoped run skips it. Ask for it by name. Only one live target runs per invocation, since both live projects draw wallets from the same genesis-funded pool.
yarn test:live --list # the live targets, as the CI matrix reads them
198
+
```
199
+
200
+
> **Note:** the `integration` live target is the harness capability plus a boundary check, not functional coverage. As of ledger v8 the composed contract does not deploy: its circuits' IR overruns the per-tx block byte budget, and the spec asserts that rejection rather than skipping. A ledger bump can move the budget, so a red spec there means the deploy now fits and the functional specs are worth porting to live.
183
201
184
202
If any files fail, a second round re-runs just those files on a fresh node with one worker, to separate a real failure from an environment flake:
Scope the same mechanism to one category, or to a subset within it. The first
190
-
argument names the category; any further argument is a filename substring
191
-
(vitest matches it), so pass a spec name to run every file whose name matches it
192
-
on the live backend — the fast loop while iterating on one feature, instead of
193
-
waiting for the whole category. The match is a substring, not an exact file, so
194
-
a name that prefixes others runs all of them:
207
+
Scope the same mechanism to one target, or a subset within it. The first argument
208
+
names the target (a category, or `integration`). Any further argument is a
209
+
filename substring vitest matches, which is the fast loop while iterating on one
210
+
feature. Being a substring, a name that prefixes others runs all of them:
195
211
196
212
```bash
197
213
yarn test:live multisig # the whole category
198
214
yarn test:live multisig ShieldedTreasury # any file matching "ShieldedTreasury"
215
+
yarn test:live integration ConfidentialFungibleToken # one integration spec
199
216
```
200
217
201
218
The two-round flake check still applies to a scoped run, so a green result
202
219
means the same thing it does for the full suite.
203
220
204
-
Stop the network when done: `yarn env:down`. (No manual `env:up`is needed — the runner resets the stack itself.)
221
+
The runner owns the stack: it starts it (`make env-up`, itself a reset) and stops it on every exit path, Ctrl-C included. No manual `env:up`or `env:down`needed. To inspect a run afterwards, set `MIDNIGHT_LIVE_KEEP_ENV=1` and stop it yourself. Container logs land in `logs/` either way.
205
222
206
223
> **Note:** The live tests all run against one shared node, so state left by an earlier run can make a later one fail. Two rules keep them reliable, both enforced by a guard that fails fast, before any wallet build:
|`MIDNIGHT_LIVE_MAX_SCAN_BLOCKS`| 3600 | Above this indexer head, the guard asks you to `env:up` rather than scan. |
236
+
|`MIDNIGHT_LIVE_KEEP_ENV`| unset |`1` leaves the stack running after the run instead of tearing it down. |
219
237
220
-
`unit-live` runs up to 3 workers in parallel, so their output interleaves. It is tagged per worker: a `▶ live worker N/3 ready` banner when a worker's wallets are funded, a `[wN] ❯ <file>` line as each spec file starts, and a `[wN] ✓ <test> (<ms>) [done/total]` line per test — showing the worker, the result, and overall progress through the run. Each worker also writes a detailed log to `logs/live-harness-wN.log`.
238
+
`integration-live` runs one worker (only the deployer wallet is in play). `unit-live` runs up to 3 workers in parallel, so their output interleaves. It is tagged per worker: a `▶ live worker N/3 ready` banner when a worker's wallets are funded, a `[wN] ❯ <file>` line as each spec file starts, and a `[wN] ✓ <test> (<ms>) [done/total]` line per test — showing the worker, the result, and overall progress through the run. Each worker also writes a detailed log to `logs/live-harness-wN.log`.
221
239
222
240
> **Tip:** to save the run to a colored, readable log, force color and pipe to `tee`. Piping (stdout is no longer a TTY) makes vitest print one clean line per result instead of an animated spinner, and `FORCE_COLOR=1` keeps the color. Write it to a `.ansi` file:
0 commit comments