Skip to content

feat(alpenglow): introducing BlockComponent#10090

Merged
ksn6 merged 6 commits intoanza-xyz:masterfrom
ksn6:upstream-block-component
Jan 17, 2026
Merged

feat(alpenglow): introducing BlockComponent#10090
ksn6 merged 6 commits intoanza-xyz:masterfrom
ksn6:upstream-block-component

Conversation

@ksn6
Copy link
Copy Markdown

@ksn6 ksn6 commented Jan 16, 2026

Problem

We need a unified, extensible data structure to represent the components of a Solana block, covering both normal transaction entries and special markers.

The structure must support a number of Alpenglow-related needs, e.g.:

... all the while remaining flexible for new marker types in the future.

Summary of Changes

We introduce a new enum, BlockComponent, which represents one logical element within a block. This code was originally designed in the alpenglow repository.

@ksn6 ksn6 requested review from AshwinSekar and cpubot January 16, 2026 19:16
@ksn6 ksn6 force-pushed the upstream-block-component branch from f56e006 to d60a792 Compare January 16, 2026 19:16
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 52.47934% with 115 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.5%. Comparing base (e0cea2e) to head (d5ad9a6).

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #10090     +/-   ##
=========================================
- Coverage    82.6%    82.5%   -0.1%     
=========================================
  Files         844      845      +1     
  Lines      316634   316876    +242     
=========================================
+ Hits       261631   261707     +76     
- Misses      55003    55169    +166     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ksn6 ksn6 requested a review from cpubot January 16, 2026 20:30
const TYPE_META: TypeMeta = match T::TYPE_META {
TypeMeta::Static { size, zero_copy } => TypeMeta::Static {
size: size + std::mem::size_of::<u16>(),
zero_copy,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think LengthPrefixed should ever be zero_copy: true.

Presumably this design anticipates variable length payloads, given that we write an explicit length prefix in serialization. This would disqualify it for zero-copy generally from a design perspective.

Structurally, LengthPrefixed's layout wouldn't support zero-copy either, as it doesn't actually house a length value (it's ignored in deserialization and not specified in the struct definition). As such, a raw byte read of size_of::<u16>() + size_of::<T>() bytes would be invalid to initialize T by definition.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure, makes sense - setting zero_copy to false in the write and read cases impl's.

@ksn6 ksn6 requested a review from cpubot January 16, 2026 21:20
type Src = Self;

const TYPE_META: TypeMeta = match T::TYPE_META {
TypeMeta::Static { size, .. } => TypeMeta::Static {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's probably not static either right? Or am I misunderstanding?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I guess if you KNEW up-front the T that you're deserializing you could conceivably use static. But presumably for the intended use-case T must be treated as opaque? I.e., should LengthPrefixed actually contain a blob of bytes rather than some T (e.g., Vec<u8>), or is the case that for the purposes of this module we'll always know T, but downstream consumption code will have to treat it as opaque?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Discussed offline - we'll want to keep this as-is, since TYPE_META is inferred based on T and LengthPrefixed is purely used for serialization purposes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Turns out we can simplify this substantially and get zero-copy going as well. Thanks @cpubot !

@ksn6 ksn6 force-pushed the upstream-block-component branch from 18e023d to d8cbc59 Compare January 17, 2026 00:45
Copy link
Copy Markdown

@cpubot cpubot left a comment

Choose a reason for hiding this comment

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

LGTM

@ksn6 ksn6 force-pushed the upstream-block-component branch from 6f07ea2 to d5ad9a6 Compare January 17, 2026 19:18
@ksn6 ksn6 enabled auto-merge January 17, 2026 19:49
@ksn6 ksn6 added this pull request to the merge queue Jan 17, 2026
Merged via the queue into anza-xyz:master with commit e5ec863 Jan 17, 2026
58 checks passed
@ksn6 ksn6 deleted the upstream-block-component branch January 17, 2026 20:41
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.

4 participants