Skip to content

feat(contracts): governance benchmarks, insurance pool deploy profile, spec/ABI coverage - #580

Merged
Levi-Ojukwu merged 1 commit into
Invoice-Liquidity-Network:mainfrom
brightpixel-dev:fix/issues-522-523-524-525
Jul 26, 2026
Merged

feat(contracts): governance benchmarks, insurance pool deploy profile, spec/ABI coverage#580
Levi-Ojukwu merged 1 commit into
Invoice-Liquidity-Network:mainfrom
brightpixel-dev:fix/issues-522-523-524-525

Conversation

@brightpixel-dev

Copy link
Copy Markdown
Contributor

Closes #522
Closes #523
Closes #524
Closes #525

What changed

#522 — Governance contract benchmark baselines

  • Added contracts/iln_governance/src/tests_benchmarks.rs with execution-cost benchmarks for create_proposal, cast_vote, and delegate_votes, mirroring the existing invoice_liquidity/tests_benchmarks.rs pattern.
  • Added contracts/iln_governance/benchmarks/baseline.json with measured baselines.
  • Generalized scripts/check_benchmark_regression.sh to check a list of <contract-dir>:<baseline-file> pairs (now invoice_liquidity + iln_governance by default) instead of being hardcoded to one contract.
  • Updated docs/benchmarks.md and CONTRIBUTING.md accordingly.

#523 — Docker Compose profile for local insurance pool testing

  • scripts/deploy-local.sh was silently missing insurance_pool from its contract list — added it, so ./scripts/deploy-local.sh now deploys all 5 contracts as intended ("local dev needs all contracts available").
  • Added scripts/deploy-insurance-pool.sh to deploy/initialize just the insurance pool.
  • Added an opt-in insurance Docker Compose profile (insurance-pool-deploy service) to docker-compose.yml and docker-compose.test.yml — run with docker compose --profile insurance up insurance-pool-deploy. It's profile-gated (not part of the default docker compose up) since it installs the Stellar CLI via cargo install on first run, which can take several minutes.
  • Added INSURANCE_POOL_CONTRACT_ID env var wiring to the indexer/notifications services, and documented all of the above in docs/local-development.md.

#524 — Contract spec JSON for insurance pool

  • scripts/gen-spec.ts now also emits an insurance_pool spec, added under a new contracts key in docs/contract-spec.json.
  • The existing top-level fields (which describe InvoiceLiquidityContract) are left untouched for backward compatibility with scripts/generate-sdk.ts, which reads them directly — verified via npx tsx --test scripts/generate-sdk.test.ts (5/5 passing).

#525 — ABI generation for insurance pool

  • scripts/gen-abi.ts now loops over both contracts instead of being hardcoded to invoice_liquidity.
  • While generalizing it, fixed two bugs that were producing an unusable docs/contract-abi.md (only 3 functions and 0 errors were ever captured for invoice_liquidity): the return-type regex broke on multi-word types like Result<(), ContractError>, and the errors regex only looked in lib.rs, but ContractError is defined in errors.rs. Both contracts now render their full function/error lists correctly.

Why

How to test

  • cd contracts/iln_governance && cargo test benchmark -- --nocapture — 4/4 passing, BENCHMARK lines match benchmarks/baseline.json.
  • cargo build -p iln_governance -p insurance_pool and cargo clippy --all-targets -p iln_governance — clean.
  • docker compose config --quiet and docker compose -f docker-compose.test.yml config --quiet — both validate; docker compose config --services (no profile) confirms insurance-pool-deploy is excluded by default, and --profile insurance config --services confirms it's included when opted in.
  • npx tsx scripts/gen-spec.ts / npx tsx scripts/gen-abi.ts — regenerate docs/contract-spec.json / docs/contract-abi.md idempotently (diff is empty on a second run).
  • npx tsx --test scripts/generate-sdk.test.ts — 5/5 passing, confirming docs/contract-spec.json's top-level shape is unchanged.

…, spec/ABI coverage

Closes Invoice-Liquidity-Network#522
Closes Invoice-Liquidity-Network#523
Closes Invoice-Liquidity-Network#524
Closes Invoice-Liquidity-Network#525

- Add execution-cost benchmarks for iln_governance (create_proposal,
  cast_vote, delegate_votes) with a baseline.json, mirroring the existing
  invoice_liquidity pattern. Generalize scripts/check_benchmark_regression.sh
  to check multiple contracts (invoice_liquidity + iln_governance) (Invoice-Liquidity-Network#522).
- Add insurance_pool to scripts/deploy-local.sh's contract list (it was
  silently missing), add scripts/deploy-insurance-pool.sh, and wire an
  opt-in "insurance" Docker Compose profile (insurance-pool-deploy service)
  into docker-compose.yml and docker-compose.test.yml for local/e2e testing
  without slowing down the default `docker compose up` (Invoice-Liquidity-Network#523).
- Extend scripts/gen-spec.ts to also emit an insurance_pool spec under a new
  `contracts` key in docs/contract-spec.json, without touching the existing
  invoice_liquidity top-level fields (keeps scripts/generate-sdk.ts working
  unchanged) (Invoice-Liquidity-Network#524).
- Generalize scripts/gen-abi.ts to loop over both contracts. Along the way,
  fixed two bugs that were producing an unusable docs/contract-abi.md: the
  return-type regex broke on multi-word types like `Result<(), ContractError>`,
  and ContractError wasn't found because it lives in errors.rs, not lib.rs (Invoice-Liquidity-Network#525).
@brightpixel-dev
brightpixel-dev force-pushed the fix/issues-522-523-524-525 branch from f9a4aca to 3c0afa4 Compare July 26, 2026 22:58
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@brightpixel-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Levi-Ojukwu
Levi-Ojukwu merged commit c68abb3 into Invoice-Liquidity-Network:main Jul 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants