Merge branch 'develop' into svaishnavy/cosmos-sdk-cli
This commit is contained in:
commit
c49a0df296
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -1,12 +1,27 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.21.2
|
## PENDING
|
||||||
*July 16th, 2018*
|
|
||||||
|
|
||||||
Features
|
Features
|
||||||
* [cosmos-sdk-cli] Added support for cosmos-sdk-cli under cosmos-sdk/cmd
|
* [cosmos-sdk-cli] Added support for cosmos-sdk-cli under cosmos-sdk/cmd
|
||||||
This allows SDK users to init a new project repository with a single command.
|
This allows SDK users to init a new project repository with a single command.
|
||||||
|
|
||||||
|
## 0.22.0
|
||||||
|
|
||||||
|
*July 16th, 2018*
|
||||||
|
|
||||||
|
BREAKING CHANGES
|
||||||
|
* [x/gov] Increase VotingPeriod, DepositPeriod, and MinDeposit
|
||||||
|
|
||||||
|
IMPROVEMENTS
|
||||||
|
* [gaiad] Default config updates:
|
||||||
|
- `timeout_commit=5000` so blocks only made every 5s
|
||||||
|
- `prof_listen_addr=localhost:6060` so profile server is on by default
|
||||||
|
- `p2p.send_rate` and `p2p.recv_rate` increases 10x (~5MB/s)
|
||||||
|
|
||||||
|
BUG FIXES
|
||||||
|
* [server] Fix to actually overwrite default tendermint config
|
||||||
|
|
||||||
## 0.21.1
|
## 0.21.1
|
||||||
|
|
||||||
*July 14th, 2018*
|
*July 14th, 2018*
|
||||||
|
|
|
@ -77,16 +77,21 @@ func interceptLoadConfig() (conf *cfg.Config, err error) {
|
||||||
rootDir := tmpConf.RootDir
|
rootDir := tmpConf.RootDir
|
||||||
configFilePath := filepath.Join(rootDir, "config/config.toml")
|
configFilePath := filepath.Join(rootDir, "config/config.toml")
|
||||||
// Intercept only if the file doesn't already exist
|
// Intercept only if the file doesn't already exist
|
||||||
|
|
||||||
if _, err := os.Stat(configFilePath); os.IsNotExist(err) {
|
if _, err := os.Stat(configFilePath); os.IsNotExist(err) {
|
||||||
// the following parse config is needed to create directories
|
// the following parse config is needed to create directories
|
||||||
sdkDefaultConfig, _ := tcmd.ParseConfig()
|
conf, _ = tcmd.ParseConfig()
|
||||||
sdkDefaultConfig.ProfListenAddress = "prof_laddr=localhost:6060"
|
conf.ProfListenAddress = "localhost:6060"
|
||||||
sdkDefaultConfig.P2P.RecvRate = 5120000
|
conf.P2P.RecvRate = 5120000
|
||||||
sdkDefaultConfig.P2P.SendRate = 5120000
|
conf.P2P.SendRate = 5120000
|
||||||
cfg.WriteConfigFile(configFilePath, sdkDefaultConfig)
|
conf.Consensus.TimeoutCommit = 5000
|
||||||
|
cfg.WriteConfigFile(configFilePath, conf)
|
||||||
// Fall through, just so that its parsed into memory.
|
// Fall through, just so that its parsed into memory.
|
||||||
}
|
}
|
||||||
conf, err = tcmd.ParseConfig()
|
|
||||||
|
if conf == nil {
|
||||||
|
conf, err = tcmd.ParseConfig()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@ func TestIsPositiveCoin(t *testing.T) {
|
||||||
{NewCoin("a", -1), false},
|
{NewCoin("a", -1), false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
res := tc.inputOne.IsPositive()
|
res := tc.inputOne.IsPositive()
|
||||||
require.Equal(t, tc.expected, res)
|
require.Equal(t, tc.expected, res, "%s positivity is incorrect, tc #%d", tc.inputOne.String(), tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ func TestIsNotNegativeCoin(t *testing.T) {
|
||||||
{NewCoin("a", -1), false},
|
{NewCoin("a", -1), false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
res := tc.inputOne.IsNotNegative()
|
res := tc.inputOne.IsNotNegative()
|
||||||
require.Equal(t, tc.expected, res)
|
require.Equal(t, tc.expected, res, "%s not-negativity is incorrect, tc #%d", tc.inputOne.String(), tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,9 +52,9 @@ func TestSameDenomAsCoin(t *testing.T) {
|
||||||
{NewCoin("steak", -11), NewCoin("steak", 10), true},
|
{NewCoin("steak", -11), NewCoin("steak", 10), true},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
res := tc.inputOne.SameDenomAs(tc.inputTwo)
|
res := tc.inputOne.SameDenomAs(tc.inputTwo)
|
||||||
require.Equal(t, tc.expected, res)
|
require.Equal(t, tc.expected, res, "coin denominations didn't match, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,9 +70,9 @@ func TestIsGTECoin(t *testing.T) {
|
||||||
{NewCoin("a", 1), NewCoin("b", 1), false},
|
{NewCoin("a", 1), NewCoin("b", 1), false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
res := tc.inputOne.IsGTE(tc.inputTwo)
|
res := tc.inputOne.IsGTE(tc.inputTwo)
|
||||||
require.Equal(t, tc.expected, res)
|
require.Equal(t, tc.expected, res, "coin GTE relation is incorrect, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ func TestIsEqualCoin(t *testing.T) {
|
||||||
{NewCoin("steak", -11), NewCoin("steak", 10), false},
|
{NewCoin("steak", -11), NewCoin("steak", 10), false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
res := tc.inputOne.IsEqual(tc.inputTwo)
|
res := tc.inputOne.IsEqual(tc.inputTwo)
|
||||||
require.Equal(t, tc.expected, res)
|
require.Equal(t, tc.expected, res, "coin equality relation is incorrect, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,9 +106,9 @@ func TestPlusCoin(t *testing.T) {
|
||||||
{NewCoin("asdf", -4), NewCoin("asdf", 5), NewCoin("asdf", 1)},
|
{NewCoin("asdf", -4), NewCoin("asdf", 5), NewCoin("asdf", 1)},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
res := tc.inputOne.Plus(tc.inputTwo)
|
res := tc.inputOne.Plus(tc.inputTwo)
|
||||||
require.Equal(t, tc.expected, res)
|
require.Equal(t, tc.expected, res, "sum of coins is incorrect, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
tc := struct {
|
tc := struct {
|
||||||
|
@ -132,9 +132,9 @@ func TestMinusCoin(t *testing.T) {
|
||||||
{NewCoin("asdf", 10), NewCoin("asdf", 1), NewCoin("asdf", 9)},
|
{NewCoin("asdf", 10), NewCoin("asdf", 1), NewCoin("asdf", 9)},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
res := tc.inputOne.Minus(tc.inputTwo)
|
res := tc.inputOne.Minus(tc.inputTwo)
|
||||||
require.Equal(t, tc.expected, res)
|
require.Equal(t, tc.expected, res, "difference of coins is incorrect, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
tc := struct {
|
tc := struct {
|
||||||
|
@ -212,10 +212,10 @@ func TestPlusCoins(t *testing.T) {
|
||||||
{Coins{{"A", negone}, {"B", zero}}, Coins{{"A", zero}, {"B", zero}}, Coins{{"A", negone}}},
|
{Coins{{"A", negone}, {"B", zero}}, Coins{{"A", zero}, {"B", zero}}, Coins{{"A", negone}}},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
res := tc.inputOne.Plus(tc.inputTwo)
|
res := tc.inputOne.Plus(tc.inputTwo)
|
||||||
assert.True(t, res.IsValid())
|
assert.True(t, res.IsValid())
|
||||||
require.Equal(t, tc.expected, res)
|
require.Equal(t, tc.expected, res, "sum of coins is incorrect, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,12 +242,12 @@ func TestParse(t *testing.T) {
|
||||||
{"5foo-bar", false, nil}, // once more, only letters in coin name
|
{"5foo-bar", false, nil}, // once more, only letters in coin name
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
res, err := ParseCoins(tc.input)
|
res, err := ParseCoins(tc.input)
|
||||||
if !tc.valid {
|
if !tc.valid {
|
||||||
require.NotNil(t, err, "%s: %#v", tc.input, res)
|
require.NotNil(t, err, "%s: %#v. tc #%d", tc.input, res, tcIndex)
|
||||||
} else if assert.Nil(t, err, "%s: %+v", tc.input, err) {
|
} else if assert.Nil(t, err, "%s: %+v", tc.input, err) {
|
||||||
require.Equal(t, tc.expected, res)
|
require.Equal(t, tc.expected, res, "coin parsing was incorrect, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,10 +296,10 @@ func TestSortCoins(t *testing.T) {
|
||||||
{dup, false, false},
|
{dup, false, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
require.Equal(t, tc.before, tc.coins.IsValid())
|
require.Equal(t, tc.before, tc.coins.IsValid(), "coin validity is incorrect before sorting, tc #%d", tcIndex)
|
||||||
tc.coins.Sort()
|
tc.coins.Sort()
|
||||||
require.Equal(t, tc.after, tc.coins.IsValid())
|
require.Equal(t, tc.after, tc.coins.IsValid(), "coin validity is incorrect after sorting, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ func (r *Rat) UnmarshalAmino(text string) (err error) {
|
||||||
//___________________________________________________________________________________
|
//___________________________________________________________________________________
|
||||||
// helpers
|
// helpers
|
||||||
|
|
||||||
// test if two rat arrays are the equal
|
// test if two rat arrays are equal
|
||||||
func RatsEqual(r1s, r2s []Rat) bool {
|
func RatsEqual(r1s, r2s []Rat) bool {
|
||||||
if len(r1s) != len(r2s) {
|
if len(r1s) != len(r2s) {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -48,22 +48,22 @@ func TestNewFromDecimal(t *testing.T) {
|
||||||
{"0.foobar.", true, Rat{}},
|
{"0.foobar.", true, Rat{}},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for tcIndex, tc := range tests {
|
||||||
res, err := NewRatFromDecimal(tc.decimalStr, 4)
|
res, err := NewRatFromDecimal(tc.decimalStr, 4)
|
||||||
if tc.expErr {
|
if tc.expErr {
|
||||||
require.NotNil(t, err, tc.decimalStr)
|
require.NotNil(t, err, tc.decimalStr, "error expected, tc #%d", tcIndex)
|
||||||
} else {
|
} else {
|
||||||
require.Nil(t, err, tc.decimalStr)
|
require.Nil(t, err, tc.decimalStr, "unexpected error, tc #%d", tcIndex)
|
||||||
require.True(t, res.Equal(tc.exp), tc.decimalStr)
|
require.True(t, res.Equal(tc.exp), tc.decimalStr, "equality was incorrect, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
// negative tc
|
// negative tc
|
||||||
res, err = NewRatFromDecimal("-"+tc.decimalStr, 4)
|
res, err = NewRatFromDecimal("-"+tc.decimalStr, 4)
|
||||||
if tc.expErr {
|
if tc.expErr {
|
||||||
require.NotNil(t, err, tc.decimalStr)
|
require.NotNil(t, err, tc.decimalStr, "error expected (negative case), tc #%d", tcIndex)
|
||||||
} else {
|
} else {
|
||||||
require.Nil(t, err, tc.decimalStr)
|
require.Nil(t, err, tc.decimalStr, "unexpected error (negative case), tc #%d", tcIndex)
|
||||||
require.True(t, res.Equal(tc.exp.Mul(NewRat(-1))), tc.decimalStr)
|
require.True(t, res.Equal(tc.exp.Mul(NewRat(-1))), tc.decimalStr, "equality was incorrect (negative case), tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,10 +99,10 @@ func TestEqualities(t *testing.T) {
|
||||||
{NewRat(-1, 7), NewRat(-3, 7), true, false, false},
|
{NewRat(-1, 7), NewRat(-3, 7), true, false, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for tcIndex, tc := range tests {
|
||||||
require.Equal(t, tc.gt, tc.r1.GT(tc.r2))
|
require.Equal(t, tc.gt, tc.r1.GT(tc.r2), "GT result is incorrect, tc #%d", tcIndex)
|
||||||
require.Equal(t, tc.lt, tc.r1.LT(tc.r2))
|
require.Equal(t, tc.lt, tc.r1.LT(tc.r2), "LT result is incorrect, tc #%d", tcIndex)
|
||||||
require.Equal(t, tc.eq, tc.r1.Equal(tc.r2))
|
require.Equal(t, tc.eq, tc.r1.Equal(tc.r2), "equality result is incorrect, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -135,15 +135,15 @@ func TestArithmetic(t *testing.T) {
|
||||||
{NewRat(100), NewRat(1, 7), NewRat(100, 7), NewRat(700), NewRat(701, 7), NewRat(699, 7)},
|
{NewRat(100), NewRat(1, 7), NewRat(100, 7), NewRat(700), NewRat(701, 7), NewRat(699, 7)},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for tcIndex, tc := range tests {
|
||||||
require.True(t, tc.resMul.Equal(tc.r1.Mul(tc.r2)), "r1 %v, r2 %v", tc.r1.Rat, tc.r2.Rat)
|
require.True(t, tc.resMul.Equal(tc.r1.Mul(tc.r2)), "r1 %v, r2 %v. tc #%d", tc.r1.Rat, tc.r2.Rat, tcIndex)
|
||||||
require.True(t, tc.resAdd.Equal(tc.r1.Add(tc.r2)), "r1 %v, r2 %v", tc.r1.Rat, tc.r2.Rat)
|
require.True(t, tc.resAdd.Equal(tc.r1.Add(tc.r2)), "r1 %v, r2 %v. tc #%d", tc.r1.Rat, tc.r2.Rat, tcIndex)
|
||||||
require.True(t, tc.resSub.Equal(tc.r1.Sub(tc.r2)), "r1 %v, r2 %v", tc.r1.Rat, tc.r2.Rat)
|
require.True(t, tc.resSub.Equal(tc.r1.Sub(tc.r2)), "r1 %v, r2 %v. tc #%d", tc.r1.Rat, tc.r2.Rat, tcIndex)
|
||||||
|
|
||||||
if tc.r2.Num().IsZero() { // panic for divide by zero
|
if tc.r2.Num().IsZero() { // panic for divide by zero
|
||||||
require.Panics(t, func() { tc.r1.Quo(tc.r2) })
|
require.Panics(t, func() { tc.r1.Quo(tc.r2) })
|
||||||
} else {
|
} else {
|
||||||
require.True(t, tc.resDiv.Equal(tc.r1.Quo(tc.r2)), "r1 %v, r2 %v", tc.r1.Rat, tc.r2.Rat)
|
require.True(t, tc.resDiv.Equal(tc.r1.Quo(tc.r2)), "r1 %v, r2 %v. tc #%d", tc.r1.Rat, tc.r2.Rat, tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,9 +168,9 @@ func TestEvaluate(t *testing.T) {
|
||||||
{NewRat(113, 12), 9},
|
{NewRat(113, 12), 9},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for tcIndex, tc := range tests {
|
||||||
require.Equal(t, tc.res, tc.r1.RoundInt64(), "%v", tc.r1)
|
require.Equal(t, tc.res, tc.r1.RoundInt64(), "%v. tc #%d", tc.r1, tcIndex)
|
||||||
require.Equal(t, tc.res*-1, tc.r1.Mul(NewRat(-1)).RoundInt64(), "%v", tc.r1.Mul(NewRat(-1)))
|
require.Equal(t, tc.res*-1, tc.r1.Mul(NewRat(-1)).RoundInt64(), "%v. tc #%d", tc.r1.Mul(NewRat(-1)), tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,10 +192,10 @@ func TestRound(t *testing.T) {
|
||||||
{NewRat(1, 2), NewRat(1, 2), 1000},
|
{NewRat(1, 2), NewRat(1, 2), 1000},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for tcIndex, tc := range tests {
|
||||||
require.Equal(t, tc.res, tc.r.Round(tc.precFactor), "%v", tc.r)
|
require.Equal(t, tc.res, tc.r.Round(tc.precFactor), "%v", tc.r, "incorrect rounding, tc #%d", tcIndex)
|
||||||
negR1, negRes := tc.r.Mul(NewRat(-1)), tc.res.Mul(NewRat(-1))
|
negR1, negRes := tc.r.Mul(NewRat(-1)), tc.res.Mul(NewRat(-1))
|
||||||
require.Equal(t, negRes, negR1.Round(tc.precFactor), "%v", negR1)
|
require.Equal(t, negRes, negR1.Round(tc.precFactor), "%v", negR1, "incorrect rounding (negative case), tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,8 +211,8 @@ func TestToLeftPadded(t *testing.T) {
|
||||||
{NewRat(1000, 3), 8, "00000333"},
|
{NewRat(1000, 3), 8, "00000333"},
|
||||||
{NewRat(1000, 3), 12, "000000000333"},
|
{NewRat(1000, 3), 12, "000000000333"},
|
||||||
}
|
}
|
||||||
for _, tc := range tests {
|
for tcIndex, tc := range tests {
|
||||||
require.Equal(t, tc.res, tc.rat.ToLeftPadded(tc.digits))
|
require.Equal(t, tc.res, tc.rat.ToLeftPadded(tc.digits), "incorrect left padding, tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,11 +296,13 @@ func TestRatsEqual(t *testing.T) {
|
||||||
{[]Rat{NewRat(1), NewRat(0)}, []Rat{NewRat(1), NewRat(0)}, true},
|
{[]Rat{NewRat(1), NewRat(0)}, []Rat{NewRat(1), NewRat(0)}, true},
|
||||||
{[]Rat{NewRat(1), NewRat(0)}, []Rat{NewRat(0), NewRat(1)}, false},
|
{[]Rat{NewRat(1), NewRat(0)}, []Rat{NewRat(0), NewRat(1)}, false},
|
||||||
{[]Rat{NewRat(1), NewRat(0)}, []Rat{NewRat(1)}, false},
|
{[]Rat{NewRat(1), NewRat(0)}, []Rat{NewRat(1)}, false},
|
||||||
|
{[]Rat{NewRat(1), NewRat(2)}, []Rat{NewRat(2), NewRat(4)}, false},
|
||||||
|
{[]Rat{NewRat(3), NewRat(18)}, []Rat{NewRat(1), NewRat(6)}, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tests {
|
for tcIndex, tc := range tests {
|
||||||
require.Equal(t, tc.eq, RatsEqual(tc.r1s, tc.r2s))
|
require.Equal(t, tc.eq, RatsEqual(tc.r1s, tc.r2s), "equality of rational arrays is incorrect, tc #%d", tcIndex)
|
||||||
require.Equal(t, tc.eq, RatsEqual(tc.r2s, tc.r1s))
|
require.Equal(t, tc.eq, RatsEqual(tc.r2s, tc.r1s), "equality of rational arrays is incorrect (converse), tc #%d", tcIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,10 @@ func TestSortJSON(t *testing.T) {
|
||||||
wantErr: false},
|
wantErr: false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for tcIndex, tc := range cases {
|
||||||
got, err := SortJSON([]byte(tc.unsortedJSON))
|
got, err := SortJSON([]byte(tc.unsortedJSON))
|
||||||
if tc.wantErr != (err != nil) {
|
if tc.wantErr != (err != nil) {
|
||||||
t.Fatalf("got %t, want: %t, err=%s", err != nil, tc.wantErr, err)
|
t.Fatalf("got %t, want: %t, tc #%d, err=%s", err != nil, tc.wantErr, tcIndex, err)
|
||||||
}
|
}
|
||||||
require.Equal(t, string(got), tc.want)
|
require.Equal(t, string(got), tc.want)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
package version
|
package version
|
||||||
|
|
||||||
const Maj = "0"
|
const Maj = "0"
|
||||||
const Min = "21"
|
const Min = "22"
|
||||||
const Fix = "1"
|
const Fix = "0"
|
||||||
|
|
||||||
const Version = "0.21.1"
|
const Version = "0.22.0"
|
||||||
|
|
||||||
// GitCommit set by build flags
|
// GitCommit set by build flags
|
||||||
var GitCommit = ""
|
var GitCommit = ""
|
||||||
|
|
|
@ -128,18 +128,24 @@ func (keeper Keeper) activateVotingPeriod(ctx sdk.Context, proposal Proposal) {
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// Procedures
|
// Procedures
|
||||||
|
|
||||||
|
var (
|
||||||
|
defaultMinDeposit int64 = 10
|
||||||
|
defaultMaxDepositPeriod int64 = 10000
|
||||||
|
defaultVotingPeriod int64 = 10000
|
||||||
|
)
|
||||||
|
|
||||||
// Gets procedure from store. TODO: move to global param store and allow for updating of this
|
// Gets procedure from store. TODO: move to global param store and allow for updating of this
|
||||||
func (keeper Keeper) GetDepositProcedure() DepositProcedure {
|
func (keeper Keeper) GetDepositProcedure() DepositProcedure {
|
||||||
return DepositProcedure{
|
return DepositProcedure{
|
||||||
MinDeposit: sdk.Coins{sdk.NewCoin("steak", 10)},
|
MinDeposit: sdk.Coins{sdk.NewCoin("steak", defaultMinDeposit)},
|
||||||
MaxDepositPeriod: 200,
|
MaxDepositPeriod: defaultMaxDepositPeriod,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets procedure from store. TODO: move to global param store and allow for updating of this
|
// Gets procedure from store. TODO: move to global param store and allow for updating of this
|
||||||
func (keeper Keeper) GetVotingProcedure() VotingProcedure {
|
func (keeper Keeper) GetVotingProcedure() VotingProcedure {
|
||||||
return VotingProcedure{
|
return VotingProcedure{
|
||||||
VotingPeriod: 200,
|
VotingPeriod: defaultVotingPeriod,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,13 @@ import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// overwrite defaults for testing
|
||||||
|
func init() {
|
||||||
|
defaultMinDeposit = 10
|
||||||
|
defaultMaxDepositPeriod = 200
|
||||||
|
defaultVotingPeriod = 200
|
||||||
|
}
|
||||||
|
|
||||||
func TestGetSetProposal(t *testing.T) {
|
func TestGetSetProposal(t *testing.T) {
|
||||||
mapp, keeper, _, _, _, _ := getMockApp(t, 0)
|
mapp, keeper, _, _, _, _ := getMockApp(t, 0)
|
||||||
mapp.BeginBlock(abci.RequestBeginBlock{})
|
mapp.BeginBlock(abci.RequestBeginBlock{})
|
||||||
|
|
|
@ -60,7 +60,7 @@ type TextProposal struct {
|
||||||
Description string `json:"description"` // Description of the proposal
|
Description string `json:"description"` // Description of the proposal
|
||||||
ProposalType ProposalKind `json:"proposal_type"` // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
|
ProposalType ProposalKind `json:"proposal_type"` // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
|
||||||
|
|
||||||
Status ProposalStatus `json:"string"` // Status of the Proposal {Pending, Active, Passed, Rejected}
|
Status ProposalStatus `json:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected}
|
||||||
|
|
||||||
SubmitBlock int64 `json:"submit_block"` // Height of the block where TxGovSubmitProposal was included
|
SubmitBlock int64 `json:"submit_block"` // Height of the block where TxGovSubmitProposal was included
|
||||||
TotalDeposit sdk.Coins `json:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit
|
TotalDeposit sdk.Coins `json:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit
|
||||||
|
@ -184,7 +184,7 @@ func (pt ProposalKind) Format(s fmt.State, verb rune) {
|
||||||
case 's':
|
case 's':
|
||||||
s.Write([]byte(fmt.Sprintf("%s", pt.String())))
|
s.Write([]byte(fmt.Sprintf("%s", pt.String())))
|
||||||
default:
|
default:
|
||||||
s.Write([]byte(fmt.Sprintf("%v", pt)))
|
s.Write([]byte(fmt.Sprintf("%v", byte(pt))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,6 +283,6 @@ func (status ProposalStatus) Format(s fmt.State, verb rune) {
|
||||||
case 's':
|
case 's':
|
||||||
s.Write([]byte(fmt.Sprintf("%s", status.String())))
|
s.Write([]byte(fmt.Sprintf("%s", status.String())))
|
||||||
default:
|
default:
|
||||||
s.Write([]byte(fmt.Sprintf("%v", status)))
|
s.Write([]byte(fmt.Sprintf("%v", byte(status))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue