Skip to content

Shuffling for 32 bit platforms #7725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions consensus/swap_or_not_shuffle/src/shuffle_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ pub fn shuffle_list(
loop {
buf.set_round(r);

let pivot = buf.raw_pivot() as usize % list_size;

let pivot = (buf.raw_pivot() % list_size as u64) as usize;
let mirror = (pivot + 1) >> 1;

buf.mix_in_position(pivot >> 8);
Expand Down
4 changes: 2 additions & 2 deletions consensus/types/src/subnet_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const MAX_SUBNET_ID: usize = 64;

/// The number of bits in a Discovery `NodeId`. This is used for binary operations on the node-id
/// data.
const NODE_ID_BITS: u64 = 256;
const NODE_ID_BITS: u32 = 256;

static SUBNET_ID_TO_STRING: LazyLock<Vec<String>> = LazyLock::new(|| {
let mut v = Vec::with_capacity(MAX_SUBNET_ID);
Expand Down Expand Up @@ -102,7 +102,7 @@ impl SubnetId {
spec: &ChainSpec,
) -> impl Iterator<Item = SubnetId> {
// The bits of the node-id we are using to define the subnets.
let prefix_bits = spec.attestation_subnet_prefix_bits as u64;
let prefix_bits = spec.attestation_subnet_prefix_bits as u32;

let node_id = U256::from_be_slice(&raw_node_id);
// calculate the prefixes used to compute the subnet and shuffling
Expand Down