The uint16 epoch
field can be removed from the FjordStaking::DepositReceipt
struct to optimize gas usage.
The FjordStaking::DepositReceipt
struct is only used within the FjordStaking::deposits
mapping, which already tracks the epoch. Therefore, including the epoch in DepositReceipt
is redundant. The only use of epoch
is in the conditional check if (dr.epoch == 0)
to determine if a user has staked before, which can be replaced by if (dr.staked == 0)
.
Removing the epoch
field from DepositReceipt
reduces gas consumption in frequently used functions like FjordStaking::stake
and FjordStaking::unstake
.
Manual code review
Redefine the DepositReceipt
struct as follows:
Replace all instances of dr.epoch == 0
with dr.staked == 0
.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.