Skip to content

Conversation

@lijunwangs
Copy link
Contributor

@lijunwangs lijunwangs commented Nov 6, 2025

This is related to anza-xyz/agave#8836 for anza-xyz/agave#8420

Alpenglow requires sending the pubkey of the client for QUIC connection to the consumer to support censoring a client using the key if the consumer determines the client is misbehaving.

We considered alternatives of adding the information to PacketBatch, BytesPacket, and we think having it in Meta is cleanest.

@alexpyattaev
Copy link
Contributor

Overall LGTM.
I wonder if we should save a bit of memory here and store None as array of zeros (since no valid Pubkey can be made of all zeros).

@lijunwangs
Copy link
Contributor Author

Overall LGTM. I wonder if we should save a bit of memory here and store None as array of zeros (since no valid Pubkey can be made of all zeros).

You meant instead of Option, just store Pubkey?

@alexpyattaev
Copy link
Contributor

You meant instead of Option, just store Pubkey?

Yes, and set it to all zeros when no Pubkey is provided. Have a getter and setter that operate on Option of course. Saves 8 bytes per packet - not sure it is worth the effort though.

@tao-stones
Copy link
Contributor

You meant instead of Option, just store Pubkey?

Yes, and set it to all zeros when no Pubkey is provided. Have a getter and setter that operate on Option of course. Saves 8 bytes per packet - not sure it is worth the effort though.

imo, worth it.

@lijunwangs
Copy link
Contributor Author

You meant instead of Option, just store Pubkey?

Yes, and set it to all zeros when no Pubkey is provided. Have a getter and setter that operate on Option of course. Saves 8 bytes per packet - not sure it is worth the effort though.

imo, worth it.

Done

alexpyattaev
alexpyattaev previously approved these changes Nov 9, 2025
Copy link
Contributor

@alexpyattaev alexpyattaev left a comment

Choose a reason for hiding this comment

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

LGTM (please wait for SDK SME approval)


#[inline]
pub fn remote_pubkey(&self) -> Option<Pubkey> {
if self.remote_pubkey == Pubkey::default() {
Copy link
Contributor

Choose a reason for hiding this comment

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

In such cases it may be preferable to explicitly compare with array of zeros rather than relying on the Default impl staying stable. Unlikely to be a problem for us of course.

@lijunwangs
Copy link
Contributor Author

@joncinque can you help review from sdk side?

Copy link
Collaborator

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Just a couple of small things on my side, looks great otherwise!

pub addr: IpAddr,
pub port: u16,
pub flags: PacketFlags,
remote_pubkey: Pubkey,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Flagging that this is technically a breaking change for anyone who builds a Meta without using Default in some way, ie:

let m = Meta { size, addr, port, flags };

It's not a problem, but probably requires a breaking release

Copy link
Contributor Author

@lijunwangs lijunwangs Nov 11, 2025

Choose a reason for hiding this comment

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

I think they can still use struct Meta, by putting the new flag with default
Met {
size,
add,
port,
flags,
..Meta::default()
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Correct, but that does still constitute a breaking change since old code will no longer compile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, whenever we introduce a field it will break as we lack a constructor.

Copy link
Collaborator

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@lijunwangs lijunwangs merged commit be80a6a into master Nov 12, 2025
24 checks passed
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.

5 participants