Skip to content

add new staking - #192

Open
mul53 wants to merge 1 commit into
add-version-reportingfrom
add-new-staking
Open

add new staking#192
mul53 wants to merge 1 commit into
add-version-reportingfrom
add-new-staking

Conversation

@mul53

@mul53 mul53 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

}

function getStaking() public view returns(address){
return addressStorage[STAKING];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see anything wrtiting too addressStorage[STAKING]. There's no _setStaking,
initializeAddresses wasn't extended, and setContractAddress upgrades an
existing proxy rather than registering a new address. getStaking() returns 0
forever, so the hook in BlockReward never fires.

Comment thread contracts/BlockReward.sol

address stakingAddress = ProxyStorage(getProxyStorage()).getStaking();
if (stakingAddress != address(0)) {
IStakingRewards(stakingAddress).recordBlockReward(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this may need wrapping in a try, if this reverts every node will fail to process the block and we risk a chain halt

/// @param cycle The cycle being recorded.
/// @param receivers List of reward receivers.
/// @param rewardWeights List of corresponding reward weights.
function recordBlockReward(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It might be worth looking to limit number of delegates currently getDelegatorsForRewardDistribution is unlimited and this call will add state growth per block per delegate (might be a potential attack vector)

/// This prevents users from claiming before the final reward amount is known.
///
/// @param cycle The cycle to finalize.
function finalizeCycleReward(uint256 cycle)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

might be worth gating this with a require to ensure the cycle is over

require(cycle != IConsensus(...).getCurrentCycleStartBlock())

/// @notice Claims rewards for multiple finalized cycles.
/// @dev Reverts if any cycle in the list is not claimable by the caller.
/// @param cycles List of cycle IDs to claim.
function claimRewards(uint256[] calldata cycles) external whenNotPaused nonReentrant {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should pausing allow withdraws still?

i.m.o pausing should just gate recording and finalization only

uint256 totalWeight = totalCycleWeights[cycle];
if (totalWeight == 0) revert NoTotalWeight();

uint256 rewardAmount = Math.mulDiv(cycleRewards[cycle], userWeight, totalWeight);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nothing major but this will accumulate dust from rounding per cycle so some rewards will be lost over time. Just something to be aware of


/// @notice Emitted when the paused state is updated.
/// @param paused The new paused state.
event Paused(bool paused);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You might want to rename this collides with OpenZepllin convention, may break indexers/ external tooling.

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.

2 participants