documentation: add comments about weight and RatNum
## Motivation
<!-- Please mention the issue fixed by this PR or detailed motivation -->
Closes
<!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged -->
MODIFY
common/types/block.go
common/types/block.go
@@ -55,11 +55,14 @@ type InnerBlock struct {
}
// RatNum represents a rational number with the numerator and denominator.
+// note: RatNum aims to be a generic representation of a rational number and parse-able by
+// different programming languages.
+// for doing math around weight inside go-spacemesh codebase, use util.Weight.
type RatNum struct {
Num, Denom uint64
}
-// AnyReward contains the rewards inforamtion.
+// AnyReward contains the reward information.
type AnyReward struct {
Coinbase Address
Weight RatNum

MODIFY
common/util/weight.go
common/util/weight.go
@@ -25,6 +25,8 @@ func WeightFromNumDenom(num, denom uint64) Weight {
}
// Weight represents weight for any ATX/ballot.
+// note: this is golang specific and is used to do math on weight.
+// for representing weight over the wire or data persistence, use types.RatNum.
type Weight struct {
*big.Rat
}

documentation: add comments about weight and RatNum (#3433)

## Motivation
<!-- Please mention the issue fixed by this PR or detailed motivation -->
Closes #3393
<!-- `Closes #XXXX, closes #XXXX, ...` links mentioned issues to this PR and automatically closes them when this it's merged -->