Skip to content

Add tickets mode to block generator#923

Merged
tomusdrw merged 14 commits into
mainfrom
ms-generator-tickets-mode
May 15, 2026
Merged

Add tickets mode to block generator#923
tomusdrw merged 14 commits into
mainfrom
ms-generator-tickets-mode

Conversation

@mateuszsikora

Copy link
Copy Markdown
Contributor

No description provided.

@mateuszsikora mateuszsikora marked this pull request as draft March 10, 2026 06:21
@coderabbitai

coderabbitai Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds an optional async ticket validation hook to TicketDistributionTask via setOnTicketReceived so incoming tickets are conditionally enqueued; validation failures or errors drop tickets with a warning. addTicket now ignores tickets from past epochs and only clears pending tickets when the epoch advances. Block-authoring accepts verified pending tickets and prepares ticket extrinsics by filtering accumulator entries, sorting by entropy ID, deduplicating, and capping by chain spec; tickets are included only during the contest period. A per-ticket ReceivedTicketMessage and a fromWorker.receivedTickets handler were added, and tests were updated/added for ticket flows and generator ticket selection.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

  • FluffyLabs/typeberry#916 — Adds e2e test parsing addTicket logs that exercise epoch filtering and distribution behavior changed here.
  • FluffyLabs/typeberry#911 — Modifies the base ticket distribution/reception flow that this PR extends with async validation and receivedTickets wiring.
  • FluffyLabs/typeberry#897 — Introduces Tickets-mode generation/state that the block-authoring pending-ticket flow and authorship cache build upon.

Suggested reviewers

  • skoszuta
  • DrEverr
  • tomusdrw

Poem

🐇 I found a ticket in the grass, so neat,
I sniffed, I checked, I tapped my feet.
Some I drop, some I keep, some I send along,
Sorted and stitched into the chain's song.
Hooray — the blocks all sing along!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess relevance to the changeset. Add a pull request description explaining the tickets mode implementation, its purpose, and how the ticket validation and distribution mechanisms work.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add tickets mode to block generator' is directly related to the main changes: implementing ticket selection and handling in the block authorship generator across multiple files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ms-generator-tickets-mode

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mateuszsikora

Copy link
Copy Markdown
Contributor Author

@fluffylabs-bot benchmark

@fluffylabs-bot

fluffylabs-bot Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Benchmark workflow triggered successfully! 🎉
Requested by: @mateuszsikora
PR number: #923
Target repository: FluffyLabs/typeberry-testing

🔗 Check the Actions tab for workflow progress.

@fluffylabs-bot

Copy link
Copy Markdown
Contributor

Picofuzz Benchmark Results

fallback

Metric @typeberry/jam@0.5.7 Current Difference
min 4.32ms 4.22ms ≈ -0.10ms (-2.29%)
mean 6.15ms 5.96ms ≈ -0.19ms (-3.09%)
p90 7.96ms 7.70ms ≈ -0.27ms (-3.33%)
p99 11.74ms 10.20ms 🟢 -1.54ms (-13.10%)

safrole

Metric @typeberry/jam@0.5.7 Current Difference
min 4.46ms 4.49ms ≈ +0.03ms (+0.66%)
mean 13.92ms 13.62ms ≈ -0.30ms (-2.13%)
p90 24.77ms 24.55ms ≈ -0.22ms (-0.90%)
p99 30.28ms 29.22ms ≈ -1.05ms (-3.48%)

storage

Metric @typeberry/jam@0.5.7 Current Difference
min 4.74ms 4.90ms ≈ +0.16ms (+3.37%)
mean 33.43ms 33.18ms ≈ -0.25ms (-0.75%)
p90 70.91ms 69.39ms ≈ -1.52ms (-2.15%)
p99 95.21ms 94.44ms ≈ -0.78ms (-0.81%)

storage_light

Metric @typeberry/jam@0.5.7 Current Difference
min 6.59ms 6.60ms ≈ +0.01ms (+0.18%)
mean 20.92ms 20.94ms ≈ +0.02ms (+0.08%)
p90 33.27ms 32.61ms ≈ -0.67ms (-2.00%)
p99 44.34ms 44.79ms ≈ +0.44ms (+1.00%)

🤖 Automated benchmark

@mateuszsikora mateuszsikora requested a review from tomusdrw March 28, 2026 15:42
@mateuszsikora mateuszsikora marked this pull request as ready for review March 28, 2026 15:42

@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: 1

🧹 Nitpick comments (1)
packages/workers/block-authorship/main.ts (1)

310-323: Consider adding a defensive length check on verification results.

The code assumes results.length === tickets.length. If bandersnatchVrf.verifyTickets returns fewer results than expected (e.g., due to a bug or early termination), accessing results[i] could return undefined, causing silent filtering of all tickets or runtime errors.

💡 Suggestion to add defensive check
   async function verifyAndAddToPool(epochIndex: number, tickets: SignedTicket[], state: State): Promise<boolean> {
     const results = await bandersnatchVrf.verifyTickets(
       bandersnatch,
       state.designatedValidatorData.length,
       state.epochRoot,
       tickets,
       getTicketEntropy(epochIndex, state),
     );
+    if (results.length !== tickets.length) {
+      logger.warn`verifyTickets returned ${results.length} results for ${tickets.length} tickets`;
+      return false;
+    }
     const verified = tickets
       .map((ticket, i) => ({ ticket, id: results[i].entropyHash }))
       .filter((_, i) => results[i].isValid);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/workers/block-authorship/main.ts` around lines 310 - 323, The
verifyAndAddToPool function assumes bandersnatchVrf.verifyTickets returns a
result per ticket; add a defensive check after calling
bandersnatchVrf.verifyTickets to ensure results.length === tickets.length and
handle mismatches (e.g., log an error via the existing logger, avoid indexing
into undefined, and return false or throw) before mapping/filtering; update
references to tickets, results, addToPool and verifyAndAddToPool so you only
call addToPool when the verification results align with the tickets and no
undefined entries will be accessed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/jam/jamnp-s/tasks/ticket-distribution.ts`:
- Around line 160-168: The current call to
this.onTicketReceivedCallback(epochIndex, ticket).then(...) lacks a rejection
handler and can cause unhandled promise rejections; update the handling for
onTicketReceivedCallback in ticket-distribution.ts so any thrown error or
rejected promise is caught (use Promise.resolve(...) if necessary) and in the
.catch() log a clear message via logger.warn or logger.error including
epochIndex, ticket id/summary and the error, and ensure the ticket is treated as
dropped (i.e., do not call this.addTicket on errors).

---

Nitpick comments:
In `@packages/workers/block-authorship/main.ts`:
- Around line 310-323: The verifyAndAddToPool function assumes
bandersnatchVrf.verifyTickets returns a result per ticket; add a defensive check
after calling bandersnatchVrf.verifyTickets to ensure results.length ===
tickets.length and handle mismatches (e.g., log an error via the existing
logger, avoid indexing into undefined, and return false or throw) before
mapping/filtering; update references to tickets, results, addToPool and
verifyAndAddToPool so you only call addToPool when the verification results
align with the tickets and no undefined entries will be accessed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4e029d37-f68c-4015-9127-2bf9e7ae3a2d

📥 Commits

Reviewing files that changed from the base of the PR and between 47fe638 and 21901a3.

📒 Files selected for processing (8)
  • packages/jam/jamnp-s/tasks/ticket-distribution.test.ts
  • packages/jam/jamnp-s/tasks/ticket-distribution.ts
  • packages/workers/block-authorship/generator.test.ts
  • packages/workers/block-authorship/generator.ts
  • packages/workers/block-authorship/main.ts
  • packages/workers/comms-authorship-network/protocol.ts
  • packages/workers/comms-authorship-network/tickets-message.ts
  • packages/workers/jam-network/main.ts

Comment thread packages/jam/jamnp-s/tasks/ticket-distribution.ts Outdated

@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: 1

♻️ Duplicate comments (1)
packages/jam/jamnp-s/tasks/ticket-distribution.ts (1)

162-172: ⚠️ Potential issue | 🟠 Major

One error-handling gap remains for synchronous validator failures.

The new .catch() covers rejected promises, but a validator that throws before returning one still escapes onTicketReceived(). Wrap the invocation in Promise.resolve().then(...) or an async helper so both failure modes go through the same drop/log path.

🛠️ Suggested change
     if (this.onTicketReceivedCallback !== null) {
+      const onTicketReceivedCallback = this.onTicketReceivedCallback;
       // Validate first; only redistribute if valid to avoid spreading tampered tickets.
-      this.onTicketReceivedCallback(epochIndex, ticket)
+      void Promise.resolve()
+        .then(() => onTicketReceivedCallback(epochIndex, ticket))
         .then((isValid) => {
           if (isValid) {
             this.addTicket(epochIndex, ticket);
           } else {
             logger.warn`Dropping invalid ticket for epoch ${epochIndex} (validation failed)`;
#!/bin/bash
node <<'NODE'
const cb = () => { throw new Error("sync boom"); };

try {
  cb().catch(() => console.log("never reached"));
} catch (error) {
  console.log("escaped:", error.message);
}

Promise.resolve()
  .then(() => cb())
  .catch((error) => console.log("normalized:", error.message));
NODE
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/jam/jamnp-s/tasks/ticket-distribution.ts` around lines 162 - 172,
The call to onTicketReceivedCallback can throw synchronously and currently
escapes the promise catch; wrap the invocation so both sync throws and returned
rejections are handled: replace the direct
this.onTicketReceivedCallback(epochIndex, ticket).then(...).catch(...) pattern
with a Promise.resolve().then(() => this.onTicketReceivedCallback(epochIndex,
ticket)).then((isValid) => { if (isValid) this.addTicket(epochIndex, ticket);
else logger.warn`Dropping invalid ticket for epoch ${epochIndex} (validation
failed)`; }).catch((error) => logger.error`Error validating ticket for epoch
${epochIndex}, attempt ${ticket.attempt}: ${error}`) (or equivalently call an
async helper that awaits onTicketReceivedCallback and uses the same then/catch
handlers).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/jam/jamnp-s/tasks/ticket-distribution.ts`:
- Around line 162-166: A late validator completion can reset state by calling
addTicket(epochIndex, ticket) with an older epoch; before invoking addTicket
from onTicketReceivedCallback's then branch, check the epochIndex against the
currentEpoch and drop/ignore any result older than this.currentEpoch (or
alternatively make addTicket monotonic by having it only advance or equal epochs
and never rollback currentEpoch or clear newer queues when epochIndex <
currentEpoch); update the logic around onTicketReceivedCallback, addTicket and
currentEpoch to enforce this monotonicity so delayed successes do not wipe newer
epoch state.

---

Duplicate comments:
In `@packages/jam/jamnp-s/tasks/ticket-distribution.ts`:
- Around line 162-172: The call to onTicketReceivedCallback can throw
synchronously and currently escapes the promise catch; wrap the invocation so
both sync throws and returned rejections are handled: replace the direct
this.onTicketReceivedCallback(epochIndex, ticket).then(...).catch(...) pattern
with a Promise.resolve().then(() => this.onTicketReceivedCallback(epochIndex,
ticket)).then((isValid) => { if (isValid) this.addTicket(epochIndex, ticket);
else logger.warn`Dropping invalid ticket for epoch ${epochIndex} (validation
failed)`; }).catch((error) => logger.error`Error validating ticket for epoch
${epochIndex}, attempt ${ticket.attempt}: ${error}`) (or equivalently call an
async helper that awaits onTicketReceivedCallback and uses the same then/catch
handlers).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fb50a407-7a68-47fd-9e32-91b6131d2b08

📥 Commits

Reviewing files that changed from the base of the PR and between 21901a3 and 4f5e97b.

📒 Files selected for processing (2)
  • packages/jam/jamnp-s/tasks/ticket-distribution.ts
  • packages/workers/block-authorship/main.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/workers/block-authorship/main.ts

Comment thread packages/jam/jamnp-s/tasks/ticket-distribution.ts Outdated

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/jam/jamnp-s/tasks/ticket-distribution.ts`:
- Around line 167-175: Prevent duplicate concurrent validations by tracking an
in-flight key composed of epochIndex + ticket signature before calling
onTicketReceivedCallback: in the on-ticket handling path where you currently
call Promise.resolve().then(() => cb(epochIndex, ticket)), add a short-circuit
check using a per-instance Map/Set keyed by `${epochIndex}:${ticket.signature}`
(or equivalent unique signature field) to see if validation is already pending;
if present, skip calling this.onTicketReceivedCallback and return early,
otherwise insert the key, call cb(...), and ensure you remove the in-flight key
in both the .then and .catch (or finally) branches; leave addTicket(epochIndex,
ticket) as the commit step after the validator returns true.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9d435924-2439-465e-a8b8-9d20f2e3f370

📥 Commits

Reviewing files that changed from the base of the PR and between 4f5e97b and dcea3e1.

📒 Files selected for processing (1)
  • packages/jam/jamnp-s/tasks/ticket-distribution.ts

Comment thread packages/jam/jamnp-s/tasks/ticket-distribution.ts
Comment thread packages/jam/jamnp-s/tasks/ticket-distribution.ts
Comment thread packages/jam/jamnp-s/tasks/ticket-distribution.ts
Comment thread packages/workers/block-authorship/generator.ts
Comment thread packages/workers/block-authorship/main.ts Outdated
Comment thread packages/workers/block-authorship/main.ts Outdated
Comment thread packages/workers/block-authorship/main.ts Outdated
Comment thread packages/workers/block-authorship/main.ts
Comment thread packages/workers/comms-authorship-network/protocol.ts
Comment thread packages/workers/jam-network/main.ts

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/workers/block-authorship/main.ts`:
- Around line 425-430: The code only calls buildTicketAuthorshipCache(...)
inside the isNewEpoch branch so a worker that started mid-epoch with no prebuilt
cache (ticketAuthorshipCache === null) will never build it; modify the logic in
main.ts near the isNewEpoch block to also call await
buildTicketAuthorshipCache(selingKeySeriesResult.ok, state.entropy[2]) when
ticketAuthorshipCache === null (i.e., after startup when prebuild was skipped)
so the cache is initialized immediately; reference the ticketAuthorshipCache
variable and the buildTicketAuthorshipCache(...) function and ensure the call is
awaited exactly once when either isNewEpoch is true or ticketAuthorshipCache ===
null.
- Around line 108-117: The eager cache build (call to
buildTicketAuthorshipCache) runs before the ticketAuthorshipCache variable is
declared, causing a TDZ crash; move the cache-building call so it happens after
ticketAuthorshipCache is initialized (or alternatively hoist the
ticketAuthorshipCache declaration above this initialState block). Specifically,
in the initialState handling where you call getSealingKeySeries and
logEpochBlockCreation (symbols: initialState, getSealingKeySeries, initialKeys,
logEpochBlockCreation, buildTicketAuthorshipCache), ensure ticketAuthorshipCache
is assigned/declared before invoking buildTicketAuthorshipCache (or relocate the
await buildTicketAuthorshipCache(...) to just after the ticketAuthorshipCache
initialization).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 575ba6ba-a9a4-42e9-a452-49e28a605f6f

📥 Commits

Reviewing files that changed from the base of the PR and between a78503a and 1bd80eb.

📒 Files selected for processing (2)
  • packages/jam/jamnp-s/tasks/ticket-distribution.ts
  • packages/workers/block-authorship/main.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/jam/jamnp-s/tasks/ticket-distribution.ts

Comment thread packages/workers/block-authorship/main.ts
Comment thread packages/workers/block-authorship/main.ts Outdated
@tomusdrw tomusdrw added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit 079e56c May 15, 2026
13 checks passed
@tomusdrw tomusdrw deleted the ms-generator-tickets-mode branch May 15, 2026 16:10
@github-actions

Copy link
Copy Markdown
View all
File Benchmark Ops
bytes/hex-from.ts[0] parse hex using Number with NaN checking 77121.66 ±0.86% 82.11% slower
bytes/hex-from.ts[1] parse hex from char codes 431043.45 ±0.43% fastest ✅
bytes/hex-from.ts[2] parse hex from string nibbles 254001.88 ±0.59% 41.07% slower
bytes/hex-to.ts[0] number toString + padding 86707.63 ±0.62% fastest ✅
bytes/hex-to.ts[1] manual 7470.34 ±1.07% 91.38% slower
codec/bigint.compare.ts[0] compare custom 89228731.61 ±4.96% 4.38% slower
codec/bigint.compare.ts[1] compare bigint 93318279.46 ±4.41% fastest ✅
codec/bigint.decode.ts[0] decode custom 66253386.41 ±3.04% 31.96% slower
codec/bigint.decode.ts[1] decode bigint 97375868.1 ±3.24% fastest ✅
codec/decoding.ts[0] manual decode 9148767.89 ±1.43% 85.98% slower
codec/decoding.ts[1] int32array decode 64523204.73 ±3.13% 1.15% slower
codec/decoding.ts[2] dataview decode 65272094.35 ±3.24% fastest ✅
codec/encoding.ts[0] manual encode 1267589.63 ±0.87% 16.22% slower
codec/encoding.ts[1] int32array encode 1513057.94 ±0.44% fastest ✅
codec/encoding.ts[2] dataview encode 1479266.4 ±0.65% 2.23% slower
collections/map-set.ts[0] 2 gets + conditional set 95711.08 ±0.78% fastest ✅
collections/map-set.ts[1] 1 get 1 set 66469.29 ±0.4% 30.55% slower
logger/index.ts[0] console.log with string concat 5654837.99 ±17.43% fastest ✅
logger/index.ts[1] console.log with args 1610827.67 ±61.61% 71.51% slower
math/add_one_overflow.ts[0] add and take modulus 91248234.49 ±4.27% fastest ✅
math/add_one_overflow.ts[1] condition before calculation 44631693.63 ±88.65% 51.09% slower
math/count-bits-u32.ts[0] standard method 46796384.43 ±2.33% 46.89% slower
math/count-bits-u32.ts[1] magic 88107802.8 ±3.56% fastest ✅
math/count-bits-u64.ts[0] standard method 454924.95 ±0.81% 89.28% slower
math/count-bits-u64.ts[1] magic 4243763.3 ±0.84% fastest ✅
math/mul_overflow.ts[0] multiply and bring back to u32 94190109.42 ±3.54% fastest ✅
math/mul_overflow.ts[1] multiply and take modulus 93681245.67 ±4.2% 0.54% slower
math/switch.ts[0] switch 96613756.07 ±4% fastest ✅
math/switch.ts[1] if 92827683.44 ±4.09% 3.92% slower
hash/index.ts[0] hash with numeric representation 64.07 ±0.53% 34.1% slower
hash/index.ts[1] hash with string representation 41 ±1.35% 57.83% slower
hash/index.ts[2] hash with symbol representation 64.12 ±0.71% 34.05% slower
hash/index.ts[3] hash with uint8 representation 71.99 ±0.6% 25.95% slower
hash/index.ts[4] hash with packed representation 97.22 ±0.82% fastest ✅
hash/index.ts[5] hash with bigint representation 69.4 ±0.72% 28.62% slower
hash/index.ts[6] hash with uint32 representation 88.48 ±0.56% 8.99% slower
bytes/bytes-to-number.ts[0] Conversion with bitops 3359.11 ±5.05% fastest ✅
bytes/bytes-to-number.ts[1] Conversion without bitops 2726.59 ±3.69% 18.83% slower
bytes/compare.ts[0] Comparing Uint32 bytes 11422.9 ±0.3% 0.61% slower
bytes/compare.ts[1] Comparing raw bytes 11492.95 ±0.49% fastest ✅
codec/view_vs_collection.ts[0] Get first element from Decoded 14419.64 ±0.68% 59.52% slower
codec/view_vs_collection.ts[1] Get first element from View 35624.03 ±0.55% fastest ✅
codec/view_vs_collection.ts[2] Get 50th element from Decoded 14412.12 ±0.77% 59.54% slower
codec/view_vs_collection.ts[3] Get 50th element from View 18998.95 ±0.75% 46.67% slower
codec/view_vs_collection.ts[4] Get last element from Decoded 14484.64 ±0.55% 59.34% slower
codec/view_vs_collection.ts[5] Get last element from View 13434.3 ±0.51% 62.29% slower
codec/view_vs_object.ts[0] Get the first field from Decoded 200856.59 ±0.77% 0.28% slower
codec/view_vs_object.ts[1] Get the first field from View 50697.63 ±0.62% 74.83% slower
codec/view_vs_object.ts[2] Get the first field as view from View 49687.37 ±0.72% 75.33% slower
codec/view_vs_object.ts[3] Get two fields from Decoded 201345.76 ±0.75% 0.03% slower
codec/view_vs_object.ts[4] Get two fields from View 39563.67 ±0.72% 80.36% slower
codec/view_vs_object.ts[5] Get two fields from materialized from View 81089.92 ±0.68% 59.74% slower
codec/view_vs_object.ts[6] Get two fields as views from View 38271.9 ±0.78% 81% slower
codec/view_vs_object.ts[7] Get only third field from Decoded 201411.6 ±0.66% fastest ✅
codec/view_vs_object.ts[8] Get only third field from View 50798.98 ±0.57% 74.78% slower
codec/view_vs_object.ts[9] Get only third field as view from View 51151.18 ±0.45% 74.6% slower
collections/map_vs_sorted.ts[0] Map 109795.72 ±3.38% fastest ✅
collections/map_vs_sorted.ts[1] Map-array 43535.48 ±0.51% 60.35% slower
collections/map_vs_sorted.ts[2] Array 50537.03 ±0.62% 53.97% slower
collections/map_vs_sorted.ts[3] SortedArray 75855.87 ±0.81% 30.91% slower
collections/hash-dict-vs-blob-dict_delete.ts[0] StringHashDictionary 2432.07 ±0.78% fastest ✅
collections/hash-dict-vs-blob-dict_delete.ts[1] BlobDictionary(1) 70.73 ±43.7% 97.09% slower
collections/hash-dict-vs-blob-dict_delete.ts[2] BlobDictionary(2) 2407.95 ±0.7% 0.99% slower
collections/hash-dict-vs-blob-dict_delete.ts[3] BlobDictionary(3) 2389.14 ±0.83% 1.77% slower
collections/hash-dict-vs-blob-dict_delete.ts[4] BlobDictionary(4) 2321.65 ±1.03% 4.54% slower
collections/hash-dict-vs-blob-dict_delete.ts[5] BlobDictionary(5) 2410.32 ±0.64% 0.89% slower
collections/hash-dict-vs-blob-dict_get.ts[0] StringHashDictionary 2823.42 ±0.61% 1.92% slower
collections/hash-dict-vs-blob-dict_get.ts[1] BlobDictionary(1) 2878.56 ±0.47% fastest ✅
collections/hash-dict-vs-blob-dict_get.ts[2] BlobDictionary(2) 2867.31 ±0.57% 0.39% slower
collections/hash-dict-vs-blob-dict_get.ts[3] BlobDictionary(3) 2811.9 ±0.64% 2.32% slower
collections/hash-dict-vs-blob-dict_get.ts[4] BlobDictionary(4) 2805.77 ±0.67% 2.53% slower
collections/hash-dict-vs-blob-dict_get.ts[5] BlobDictionary(5) 2694.85 ±0.86% 6.38% slower
collections/hash-dict-vs-blob-dict_set.ts[0] StringHashDictionary 2024.24 ±5.02% 10.4% slower
collections/hash-dict-vs-blob-dict_set.ts[1] BlobDictionary(1) 2224.74 ±0.59% 1.52% slower
collections/hash-dict-vs-blob-dict_set.ts[2] BlobDictionary(2) 2225.27 ±0.73% 1.5% slower
collections/hash-dict-vs-blob-dict_set.ts[3] BlobDictionary(3) 2259.1 ±0.56% fastest ✅
collections/hash-dict-vs-blob-dict_set.ts[4] BlobDictionary(4) 2175.22 ±2.73% 3.71% slower
collections/hash-dict-vs-blob-dict_set.ts[5] BlobDictionary(5) 2121.42 ±1.7% 6.09% slower
hash/blake2b.ts[0] our hasher 1.05 ±1.55% fastest ✅
hash/blake2b.ts[1] blake2b js 0.03 ±0.35% 97.14% slower
crypto/ed25519.ts[0] native crypto 5.97 ±1.1% fastest ✅
crypto/ed25519.ts[1] wasm lib 2.84 ±1.12% 52.43% slower
crypto/ed25519.ts[2] wasm lib batch 2.82 ±1.31% 52.76% slower

Benchmarks summary: 83/83 OK ✅

This was referenced Jun 1, 2026
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