MCPcopy Create free account
hub / github.com/akash-network/node / TestCalculateBlocksDiff_NoOverflowPanic

Function TestCalculateBlocksDiff_NoOverflowPanic

x/bme/keeper/keeper_test.go:133–145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func TestCalculateBlocksDiff_NoOverflowPanic(t *testing.T) {
134 // Ensure no panic with extreme parameters that would cause
135 // int64 overflow if not for the Dec cap.
136 params := defaultTestParams()
137 params.EpochBlocksBackoffPercent = 100 // 100%, base = 2.0
138
139 // steps=50 → 2^50 * 10 = ~1.13 * 10^16, well beyond int64
140 // Should not panic, should return 14400
141 require.NotPanics(t, func() {
142 result := calculateBlocksDiff(params, 9000)
143 require.Equal(t, int64(14400), result)
144 })
145}
146
147func TestCalculateBlocksDiff_BelowHaltThreshold(t *testing.T) {
148 // CR below halt threshold is still valid input—calculateBlocksDiff

Callers

nothing calls this directly

Calls 2

defaultTestParamsFunction · 0.85
calculateBlocksDiffFunction · 0.85

Tested by

no test coverage detected