Description
Summary of Bug
Noticed throughout the repository that there is this pattern
sommelier/x/cork/keeper/keeper.go
Lines 103 to 108 in 3157d97
Suggestion
Simply use byte slicing which can be made so much clearer and removes unnecessary expenses
key := iter.Key()[1:]
blockHeight, key := sdk.BigEndianToUint64(key[:8]), key[8:]
id, key := key[:32], key[32:]
val, key := sdk.ValAddress(key[:20]), key[20:]
contract := common.BytesToAddress(key[:])
and you'll notice performance improvements from not being heavy handed with all these bytes.NewBuffer allocations
Other spots
sommelier/x/axelarcork/keeper/keeper.go
Lines 234 to 238 in 3157d97
sommelier/x/axelarcork/keeper/keeper.go
Lines 154 to 160 in 3157d97
sommelier/x/axelarcork/keeper/keeper.go
Lines 335 to 337 in 3157d97
sommelier/x/axelarcork/keeper/keeper.go
Lines 535 to 537 in 3157d97