Skip to content

Commit 884ca03

Browse files
anarcheuzYour Name
andauthored
set artifacts to be built with nightly-2025-10-30 (#388)
Co-authored-by: Your Name <[email protected]>
1 parent 6710a65 commit 884ca03

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

.github/workflows/build-common.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ jobs:
1818
cancel-in-progress: true
1919
steps:
2020
- uses: actions/checkout@v4
21-
- uses: dtolnay/[email protected]
21+
# TODO: change back to stable once rust releases the coverage fix
22+
# - uses: dtolnay/[email protected]
23+
- uses: actions-rs/toolchain@v1
2224
with:
25+
toolchain: nightly-2025-10-30
26+
override: true
2327
components: "clippy, rustfmt"
2428
- uses: Swatinem/rust-cache@v2
2529
with:

src/utils/fd_hash.rs

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ const C3: u64 = 1609587929392839161;
55
const C4: u64 = 9650029242287828579;
66
const C5: u64 = 2870177450012600261;
77

8-
#[inline(always)]
9-
#[allow(clippy::arithmetic_side_effects)]
10-
fn rotate_left(x: u64, r: u32) -> u64 {
11-
(x << r) | (x >> (64 - r))
12-
}
13-
148
/// Rust port of Firedancer's fd_hash
159
/// https://github.com/firedancer-io/firedancer/blob/main/src/util/fd_hash.c
1610
pub fn fd_hash(seed: u64, buf: &[u8]) -> u64 {
@@ -32,32 +26,33 @@ pub fn fd_hash(seed: u64, buf: &[u8]) -> u64 {
3226
let p2 = u64::from_le_bytes(p[16..24].try_into().unwrap());
3327
let p3 = u64::from_le_bytes(p[24..32].try_into().unwrap());
3428
w = w.wrapping_add(p0.wrapping_mul(C2));
35-
w = rotate_left(w, 31);
29+
w = w.rotate_left(31);
3630
w = w.wrapping_mul(C1);
3731

3832
x = x.wrapping_add(p1.wrapping_mul(C2));
39-
x = rotate_left(x, 31);
33+
x = x.rotate_left(31);
4034
x = x.wrapping_mul(C1);
4135

4236
y = y.wrapping_add(p2.wrapping_mul(C2));
43-
y = rotate_left(y, 31);
37+
y = y.rotate_left(31);
4438
y = y.wrapping_mul(C1);
4539

4640
z = z.wrapping_add(p3.wrapping_mul(C2));
47-
z = rotate_left(z, 31);
41+
z = z.rotate_left(31);
4842
z = z.wrapping_mul(C1);
4943

5044
p = &p[32..];
5145
}
5246

53-
h = rotate_left(w, 1)
54-
.wrapping_add(rotate_left(x, 7))
55-
.wrapping_add(rotate_left(y, 12))
56-
.wrapping_add(rotate_left(z, 18));
47+
h = w
48+
.rotate_left(1)
49+
.wrapping_add(x.rotate_left(7))
50+
.wrapping_add(y.rotate_left(12))
51+
.wrapping_add(z.rotate_left(18));
5752

5853
for v in [w, x, y, z] {
5954
let mut vv = v.wrapping_mul(C2);
60-
vv = rotate_left(vv, 31);
55+
vv = vv.rotate_left(31);
6156
vv = vv.wrapping_mul(C1);
6257
h ^= vv;
6358
h = h.wrapping_mul(C1).wrapping_add(C4);
@@ -69,25 +64,25 @@ pub fn fd_hash(seed: u64, buf: &[u8]) -> u64 {
6964
while p.len() >= 8 {
7065
let w = u64::from_le_bytes(p[0..8].try_into().unwrap());
7166
let mut ww = w.wrapping_mul(C2);
72-
ww = rotate_left(ww, 31);
67+
ww = ww.rotate_left(31);
7368
ww = ww.wrapping_mul(C1);
7469
h ^= ww;
75-
h = rotate_left(h, 27).wrapping_mul(C1).wrapping_add(C4);
70+
h = h.rotate_left(27).wrapping_mul(C1).wrapping_add(C4);
7671
p = &p[8..];
7772
}
7873

7974
if p.len() >= 4 {
8075
let w = u32::from_le_bytes(p[0..4].try_into().unwrap()) as u64;
8176
let ww = w.wrapping_mul(C1);
8277
h ^= ww;
83-
h = rotate_left(h, 23).wrapping_mul(C2).wrapping_add(C3);
78+
h = h.rotate_left(23).wrapping_mul(C2).wrapping_add(C3);
8479
p = &p[4..];
8580
}
8681

8782
for &byte in p {
8883
let w = (byte as u64).wrapping_mul(C5);
8984
h ^= w;
90-
h = rotate_left(h, 11).wrapping_mul(C1);
85+
h = h.rotate_left(11).wrapping_mul(C1);
9186
}
9287

9388
// Final avalanche

src/utils/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ pub const fn feature_u64(feature: &Pubkey) -> u64 {
2626
lazy_static! {
2727
static ref INDEXED_FEATURES: AHashMap<u64, Pubkey> = {
2828
FEATURE_NAMES
29-
.iter()
30-
.map(|(pubkey, _)| (feature_u64(pubkey), *pubkey))
29+
.keys()
30+
.map(|pubkey| (feature_u64(pubkey), *pubkey))
3131
.collect()
3232
};
3333
}

0 commit comments

Comments
 (0)