Skip to content

Commit 8d2319d

Browse files
Merge pull request HyperSafeD#732 from EbukaMoses/Add_integration
contracts/*: Add integration/e2e coverage in CI (ABI / interface docs…
2 parents 8d77e6b + 332645c commit 8d2319d

105 files changed

Lines changed: 8087 additions & 2309 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/benchmarks.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ jobs:
3333
- name: Install Rust
3434
uses: dtolnay/rust-toolchain@stable
3535

36+
- name: Install System Dependencies
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y libdbus-1-dev pkg-config
40+
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH
41+
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
42+
3643
- name: Rust Cache
3744
uses: Swatinem/rust-cache@v2
3845

.github/workflows/ci.yml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143
echo 'module.exports = {};' > tooling/sanctifier-wasm/pkg/index.js
144144
145145
- name: Install frontend dependencies
146-
run: cd frontend && npm ci
146+
run: cd frontend && npm install
147147

148148
- name: Run unit tests
149149
run: cd frontend && npm test
@@ -223,7 +223,7 @@ jobs:
223223
echo 'module.exports = {};' > tooling/sanctifier-wasm/pkg/index.js
224224
225225
- name: Install frontend dependencies
226-
run: cd frontend && npm ci
226+
run: cd frontend && npm install
227227

228228
- name: Install Playwright browsers
229229
run: cd frontend && npx playwright install --with-deps chromium
@@ -263,14 +263,63 @@ jobs:
263263
echo 'module.exports = {};' > tooling/sanctifier-wasm/pkg/index.js
264264
265265
- name: Install frontend dependencies
266-
run: cd frontend && npm ci
266+
run: cd frontend && npm install
267267

268268
- name: Install Playwright browsers
269269
run: cd frontend && npx playwright install --with-deps chromium
270270

271271
- name: Run schema rendering e2e suite
272272
run: cd frontend && npm run test:e2e:schema
273273

274+
contract-docs:
275+
name: Contract ABI / Interface Docs
276+
runs-on: ubuntu-latest
277+
278+
steps:
279+
- name: Checkout repository
280+
uses: actions/checkout@v4
281+
282+
- name: Install stable Rust toolchain
283+
uses: dtolnay/rust-toolchain@stable
284+
285+
- name: Cache cargo registry & build artifacts
286+
uses: actions/cache@v4
287+
with:
288+
path: |
289+
~/.cargo/bin/
290+
~/.cargo/registry/index/
291+
~/.cargo/registry/cache/
292+
~/.cargo/git/db/
293+
target/
294+
key: ${{ runner.os }}-contract-docs-${{ hashFiles('**/Cargo.lock') }}
295+
restore-keys: |
296+
${{ runner.os }}-contract-docs-
297+
298+
- name: Generate contract docs and interface summary
299+
run: make contract-docs
300+
301+
- name: Verify interface summary is up-to-date
302+
run: |
303+
# Run extraction-only check (rustdoc already generated above)
304+
SKIP_RUSTDOC=1 bash scripts/gen-contract-docs.sh --check
305+
306+
- name: Run ABI surface stability tests (amm-pool)
307+
run: cargo test -p amm-pool --test integration_tests abi_ -- --nocapture
308+
309+
- name: Upload rustdoc artifact
310+
uses: actions/upload-artifact@v4
311+
with:
312+
name: contract-rustdoc
313+
path: target/doc/
314+
retention-days: 14
315+
316+
- name: Upload interface JSON artifact
317+
uses: actions/upload-artifact@v4
318+
with:
319+
name: contract-interfaces-json
320+
path: docs/generated/contract-interfaces.json
321+
retention-days: 14
322+
274323
commitlint:
275324
name: Lint Commit Messages
276325
runs-on: ubuntu-latest

.github/workflows/soroban-deploy.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ jobs:
6565
run: |
6666
sudo apt-get update
6767
sudo apt-get install -y libdbus-1-dev pkg-config
68+
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH
69+
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
6870
cargo install --locked soroban-cli || true
6971
soroban --version
7072
@@ -166,6 +168,10 @@ jobs:
166168

