Skip to content

Conversation

@mateuszsikora
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 1, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Added comprehensive test coverage for block creation logic, including scenarios for same-epoch slots and epoch boundary transitions.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

A new test file for the Generator's block creation logic in fallback mode has been added with comprehensive test coverage. The file includes mock data structures for validators and blockchain primitives, helper functions to construct mock databases and expected blocks, and test cases covering block creation for same-epoch slots and epoch boundary transitions. Tests verify exact block structure including headers, extrinsics, seals, and epoch markers using mocked VRF and WASM bindings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • tomusdrw
  • skoszuta

Poem

🐰 Hop, hop! New tests bloom bright,
Block creation now tested just right,
Validators dance, epochs align,
With mocks and assertions so fine,
Fallback mode shines in the light!

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% 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 description was provided by the author; this is a completely empty pull request description. Consider adding a brief description explaining the purpose of these tests and what fallback mode functionality they validate.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding comprehensive test suite for Generator's fallback mode block creation logic.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ms-generator-fallback-tests

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

@tomusdrw tomusdrw added this pull request to the merge queue Feb 1, 2026
Merged via the queue into main with commit ab9c0e1 Feb 1, 2026
13 checks passed
@tomusdrw tomusdrw deleted the ms-generator-fallback-tests branch February 1, 2026 10:26
@github-actions
Copy link

github-actions bot commented Feb 1, 2026

View all
File Benchmark Ops
bytes/hex-to.ts[0] number toString + padding 81895.03 ±2.62% fastest ✅
bytes/hex-to.ts[1] manual 6313.91 ±2.67% 92.29% slower
hash/index.ts[0] hash with numeric representation 54.71 ±4.56% 42.03% slower
hash/index.ts[1] hash with string representation 29.95 ±2.72% 68.26% slower
hash/index.ts[2] hash with symbol representation 56.51 ±2.71% 40.12% slower
hash/index.ts[3] hash with uint8 representation 64.02 ±1.58% 32.16% slower
hash/index.ts[4] hash with packed representation 94.37 ±0.84% fastest ✅
hash/index.ts[5] hash with bigint representation 69.82 ±0.65% 26.01% slower
hash/index.ts[6] hash with uint32 representation 79.68 ±0.42% 15.57% slower
codec/bigint.compare.ts[0] compare custom 97589088.97 ±4.86% fastest ✅
codec/bigint.compare.ts[1] compare bigint 96018844.23 ±4.84% 1.61% slower
codec/bigint.decode.ts[0] decode custom 69700097.63 ±3.83% fastest ✅
codec/bigint.decode.ts[1] decode bigint 41555515.73 ±1.71% 40.38% slower
codec/encoding.ts[0] manual encode 931837.89 ±0.45% 12.61% slower
codec/encoding.ts[1] int32array encode 1066255.53 ±0.3% fastest ✅
codec/encoding.ts[2] dataview encode 1063469.67 ±0.47% 0.26% slower
collections/map-set.ts[0] 2 gets + conditional set 84182.92 ±0.89% fastest ✅
collections/map-set.ts[1] 1 get 1 set 48191.62 ±0.67% 42.75% slower
codec/decoding.ts[0] manual decode 9293566.67 ±1.3% 85.9% slower
codec/decoding.ts[1] int32array decode 64253391.71 ±3.74% 2.55% slower
codec/decoding.ts[2] dataview decode 65933353.41 ±3.21% fastest ✅
bytes/hex-from.ts[0] parse hex using Number with NaN checking 45920.88 ±1.35% 88.88% slower
bytes/hex-from.ts[1] parse hex from char codes 413092.28 ±1.92% fastest ✅
bytes/hex-from.ts[2] parse hex from string nibbles 205705.87 ±4.28% 50.2% slower
math/count-bits-u64.ts[0] standard method 343612.66 ±2.78% 86.48% slower
math/count-bits-u64.ts[1] magic 2542218.79 ±1.95% fastest ✅
math/mul_overflow.ts[0] multiply and bring back to u32 80366764.21 ±5.8% fastest ✅
math/mul_overflow.ts[1] multiply and take modulus 80094478.64 ±5.48% 0.34% slower
math/switch.ts[0] switch 78854903.12 ±5.69% fastest ✅
math/switch.ts[1] if 76474884.41 ±6.06% 3.02% slower
math/count-bits-u32.ts[0] standard method 37692262.26 ±3.44% 55% slower
math/count-bits-u32.ts[1] magic 83761656.18 ±5.62% fastest ✅
logger/index.ts[0] console.log with string concat 4672560.41 ±22.47% fastest ✅
logger/index.ts[1] console.log with args 1108736.01 ±99.97% 76.27% slower
math/add_one_overflow.ts[0] add and take modulus 100844868.34 ±3.06% fastest ✅
math/add_one_overflow.ts[1] condition before calculation 81055501.72 ±10.79% 19.62% slower
codec/view_vs_object.ts[0] Get the first field from Decoded 177270.59 ±1.46% 2.91% slower
codec/view_vs_object.ts[1] Get the first field from View 45226.27 ±0.4% 75.23% slower
codec/view_vs_object.ts[2] Get the first field as view from View 43648.99 ±1.38% 76.09% slower
codec/view_vs_object.ts[3] Get two fields from Decoded 178272.82 ±0.61% 2.36% slower
codec/view_vs_object.ts[4] Get two fields from View 36334.84 ±0.75% 80.1% slower
codec/view_vs_object.ts[5] Get two fields from materialized from View 75201.01 ±0.51% 58.81% slower
codec/view_vs_object.ts[6] Get two fields as views from View 36369.48 ±0.58% 80.08% slower
codec/view_vs_object.ts[7] Get only third field from Decoded 182584.08 ±0.57% fastest ✅
codec/view_vs_object.ts[8] Get only third field from View 45675.79 ±0.59% 74.98% slower
codec/view_vs_object.ts[9] Get only third field as view from View 45775.56 ±0.48% 74.93% slower
codec/view_vs_collection.ts[0] Get first element from Decoded 12246.23 ±0.53% 54.34% slower
codec/view_vs_collection.ts[1] Get first element from View 26820.83 ±1.7% fastest ✅
codec/view_vs_collection.ts[2] Get 50th element from Decoded 11846.29 ±1.49% 55.83% slower
codec/view_vs_collection.ts[3] Get 50th element from View 14704.19 ±0.95% 45.18% slower
codec/view_vs_collection.ts[4] Get last element from Decoded 12171.4 ±0.39% 54.62% slower
codec/view_vs_collection.ts[5] Get last element from View 10253.02 ±0.33% 61.77% slower
collections/hash-dict-vs-blob-dict_set.ts[0] StringHashDictionary 1598.74 ±0.67% 0.93% slower
collections/hash-dict-vs-blob-dict_set.ts[1] BlobDictionary(1) 1554.22 ±2.2% 3.69% slower
collections/hash-dict-vs-blob-dict_set.ts[2] BlobDictionary(2) 1544.09 ±1.81% 4.32% slower
collections/hash-dict-vs-blob-dict_set.ts[3] BlobDictionary(3) 1613.77 ±0.62% fastest ✅
collections/hash-dict-vs-blob-dict_set.ts[4] BlobDictionary(4) 1603.81 ±0.6% 0.62% slower
collections/hash-dict-vs-blob-dict_set.ts[5] BlobDictionary(5) 1602.21 ±0.65% 0.72% slower
collections/hash-dict-vs-blob-dict_get.ts[0] StringHashDictionary 2091.25 ±0.61% 0.49% slower
collections/hash-dict-vs-blob-dict_get.ts[1] BlobDictionary(1) 2046.16 ±2.46% 2.64% slower
collections/hash-dict-vs-blob-dict_get.ts[2] BlobDictionary(2) 2024.84 ±1.44% 3.65% slower
collections/hash-dict-vs-blob-dict_get.ts[3] BlobDictionary(3) 2098.5 ±0.59% 0.15% slower
collections/hash-dict-vs-blob-dict_get.ts[4] BlobDictionary(4) 2101.61 ±0.64% fastest ✅
collections/hash-dict-vs-blob-dict_get.ts[5] BlobDictionary(5) 2080.45 ±0.5% 1.01% slower
collections/hash-dict-vs-blob-dict_delete.ts[0] StringHashDictionary 2107.58 ±0.25% 0.48% slower
collections/hash-dict-vs-blob-dict_delete.ts[1] BlobDictionary(1) 1984 ±2.55% 6.31% slower
collections/hash-dict-vs-blob-dict_delete.ts[2] BlobDictionary(2) 2018.77 ±1.45% 4.67% slower
collections/hash-dict-vs-blob-dict_delete.ts[3] BlobDictionary(3) 2045.69 ±0.96% 3.4% slower
collections/hash-dict-vs-blob-dict_delete.ts[4] BlobDictionary(4) 2115.34 ±0.52% 0.11% slower
collections/hash-dict-vs-blob-dict_delete.ts[5] BlobDictionary(5) 2117.67 ±0.49% fastest ✅
collections/map_vs_sorted.ts[0] Map 135524.53 ±0.88% fastest ✅
collections/map_vs_sorted.ts[1] Map-array 44551.6 ±1.79% 67.13% slower
collections/map_vs_sorted.ts[2] Array 28676.59 ±4.45% 78.84% slower
collections/map_vs_sorted.ts[3] SortedArray 82948.74 ±0.33% 38.79% slower
bytes/bytes-to-number.ts[0] Conversion with bitops 3517.46 ±5.83% 6.68% slower
bytes/bytes-to-number.ts[1] Conversion without bitops 3769.41 ±5.47% fastest ✅
bytes/compare.ts[0] Comparing Uint32 bytes 10193.77 ±0.45% 3.6% slower
bytes/compare.ts[1] Comparing raw bytes 10574.05 ±0.35% fastest ✅
hash/blake2b.ts[0] our hasher 1.13 ±0.8% fastest ✅
hash/blake2b.ts[1] blake2b js 0.03 ±0.35% 97.35% slower
crypto/ed25519.ts[0] native crypto 6.11 ±1.23% fastest ✅
crypto/ed25519.ts[1] wasm lib 2.09 ±0.29% 65.79% slower
crypto/ed25519.ts[2] wasm lib batch 2.14 ±0.22% 64.98% slower

Benchmarks summary: 83/83 OK ✅

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants