Skip to content

Conversation

@carllin
Copy link
Contributor

@carllin carllin commented Mar 18, 2025

Problem

  1. Alpenglow reduces the number of ticks to one per slot, and no ticks for skip slots, but the tick verification code still expects ticks_per_slot ticks for every slot between the slot X and its parent Y
  2. Current PoH verification expects hashes_per_tick hashes between each tick, but alpenglow doesn't actually hash, so we should remove that check for alpenglow ticks

Summary of Changes

Fixes #

@carllin carllin requested review from ksn6 and wen-coding March 18, 2025 07:13

if let Some(first_alpenglow_slot) = bank
.feature_set
.activated_slot(&solana_feature_set::secp256k1_program_enabled::id())
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think I keep seeing this check everywhere, is it possible we do it in one place and pass around?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think it's uglier to do that, you would have to add arguments to all these functions that already take a bank

// 2. One extra tick for the actual alpenglow slot
(first_alpenglow_slot - parent_slot - 1) * bank.ticks_per_slot() + 1
} else {
1
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment that in Alpenglow world we have no tick for skipped slots?

1
}
};
bank.set_tick_height(bank.max_tick_height() - num_expected_ticks);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we need to add assertion here this value is something reasonable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's strictly less than max_tick_height() which is something reasonable

// check above. Because in Alpenglow the last tick does not have any
// hashing guarantees, we pass everything but that last tick to the
// entry verification.
entries = &entries[..entries.len() - 1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Err, do we have to change entries inside verify_ticks? Can we do skip_verification for all Alpenglow blocks instead in the caller?

Copy link
Contributor Author

@carllin carllin Mar 19, 2025

Choose a reason for hiding this comment

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

we need to verify alpenglow blocks that have parents from before the epoch boundary because those parents have ticks, otherwise anybody could make a new alpenglow block with a very early parent from the previous epoch

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we someday do without that one tick in Alpenglow block?

if bank.slot() >= first_alpenglow_slot && next_bank_tick_height == max_bank_tick_height {
if entries.is_empty() {
// This shouldn't happen, but good to double check
error!("Processing empty entries in verify_ticks()");
Copy link
Contributor

Choose a reason for hiding this comment

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

If this shouldn't happen, should we return Ok(()) here?

Copy link
Contributor Author

@carllin carllin Mar 19, 2025

Choose a reason for hiding this comment

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

It shouldn't happen because I'm assuming the callers will not pass this function an empty set of entries to verify, i.e. blockstore shouldn't deserialize empty entries

But an empty set of entries always passes the hashes_per_tick() check, so returning Ok(()) is fine here

@carllin carllin merged commit d1e1067 into anza-xyz:master Mar 20, 2025
7 checks passed
bw-solana pushed a commit to bw-solana/alpenglow that referenced this pull request Aug 1, 2025
bw-solana pushed a commit to bw-solana/alpenglow that referenced this pull request Aug 1, 2025
bw-solana pushed a commit to bw-solana/alpenglow that referenced this pull request Aug 1, 2025
bw-solana pushed a commit to bw-solana/alpenglow that referenced this pull request Aug 1, 2025
bw-solana pushed a commit to bw-solana/alpenglow that referenced this pull request Aug 1, 2025
bw-solana pushed a commit to bw-solana/alpenglow that referenced this pull request Aug 1, 2025
bw-solana pushed a commit to bw-solana/alpenglow that referenced this pull request Aug 2, 2025
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