Skip to content

Javajam test vectors runner#476

Merged
tomusdrw merged 24 commits into
mainfrom
maso-javajam-tests
Jul 16, 2025
Merged

Javajam test vectors runner#476
tomusdrw merged 24 commits into
mainfrom
maso-javajam-tests

Conversation

@DrEverr

@DrEverr DrEverr commented Jul 11, 2025

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 11, 2025

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for the "javajam" test suite and a dedicated test runner.
    • Introduced new utilities and classes for blockchain state loading and state transition testing.
    • Added new classes for recent block history and accumulation output.
  • Enhancements

    • Improved JSON parsing helpers for byte arrays and blobs.
    • Expanded service account information with additional fields.
    • Enhanced dictionary and state structures with new methods and properties.
    • Updated default protocol version to GpVersion.V0_6_7.
  • Bug Fixes

    • Adjusted logic to support multiple authorization managers and per-core privileges.
  • Refactor

    • Streamlined and clarified variable names and logging in the test runner.
    • Reworked recent block state structure and related logic for better maintainability.
  • Chores

    • Updated dependencies and scripts to support new test runner features.

Walkthrough

This update introduces a new "javajam" test runner and associated state transition testing infrastructure, including utilities for loading and representing blockchain state and transitions. Several core data structures are updated, notably the handling of recent blocks, accumulation outputs, and privileged services, now supporting per-core mappings. Numerous codecs and type definitions are revised for consistency and extensibility.

Changes

File(s) Change Summary
bin/test-runner/common.ts Refactored variable names for clarity and reordered JSON parsing in test preparation. Logging and comments updated. No functional changes.
bin/test-runner/index.ts Added "javajam" suite entry to suites mapping.
bin/test-runner/javajam.ts Introduced new JavaJam test runner for state transition tests with specific filters and error handling.
bin/test-runner/package.json Added @typeberry/database-lmdb dependency and new "javajam" script.
bin/test-runner/state-transition/state-loader.ts New module: defines KeyVal, TestState, and loadState for blockchain state loading and conversion.
bin/test-runner/state-transition/state-transition.ts New module: defines StateTransition and runStateTransition for state transition testing and verification.
bin/test-runner/w3f/accumulate.ts Updated privileges to support multiple assign numbers and updated parsing and state construction accordingly.
packages/core/utils/compatibility.ts Changed DEFAULT_VERSION from GpVersion.V0_6_4 to GpVersion.V0_6_7.
packages/jam/block-json/common.ts Added generic byte array parsers (bytesN, bytesNNoPrefix), updated blob parsing, and added explicit no-prefix blob parser.
packages/jam/config/node/jip-chain-spec.ts Simplified JSON parsing for genesis_state using new generic byte array parsers.
packages/jam/database/truncated-hash-dictionary.ts Added size getter, has, and values methods to TruncatedHashDictionary.
packages/jam/jam-host-calls/externalities/state-update.ts Changed privilegedServices.authorizer from single ServiceId to PerCore<ServiceId>.
packages/jam/state-merkleization/serialize.ts Updated recentBlocks codec to use RecentBlocks.Codec. Adjusted imports accordingly.
packages/jam/state/accumulation-output.ts New class AccumulationOutput extending WithDebug.
packages/jam/state/block-state.ts Replaced mmr property with accumulationResult in BlockState. Updated constructor and codec.
packages/jam/state/privileged-services.ts Changed authManager from single ServiceId to PerCore<ServiceId>, updated codec.
packages/jam/state/recent-blocks.ts New class RecentBlocks with blocks array and MMR peaks, codec, and factory method.
packages/jam/state/service.ts Extended ServiceAccountInfo with storageOffset, creation, lastAccumulation, and parentService fields. Updated codec and constructor.
packages/jam/state/state.ts Changed recentBlocks property from array of BlockState to RecentBlocks type.
packages/jam/transition/accumulate/accumulate.ts Updated logic to support multiple authorization managers in mergeServiceStateUpdates.
packages/jam/transition/recent-history.ts Refactored to use recentBlocks.blocks and removed active MMR computation, preserving MMR data as-is.
packages/jam/transition/reports/verify-contextual.ts Updated loops for new recentBlocks structure and disabled BEEFY super peak hash verification.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant JavaJamRunner
    participant StateLoader
    participant StateTransition
    participant Blockchain

    CLI->>JavaJamRunner: Start test run with arguments
    JavaJamRunner->>StateLoader: Load pre-state and post-state from JSON
    JavaJamRunner->>StateTransition: Parse block and state transitions
    StateTransition->>Blockchain: Initialize test context (pre-state, prior blocks)
    StateTransition->>Blockchain: Execute state transition
    Blockchain-->>StateTransition: Return new state
    StateTransition->>JavaJamRunner: Compare new state to expected post-state
    JavaJamRunner-->>CLI: Report test results
Loading

Poem

A hop, a skip, a JavaJam leap,
New runners and states for the blockchain to keep.
With bytes and blobs, and per-core might,
Recent blocks sparkle, codecs set right.
The rabbit approves—so onward we bound,
In fields of hashes, new features are found!

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@DrEverr
DrEverr marked this pull request as ready for review July 14, 2025 19:31
@DrEverr
DrEverr requested review from skoszuta and tomusdrw July 14, 2025 19:37

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
packages/jam/state/accumulation-output.ts (1)

3-4: Placeholder class - consider adding documentation for intended usage.

This appears to be a placeholder class for future accumulation output functionality. Consider adding more detailed documentation about the intended purpose and structure of this class to guide future development.

packages/jam/state/block-state.ts (1)

25-30: Address the TODO: Define proper hash type for accumulation result.

The TODO comment indicates that the correct hash type needs to be defined for accumulationResult. This should be resolved to ensure type safety and clarity.

Would you like me to help define the appropriate opaque hash type for the accumulation result, similar to how StateRootHash and HeaderHash are defined?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Lite

📥 Commits

Reviewing files that changed from the base of the PR and between 4b51d46 and 30e6307.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (22)
  • bin/test-runner/common.ts (4 hunks)
  • bin/test-runner/index.ts (1 hunks)
  • bin/test-runner/javajam.ts (1 hunks)
  • bin/test-runner/package.json (2 hunks)
  • bin/test-runner/state-transition/state-loader.ts (1 hunks)
  • bin/test-runner/state-transition/state-transition.ts (1 hunks)
  • bin/test-runner/w3f/accumulate.ts (4 hunks)
  • packages/core/utils/compatibility.ts (1 hunks)
  • packages/jam/block-json/common.ts (1 hunks)
  • packages/jam/config/node/jip-chain-spec.ts (2 hunks)
  • packages/jam/database/truncated-hash-dictionary.ts (2 hunks)
  • packages/jam/jam-host-calls/externalities/state-update.ts (2 hunks)
  • packages/jam/state-merkleization/serialize.ts (2 hunks)
  • packages/jam/state/accumulation-output.ts (1 hunks)
  • packages/jam/state/block-state.ts (1 hunks)
  • packages/jam/state/privileged-services.ts (3 hunks)
  • packages/jam/state/recent-blocks.ts (1 hunks)
  • packages/jam/state/service.ts (4 hunks)
  • packages/jam/state/state.ts (2 hunks)
  • packages/jam/transition/accumulate/accumulate.ts (1 hunks)
  • packages/jam/transition/recent-history.ts (3 hunks)
  • packages/jam/transition/reports/verify-contextual.ts (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

Instructions used from:

Sources:
⚙️ CodeRabbit Configuration File

packages/core/**/*.ts

Instructions used from:

Sources:
⚙️ CodeRabbit Configuration File

🧠 Learnings (21)
📓 Common learnings
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#351
File: packages/core/state-machine/channel.ts:131-137
Timestamp: 2025-04-24T19:44:58.110Z
Learning: The `doUntil` method in `MessageChannelStateMachine` was changed from using `Promise.all` to execute work and state transition concurrently, to using sequential awaits which ensures work completes before waiting for the state transition.
bin/test-runner/index.ts (1)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#399
File: .github/workflows/vectors-jamduna.yml:78-78
Timestamp: 2025-05-26T21:31:58.688Z
Learning: In the typeberry project, the npm start script in the test-runner workspace is designed to accept test suite names as arguments (e.g., "jamduna", "w3f"). The command `npm start -w @typeberry/test-runner jamduna` is the correct way to run the jamduna test suite, not `npm run jamduna`. This is an architectural design choice where the start script acts as a unified entry point for different test suites.
bin/test-runner/package.json (3)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#399
File: .github/workflows/vectors-jamduna.yml:78-78
Timestamp: 2025-05-26T21:31:58.688Z
Learning: In the typeberry project, the npm start script in the test-runner workspace is designed to accept test suite names as arguments (e.g., "jamduna", "w3f"). The command `npm start -w @typeberry/test-runner jamduna` is the correct way to run the jamduna test suite, not `npm run jamduna`. This is an architectural design choice where the start script acts as a unified entry point for different test suites.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#442
File: packages/core/pvm-debugger-adapter/index.ts:22-40
Timestamp: 2025-06-18T20:35:13.536Z
Learning: The `@typeberry/utils` package has browser compatibility issues due to Node.js-specific code like `measure` function using `process.hrtime()` and `testUtils` importing `node:assert`, causing white screens in browser environments.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#442
File: packages/core/pvm-debugger-adapter/index.ts:22-40
Timestamp: 2025-06-18T20:35:13.536Z
Learning: The `measure` function in `@typeberry/utils/debug.ts` attempts environment detection by checking `process === undefined` but still causes bundling issues because bundlers see the `process.hrtime` reference in the Node.js branch.
packages/jam/jam-host-calls/externalities/state-update.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
packages/jam/config/node/jip-chain-spec.ts (6)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/transition/accumulate/accumulate.ts:193-193
Timestamp: 2025-06-10T12:04:56.072Z
Learning: In the typeberry codebase, the Service.getPreimage() method was updated to return BytesBlob | null directly instead of PreimageItem | null, so the returned value is already a BytesBlob and doesn't need .blob property access.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#351
File: packages/jam/state-merkleization/index.ts:19-37
Timestamp: 2025-04-24T19:48:31.051Z
Learning: In the typeberry codebase, `Bytes` inherits from `BytesBlob`, so a `Bytes` instance can be directly used where a `BytesBlob` is expected without needing conversion.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#351
File: bin/jam/genesis.ts:7-11
Timestamp: 2025-04-24T19:42:18.083Z
Learning: Error handling for file operations and JSON parsing in the typeberry project is done at a higher level in the call stack rather than within individual utility functions.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#442
File: packages/core/pvm-debugger-adapter/index.ts:22-40
Timestamp: 2025-06-18T20:35:13.536Z
Learning: The `@typeberry/utils` package has browser compatibility issues due to Node.js-specific code like `measure` function using `process.hrtime()` and `testUtils` importing `node:assert`, causing white screens in browser environments.
packages/jam/transition/accumulate/accumulate.ts (3)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#351
File: packages/core/state-machine/channel.ts:131-137
Timestamp: 2025-04-24T19:44:58.110Z
Learning: The `doUntil` method in `MessageChannelStateMachine` was changed from using `Promise.all` to execute work and state transition concurrently, to using sequential awaits which ensures work completes before waiting for the state transition.
packages/jam/state/state.ts (3)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/database-lmdb/states.test.ts:158-160
Timestamp: 2025-06-10T12:06:32.535Z
Learning: In test code, tomusdrw prefers pragmatic solutions over strict type safety when listing all entries would be cumbersome. Using `Object.assign({}, state)` for state updates in tests is acceptable even if it compromises type safety, prioritizing test maintainability and readability.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
packages/jam/state/privileged-services.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
packages/jam/transition/recent-history.ts (3)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/database-lmdb/states.test.ts:158-160
Timestamp: 2025-06-10T12:06:32.535Z
Learning: In test code, tomusdrw prefers pragmatic solutions over strict type safety when listing all entries would be cumbersome. Using `Object.assign({}, state)` for state updates in tests is acceptable even if it compromises type safety, prioritizing test maintainability and readability.
packages/jam/block-json/common.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/transition/accumulate/accumulate.ts:193-193
Timestamp: 2025-06-10T12:04:56.072Z
Learning: In the typeberry codebase, the Service.getPreimage() method was updated to return BytesBlob | null directly instead of PreimageItem | null, so the returned value is already a BytesBlob and doesn't need .blob property access.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#351
File: packages/jam/state-merkleization/index.ts:19-37
Timestamp: 2025-04-24T19:48:31.051Z
Learning: In the typeberry codebase, `Bytes` inherits from `BytesBlob`, so a `Bytes` instance can be directly used where a `BytesBlob` is expected without needing conversion.
packages/jam/database/truncated-hash-dictionary.ts (1)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
bin/test-runner/w3f/accumulate.ts (4)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/database-lmdb/states.test.ts:158-160
Timestamp: 2025-06-10T12:06:32.535Z
Learning: In test code, tomusdrw prefers pragmatic solutions over strict type safety when listing all entries would be cumbersome. Using `Object.assign({}, state)` for state updates in tests is acceptable even if it compromises type safety, prioritizing test maintainability and readability.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#351
File: bin/jam/genesis.ts:7-11
Timestamp: 2025-04-24T19:42:18.083Z
Learning: Error handling for file operations and JSON parsing in the typeberry project is done at a higher level in the call stack rather than within individual utility functions.
bin/test-runner/state-transition/state-loader.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/database-lmdb/states.test.ts:158-160
Timestamp: 2025-06-10T12:06:32.535Z
Learning: In test code, tomusdrw prefers pragmatic solutions over strict type safety when listing all entries would be cumbersome. Using `Object.assign({}, state)` for state updates in tests is acceptable even if it compromises type safety, prioritizing test maintainability and readability.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
packages/jam/transition/reports/verify-contextual.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
packages/jam/state/recent-blocks.ts (1)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
bin/test-runner/common.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#399
File: .github/workflows/vectors-jamduna.yml:78-78
Timestamp: 2025-05-26T21:31:58.688Z
Learning: In the typeberry project, the npm start script in the test-runner workspace is designed to accept test suite names as arguments (e.g., "jamduna", "w3f"). The command `npm start -w @typeberry/test-runner jamduna` is the correct way to run the jamduna test suite, not `npm run jamduna`. This is an architectural design choice where the start script acts as a unified entry point for different test suites.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/database-lmdb/states.test.ts:158-160
Timestamp: 2025-06-10T12:06:32.535Z
Learning: In test code, tomusdrw prefers pragmatic solutions over strict type safety when listing all entries would be cumbersome. Using `Object.assign({}, state)` for state updates in tests is acceptable even if it compromises type safety, prioritizing test maintainability and readability.
packages/jam/state/service.ts (5)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/transition/accumulate/accumulate.ts:193-193
Timestamp: 2025-06-10T12:04:56.072Z
Learning: In the typeberry codebase, the Service.getPreimage() method was updated to return BytesBlob | null directly instead of PreimageItem | null, so the returned value is already a BytesBlob and doesn't need .blob property access.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#442
File: packages/core/pvm-debugger-adapter/index.ts:22-40
Timestamp: 2025-06-18T20:35:13.536Z
Learning: The `@typeberry/utils` package has browser compatibility issues due to Node.js-specific code like `measure` function using `process.hrtime()` and `testUtils` importing `node:assert`, causing white screens in browser environments.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#351
File: packages/jam/state-merkleization/index.ts:19-37
Timestamp: 2025-04-24T19:48:31.051Z
Learning: In the typeberry codebase, `Bytes` inherits from `BytesBlob`, so a `Bytes` instance can be directly used where a `BytesBlob` is expected without needing conversion.
bin/test-runner/state-transition/state-transition.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/database-lmdb/states.test.ts:158-160
Timestamp: 2025-06-10T12:06:32.535Z
Learning: In test code, tomusdrw prefers pragmatic solutions over strict type safety when listing all entries would be cumbersome. Using `Object.assign({}, state)` for state updates in tests is acceptable even if it compromises type safety, prioritizing test maintainability and readability.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
packages/jam/state-merkleization/serialize.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
bin/test-runner/javajam.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#399
File: .github/workflows/vectors-jamduna.yml:78-78
Timestamp: 2025-05-26T21:31:58.688Z
Learning: In the typeberry project, the npm start script in the test-runner workspace is designed to accept test suite names as arguments (e.g., "jamduna", "w3f"). The command `npm start -w @typeberry/test-runner jamduna` is the correct way to run the jamduna test suite, not `npm run jamduna`. This is an architectural design choice where the start script acts as a unified entry point for different test suites.
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/database-lmdb/states.test.ts:158-160
Timestamp: 2025-06-10T12:06:32.535Z
Learning: In test code, tomusdrw prefers pragmatic solutions over strict type safety when listing all entries would be cumbersome. Using `Object.assign({}, state)` for state updates in tests is acceptable even if it compromises type safety, prioritizing test maintainability and readability.
packages/jam/state/block-state.ts (2)
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state-merkleization/serialize-update.ts:115-126
Timestamp: 2025-06-10T12:10:10.532Z
Learning: In packages/jam/state-merkleization/serialize-update.ts, service removal is handled separately from service updates. The UpdateServiceKind enum does not include a Remove variant. Service removals are handled via the servicesRemoved parameter in serializeUpdate() which is processed by serializeRemovedServices(), while service updates/creations are handled via servicesUpdates parameter processed by serializeServiceUpdates().
Learnt from: tomusdrw
PR: FluffyLabs/typeberry#419
File: packages/jam/state/state-inmemory.ts:141-149
Timestamp: 2025-06-10T12:20:17.513Z
Learning: In the `InMemoryService.copyFrom` function in `packages/jam/state/state-inmemory.ts`, duplicate checking for `(hash, length)` pairs in the lookup history is not necessary because the function operates under the assumption that the input `ServiceEntries` comes from an existing well-formed state, which already maintains the invariant of unique lookup history entries per hash and length combination.
🧬 Code Graph Analysis (13)
packages/jam/jam-host-calls/externalities/state-update.ts (2)
packages/jam/state/common.ts (1)
  • PerCore (8-8)
bin/rpc/src/types.ts (2)
  • ServiceId (93-93)
  • ServiceId (100-100)
packages/jam/state/state.ts (1)
packages/jam/state/recent-blocks.ts (1)
  • RecentBlocks (11-35)
packages/jam/state/privileged-services.ts (2)
packages/jam/state/common.ts (2)
  • codecPerCore (17-20)
  • PerCore (8-8)
packages/jam/block/common.ts (1)
  • ServiceId (26-26)
packages/jam/transition/recent-history.ts (2)
packages/jam/state-merkleization/serialize.ts (1)
  • recentBlocks (65-69)
packages/core/collections/sized-array.ts (1)
  • asKnownSize (13-15)
packages/jam/block-json/common.ts (1)
packages/core/bytes/bytes.ts (2)
  • Bytes (152-218)
  • BytesBlob (10-147)
packages/jam/database/truncated-hash-dictionary.ts (1)
packages/core/bytes/bytes.ts (1)
  • Bytes (152-218)
bin/test-runner/w3f/accumulate.ts (2)
packages/jam/state/common.ts (1)
  • tryAsPerCore (10-16)
packages/jam/block/common.ts (1)
  • tryAsServiceId (28-28)
bin/test-runner/state-transition/state-loader.ts (5)
packages/core/bytes/bytes.ts (2)
  • Bytes (152-218)
  • BytesBlob (10-147)
packages/jam/block/common.ts (1)
  • StateRootHash (43-43)
packages/jam/database/truncated-hash-dictionary.ts (1)
  • TruncatedHashDictionary (15-76)
packages/jam/state-merkleization/state-entries.ts (1)
  • StateEntries (31-107)
packages/jam/state-merkleization/serialized-state.ts (1)
  • SerializedState (38-172)
packages/jam/transition/reports/verify-contextual.ts (5)
packages/core/mmr/index.ts (1)
  • MmrHasher (17-22)
packages/core/hash/hash.ts (1)
  • KeccakHash (20-20)
packages/jam/state-merkleization/serialize.ts (1)
  • recentBlocks (65-69)
packages/core/collections/hash-dictionary.ts (1)
  • HashDictionary (24-98)
packages/jam/state/block-state.ts (1)
  • BlockState (10-38)
packages/jam/state/recent-blocks.ts (7)
packages/jam/block/codec.ts (1)
  • codecKnownSizeArray (47-57)
packages/jam/state/block-state.ts (1)
  • BlockState (10-38)
packages/jam/state/state.ts (2)
  • MAX_RECENT_HISTORY (40-40)
  • MAX_RECENT_HISTORY (41-41)
packages/core/codec/descriptors.ts (2)
  • readonlyArray (121-131)
  • CodecRecord (139-141)
packages/core/collections/sized-array.ts (1)
  • KnownSizeArray (10-10)
packages/core/mmr/index.ts (1)
  • MmrPeaks (7-14)
packages/core/hash/hash.ts (1)
  • KeccakHash (20-20)
packages/jam/state/service.ts (3)
packages/jam/block/common.ts (4)
  • tryAsTimeSlot (18-18)
  • tryAsServiceId (28-28)
  • TimeSlot (16-16)
  • ServiceId (26-26)
packages/core/numbers/index.ts (2)
  • U64 (27-27)
  • U32 (24-24)
bin/rpc/src/types.ts (2)
  • ServiceId (93-93)
  • ServiceId (100-100)
packages/jam/state-merkleization/serialize.ts (1)
packages/jam/state/recent-blocks.ts (1)
  • RecentBlocks (11-35)
packages/jam/state/block-state.ts (5)
packages/jam/block/common.ts (1)
  • StateRootHash (43-43)
packages/jam/block/codec.ts (1)
  • codecHashDictionary (87-134)
packages/jam/block/work-report.ts (1)
  • WorkPackageInfo (59-77)
packages/core/codec/descriptors.ts (1)
  • CodecRecord (139-141)
packages/core/hash/hash.ts (1)
  • OpaqueHash (14-14)
🔇 Additional comments (34)
packages/core/utils/compatibility.ts (1)

8-8: Version update looks good.

The update from V0_6_4 to V0_6_7 aligns with the broader changes in this PR. The logic and validation remain unchanged.

packages/jam/block-json/common.ts (2)

7-11: Well-structured generic byte parsers.

The new bytesN and bytesNNoPrefix functions provide flexible byte parsing for arbitrary lengths while maintaining type safety. The generic type parameters with appropriate defaults are well-designed.


18-20: Consistent prefix handling improvements.

The change to use BytesBlob.parseBlob for bytesBlob and the addition of bytesBlobNoPrefix provide clearer separation between prefix and no-prefix parsing variants.

bin/test-runner/index.ts (1)

16-16: Test suite addition looks good.

The new "javajam" suite entry follows the established pattern and integrates well with the existing test infrastructure.

bin/test-runner/package.json (2)

20-20: New dependency addition is appropriate.

The @typeberry/database-lmdb dependency supports the new state loading and storage utilities for the javajam test runner. The version is consistent with other typeberry packages.


37-37: Script addition follows established pattern.

The new "javajam" script follows the same pattern as the existing test runners and integrates well with the test infrastructure.

packages/jam/jam-host-calls/externalities/state-update.ts (2)

9-9: Import addition for per-core type is correct.

The PerCore import is necessary to support the new per-core authorization model.


125-125: Type change aligns with per-core authorization model.

The change from ServiceId to PerCore<ServiceId> for the authorizer property correctly reflects the architectural shift to per-core authorization managers, as mentioned in the AI summary.

packages/jam/transition/accumulate/accumulate.ts (1)

425-425: Correct adaptation to multi-core authorization managers.

The change from checking a single authManager to using .some() with an array correctly adapts to the new PerCore<ServiceId> structure for authorization managers. The logic maintains the same semantic meaning while supporting multiple authorization managers per core.

packages/jam/state/state.ts (2)

13-13: Updated import to support new RecentBlocks structure.

The import change from BlockState to RecentBlocks aligns with the structural refactoring of recent blocks representation.


140-140: Improved state structure with RecentBlocks encapsulation.

The change from KnownSizeArray<BlockState, ...> to RecentBlocks represents a well-designed structural improvement. The new RecentBlocks class encapsulates both the blocks array and MMR structure, providing a richer data model while maintaining access to the blocks through the blocks property.

packages/jam/config/node/jip-chain-spec.ts (2)

2-2: Appropriate use of type-only import.

The change to a type-only import for Bytes is correct since it's only used for type annotations in this file.


69-69: Simplified JSON deserialization with specialized utility functions.

The change from custom parsing logic to using fromJson.bytesNNoPrefix(31) and fromJson.bytesBlobNoPrefix improves code clarity and maintainability. The specialized utility functions provide more declarative and consistent parsing behavior.

packages/jam/state-merkleization/serialize.ts (2)

30-30: Updated import to align with RecentBlocks refactoring.

The import change from BlockState and MAX_RECENT_HISTORY to RecentBlocks is consistent with the broader refactoring of recent blocks representation.


67-67: Cleaner serialization using RecentBlocks.Codec.

The change from manually constructing a known-size array codec to using RecentBlocks.Codec is a cleaner approach. The RecentBlocks.Codec handles the serialization of both the blocks array and MMR structure internally, providing better encapsulation and maintainability.

packages/jam/transition/reports/verify-contextual.ts (3)

88-88: LGTM! Consistent with the RecentBlocks structural refactoring.

The updates to access state.recentBlocks.blocks align with the broader refactoring where recentBlocks is now a RecentBlocks object containing a blocks array.

Also applies to: 142-143, 281-282


137-137: Good practice: Unused parameter marked with underscore prefix.

The _hasher naming convention clearly indicates the parameter is currently unused.


169-176: Verify: Is the MMR validation removal temporary?

The BEEFY super peak hash verification has been disabled. This removes an important validation step that ensures the integrity of the MMR structure.

Is this a temporary change as part of the ongoing refactoring, or is the MMR validation being permanently removed? If permanent, please ensure that validation is handled elsewhere or document why it's no longer needed.

packages/jam/state/privileged-services.ts (1)

3-3: Well-implemented per-core structure for authManager.

The change from a single ServiceId to PerCore<ServiceId> is consistently implemented across imports, codec, and property declaration. This aligns with the broader architectural shift to support per-core authorization management.

Also applies to: 30-30, 47-47

bin/test-runner/javajam.ts (1)

1-14: LGTM! Clean implementation of the JavaJam test runner.

The new test runner follows the established pattern and is properly configured to handle state transition tests. The error handling and logging are appropriate.

packages/jam/database/truncated-hash-dictionary.ts (1)

38-41: Excellent additions to complete the dictionary interface.

The new size, has, and values methods provide essential dictionary functionality:

  • size getter properly delegates to the underlying dictionary
  • has method correctly applies the same truncation logic as other methods
  • values iterator enables standard iteration patterns

These additions make TruncatedHashDictionary a more complete and usable collection.

Also applies to: 49-54, 68-71

packages/jam/transition/recent-history.ts (2)

43-43: Properly adapted to the new RecentBlocks structure.

The changes correctly handle the new state structure where:

  • recentBlocks is now an object with blocks array and mmr field
  • accumulationResult replaces the mmr property in BlockState
  • The return value preserves the existing MMR data unchanged

Also applies to: 61-61, 72-75


50-56: Consistent with MMR handling changes across the codebase.

The MMR construction and update logic has been disabled, matching the pattern seen in verify-contextual.ts. The code now simply stores the accumulateRoot as accumulationResult without active MMR manipulation.

Please confirm that this simplified approach to MMR handling is intentional and that MMR data integrity is maintained through other means in the system.

bin/test-runner/w3f/accumulate.ts (3)

9-9: Import addition looks good.

The tryAsPerCore import is correctly added to support the new per-core authorization management functionality.


41-41: Consistent type change from single to array.

The change from assign: number to assign: number[] is correctly implemented in both the JSON parsing schema and type definition, supporting the shift to per-core authorization management.

Also applies to: 59-59


85-88: Well-implemented per-core authorization management.

The change correctly maps the array of assign privileges to per-core ServiceIds using tryAsPerCore with proper validation against the chain specification.

packages/jam/state/recent-blocks.ts (1)

10-35: Well-implemented class following coding guidelines.

The RecentBlocks class correctly follows the TypeScript coding guidelines with:

  • Static Codec field for serialization/deserialization
  • Private constructor ensuring controlled instantiation
  • Static create method for object creation
  • Proper type definitions and constraints on array sizes
  • Appropriate use of WithDebug extension

The implementation properly encapsulates recent blocks history with MMR data structure.

bin/test-runner/state-transition/state-loader.ts (2)

9-16: Clean data class implementation.

The KeyVal class is properly implemented with appropriate JSON parsing schema for 31-byte keys and variable-length blob values.


18-35: Proper state loading utility implementation.

The TestState class and loadState function are correctly implemented:

  • Clear JSON parsing schema for state representation
  • Efficient conversion from key-value pairs to truncated hash dictionary
  • Proper use of StateEntries.fromTruncatedDictionaryUnsafe for state creation
  • Clean separation of concerns between parsing and state construction
packages/jam/state/service.ts (3)

48-48: Proper codec field additions.

The new codec fields are correctly implemented:

  • storageOffset uses appropriate u64 type
  • creation and lastAccumulation properly convert u32 to TimeSlot
  • parentService properly converts u32 to ServiceId

All type conversions follow established patterns in the codebase.

Also applies to: 51-53


62-62: Consistent create method updates.

The static create method correctly includes all new fields and passes them to the constructor in the proper order, maintaining consistency with the codec definition.

Also applies to: 65-67


96-107: Well-documented constructor parameters.

The new constructor parameters are properly implemented with:

  • Appropriate types (U64, TimeSlot, ServiceId)
  • Clear JSDoc documentation explaining each field's purpose
  • Consistent formatting with existing parameters
bin/test-runner/common.ts (1)

44-44: Good variable naming and clarity improvements.

The variable renaming and comment updates improve code readability:

  • filestestFiles for better clarity
  • More descriptive variable names in test aggregation (testGroupName, testRunners, batchSize)
  • Clearer comments without changing functionality

These changes enhance maintainability while preserving all existing behavior.

Also applies to: 47-47, 50-51, 80-98

bin/test-runner/state-transition/state-transition.ts (1)

50-50: Sorting by timeSlotIndex is safe as implemented.

The TimeSlot type is an opaque alias over U32 (a number), so at runtime it’s just a number. Subtraction in the sort comparator will work correctly; no special bigint handling is needed.

No changes required for the sort on line 50.

Comment thread packages/jam/state/block-state.ts Outdated
Comment thread bin/test-runner/state-transition/state-transition.ts
@DrEverr
DrEverr force-pushed the maso-javajam-tests branch from 61d29ab to 3b90b96 Compare July 14, 2025 21:08

@tomusdrw tomusdrw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be good to add GHA workflow to run the tests (even though they are skipped). That way we will be able to merge that PR into main and proceed with tests one-by-one.

Comment thread packages/jam/database/truncated-hash-dictionary.ts Outdated
Comment thread bin/test-runner/package.json Outdated
@tomusdrw
tomusdrw enabled auto-merge (squash) July 16, 2025 22:55
@github-actions

Copy link
Copy Markdown
View all
File Benchmark Ops
bytes/hex-to.ts[0] number toString + padding 334229.9 ±0.1% fastest ✅
bytes/hex-to.ts[1] manual 16492.08 ±0.21% 95.07% slower
codec/bigint.compare.ts[0] compare custom 271096295.04 ±5.19% 0.5% slower
codec/bigint.compare.ts[1] compare bigint 272459810.16 ±4.58% fastest ✅
bytes/hex-from.ts[0] parse hex using Number with NaN checking 146208.48 ±0.07% 83.83% slower
bytes/hex-from.ts[1] parse hex from char codes 903971.05 ±0.07% fastest ✅
bytes/hex-from.ts[2] parse hex from string nibbles 564807.86 ±0.22% 37.52% slower
collections/map-set.ts[0] 2 gets + conditional set 121391.51 ±0.12% fastest ✅
collections/map-set.ts[1] 1 get 1 set 60907.03 ±0.52% 49.83% slower
codec/bigint.decode.ts[0] decode custom 170598866.95 ±3.16% fastest ✅
codec/bigint.decode.ts[1] decode bigint 105568332.2 ±3.02% 38.12% slower
math/count-bits-u64.ts[0] standard method 9160267.95 ±0.42% 90.13% slower
math/count-bits-u64.ts[1] magic 92774256.72 ±1.49% fastest ✅
hash/index.ts[0] hash with numeric representation 189.44 ±0.11% 28.59% slower
hash/index.ts[1] hash with string representation 120.74 ±0.31% 54.49% slower
hash/index.ts[2] hash with symbol representation 183.91 ±0.29% 30.68% slower
hash/index.ts[3] hash with uint8 representation 163.92 ±0.3% 38.21% slower
hash/index.ts[4] hash with packed representation 265.29 ±0.49% fastest ✅
hash/index.ts[5] hash with bigint representation 193.29 ±0.18% 27.14% slower
hash/index.ts[6] hash with uint32 representation 204.88 ±0.34% 22.77% slower
logger/index.ts[0] console.log with string concat 9280052.91 ±28.12% fastest ✅
logger/index.ts[1] console.log with args 632811.26 ±84.36% 93.18% slower
math/add_one_overflow.ts[0] add and take modulus 207768813.44 ±37.12% 15.51% slower
math/add_one_overflow.ts[1] condition before calculation 245917119.23 ±5.97% fastest ✅
math/count-bits-u32.ts[0] standard method 85415369.61 ±1.75% 67.17% slower
math/count-bits-u32.ts[1] magic 260176463.07 ±4.16% fastest ✅
codec/encoding.ts[0] manual encode 37481.83 ±52.36% 98.54% slower
codec/encoding.ts[1] int32array encode 2008315.71 ±4.32% 22.04% slower
codec/encoding.ts[2] dataview encode 2576067.01 ±1.67% fastest ✅
codec/decoding.ts[0] manual decode 12753704.76 ±0.44% 92.11% slower
codec/decoding.ts[1] int32array decode 160942265.6 ±2.39% 0.48% slower
codec/decoding.ts[2] dataview decode 161718632.34 ±3.34% fastest ✅
math/mul_overflow.ts[0] multiply and bring back to u32 263159913.81 ±6.04% 1.21% slower
math/mul_overflow.ts[1] multiply and take modulus 266384476.67 ±6% fastest ✅
math/switch.ts[0] switch 262808294.21 ±5.09% fastest ✅
math/switch.ts[1] if 251444050.34 ±6.3% 4.32% slower
codec/view_vs_collection.ts[0] Get first element from Decoded 24842.6 ±3.51% 59.73% slower
codec/view_vs_collection.ts[1] Get first element from View 61697.42 ±3.31% fastest ✅
codec/view_vs_collection.ts[2] Get 50th element from Decoded 27084.9 ±0.15% 56.1% slower
codec/view_vs_collection.ts[3] Get 50th element from View 35448 ±2.48% 42.55% slower
codec/view_vs_collection.ts[4] Get last element from Decoded 26602.7 ±0.16% 56.88% slower
codec/view_vs_collection.ts[5] Get last element from View 25877.52 ±0.72% 58.06% slower
codec/view_vs_object.ts[0] Get the first field from Decoded 427048.79 ±0.26% fastest ✅
codec/view_vs_object.ts[1] Get the first field from View 97767.94 ±1.06% 77.11% slower
codec/view_vs_object.ts[2] Get the first field as view from View 86159.63 ±1.21% 79.82% slower
codec/view_vs_object.ts[3] Get two fields from Decoded 395814.29 ±1.57% 7.31% slower
codec/view_vs_object.ts[4] Get two fields from View 74798.94 ±1.76% 82.48% slower
codec/view_vs_object.ts[5] Get two fields from materialized from View 163625.64 ±0.75% 61.68% slower
codec/view_vs_object.ts[6] Get two fields as views from View 40956.55 ±94.09% 90.41% slower
codec/view_vs_object.ts[7] Get only third field from Decoded 226619.87 ±4.88% 46.93% slower
codec/view_vs_object.ts[8] Get only third field from View 82201.49 ±1.83% 80.75% slower
codec/view_vs_object.ts[9] Get only third field as view from View 80929 ±3.16% 81.05% slower
collections/map_vs_sorted.ts[0] Map 227672.61 ±0.05% fastest ✅
collections/map_vs_sorted.ts[1] Map-array 103542.46 ±0.03% 54.52% slower
collections/map_vs_sorted.ts[2] Array 71457.53 ±4.22% 68.61% slower
collections/map_vs_sorted.ts[3] SortedArray 188855.67 ±0.51% 17.05% slower
bytes/compare.ts[0] Comparing Uint32 bytes 17262.42 ±1.4% 16.31% slower
bytes/compare.ts[1] Comparing raw bytes 20626.77 ±2.16% fastest ✅
hash/blake2b.ts[0] hasher with simple allocator 0.0453 ±0.73% 0.22% slower
hash/blake2b.ts[1] hasher with page allocator 0.0454 ±0.08% fastest ✅
crypto/ed25519.ts[0] native crypto 8.27 ±0.51% 72.29% slower
crypto/ed25519.ts[1] wasm lib 10.64 ±0.05% 64.36% slower
crypto/ed25519.ts[2] wasm lib batch 29.85 ±0.53% fastest ✅

Benchmarks summary: 63/63 OK ✅

@tomusdrw
tomusdrw merged commit 2bfcd29 into main Jul 16, 2025
10 checks passed
@tomusdrw
tomusdrw deleted the maso-javajam-tests branch July 16, 2025 23:32
@coderabbitai coderabbitai Bot mentioned this pull request Oct 27, 2025
7 tasks
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.

2 participants