This reverts commit 65048683b5
.
This commit is contained in:
parent
3ee975c57b
commit
37c92c5f39
|
@ -219,7 +219,6 @@ functionality that requires an online connection.
|
||||||
* (types/rest) [\#5900](https://github.com/cosmos/cosmos-sdk/pull/5900) Add Check*Error function family to spare developers from replicating tons of boilerplate code.
|
* (types/rest) [\#5900](https://github.com/cosmos/cosmos-sdk/pull/5900) Add Check*Error function family to spare developers from replicating tons of boilerplate code.
|
||||||
* (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Tendermint Consensus parameters can now be changed via parameter change proposals through `x/gov`.
|
* (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Tendermint Consensus parameters can now be changed via parameter change proposals through `x/gov`.
|
||||||
* (x/auth/ante) [\#6040](https://github.com/cosmos/cosmos-sdk/pull/6040) `AccountKeeper` interface used for `NewAnteHandler` and handler's decorators to add support of using custom `AccountKeeper` implementations.
|
* (x/auth/ante) [\#6040](https://github.com/cosmos/cosmos-sdk/pull/6040) `AccountKeeper` interface used for `NewAnteHandler` and handler's decorators to add support of using custom `AccountKeeper` implementations.
|
||||||
* (simulation) [\#6002](https://github.com/cosmos/cosmos-sdk/pull/6002) Add randomized consensus params into simulation.
|
|
||||||
|
|
||||||
## [v0.38.3] - 2020-04-09
|
## [v0.38.3] - 2020-04-09
|
||||||
|
|
||||||
|
|
|
@ -37,12 +37,12 @@ func TestValidateCmd(t *testing.T) {
|
||||||
args []string
|
args []string
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"misspelled command", []string{"COMMISSION"}, true},
|
{"misspelled command", []string{"commission"}, true}, // nolint: misspell
|
||||||
{"no command provided", []string{}, false},
|
{"no command provided", []string{}, false},
|
||||||
{"help flag", []string{"COMMISSION", "--help"}, false},
|
{"help flag", []string{"commission", "--help"}, false}, // nolint: misspell
|
||||||
{"shorthand help flag", []string{"COMMISSION", "-h"}, false},
|
{"shorthand help flag", []string{"commission", "-h"}, false}, // nolint: misspell
|
||||||
{"flag only, no command provided", []string{"--gas", "1000atom"}, false},
|
{"flag only, no command provided", []string{"--gas", "1000atom"}, false},
|
||||||
{"flag and misspelled command", []string{"--gas", "1000atom", "COMMISSION"}, true},
|
{"flag and misspelled command", []string{"--gas", "1000atom", "comission"}, true}, // nolint: misspell
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
|
@ -5,12 +5,11 @@ import (
|
||||||
|
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
dbm "github.com/tendermint/tm-db"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
"github.com/cosmos/cosmos-sdk/store/cachekv"
|
"github.com/cosmos/cosmos-sdk/store/cachekv"
|
||||||
"github.com/cosmos/cosmos-sdk/store/dbadapter"
|
"github.com/cosmos/cosmos-sdk/store/dbadapter"
|
||||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||||
|
dbm "github.com/tendermint/tm-db"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
package simulation
|
package simulation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/types"
|
|
||||||
|
|
||||||
"github.com/tendermint/go-amino"
|
|
||||||
abci "github.com/tendermint/tendermint/abci/types"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
|
||||||
"github.com/cosmos/cosmos-sdk/types/simulation"
|
"github.com/cosmos/cosmos-sdk/types/simulation"
|
||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -150,33 +142,3 @@ func (w WeightedProposalContent) DefaultWeight() int {
|
||||||
func (w WeightedProposalContent) ContentSimulatorFn() simulation.ContentSimulatorFn {
|
func (w WeightedProposalContent) ContentSimulatorFn() simulation.ContentSimulatorFn {
|
||||||
return w.contentSimulatorFn
|
return w.contentSimulatorFn
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Param change proposals
|
|
||||||
|
|
||||||
// RandomParams returns random simulation consensus parameters, it extracts the Evidence from the Staking genesis state.
|
|
||||||
func RandomConsensusParams(r *rand.Rand, appState json.RawMessage) *abci.ConsensusParams {
|
|
||||||
cdc := amino.NewCodec()
|
|
||||||
|
|
||||||
var genesisState map[string]json.RawMessage
|
|
||||||
cdc.UnmarshalJSON(appState, &genesisState)
|
|
||||||
|
|
||||||
stakingGenesisState := stakingtypes.GetGenesisStateFromAppState(cdc, genesisState)
|
|
||||||
|
|
||||||
consensusParams := &abci.ConsensusParams{
|
|
||||||
Block: &abci.BlockParams{
|
|
||||||
MaxBytes: int64(simulation.RandIntBetween(r, 20000000, 30000000)),
|
|
||||||
MaxGas: -1,
|
|
||||||
},
|
|
||||||
Validator: &abci.ValidatorParams{
|
|
||||||
PubKeyTypes: []string{types.ABCIPubKeyTypeSecp256k1, types.ABCIPubKeyTypeEd25519},
|
|
||||||
},
|
|
||||||
Evidence: &abci.EvidenceParams{
|
|
||||||
MaxAgeNumBlocks: int64(stakingGenesisState.Params.UnbondingTime / AverageBlockTime),
|
|
||||||
MaxAgeDuration: stakingGenesisState.Params.UnbondingTime,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
fmt.Printf("Selected randomly generated consensus parameters:\n%s\n", codec.MustMarshalJSONIndent(cdc, consensusParams))
|
|
||||||
|
|
||||||
return consensusParams
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/types/simulation"
|
"github.com/cosmos/cosmos-sdk/types/simulation"
|
||||||
)
|
)
|
||||||
|
|
||||||
const AverageBlockTime = 6 * time.Second
|
|
||||||
|
|
||||||
// initialize the chain for the simulation
|
// initialize the chain for the simulation
|
||||||
func initChain(
|
func initChain(
|
||||||
r *rand.Rand, params Params, accounts []simulation.Account, app *baseapp.BaseApp,
|
r *rand.Rand, params Params, accounts []simulation.Account, app *baseapp.BaseApp,
|
||||||
|
@ -27,12 +25,9 @@ func initChain(
|
||||||
|
|
||||||
appState, accounts, chainID, genesisTimestamp := appStateFn(r, accounts, config)
|
appState, accounts, chainID, genesisTimestamp := appStateFn(r, accounts, config)
|
||||||
|
|
||||||
consensusParams := RandomConsensusParams(r, appState)
|
|
||||||
|
|
||||||
req := abci.RequestInitChain{
|
req := abci.RequestInitChain{
|
||||||
AppStateBytes: appState,
|
AppStateBytes: appState,
|
||||||
ChainId: chainID,
|
ChainId: chainID,
|
||||||
ConsensusParams: consensusParams,
|
|
||||||
}
|
}
|
||||||
res := app.InitChain(req)
|
res := app.InitChain(req)
|
||||||
validators := newMockValidators(r, res.Validators, params)
|
validators := newMockValidators(r, res.Validators, params)
|
||||||
|
@ -113,7 +108,7 @@ func SimulateFromSeed(
|
||||||
|
|
||||||
// These are operations which have been queued by previous operations
|
// These are operations which have been queued by previous operations
|
||||||
operationQueue := NewOperationQueue()
|
operationQueue := NewOperationQueue()
|
||||||
var timeOperationQueue []simulation.FutureOperation
|
timeOperationQueue := []simulation.FutureOperation{}
|
||||||
|
|
||||||
logWriter := NewLogWriter(testingMode)
|
logWriter := NewLogWriter(testingMode)
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,14 +37,3 @@ func DefaultGenesisState() GenesisState {
|
||||||
Params: DefaultParams(),
|
Params: DefaultParams(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetGenesisStateFromAppState returns x/staking GenesisState given raw application
|
|
||||||
// genesis state.
|
|
||||||
func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawMessage) GenesisState {
|
|
||||||
var genesisState GenesisState
|
|
||||||
if appState[ModuleName] != nil {
|
|
||||||
cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState)
|
|
||||||
}
|
|
||||||
|
|
||||||
return genesisState
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue