Skip to content

fix(weighted-staking): mitigate block.timestamp manipulation risk - #217

Merged
dDevAhmed merged 2 commits into
DigiNodes:mainfrom
mijinummi:fix/159-weightedstaking-timestamp-manipulation
May 29, 2026
Merged

fix(weighted-staking): mitigate block.timestamp manipulation risk#217
dDevAhmed merged 2 commits into
DigiNodes:mainfrom
mijinummi:fix/159-weightedstaking-timestamp-manipulation

Conversation

@mijinummi

@mijinummi mijinummi commented May 29, 2026

Copy link
Copy Markdown
Contributor

🎯 Summary

Closes #159

This PR hardens WeightedStaking.sol against miner-controlled block.timestamp manipulation during reward and staking window calculations.

The implementation replaces direct timestamp dependency in sensitive short-window calculations with safer bounded logic and introduces invariant-focused validation to reduce manipulation risk.

🧠 Problem Context

Audit issue identified:

Small timestamp windows can be influenced by miners/validators
Direct reliance on block.timestamp may allow:
premature unlocks
reward skewing
edge-window exploitation

Reference: Internal Ref #CO-159

Closes #189
This PR refines voter claim handling by optimizing how voter addresses are reused across repeated claim operations.

The implementation reduces redundant storage writes for high-frequency voters while preserving claim integrity and replay protection guarantees.

@dDevAhmed
dDevAhmed merged commit 6fbc92c into DigiNodes:main May 29, 2026
4 of 8 checks passed
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.

Voter address reuse across claims WeightedStaking.sol block.timestamp manipulation

2 participants