You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
node(governor): add some type safety; rename decimals to scalingFactor
- Change TokenConfigEntry.Decimals field from int64 to uint8 for more appropriate data type
- Rename tokenEntry.decimals to scalingFactor with clarifying comment explaining it represents 10^decimals
- Add comprehensive error checking in computeValue function to prevent nil pointer dereferences and division by zero
- Add test cases to validate token prices are positive and decimals are within sensible bounds (0-24)
assert.GreaterOrEqual(t, tokenConfigEntry.Decimals, uint8(0), "Token decimals must be greater than or equal to zero")
53
+
assert.LessOrEqual(t, tokenConfigEntry.Decimals, uint8(maxDecimals), fmt.Sprintf("Token decimals must be less than or equal to %d but got %d. details: %v", maxDecimals, tokenConfigEntry.Decimals, tokenConfigEntry))
54
+
}
55
+
}
56
+
36
57
// Flag a situation where a Governed chain does not have any governed assets. Often times when adding a mainnet chain,
37
58
// a list of tokens will be added so that they can be governed. (These tokens are sourced by CoinGecko or manually
38
59
// populated.) While this is not a hard requirement, it may represent that a developer has forgotten to take the step
0 commit comments