167169
- name: Install Soroban CLI
168170
run: |
171+
sudo apt-get update
172+
sudo apt-get install -y libdbus-1-dev pkg-config
173+
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH
174+
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
169175
cargo install --locked soroban-cli || true
170176
171177
- name: Run continuous validation checks

Cargo.lock

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ members = [
66
"contracts/vulnerable-contract",
77
"contracts/token-with-bugs",
88
"contracts/amm-pool",
9+
"contracts/governance",
10+
"contracts/multisig",
11+
"contracts/timelock",
912
"contracts/reentrancy-guard",
1013
"contracts/runtime-guard-wrapper",
1114
"contracts/kani-poc",
1215
"contracts/my-contract",
16+
"contracts/flashloan-token",
17+
"contracts/proxy",
18+
"contracts/vesting",
19+
"contracts/benchmark",
1320

1421
]
1522
resolver = "2"
@@ -20,6 +27,9 @@ soroban-sdk = { version = "21.7.6" }
2027
[workspace.package]
2128
rust-version = "1.78"
2229

30+
[workspace.lints.rust]
31+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] }
32+
2333
[profile.release]
2434
opt-level = "z"
2535
overflow-checks = true

DOCUMENTATION_INDEX.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@
8585

8686
## 🛠️ Component Documentation
8787

88+
### Contract ABI / Interface Reference
89+
**[docs/contract-interfaces.md](docs/contract-interfaces.md)** - Public ABI for all contracts in `contracts/*`
90+
- Function signatures and descriptions for every contract
91+
- Error code tables
92+
- Machine-readable JSON at `docs/generated/contract-interfaces.json`
93+
- Regenerate with `make contract-docs`; CI enforces freshness via `make contract-docs-check`
94+
8895
### Runtime Guard Wrapper Contract
8996

9097
**[contracts/runtime-guard-wrapper/README.md](contracts/runtime-guard-wrapper/README.md)**

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build test lint fmt audit release clean docs
1+
.PHONY: build test lint fmt audit release clean docs contract-docs contract-docs-check
22

33
## Build all workspace crates (debug).
44
build:
@@ -35,3 +35,11 @@ docs:
3535
## Remove all build artefacts.
3636
clean:
3737
cargo clean
38+
39+
## Generate ABI / interface docs for all contracts (rustdoc + JSON summary).
40+
contract-docs:
41+
bash scripts/gen-contract-docs.sh
42+
43+
## Verify contract-interfaces.json is up-to-date (used in CI).
44+
contract-docs-check:
45+
bash scripts/gen-contract-docs.sh --check

benchmarks/data_schemas_perf.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"generated_at_epoch_ms": 1777332857449,
3+
"metrics": [
4+
{
5+
"bytes": 6140,
6+
"max_pattern_len": 72,
7+
"parse_ms": 0.08494299981975928,
8+
"path": "data/vulnerability-db.json",
9+
"read_ms": 0.7110500000635511,
10+
"total_pattern_len": 628,
11+
"vulnerabilities": 12
12+
},
13+
{
14+
"bytes": 2591,
15+
"max_pattern_len": 91,
16+
"parse_ms": 0.042007000047306065,
17+
"path": "tooling/sanctifier-cli/data/vulnerability-db.json",
18+
"read_ms": 0.36192899960951763,
19+
"total_pattern_len": 209,
20+
"vulnerabilities": 5
21+
},
22+
{
23+
"bytes": 2380,
24+
"max_pattern_len": null,
25+
"parse_ms": 0.05150400011189049,
26+
"path": "schemas/vulnerability-db.json",
27+
"read_ms": 0.4795800000465533,
28+
"total_pattern_len": null,
29+
"vulnerabilities": null
30+
}
31+
]
32+
}

benchmarks/docs_nav_perf.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"file": "DOCUMENTATION_INDEX.md",
3-
"size_bytes": 11542,
4-
"total_links": 63,
5-
"internal_links": 57,
3+
"size_bytes": 14324,
4+
"total_links": 83,
5+
"internal_links": 77,
66
"dead_links_count": 0,
77
"dead_links": [],
88
"max_nesting_depth": 0

0 commit comments

Comments
 (0)