Mint: recompute ehash quote amounts from the share hash #44
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
vnprc/hashpool#44
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Make the mint derive each ehash quote's amount from the share hash itself, so the pool's asserted number is informational at most and a mint-side floor governs issuance.
Primary goals:
amount == calculate_ehash_amount(header_hash, minimum_difficulty)(or simply recomputes and ignores the pool's value), usingehash::calculate_ehash_amount(protocols/ehash/src/work.rs:11) which it already depends on via the quote path.minimum_difficultycomes from its own config, refuses to start below a floor (suggest 24), and is logged at startup next to the pool's claimed value.config/shared/*.tomlset[ehash] minimum_difficulty = 0androles/pool/src/lib/mod.rs:95falls back to 32 only when the key is absent), every accepted share is credited2^leading_zerosunits — a 32-zero-bit share earns ~4.3e9 units instead of 1. Mint-side recompute makes the pool's knob unable to inflate issuance regardless of config drift.Current state and specifics
The mint trusts
MintQuoteRequest.amountverbatim (roles/mint/src/lib/sv2_connection/quote_processing.rs): it pays the quote at epoch finality for whatever amount the pool asserted, up to 2^63-1, keyed to any locking key in the request. The fields the mint would need to check the work — the share'sheader_hash— are already in the message;leading_zero_bitsis computed there today but only for a log line (estimated_min_difficulty), never enforced. Dedup is by(header_hash, locking_key)uniqueness only.The full findings write-up is
notes/hashpool/security-review-2026-10-15.md(findings H-1 and C-1).Scope
In scope: amount validation/recompute in the mint quote path, mint-side
minimum_difficultyconfig + startup floor, tests covering mismatched/over-claimed amounts.Out of scope, tracked separately: authenticated quote creation (pool holds a mint-issued token) — the planned auth layer; this issue stands independently as defense in depth so a leaked or misconfigured pool key cannot mint unbounded supply. Pool-side config cleanup (collapsing the three difficulty knobs) is its own follow-up once the mint enforces the truth.