Deterministic 'make test_sim' on CircleCI; bank test fix
This commit is contained in:
parent
8bd54f0701
commit
05ceff5212
|
@ -99,6 +99,7 @@ jobs:
|
|||
name: Test simulation
|
||||
command: |
|
||||
export PATH="$GOBIN:$PATH"
|
||||
export GAIA_SIMULATION_SEED=1531897442166404087
|
||||
make test_sim
|
||||
|
||||
test_cover:
|
||||
|
|
|
@ -5,8 +5,6 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"math/rand"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/mock"
|
||||
|
|
|
@ -41,8 +41,7 @@ func SupplyInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) sim
|
|||
return false
|
||||
})
|
||||
require.True(t, pool.LooseTokens.RoundInt64() == loose.Int64(), "expected loose tokens to equal total steak held by accounts - pool.LooseTokens: %v, sum of account tokens: %v\nlog: %s",
|
||||
pool.LooseTokens, loose, log)
|
||||
// stats["stake/invariant/looseTokens"] += 1
|
||||
pool.LooseTokens.RoundInt64(), loose.Int64(), log)
|
||||
|
||||
// Bonded tokens should equal sum of tokens with bonded validators
|
||||
bonded := sdk.ZeroRat()
|
||||
|
@ -54,7 +53,6 @@ func SupplyInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) sim
|
|||
return false
|
||||
})
|
||||
require.True(t, pool.BondedTokens.Equal(bonded), "expected bonded tokens to equal total steak held by bonded validators\nlog: %s", log)
|
||||
// stats["stake/invariant/bondedTokens"] += 1
|
||||
|
||||
// TODO Inflation check on total supply
|
||||
}
|
||||
|
@ -68,7 +66,6 @@ func PositivePowerInvariant(k stake.Keeper) simulation.Invariant {
|
|||
require.True(t, validator.GetPower().GT(sdk.ZeroRat()), "validator with non-positive power stored")
|
||||
return false
|
||||
})
|
||||
// stats["stake/invariant/positivePower"] += 1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ func SimulateMsgCreateValidator(m auth.AccountMapper, k stake.Keeper) simulation
|
|||
}
|
||||
event(fmt.Sprintf("stake/MsgCreateValidator/%v", result.IsOK()))
|
||||
// require.True(t, result.IsOK(), "expected OK result but instead got %v", result)
|
||||
action = fmt.Sprintf("TestMsgCreateValidator: %s", msg.GetSignBytes())
|
||||
action = fmt.Sprintf("TestMsgCreateValidator: ok %v, msg %s", result.IsOK(), msg.GetSignBytes())
|
||||
return action, nil
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ func SimulateMsgEditValidator(k stake.Keeper) simulation.TestAndRunTx {
|
|||
write()
|
||||
}
|
||||
event(fmt.Sprintf("stake/MsgEditValidator/%v", result.IsOK()))
|
||||
action = fmt.Sprintf("TestMsgEditValidator: %s", msg.GetSignBytes())
|
||||
action = fmt.Sprintf("TestMsgEditValidator: ok %v, msg %s", result.IsOK(), msg.GetSignBytes())
|
||||
return action, nil
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ func SimulateMsgDelegate(m auth.AccountMapper, k stake.Keeper) simulation.TestAn
|
|||
write()
|
||||
}
|
||||
event(fmt.Sprintf("stake/MsgDelegate/%v", result.IsOK()))
|
||||
action = fmt.Sprintf("TestMsgDelegate: %s", msg.GetSignBytes())
|
||||
action = fmt.Sprintf("TestMsgDelegate: ok %v, msg %s", result.IsOK(), msg.GetSignBytes())
|
||||
return action, nil
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ func SimulateMsgBeginUnbonding(m auth.AccountMapper, k stake.Keeper) simulation.
|
|||
write()
|
||||
}
|
||||
event(fmt.Sprintf("stake/MsgBeginUnbonding/%v", result.IsOK()))
|
||||
action = fmt.Sprintf("TestMsgBeginUnbonding: %s", msg.GetSignBytes())
|
||||
action = fmt.Sprintf("TestMsgBeginUnbonding: ok %v, msg %s", result.IsOK(), msg.GetSignBytes())
|
||||
return action, nil
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ func SimulateMsgCompleteUnbonding(k stake.Keeper) simulation.TestAndRunTx {
|
|||
write()
|
||||
}
|
||||
event(fmt.Sprintf("stake/MsgCompleteUnbonding/%v", result.IsOK()))
|
||||
action = fmt.Sprintf("TestMsgCompleteUnbonding with %s", msg.GetSignBytes())
|
||||
action = fmt.Sprintf("TestMsgCompleteUnbonding: ok %v, msg %s", result.IsOK(), msg.GetSignBytes())
|
||||
return action, nil
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ func SimulateMsgCompleteRedelegate(k stake.Keeper) simulation.TestAndRunTx {
|
|||
write()
|
||||
}
|
||||
event(fmt.Sprintf("stake/MsgCompleteRedelegate/%v", result.IsOK()))
|
||||
action = fmt.Sprintf("TestMsgCompleteRedelegate with %s", msg.GetSignBytes())
|
||||
action = fmt.Sprintf("TestMsgCompleteRedelegate: ok %v, msg %s", result.IsOK(), msg.GetSignBytes())
|
||||
return action, nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue