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
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ jobs:
- name: Rebuild and verify WASM
run: |
go test ./...
make test-wasm
git diff --exit-code -- assets
make check-wasm
make test-wasm WASM_OUT=dist/ci-wasm
node scripts/check-wasm-rebuild.mjs assets dist/ci-wasm

- name: Verify reproducible WASM release archives
run: make test-wasm-release
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ writer semantics independently in TypeScript.

## Version and Core release

The package asset binding is `0.0.5`, built against the published
`malt-core v0.0.11-rc.2` release at commit
`a8b0f9260ff025e834a803f87161685914604d11`.
The package asset binding is `0.0.6`, built against the published
`malt-core v0.0.11-rc.4` release at commit
`595f1e05aa86b0339addaa0f0e2ac6672faa8e00`.
[`malt-core.lock.json`](./malt-core.lock.json) binds that tag, commit, Go module
checksums. The `malt.ts-core-lock/v2` lock binds Core source only; Core WASM
assets are not required. This repository exclusively owns WASM entrypoints,
Expand Down Expand Up @@ -107,10 +107,12 @@ indices as eight unsigned big-endian bytes, and `encodeKeyLabel(Uint8Array)`
serializes Direct 32-byte keys. `deriveCoordinate({profile, label})` executes
Core derivation in the verifier Worker and returns a key or a bigint index.
JavaScript performs no label hashing or application path normalization.
Prefix layout 4 authenticates exact original label bytes and targets; distinct
Map layout 4 authenticates exact original label bytes and targets; distinct
labels at the same full coordinate are errors. Layout 1 is rejected without a
compatibility reader. Rebuild old Prefix state and its dependent parent Roots;
Positional layout 3 and Root V=0 are unchanged.
compatibility reader. Rebuild old Map state and its dependent parent Roots;
List remains layout 3 and Root V=0 is unchanged. Core rc.4 includes rc.3's
empty-cell scalar-zero encoding; roots and proofs from rc.2 or earlier must
be regenerated from original inputs, including dependent parent Roots.

`prepareAuthentication(backend, stateJSON)` builds a complete candidate.
`updateAuthentication(backend, candidateJSON, stateJSON)` verifies a complete
Expand Down Expand Up @@ -170,7 +172,7 @@ session snapshot compatibility APIs. Worker readiness requires the complete
current ABI. There are no forwarding aliases or optional old-runtime exports.

The `malt-core.lock.json` and packaged binary assets identify the published
Core `v0.0.11-rc.2` release. Its current host and batch APIs are bound to the
Core `v0.0.11-rc.4` release. Its current host and batch APIs are bound to the
exact release tag, source commit, and module checksums.
Source integration checks remain separate from this published release binding.

Expand Down Expand Up @@ -205,7 +207,7 @@ See [WASM release assets](docs/wasm-release-assets.md).
The former Core WASM manifest/asset-set properties are removed. Consumers use
this package's asset checksums and build provenance for the WASM it distributes.

The package uses root-only Positional metadata: `count` plus an optional
The package uses root-only List metadata: `count` plus an optional
opaque `payload_cid`. Range bounds are element indices, and non-root vectors
have no reserved metadata slot. Application JSON decoding stays in consumers.
The packaged verifier and writer assets are built from the exact audited Core
Expand Down
10 changes: 5 additions & 5 deletions assets/verifier/PROVENANCE.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"schema": "malt.ts-verifier.provenance/v1",
"source_repository": "https://github.com/DeWebProtocol/malt-ts.git",
"build_inputs_sha256": "d4f7b398570ed5fde535de33ebc9a4f57a1204d1f51c6ca271dbc522c9881f96",
"build_inputs_sha256": "1df72aa516dc33125758c7491cbe493fb885a9bcc2effce57a302c52406ad861",
"core": {
"module_path": "github.com/dewebprotocol/malt-core",
"module_version": "v0.0.11-rc.2",
"module_version": "v0.0.11-rc.4",
"source_repository": "https://github.com/DeWebProtocol/malt-core.git",
"source_commit": "a8b0f9260ff025e834a803f87161685914604d11",
"module_sum": "h1:n1znvAKDKeH+vlrZ7o1nvinro2CGb1LoBtf0O3WOPzQ=",
"source_commit": "595f1e05aa86b0339addaa0f0e2ac6672faa8e00",
"module_sum": "h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM=",
"go_mod_sum": "h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA="
},
"target": "js/wasm",
Expand All @@ -16,7 +16,7 @@
"maltDeriveCoordinate"
],
"go_version": "go1.26.8",
"go_toolchain": "go version go1.26.8 linux/amd64",
"go_toolchain": "go version go1.26.8 windows/amd64",
"build_flags": [
"-p=6",
"-mod=readonly",
Expand Down
4 changes: 2 additions & 2 deletions assets/verifier/SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
0b3112c3d5dc2fffdfe1aa430307abacf609d1eebf00445ef54624ed7d03799e malt-verifier.wasm
fdc3af9dce8de3b322de1cad208c750351fe068892363ab1f8937486c062bf77 malt-verifier.wasm
0c949f4996f9a89698e4b5c586de32249c3b69b7baadb64d220073cc04acba14 wasm_exec.js
d77425461b8d70a34b7be7f21294e87a0f7804bceaa89494e1f700f45b9b9ca6 PROVENANCE.json
7be58669bd890583d02be4e621c828287b3aa72d18d06d912035e3ce73369622 PROVENANCE.json
Binary file modified assets/verifier/malt-verifier.wasm
Binary file not shown.
10 changes: 5 additions & 5 deletions assets/writer/PROVENANCE.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"schema": "malt.ts-writer.provenance/v1",
"source_repository": "https://github.com/DeWebProtocol/malt-ts.git",
"build_inputs_sha256": "d4f7b398570ed5fde535de33ebc9a4f57a1204d1f51c6ca271dbc522c9881f96",
"build_inputs_sha256": "1df72aa516dc33125758c7491cbe493fb885a9bcc2effce57a302c52406ad861",
"core": {
"module_path": "github.com/dewebprotocol/malt-core",
"module_version": "v0.0.11-rc.2",
"module_version": "v0.0.11-rc.4",
"source_repository": "https://github.com/DeWebProtocol/malt-core.git",
"source_commit": "a8b0f9260ff025e834a803f87161685914604d11",
"module_sum": "h1:n1znvAKDKeH+vlrZ7o1nvinro2CGb1LoBtf0O3WOPzQ=",
"source_commit": "595f1e05aa86b0339addaa0f0e2ac6672faa8e00",
"module_sum": "h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM=",
"go_mod_sum": "h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA="
},
"target": "js/wasm",
Expand All @@ -28,7 +28,7 @@
"sha256": "3799df0a77d1843b13a3a08744165180a12e1cd2dca529bee64ad691ac63adaf"
},
"go_version": "go1.26.8",
"go_toolchain": "go version go1.26.8 linux/amd64",
"go_toolchain": "go version go1.26.8 windows/amd64",
"build_flags": [
"-p=6",
"-mod=readonly",
Expand Down
10 changes: 5 additions & 5 deletions assets/writer/SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
95c9a29d00f076dc3bd6709c1c2e371a72fd0d42c0990f75384f2f83d433aedb malt-writer-kzg.wasm
86ad199013c2b98240bd30fb8b8224643eac860879534a3e7b2b31b13230af6e malt-writer-ipa-direct.wasm
2eb5114553568b75481fd967f11950ce1c37905aa8e18e350b081dfd76720c70 malt-writer-ipa-compact.wasm
6872a6b4a3f79a8d9ef6ff90259c4206931e91a2d27a41335707fb2c59d37101 malt-writer-ipa-fast.wasm
b9a9de50f0dc945454f0e3f7e77b720d885747398cca3cf6b7ea4e80b4abfb86 malt-writer-kzg.wasm
e5432d306116fa54c21ebd78fcf320f2a6cef6f63259e2600573aa9dba0381b5 malt-writer-ipa-direct.wasm
e78d4fc1ac43c3e1b8bef261b7c8aa1b23442976e13fea28f33af1b9744702ab malt-writer-ipa-compact.wasm
8d57eada1383a1f65ab678434d721f9dd5f4f4cd43024231234f2c413cb7d14d malt-writer-ipa-fast.wasm
6311876a80f3c9333f20e6a8ae8b55b7235b1f7411d6ae2224bc90b55fe779a2 malt-writer-worker.mjs
968657d9a8818feb23b6463aca609478c81423a93a8b0dc453705ad009214db0 malt-writer-workers.mjs
0c949f4996f9a89698e4b5c586de32249c3b69b7baadb64d220073cc04acba14 wasm_exec.js
db2db64e7fe5b0bf977d4d1376c4529cfe606c14ff3fe85984321bb87fab65c5 PROVENANCE.json
4440c9b6048ed8b77eba3030c81c1fa669359e558f0938ce50dc90479e0e92d3 PROVENANCE.json
Binary file modified assets/writer/malt-writer-ipa-compact.wasm
Binary file not shown.
Binary file modified assets/writer/malt-writer-ipa-direct.wasm
Binary file not shown.
Binary file modified assets/writer/malt-writer-ipa-fast.wasm
Binary file not shown.
Binary file modified assets/writer/malt-writer-kzg.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/dewebprotocol/malt-ts

go 1.26.8

require github.com/dewebprotocol/malt-core v0.0.11-rc.2
require github.com/dewebprotocol/malt-core v0.0.11-rc.4

require (
github.com/bits-and-blooms/bitset v1.25.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/consensys/gnark-crypto v0.22.0 h1:RYH7FX1/zkmNrSiABo70HAqew41SRUsoluK
github.com/consensys/gnark-crypto v0.22.0/go.mod h1:HL8XflRG4cvau1PEG3CWBTD2kkzUzdlqZF6BBgy57F8=
github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4=
github.com/crate-crypto/go-kzg-4844 v1.1.0/go.mod h1:JolLjpSff1tCCJKaJx4psrlEdlXuJEC996PL3tTAFks=
github.com/dewebprotocol/malt-core v0.0.11-rc.2 h1:n1znvAKDKeH+vlrZ7o1nvinro2CGb1LoBtf0O3WOPzQ=
github.com/dewebprotocol/malt-core v0.0.11-rc.2/go.mod h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA=
github.com/dewebprotocol/malt-core v0.0.11-rc.4 h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM=
github.com/dewebprotocol/malt-core v0.0.11-rc.4/go.mod h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA=
github.com/ipfs/go-cid v0.6.2 h1:VuGwJd+KJTaMJ4S4d5EEf9SXc17YUblS5axCbocn9YE=
github.com/ipfs/go-cid v0.6.2/go.mod h1:Xhwg8NzHeK9xPCEZkCw4idzPiuNMpX3fARuI5Iwj1Lo=
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
Expand Down
6 changes: 3 additions & 3 deletions malt-core.lock.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"schema": "malt.ts-core-lock/v2",
"module_path": "github.com/dewebprotocol/malt-core",
"module_version": "v0.0.11-rc.2",
"module_version": "v0.0.11-rc.4",
"source_repository": "https://github.com/DeWebProtocol/malt-core.git",
"source_commit": "a8b0f9260ff025e834a803f87161685914604d11",
"module_sum": "h1:n1znvAKDKeH+vlrZ7o1nvinro2CGb1LoBtf0O3WOPzQ=",
"source_commit": "595f1e05aa86b0339addaa0f0e2ac6672faa8e00",
"module_sum": "h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM=",
"go_mod_sum": "h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA="
}
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dewebprotocol/malt",
"version": "0.0.5",
"version": "0.0.6",
"description": "Stable TypeScript and browser WASM SDK for MALT",
"type": "module",
"license": "Apache-2.0",
Expand Down
6 changes: 3 additions & 3 deletions scripts/build-wasm-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ authentication_corpus_sha256="$(sha256sum "${core_module_dir}/conformance/authen
chmod 0644 "${verifier_staging}/"* "${writer_staging}/"*
(
cd "${verifier_staging}"
sha256sum malt-verifier.wasm wasm_exec.js PROVENANCE.json >SHA256SUMS
sha256sum --text malt-verifier.wasm wasm_exec.js PROVENANCE.json >SHA256SUMS
)
(
cd "${writer_staging}"
sha256sum \
sha256sum --text \
malt-writer-kzg.wasm \
malt-writer-ipa-direct.wasm \
malt-writer-ipa-compact.wasm \
Expand Down Expand Up @@ -148,7 +148,7 @@ manifest_name="malt-wasm-release-${release_version}-${manifest_digest}.json"
mv "${temporary}/WASM-RELEASE.json" "${temporary}/${manifest_name}"
(
cd "${temporary}"
sha256sum "${verifier_archive}" "${writer_archive}" "${manifest_name}" >SHA256SUMS
sha256sum --text "${verifier_archive}" "${writer_archive}" "${manifest_name}" >SHA256SUMS
)

for artifact in "${verifier_archive}" "${writer_archive}" "${manifest_name}" SHA256SUMS; do
Expand Down
8 changes: 4 additions & 4 deletions scripts/build-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ build_inputs_digest() {
"${source_file}" >&2
exit 1
}
sha256sum "${source_file}"
sha256sum --text "${source_file}"
done |
sha256sum |
sha256sum --text |
awk '{print $1}'
)
}
Expand Down Expand Up @@ -255,11 +255,11 @@ PROVENANCE_PATH="${writer_staging}/PROVENANCE.json" node -e '

(
cd "${verifier_staging}"
sha256sum malt-verifier.wasm wasm_exec.js PROVENANCE.json >SHA256SUMS
sha256sum --text malt-verifier.wasm wasm_exec.js PROVENANCE.json >SHA256SUMS
)
(
cd "${writer_staging}"
sha256sum \
sha256sum --text \
malt-writer-kzg.wasm \
malt-writer-ipa-direct.wasm \
malt-writer-ipa-compact.wasm \
Expand Down
54 changes: 54 additions & 0 deletions scripts/check-wasm-rebuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import assert from 'node:assert/strict'
import { createHash } from 'node:crypto'
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

function readAssets(directory) {
const entries = fs.readdirSync(directory, { withFileTypes: true })
assert(entries.every((entry) => entry.isFile()), `non-file asset in ${directory}`)
const files = new Map(entries.map((entry) => [entry.name, fs.readFileSync(path.join(directory, entry.name))]))
assert(files.has('SHA256SUMS') && files.has('PROVENANCE.json'), 'missing asset metadata')
const checked = new Set()
for (const line of files.get('SHA256SUMS').toString('utf8').trimEnd().split('\n')) {
const match = /^([a-f0-9]{64}) ([a-zA-Z0-9_.-]+)$/.exec(line)
assert(match, `invalid checksum line: ${line}`)
const [, expected, name] = match
assert(name !== 'SHA256SUMS' && files.has(name) && !checked.has(name), `invalid checksum entry: ${name}`)
assert.equal(createHash('sha256').update(files.get(name)).digest('hex'), expected, `checksum mismatch: ${name}`)
checked.add(name)
}
assert.deepEqual([...checked].sort(), [...files.keys()].filter((name) => name !== 'SHA256SUMS').sort(), 'incomplete checksum coverage')
return files
}

function portableProvenance(contents) {
const provenance = JSON.parse(contents.toString('utf8'))
const toolchain = /^go version (go[0-9]+\.[0-9]+\.[0-9]+) ([a-z0-9]+)\/([a-z0-9]+)$/.exec(provenance.go_toolchain || '')
assert(toolchain && toolchain[1] === provenance.go_version, 'invalid provenance toolchain')
// The compiler version and target must match; the machine running the
// compiler may differ. Keep the actual build host in each published record.
return { ...provenance, go_toolchain: toolchain[1] }
}

export function validateWasmRebuild(publishedRoot, rebuiltRoot) {
for (const kind of ['verifier', 'writer']) {
const published = readAssets(path.join(publishedRoot, kind))
const rebuilt = readAssets(path.join(rebuiltRoot, kind))
assert.deepEqual([...published.keys()].sort(), [...rebuilt.keys()].sort(), `different ${kind} asset sets`)
for (const [name, bytes] of published) {
if (name === 'SHA256SUMS') continue // Both complete manifests were checked above.
if (name === 'PROVENANCE.json') {
assert.deepEqual(portableProvenance(bytes), portableProvenance(rebuilt.get(name)), `${kind} provenance differs`)
} else {
assert(bytes.equals(rebuilt.get(name)), `${kind}/${name} differs`)
}
}
}
}

if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
assert.equal(process.argv.length, 4, 'usage: node scripts/check-wasm-rebuild.mjs PUBLISHED REBUILT')
validateWasmRebuild(process.argv[2], process.argv[3])
console.log('WASM rebuild matches all payload bytes and portable provenance.')
}
8 changes: 4 additions & 4 deletions src/release.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const maltTSVersion = '0.0.5'
export const maltTSVersion = '0.0.6'

export const maltCoreRelease = Object.freeze({
version: 'v0.0.11-rc.2',
commit: 'a8b0f9260ff025e834a803f87161685914604d11',
moduleSum: 'h1:n1znvAKDKeH+vlrZ7o1nvinro2CGb1LoBtf0O3WOPzQ=',
version: 'v0.0.11-rc.4',
commit: '595f1e05aa86b0339addaa0f0e2ac6672faa8e00',
moduleSum: 'h1:txnIBdjlVnQkPMUs6xxNwIEOoZxpQdJbmPDXkZbzgvM=',
goModSum: 'h1:uAbiKECccmR8MlDotFWLdAgp+JFStdSn2SqA6ILEXhA='
})
23 changes: 17 additions & 6 deletions test/core-tag-lookup.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ import { expect, it } from 'vitest'

const resolver = path.resolve(process.cwd(), 'scripts/resolve-core-tag.sh')
const moduleVersion = 'v0.0.7-rc.2'
const realGit = execFileSync('which', ['git'], { encoding: 'utf8' }).trim()
const realGit = execFileSync('bash', ['-c', 'command -v git'], { encoding: 'utf8' }).trim()

function resolveTag(arguments_, options) {
// Git Bash prepends its own tools to inherited PATH on Windows. Add test
// doubles after Bash starts so the bounded-retry tests exercise them too.
return execFileSync('bash', ['-c',
'if [[ -n ${MALT_TEST_BIN:-} ]]; then export PATH="${MALT_TEST_BIN}:${PATH}"; fi; exec bash "$@"',
'--', resolver, ...arguments_
], options)
}


function cleanGitEnvironment(extra = {}) {
const environment = { ...process.env }
Expand Down Expand Up @@ -71,7 +81,9 @@ function retryEnvironment(root, gitScript) {
attempts,
sleeps,
environment: cleanGitEnvironment({
PATH: `${bin}:${process.env.PATH}`,
MALT_TEST_BIN: process.platform === 'win32'
? execFileSync('bash', ['-c', 'cygpath -u -- "$1"', '--', bin], { encoding: 'utf8' }).trim()
: bin,
REAL_GIT: realGit,
RETRY_ATTEMPTS_FILE: attempts
})
Expand Down Expand Up @@ -112,7 +124,7 @@ it('ignores inherited Git command config that redirects the canonical remote', (
const redirected = createTaggedRepository(root, 'redirected', 'redirected')
expect(redirected.commit).not.toBe(canonical.commit)

const output = execFileSync(resolver, [canonical.url, moduleVersion], {
const output = resolveTag([canonical.url, moduleVersion], {
encoding: 'utf8',
env: {
...process.env,
Expand All @@ -136,7 +148,7 @@ it('retries transient canonical tag lookup failures with bounded backoff', () =>
try {
const canonical = createTaggedRepository(root, 'canonical', 'canonical')
const retry = retryEnvironment(root, retryingGit)
const output = execFileSync(resolver, [canonical.url, moduleVersion], {
const output = resolveTag([canonical.url, moduleVersion], {
encoding: 'utf8',
env: retry.environment
}).trim()
Expand All @@ -153,8 +165,7 @@ it('stops after three canonical tag lookup failures and preserves the error', ()
const root = mkdtempSync(path.join(tmpdir(), 'malt-ts-core-tag-failure-test.'))
try {
const retry = retryEnvironment(root, failingGit)
expect(() => execFileSync(
resolver,
expect(() => resolveTag(
['https://github.com/DeWebProtocol/malt-core.git', moduleVersion],
{ encoding: 'utf8', env: retry.environment, stdio: 'pipe' }
)).toThrow(/simulated permanent TLS failure/)
Expand Down
Loading
Loading