Skip to content

fix(hall_of_rust): PowerPC arch bonus never applied (upper-case keys vs lower-cased arch) - #7956

Merged
Scottcjn merged 2 commits into
Scottcjn:mainfrom
Vyacheslav-Tomashevskiy:fix/hall-of-rust-powerpc-arch-bonus-case
Jul 13, 2026
Merged

Scottcjn merged 2 commits into
Scottcjn:mainfrom
Vyacheslav-Tomashevskiy:fix/hall-of-rust-powerpc-arch-bonus-case

Conversation

@Vyacheslav-Tomashevskiy

Copy link
Copy Markdown
Contributor

Problem

calculate_rust_score() in node/hall_of_rust.py lower-cases the reported architecture:

arch = machine.get('device_arch', 'modern').lower()
for key, bonus in arch_bonus.items():
    if key in arch:   # case-sensitive substring test

…but the PowerPC entries in arch_bonus used upper-case keys 'G3'/'G4'/'G5'. Because 'G4' in 'g4' is False, a PowerPC machine — the exact vintage hardware the Hall of Rust exists to celebrate — never received its architecture bonus.

Concrete failing inputs (pure function, current_year passed explicitly, all other score terms 0):

device_arch expected actual (main)
G4 70.0 0.0
G3 80.0 0.0
G5 60.0 0.0

This silently under-scores PowerPC machines, corrupting leaderboard ordering (ORDER BY rust_score DESC) and badge assignment.

Fix

Lower-case the three PowerPC keys to match the already-lower-cased arch value:

-        'G3': 80, 'G4': 70, 'G5': 60,
+        'g3': 80, 'g4': 70, 'g5': 60,

The sibling estimate_manufacture_year() already uses key.lower() in arch.lower(), confirming lower-case is the intended convention.

Test

Adds node/test_hall_of_rust_arch_bonus_poc.py:

  • Fails on main: G3/G4/G5 return 0.0.
  • Passes with fix: all 5 cases green (pytest ... -q → 5 passed).
  • Nearby suites unaffected: test_hall_of_rust_limit_validation.py (6), test_hall_of_rust_error_responses.py (8), explorer/test_hall_of_rust_non_object.py (15) all pass.

…vs lower-cased arch)

calculate_rust_score() lower-cases device_arch before the substring match,
but the PowerPC entries in arch_bonus used upper-case keys 'G3'/'G4'/'G5'.
Since 'G4' in 'g4' is False, every PowerPC machine — the exact vintage
hardware the Hall of Rust exists to celebrate — silently lost its
architecture bonus, corrupting leaderboard ordering (ORDER BY rust_score
DESC) and badge assignment.

Lower-case the three PowerPC keys to match the already-lower-cased arch
value. The sibling estimate_manufacture_year() already uses key.lower(),
confirming lower-case is the intended convention.

Adds node/test_hall_of_rust_arch_bonus_poc.py (fails on main for G3/G4/G5,
passes with fix).
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Non-doc PRs have a BCOS-L1 or BCOS-L2 label
  • Doc-only PRs are exempt from BCOS tier labels when they only touch docs/**, *.md, or common image/PDF files
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related size/M PR: 51-200 lines labels Jul 13, 2026
@Scottcjn

Copy link
Copy Markdown
Owner

Maintainer validation: all 19 focused multiplier and profile tests pass locally. Normalizing the profile keys to lowercase matches the already-lowercased architecture lookup and restores the intended G3/G4/G5 multipliers. The aggregate CI failure is the stale main-branch fetchall/checksum baseline repaired in #7957, not a regression in this PR.

@Scottcjn
Scottcjn merged commit e8d372b into Scottcjn:main Jul 13, 2026
11 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

RTC Reward

This merged PR earned 5 RTC — sent to Vyacheslav-Tomashevskiy.

RustChain Bounty Program

Scottcjn added a commit that referenced this pull request Aug 10, 2026
…r) (#7969)

calculate_rust_score() matches device_arch against arch_bonus with a
substring test that stops at the first hit. 'pentium' is a substring of
'pentium4' and comes first in dict-iteration order, so a Pentium 4 machine
matched 'pentium' and got 100 instead of its intended 50 -- the
'pentium4': 50 entry was unreachable dead code, and every Pentium 4 sat
50 points too high on the ORDER BY rust_score DESC leaderboard.

Iterate arch_bonus longest-key-first so the most specific substring wins.
This resolves the pentium/pentium4 overlap and is robust to future
overlapping keys, without regressing the PowerPC fix (#7956).

Adds node/test_hall_of_rust_pentium4_bonus.py (fails on main: pentium4
returns 100; passes with fix: 50), PowerPC/486/pentium cases kept green.

Co-authored-by: AutoJanitor <crypteauxcajun@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related size/M PR: 51-200 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants