Skip to content

Commit da6f814

Browse files
committed
fix(explorer): correct atomic-unit thresholds in payload proof validation
1 parent 769c36c commit da6f814

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

proof_validation.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,22 @@ const (
1313
// Prevents uint64 to int64 wraparound attacks
1414
MAX_INT64_SAFE = 9223372036854775807
1515

16+
// For display and calculations: 1 DERO = 100,000 atomic units
17+
// (matches derohe globals.go and GetInfo RPC supply conversion)
18+
ATOMIC_UNITS_PER_DERO = 100_000
19+
1620
// Maximum reasonable transfer amount in atomic units
1721
// DERO hard cap: 21M DERO (like Bitcoin, this will never increase)
18-
// Setting max at 22M DERO = 22 trillion atomic units
19-
// This is ~5% above hard cap, allows buffer while blocking impossible amounts
20-
MAX_REASONABLE_AMOUNT_ATOMIC = 22_000_000_000_000 // 22 million DERO
21-
22-
// For display and calculations
23-
ATOMIC_UNITS_PER_DERO = 100_000
22+
// Setting max at 22M DERO = ~5% above hard cap.
23+
// Blocks impossible amounts while leaving a buffer.
24+
MAX_REASONABLE_AMOUNT_ATOMIC = 22_000_000 * ATOMIC_UNITS_PER_DERO // 2_200_000_000_000
2425

2526
// Hard cap reference
26-
DERO_HARD_CAP_ATOMIC = 21_000_000_000_000 // 21 million DERO in atomic units
27+
DERO_HARD_CAP_ATOMIC = 21_000_000 * ATOMIC_UNITS_PER_DERO // 2_100_000_000_000
2728

2829
// Current approximate circulating supply (for context display)
2930
// This is approximate - actual supply can be queried from daemon
30-
CURRENT_SUPPLY_APPROX_ATOMIC = 16_500_000_000_000 // ~16.5 million DERO
31+
CURRENT_SUPPLY_APPROX_ATOMIC = 16_500_000 * ATOMIC_UNITS_PER_DERO // 1_650_000_000_000
3132
)
3233

3334
// ProofValidationResult holds the validation result with context
@@ -117,7 +118,7 @@ func DetectSuspiciousProofPatterns(amount uint64) []string {
117118
}
118119

119120
// Warning 3: Very large amount (> 1M DERO) - not fake, just notable
120-
largeThreshold := uint64(1_000_000_000_000) // 1M DERO
121+
largeThreshold := uint64(1_000_000 * ATOMIC_UNITS_PER_DERO) // 1M DERO
121122
if amount > largeThreshold && amount <= CURRENT_SUPPLY_APPROX_ATOMIC {
122123
amountDero := amount / ATOMIC_UNITS_PER_DERO
123124
warnings = append(warnings,

0 commit comments

Comments
 (0)