Category: Coding Mistakes
Incorrect method comments
Informational Severity
Informational Impact
Low Likelihood
Description
The TSS keeper was changed so that there is only a single entry instead of storing it based on the index, but all of the comments still refer to the index:
// SetTSS set a specific tSS in the store from its index
func (k Keeper) SetTSS(ctx sdk.Context, tss types.TSS) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSKey))
b := k.cdc.MustMarshal(&tss)
store.Set([]byte{0}, b)
}
// GetTSS returns a tSS from its index
func (k Keeper) GetTSS(ctx sdk.Context) (val types.TSS, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSKey))
b := store.Get([]byte{0})
if b == nil {
return val, false
}
k.cdc.MustUnmarshal(b, &val)
return val, true
}
Impact
When reading the comments to understand the code, it is not clear that the index is now always zero and only a single TSS is stored.
Recommendations
Update the comments to reflect the new code.
Remediation
This issue has been acknowledged by ZetaChain, and a fix was implemented in commit 829ebf9a↗.