Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@ jobs:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Lint
run: npm run lint
- name: Build
run: npm run build:mesh && npm run build:docs && npm run build:apps && npm run build:scripts
- name: Test Scalus integrations
run: |
npm test --workspace @meshsdk/core-cst
npm test --workspace @meshsdk/scalus-emulator
- name: Test Scalus package exports
run: |
npm run test:package --workspace @meshsdk/core-cst
npm run test:package --workspace @meshsdk/scalus-emulator
npm run test:scalus-packages
93 changes: 13 additions & 80 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
"lint": "turbo lint",
"pack": "turbo pack",
"test": "turbo test -- --passWithNoTests",
"sh:version": "sh scripts/bump-version.sh"
"sh:version": "sh scripts/bump-version.sh",
"test:scalus-packages": "node scripts/test-scalus-packages.mjs"
},
"devDependencies": {
"@meshsdk/configs": "*",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.12",
"dotenv": "^16.4.5",
"esbuild": "^0.28.1",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"ts-node": "^10.9.2",
Expand Down
42 changes: 42 additions & 0 deletions packages/mesh-core-cst/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,45 @@
Types and utilities functions between Mesh and [cardano-js-sdk](https://github.com/input-output-hk/cardano-js-sdk)

[meshjs.dev](https://meshjs.dev/)

## Scalus offline evaluator

`OfflineEvaluatorScalus` declares Scalus as a runtime dependency and loads it
inside `evaluateTx` using native dynamic import. The ESM and CommonJS package
entries can both use the ESM-only Scalus package without embedding its bundle.

The optional fifth constructor parameter selects the ledger protocol major
version. It defaults to 10 to preserve the prior version selection. Pass the
version used by the target ledger explicitly when evaluating other eras:

```ts
const evaluator = new OfflineEvaluatorScalus(
fetcher,
"preprod",
undefined, // network slot configuration
undefined, // positional V1, V2, V3 cost models
11,
);
```

Cost models are positional: indices 0, 1 and 2 are V1, V2 and V3. They must
match the target ledger's protocol parameters. Voting and proposing redeemers
map to Mesh's VOTE and PROPOSE tags.

## Budget change on upgrade

For the existing minting test, published Mesh with Scalus 0.17.0 reports
508,703 memory and 164,980,381 steps. Scalus 1.2.0 reports 508,703 memory and
164,973,765 steps at explicit PV10. This measured version delta
is separate from the protocol-default change; preserving PV10 does not promise
identical budgets across evaluator releases. The exact internal cause of this
delta has not been established by this integration work.

Run the real evaluator test with:

```sh
npm run test:scalus --workspace @meshsdk/core-cst
```

The dedicated Jest configuration enables ESM for the Scalus dependency. Scalus
1.2 requires Node.js 20 or newer and uses Web Crypto in browser bundles.
1 change: 1 addition & 0 deletions packages/mesh-core-cst/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Config } from "jest";

const jestConfig: Config = {
clearMocks: true,
testPathIgnorePatterns: ["/offline-evaluator-scalus.test.ts$"],
maxWorkers: 1,
testEnvironment: "node",
testMatch: ["**/packages/**/*.test.ts"],
Expand Down
Loading
Loading