PRs recently targeted against develop, have been failing intermittently on the following test:
--- FAIL: TestBonding (4.77s)
Error Trace: lcd_test.go:644
Error: Not equal:
expected: 30000000.000000000000000000
actual : 30303030.303030303030303030
Diff:
--- Expected
+++ Actual
@@ -1,2 +1,2 @@
-(types.Dec) 30000000.000000000000000000
+(types.Dec) 30303030.303030303030303030
Test: TestBonding
May be addressed by #3553 -- related to minting.
Likely the issue is that the Tendermint instance is running for a non-constant number of blocks before we query it.
If you set the initial inflation, min inflation, and max inflation to zero there should be no inflation.
And I don't think we can rely on query results to return the exact inflation if we don't precisely specify the number of blocks we're running for in an LCD test.
@cwgoes:
inflationMin := sdk.ZeroDec()
if minting {
inflationMin = sdk.MustNewDecFromStr("10000.0")
genesisState.MintData.Params.InflationMax = sdk.MustNewDecFromStr("15000.0")
} else {
genesisState.MintData.Params.InflationMax = inflationMin
}
genesisState.MintData.Minter.Inflation = inflationMin
genesisState.MintData.Params.InflationMin = inflationMin
The dog is still barking a hell of a lot. Hence reopening.
Looks like this was fixed. Closing
(https://github.com/cosmos/cosmos-sdk/commit/fa2e9b85181039d43f1789e1b03226372caab41b fixed another failure, not this one)
The easy suspect is tokens being minted due to a delay in the timing... has anyone been able to replicate this consistently with some time.Sleep('s placed around?
The easy suspect is tokens being minted due to a delay in the timing... has anyone been able to replicate this consistently with some
time.Sleep('s placed around?
@rigelrozanski, @alessio stated the above happens even when inflation is turned off.
Correct @alexanderbez.
In TestBonding, fixtures are initiliazed with 0 inflation (as in InitializeTestLCD call's trailing argument is false):
func TestBonding(t *testing.T) {
kb, err := keys.NewKeyBaseFromDir(InitClientHome(t, ""))
require.NoError(t, err)
addr, _ := CreateAddr(t, name1, pw, kb)
cleanup, valPubKeys, operAddrs, port := InitializeTestLCD(t, 2, []sdk.AccAddress{addr}, false)
madness
So this would actually make sense - this delegation that's we're querying to is the delegation created to the second validator (which does not sign in the lcd tests - hence eventually it should get slashed)... if the test takes long enough and the second validator gets slashed before this redelegation takes place then when the redegation does take place it the shares it receives will be greater than 1-to-1 (because the existing original shares of the second validator are worth less than 1 due to the slash)...
Thus the mystery of where these extra shares come from makes sense... the solution is to simply query the exchange rate of the second validator and verify tokens instead of shares
:)