Skip to content

Update example-bboard for the current Midnight compatibility matrix#1358

Open
jmaciaal wants to merge 5 commits intomidnightntwrk:mainfrom
jmaciaal:chore/update-midnight-compat
Open

Update example-bboard for the current Midnight compatibility matrix#1358
jmaciaal wants to merge 5 commits intomidnightntwrk:mainfrom
jmaciaal:chore/update-midnight-compat

Conversation

@jmaciaal
Copy link
Copy Markdown

Summary

This PR updates example-bboard to the current Midnight compatibility matrix and fixes the CLI flow so the example can be built and exercised successfully on Preprod.

Changes

  • upgraded the repo to the current supported Midnight package set
  • migrated CLI/runtime usage from ledger-v7 to ledger-v8
  • updated proof server images to 8.0.3
  • added Node 24.11.1 guidance and .nvmrc
  • fixed the compiled contract wrapper to point at the generated managed assets
  • updated API private-state handling to work with the current provider model
  • adapted CLI wallet startup, DUST registration, and fee balancing to current SDK behavior
  • fixed CLI behavior so contract assertion failures return to the main menu instead of terminating the process
  • refreshed README setup and Preprod deployment instructions

Why

The repository was still pinned to an older Midnight stack and no longer matched the current support matrix. In practice this caused compatibility drift across dependencies, proof server setup, private state handling, and the CLI transaction flow.

Validation

  • npm install
  • cd contract && npm run compact && npm run build && npm run test
  • cd api && npm run typecheck && npm run build
  • cd bboard-cli && npm run typecheck && npm run build

Manual Preprod validation:

  • built the contract and CLI
  • created/joined wallets on Preprod
  • generated DUST
  • deployed a bulletin board contract
  • posted a message
  • took the message down
  • posted again after sequence increment
  • joined the deployed board from another seed
  • verified expected contract assertion behavior for invalid actions

@jmaciaal jmaciaal requested review from a team as code owners March 27, 2026 06:48
@nstanford5 nstanford5 mentioned this pull request Mar 28, 2026
Copy link
Copy Markdown
Contributor

@JAlbertCode JAlbertCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following changes are required before it can be merged. The ui is dependent on the same packages and libraries, so those files need to be updated too.


.github/workflows/ci.yaml

Two updates needed to align CI with the package changes in this PR:

compact-version: '0.30.0'   # was 0.29.0 — must match compact-runtime 0.15.0 / compact-js 2.5.0
node-version: "24"           # was 22 — required by the engines field added to package.json

bboard-cli/tsconfig.json

"moduleResolution": "Bundler"   // is currently set to "node"

bboard-ui/tsconfig.json

"moduleResolution": "Bundler"   // is currently set to "Node"

bboard-ui/vite.config.ts

Three references to @midnight-ntwrk/onchain-runtime-v2 need to be updated to onchain-runtime-v3. The installed package is v3.


bboard-ui/src/in-memory-private-state-provider.ts

Two changes required:

  1. ContractAddress is imported from @midnight-ntwrk/ledger-v7 which is no longer installed, move to @midnight-ntwrk/compact-runtime
  2. PrivateStateProvider in midnight-js-types v4 adds five new required interface members: setContractAddress, exportPrivateStates, importPrivateStates, exportSigningKeys, importSigningKeys. The in-memory provider must implement all five.

bboard-ui/src/contexts/BrowserDeployedBoardManager.ts

ledger-v7 is no longer installed. The five transaction types (Binding, FinalizedTransaction, Proof, SignatureEnabled, Transaction, TransactionId) must be imported from @midnight-ntwrk/ledger-v8. Additionally, UnboundTransaction should be imported as a type from @midnight-ntwrk/midnight-js-types rather than from ledger-v7.

README.md Outdated
Comment on lines +10 to +21
This fork is aligned to the Midnight compatibility matrix published on March 26, 2026:

- `compact 0.5.0`
- `compactc 0.30.0`
- `Compact Runtime 0.15.0`
- `Compact JS 2.5.0`
- `Midnight.js 4.0.2`
- `testkit-js 4.0.2`
- `Ledger 8.0.3`
- `DApp Connector API 4.0.1`
- `Proof Server 8.0.3`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section should be removed. The packages are constantly being updated and this is extra maintenance. Devs can check the package if they need the versions.

@@ -8,6 +8,7 @@
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "node",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modeResolution should be updated to "Bundler"

package.json Outdated
Comment on lines +22 to +41
"@midnight-ntwrk/dapp-connector-api": "4.0.1",
"@midnight-ntwrk/ledger-v8": "8.0.3",
"@midnight-ntwrk/midnight-js-compact": "4.0.2",
"@midnight-ntwrk/midnight-js-contracts": "4.0.2",
"@midnight-ntwrk/midnight-js-fetch-zk-config-provider": "4.0.2",
"@midnight-ntwrk/midnight-js-http-client-proof-provider": "4.0.2",
"@midnight-ntwrk/midnight-js-indexer-public-data-provider": "4.0.2",
"@midnight-ntwrk/midnight-js-level-private-state-provider": "4.0.2",
"@midnight-ntwrk/midnight-js-network-id": "4.0.2",
"@midnight-ntwrk/midnight-js-node-zk-config-provider": "4.0.2",
"@midnight-ntwrk/midnight-js-types": "4.0.2",
"@midnight-ntwrk/midnight-js-utils": "4.0.2",
"@midnight-ntwrk/testkit-js": "4.0.2",
"@midnight-ntwrk/wallet-sdk-abstractions": "2.0.0",
"@midnight-ntwrk/wallet-sdk-address-format": "3.1.0",
"@midnight-ntwrk/wallet-sdk-dust-wallet": "3.0.0",
"@midnight-ntwrk/wallet-sdk-facade": "3.0.0",
"@midnight-ntwrk/wallet-sdk-hd": "3.0.1",
"@midnight-ntwrk/wallet-sdk-shielded": "2.1.0",
"@midnight-ntwrk/wallet-sdk-unshielded-wallet": "2.1.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to stick to the major updates for our packages to reduce the number of updates we need to make. Please update this to the following packages:

"@midnight-ntwrk/dapp-connector-api": "^4.0.0",
"@midnight-ntwrk/ledger-v8": "^8.0.0",
"@midnight-ntwrk/midnight-js-compact": "^4.0.0",
"@midnight-ntwrk/midnight-js-contracts": "^4.0.0",
"@midnight-ntwrk/midnight-js-fetch-zk-config-provider": "^4.0.0",
"@midnight-ntwrk/midnight-js-http-client-proof-provider": "^4.0.0",
"@midnight-ntwrk/midnight-js-indexer-public-data-provider": "^4.0.0",
"@midnight-ntwrk/midnight-js-level-private-state-provider": "^4.0.0",
"@midnight-ntwrk/midnight-js-network-id": "^4.0.0",
"@midnight-ntwrk/midnight-js-node-zk-config-provider": "^4.0.0",
"@midnight-ntwrk/midnight-js-types": "^4.0.0",
"@midnight-ntwrk/midnight-js-utils": "^4.0.0",
"@midnight-ntwrk/testkit-js": "^4.0.0",
"@midnight-ntwrk/wallet-sdk-abstractions": "^2.0.0",
"@midnight-ntwrk/wallet-sdk-address-format": "^3.0.0",
"@midnight-ntwrk/wallet-sdk-dust-wallet": "^3.0.0",
"@midnight-ntwrk/wallet-sdk-facade": "^3.0.0",
"@midnight-ntwrk/wallet-sdk-hd": "^3.0.0",
"@midnight-ntwrk/wallet-sdk-shielded": "^2.0.0",
"@midnight-ntwrk/wallet-sdk-unshielded-wallet": "^2.0.0",

package.json Outdated
"@midnight-ntwrk/wallet-sdk-hd": "3.0.1",
"@midnight-ntwrk/wallet-sdk-shielded": "2.1.0",
"@midnight-ntwrk/wallet-sdk-unshielded-wallet": "2.1.0",
"axios": "^1.13.6",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this to "axios": "1.13.6"

There was an exploit discovered with axios 1.14.1 and we want to prevent users from downloading it.

- **Transaction fee configuration**
The default `additionalFeeOverhead` value (`500_000_000_000_000_000n`) from 'midnight-testkit-js' is required on the Undeployed network (lower values fail with `BalanceCheckOverspend` on the `midnight-node` side). On the Preview network, that high overhead prevents transaction creation because it requires a large amount of dust, so it is overridden and set to `1_000n`. The root cause is not yet clear.

- **LevelDB private state provider**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is still relevant and should be kept in here.

README.md Outdated
Some of the tooling used in `midnight-testkit-js`, `midnight-js` and `midnight-wallet` is not currently well suited for direct application use. Significant wiring and integration logic is required, parts of which are copied into this repository.
More flexible and composable APIs would reduce the need for copying and modification, allowing consumers to extend functionality rather than patch or fork existing implementations.
- CLI private state is now stored per contract address, matching the `Midnight.js 4.x` private-state provider model.
- The supported deployment target for this fork is `Preprod` through the CLI flow.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no mention of a fork since this will be merged to main.

README.md Outdated
More flexible and composable APIs would reduce the need for copying and modification, allowing consumers to extend functionality rather than patch or fork existing implementations.
- CLI private state is now stored per contract address, matching the `Midnight.js 4.x` private-state provider model.
- The supported deployment target for this fork is `Preprod` through the CLI flow.
- `standalone` is kept in the repository but is not the primary acceptance path for this migration.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed.

@JAlbertCode
Copy link
Copy Markdown
Contributor

@jmaciaal, please review the requested changes and make the update by the end of the week so we can keep our examples up to date. If you are unable to get to it by the end of the week, I will make a PR with the changes needed so we can move forward. Keep me posted on your progress.

@jmaciaal
Copy link
Copy Markdown
Author

jmaciaal commented Apr 2, 2026

Hey, sorry I missed this. I’ll push the requested updates today. Thanks for the patience.

@jmaciaal
Copy link
Copy Markdown
Author

jmaciaal commented Apr 3, 2026

I pushed the requested follow-up updates.

  • CI updated to Compact 0.30.0 and Node 24
  • dependency ranges updated to major-version ranges, with axios pinned to 1.13.6
  • moduleResolution updated to Bundler in the API, CLI, and UI
  • UI runtime references moved from @midnight-ntwrk/onchain-runtime-v2 to v3
  • in-memory private state provider updated for the midnight-js-types v4 interface
  • BrowserDeployedBoardManager imports migrated off ledger-v7
  • README cleanup to remove fork-specific/version-matrix maintenance text while keeping the transaction fee note
  • package-lock.json regenerated

Re-ran the local checks:

  • cd contract && npm run ci
  • cd api && npm run ci
  • cd bboard-cli && npm run ci
  • cd bboard-ui && npm run ci
  • cd bboard-ui && npm run build
  • cd bboard-ui && npm run build:preview

And manually re-validated the CLI flow on Preprod, and verified the UI locally after the updated build.

@jmaciaal jmaciaal requested a review from JAlbertCode April 11, 2026 04:49
Copy link
Copy Markdown
Contributor

@JAlbertCode JAlbertCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes work. The network is taking a bit longer to sync than usual, so I will make another PR to address timeout issues, but everything in this PR works and gets the repo up to date.

@JAlbertCode
Copy link
Copy Markdown
Contributor

@jmaciaal commits require verified signatures. Please re-sign your commits so we can merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants