Skip to content

Latest commit

 

History

History
38 lines (20 loc) · 770 Bytes

048.md

File metadata and controls

38 lines (20 loc) · 770 Bytes

Handsome Wool Bat

High

Function startReward cannot perform sorting correctly.

Summary

https://github.com/sherlock-audit/2024-08-morphl2/blob/main/morph/contracts/contracts/l2/staking/L2Staking.sol#L252-L275 The function startReward performs insertion sort on stakerAddresses. However, the implementation of the sorting algorithm was wrong, causing stakerRankings to not be sorted correctly.

Root Cause

In L2Staking.sol#startReward, the insertion sort is implemented incorrectly.

Internal pre-conditions

  1. Admin call startReward.

External pre-conditions

No response

Attack Path

No response

Impact

The state of stakerRankings will be incorrect.

PoC

No response

Mitigation

Reimplement insertion sort correctly.