Skip to content

Fix: Correct hashrate unit display to H/s for RandomX#3264

Open
Ojas2095 wants to merge 1 commit into
tari-project:mainfrom
Ojas2095:fix-3210-hashrate-unit
Open

Fix: Correct hashrate unit display to H/s for RandomX#3264
Ojas2095 wants to merge 1 commit into
tari-project:mainfrom
Ojas2095:fix-3210-hashrate-unit

Conversation

@Ojas2095

Copy link
Copy Markdown

Fixes #3210 by properly detecting the RandomX algorithm in CPU.tsx and formatting the unit as H/s instead of G/s. This resolves the regression where macOS (and CPU mining in general) was incorrectly showing G/s.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for formatting hashrates for the "RandomX" algorithm, which is used in CPU mining. It updates the formatHashrate utility to set the base unit to 'H' instead of 'G' when the algorithm is "RandomX", adds corresponding unit tests, and passes the "RandomX" algorithm prop to the CPU tile component. The reviewer identified a TypeScript compilation error where the algo prop passed to the tile component does not match the expected GpuMiningAlgorithm type, and suggested a type cast or a type definition update to resolve it.

progressDiff={rewardsRef.current?.rewardValue}
unpaidFMT={rewardsRef.current?.unpaidFMT || '-'}
minerModuleState={cpuMiningModuleState}
algo="RandomX"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Passing the string "RandomX" to the algo prop will cause a TypeScript compilation error because MinerTileProps in Miner.tsx defines algo as GpuMiningAlgorithm (which only contains 'C29'). To fix this, MinerTileProps should be updated to accept string | GpuMiningAlgorithm. As a temporary workaround to make this file compile, you can cast it to any.

Suggested change
algo="RandomX"
algo={"RandomX" as any}

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.

Tari Universe 1.6.11 reports rate in G/s on Mac for CPU

1 participant