Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sim refactor 3: move weighted operations to modules #4869

Merged
merged 157 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
771e305
move GenesisState generators to modules
fedekunze Jul 30, 2019
77d8bd9
minor change on slashing genState generator
fedekunze Aug 2, 2019
52c18e0
move simulation params back to modules (#4839)
fedekunze Aug 5, 2019
bea474f
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into fe…
fedekunze Aug 5, 2019
237b65a
cleanup params
fedekunze Aug 5, 2019
8bb9880
various fixes
fedekunze Aug 5, 2019
84fa364
move store decoders to modules
fedekunze Jul 30, 2019
687125a
fix
fedekunze Aug 5, 2019
eeb0469
module pattern
fedekunze Aug 5, 2019
5fa13a3
split generators for param change
fedekunze Aug 6, 2019
5efe2bd
param changes
fedekunze Aug 6, 2019
3e15e2a
revert util pkg
fedekunze Aug 6, 2019
521c4dd
banksim
fedekunze Aug 6, 2019
5c41dd2
compile
fedekunze Aug 7, 2019
865a5e4
update Decoders params
fedekunze Aug 7, 2019
45a0e3c
fix
fedekunze Aug 7, 2019
da6de9f
address @colin-axner comments
fedekunze Aug 8, 2019
b59f37c
merge master
fedekunze Aug 8, 2019
f25f970
move weighted operations to modules
fedekunze Jul 30, 2019
66d459a
cleanup
fedekunze Aug 8, 2019
867ba5a
merge master
fedekunze Aug 8, 2019
4f59730
cleanup
fedekunze Aug 8, 2019
bd71a17
Update cmd_test.go
fedekunze Aug 8, 2019
3628d90
merge master
fedekunze Aug 9, 2019
564b484
Merge branch 'fedekunze/move-sim-decoders' of https://github.com/cosm…
fedekunze Aug 9, 2019
fc1e72a
simulation manager
fedekunze Aug 9, 2019
cca3a19
mino fixes
fedekunze Aug 9, 2019
c48a035
cleanup
fedekunze Aug 9, 2019
8c02035
merge sim refactor part 1
fedekunze Aug 9, 2019
5fe9b91
add GenerateGenesisState to simulation manager
fedekunze Aug 9, 2019
225bea3
Apply suggestions from code review
fedekunze Aug 9, 2019
9f3525b
address @rigelrozanski comments
fedekunze Aug 9, 2019
c13ecb6
changelog
fedekunze Aug 9, 2019
4959068
Apply suggestions from code review
fedekunze Aug 10, 2019
4a4db84
update tests
fedekunze Aug 12, 2019
0338964
Merge branch 'fedekunze/move-sim-decoders' of https://github.com/cosm…
fedekunze Aug 12, 2019
84555d9
Merge branch 'fedekunze/move-sim-decoders' of https://github.com/cosm…
fedekunze Aug 12, 2019
258e3e6
restructure modules simulation pkgs
fedekunze Aug 12, 2019
785ac1d
merge sim decoders PR
fedekunze Aug 12, 2019
c627c68
remove cycle deps
fedekunze Aug 12, 2019
427b235
rename funcs and add missing params
fedekunze Aug 12, 2019
7793e11
modularize simulator param changes
fedekunze Aug 13, 2019
d81ba90
build
fedekunze Aug 13, 2019
3899350
fix params keys
fedekunze Aug 13, 2019
c0cd833
make format
fedekunze Aug 13, 2019
e574743
merge master
fedekunze Aug 13, 2019
694e699
merge master
fedekunze Aug 14, 2019
b3ad025
various fixes
fedekunze Aug 14, 2019
538e6e1
fix tests
fedekunze Aug 14, 2019
2ac27a2
minor updates to sim_test
fedekunze Aug 14, 2019
702a257
merge master
fedekunze Aug 16, 2019
d6c669b
cleanup
fedekunze Aug 16, 2019
85ced57
more cleanup
fedekunze Aug 16, 2019
ea76486
modularize genesis generators
fedekunze Aug 16, 2019
9db1881
minor cleanup
fedekunze Aug 16, 2019
cb3f361
remove cdc from generators
fedekunze Aug 20, 2019
d1b96f0
remove cdc
fedekunze Aug 20, 2019
329d32b
merge master
fedekunze Aug 20, 2019
887f2e7
add get or generate
fedekunze Aug 20, 2019
b51949c
fix non-determinism in simulation
fedekunze Aug 20, 2019
ee7c66d
changelog and x/simulation godoc
fedekunze Aug 20, 2019
6bd9554
changes from master
fedekunze Aug 20, 2019
86a6819
merge simulation part 2
fedekunze Aug 20, 2019
4928867
cleanup operations
fedekunze Aug 20, 2019
f22313a
update operations to use baseapp
fedekunze Aug 22, 2019
8f1240c
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into fe…
fedekunze Aug 26, 2019
5a31d65
updates and cleanup operations
fedekunze Aug 26, 2019
89cf7b9
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into fe…
fedekunze Aug 27, 2019
5f606ea
update operations
fedekunze Aug 27, 2019
d450ebb
restructure sim ops params
fedekunze Aug 27, 2019
abb288f
merge master
fedekunze Aug 27, 2019
51bf12b
merge master
fedekunze Aug 28, 2019
fe3f6f3
rename sim /operations/msg.go to /operations.go
fedekunze Aug 28, 2019
f3a398b
move GenTx to a helper pkg to avoid circle deps
fedekunze Aug 28, 2019
666a301
rm msg.ValidateBasic
fedekunze Aug 28, 2019
1bb0adc
changelog
fedekunze Aug 28, 2019
b300de0
random fees; delete auth's DeductFees sim operation
fedekunze Aug 29, 2019
bcf6796
add chain-id for sig verification
fedekunze Aug 29, 2019
bb47279
Update x/simulation/account.go
fedekunze Aug 29, 2019
b52a122
fix bank, gov and distr errors
fedekunze Aug 29, 2019
08af7df
Merge branch 'fedekunze/4935-sim-ops-baseapp' of https://github.com/c…
fedekunze Aug 29, 2019
a0a4105
fix staking and slashing errors; increase prob for send enabled
fedekunze Aug 29, 2019
0d33e53
increase gas x10
fedekunze Aug 29, 2019
d2d8e06
make format
fedekunze Aug 29, 2019
882b529
fix some distr and staking edge cases
fedekunze Aug 29, 2019
86798bd
fix all edge cases
fedekunze Aug 30, 2019
8a5a8f7
golang ci
fedekunze Aug 30, 2019
d2433c8
rename acc vars; default no fees to 0stake
fedekunze Aug 30, 2019
0172569
cleanup; check for exchange rate and skip invalid ops
fedekunze Aug 30, 2019
2a2c369
fixes
fedekunze Aug 30, 2019
50f6959
check for max entries
fedekunze Aug 30, 2019
309348a
add pubkey to genaccounts
fedekunze Aug 30, 2019
4e2d3b3
fix gov bug
fedekunze Sep 2, 2019
e662201
update staking sim ops
fedekunze Sep 2, 2019
f1c3e12
fix small redelegation error
fedekunze Sep 2, 2019
3298d5d
fix small self delegation on unjail
fedekunze Sep 2, 2019
8501356
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into fe…
fedekunze Sep 2, 2019
e615ee1
rm inf loop on random val/accs
fedekunze Sep 2, 2019
9e81756
copy array
fedekunze Sep 2, 2019
490bc77
add ok boolean to RandomValidator return values
fedekunze Sep 2, 2019
2139e75
format
fedekunze Sep 2, 2019
94dcc8c
merge #4946
fedekunze Sep 3, 2019
e64f774
build
fedekunze Sep 3, 2019
0b10ad0
add WeightedOperations to AppModuleSimulation
fedekunze Sep 3, 2019
370a664
define each module proposals content as part of the module pattern
fedekunze Sep 4, 2019
7da6f34
Update x/bank/simulation/operations.go
fedekunze Sep 4, 2019
bd7ed37
Update simapp/helpers/test_helpers.go
fedekunze Sep 4, 2019
59620ed
address @colin-axner comments
fedekunze Sep 4, 2019
b2b4a63
add genaccount pubkey validation
fedekunze Sep 4, 2019
c739839
fix test
fedekunze Sep 4, 2019
8d5a90e
update operations and move RandomFees to x/simulation
fedekunze Sep 5, 2019
52875e5
update gov ops
fedekunze Sep 5, 2019
ae94071
merge master
fedekunze Sep 5, 2019
c49543f
address @alexanderbez comments
fedekunze Sep 6, 2019
86503a9
avoid modifications to config
fedekunze Sep 6, 2019
496fa15
reorder params
fedekunze Sep 6, 2019
0b9b1f4
modularized sim operations working
fedekunze Sep 9, 2019
7aad9cb
merge master
fedekunze Sep 9, 2019
f00fbab
merge sims baseapp PR
fedekunze Sep 9, 2019
337a25c
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into fe…
fedekunze Sep 9, 2019
efcab1d
changelog
fedekunze Sep 9, 2019
70e8bfa
Merge branch 'fedekunze/4935-sim-ops-baseapp' of https://github.com/c…
fedekunze Sep 9, 2019
7543f45
Update types/module/simulation.go
fedekunze Sep 11, 2019
01da23d
Update x/simulation/params.go
fedekunze Sep 11, 2019
cc719ba
Update x/simulation/params.go
fedekunze Sep 11, 2019
ce53f80
update /types/module
fedekunze Sep 11, 2019
d4df4bf
Update x/distribution/simulation/genesis.go
fedekunze Sep 11, 2019
4f9961a
merge master
fedekunze Sep 24, 2019
8396254
Merge branch 'fedekunze/4935-sim-ops-baseapp' of https://github.com/c…
fedekunze Sep 24, 2019
a188a77
remove named return values
fedekunze Sep 24, 2019
ea3594b
ensure all operations are simulated
fedekunze Sep 25, 2019
f39fc77
Merge branch 'master' into fedekunze/4935-sim-ops-baseapp
fedekunze Sep 25, 2019
c79bc9a
golangci
fedekunze Sep 25, 2019
5491db8
Merge branch 'fedekunze/4935-sim-ops-baseapp' of https://github.com/c…
fedekunze Sep 25, 2019
c9faeeb
add nolint
fedekunze Sep 25, 2019
b310b12
disable whitespace and funlen linter
fedekunze Sep 25, 2019
446179d
disable godox
fedekunze Sep 25, 2019
42eebc3
add TODO on unjail
fedekunze Sep 25, 2019
272e08a
update ops weights
fedekunze Sep 25, 2019
5a3712d
address @alexanderbez comments
fedekunze Sep 30, 2019
c45382b
remove dup
fedekunze Sep 30, 2019
efd2edb
update godoc
fedekunze Sep 30, 2019
daa8206
Merge branch 'master' into fedekunze/4935-sim-ops-baseapp
fedekunze Sep 30, 2019
55f4eb2
merge sim baseapp branch
fedekunze Sep 30, 2019
e34af9d
remove unused func
fedekunze Oct 1, 2019
3b9b870
merge master
fedekunze Nov 22, 2019
c16e512
build fixes
fedekunze Nov 22, 2019
a933a05
move weights to the same file
fedekunze Nov 26, 2019
58357f2
scopelint
fedekunze Nov 26, 2019
9e84b66
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into fe…
fedekunze Dec 2, 2019
bfb0a94
changelog
fedekunze Dec 2, 2019
15c015b
address @AdityaSripal comments
fedekunze Dec 3, 2019
a9696c0
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into fe…
fedekunze Dec 3, 2019
6ba787d
Merge branch 'master' into fedekunze/move-sim-operations
alexanderbez Dec 4, 2019
9ba2ec5
Merge branch 'master' into fedekunze/move-sim-operations
fedekunze Dec 4, 2019
cb524e0
address @alexanderbez comments
fedekunze Dec 4, 2019
40a38fa
Merge branch 'fedekunze/move-sim-operations' of https://github.com/co…
fedekunze Dec 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address @AdityaSripal comments
  • Loading branch information
fedekunze committed Dec 3, 2019
commit 15c015b5339f11eed91bdab5b10680c6a0c9c5f5
2 changes: 1 addition & 1 deletion simapp/params/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ file with the weights defined for each of the transaction operations:
}

In the example above, the `MsgSend` has 60% chance to be simulated, while the
"MsgDelegate" will always be simulated.
`MsgDelegate` will always be simulated.
*/
package params
6 changes: 5 additions & 1 deletion simapp/params/weights.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package params

// Default simulation weights
// Default simulation operation weights for messages and gov proposals
const (
DefaultWeightMsgSend int = 100
DefaultWeightMsgMultiSend int = 10
Expand All @@ -15,4 +15,8 @@ const (
DefaultWeightMsgDelegate int = 100
DefaultWeightMsgUndelegate int = 100
DefaultWeightMsgBeginRedelegate int = 100

DefaultWeightCommunitySpendProposal int = 5
DefaultWeightTextProposal int = 5
DefaultWeightParamChangeProposal int = 5
)
4 changes: 2 additions & 2 deletions x/bank/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ func WeightedOperations(appParams simulation.AppParams, cdc *codec.Codec, ak typ
)

return simulation.WeightedOperations{
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgSend,
SimulateMsgSend(ak, bk),
),
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgMultiSend,
SimulateMsgMultiSend(ak, bk),
),
Expand Down
6 changes: 3 additions & 3 deletions x/distribution/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ func WeightedOperations(appParams simulation.AppParams, cdc *codec.Codec, ak typ
)

return simulation.WeightedOperations{
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgSetWithdrawAddress,
SimulateMsgSetWithdrawAddress(ak, k),
),
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgWithdrawDelegationReward,
SimulateMsgWithdrawDelegatorReward(ak, k, sk),
),
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgWithdrawValidatorCommission,
SimulateMsgWithdrawValidatorCommission(ak, k, sk),
),
Expand Down
3 changes: 2 additions & 1 deletion x/distribution/simulation/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package simulation
import (
"math/rand"

appsimparams "github.com/cosmos/cosmos-sdk/simapp/params"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/distribution/keeper"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
Expand All @@ -18,7 +19,7 @@ func ProposalContents(k keeper.Keeper) []simulation.WeightedProposalContent {
return []simulation.WeightedProposalContent{
{
AppParamsKey: OpWeightSubmitCommunitySpendProposal,
DefaultWeight: 5,
DefaultWeight: appsimparams.DefaultWeightCommunitySpendProposal,
ContentSimulatorFn: SimulateCommunityPoolSpendProposalContent(k),
},
}
Expand Down
6 changes: 3 additions & 3 deletions x/gov/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ func WeightedOperations(appParams simulation.AppParams, cdc *codec.Codec, ak typ

wProposalOps = append(
wProposalOps,
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weight,
SimulateSubmitProposal(ak, k, wContent.ContentSimulatorFn),
),
)
}

wGovOps := simulation.WeightedOperations{
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgDeposit,
SimulateMsgDeposit(ak, k),
),
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgVote,
SimulateMsgVote(ak, k),
),
Expand Down
3 changes: 2 additions & 1 deletion x/gov/simulation/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package simulation
import (
"math/rand"

appsimparams "github.com/cosmos/cosmos-sdk/simapp/params"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/simulation"
Expand All @@ -16,7 +17,7 @@ func ProposalContents() []simulation.WeightedProposalContent {
return []simulation.WeightedProposalContent{
{
AppParamsKey: OpWeightSubmitTextProposal,
DefaultWeight: 5,
DefaultWeight: appsimparams.DefaultWeightTextProposal,
ContentSimulatorFn: SimulateTextProposalContent,
},
}
Expand Down
3 changes: 2 additions & 1 deletion x/params/simulation/proposals.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package simulation

import (
appsimparams "github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/cosmos/cosmos-sdk/x/simulation"
)

Expand All @@ -12,7 +13,7 @@ func ProposalContents(paramChanges []simulation.ParamChange) []simulation.Weight
return []simulation.WeightedProposalContent{
{
AppParamsKey: OpWeightSubmitParamChangeProposal,
DefaultWeight: 5,
DefaultWeight: appsimparams.DefaultWeightParamChangeProposal,
ContentSimulatorFn: SimulateParamChangeProposalContent(paramChanges),
},
}
Expand Down
4 changes: 2 additions & 2 deletions x/simulation/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ type WeightedOperation struct {
Op Operation
}

// NewWeigthedOperation creates a new WeightedOperation instance
func NewWeigthedOperation(weight int, op Operation) WeightedOperation {
// NewWeightedOperation creates a new WeightedOperation instance
func NewWeightedOperation(weight int, op Operation) WeightedOperation {
return WeightedOperation{
Weight: weight,
Op: op,
Expand Down
2 changes: 1 addition & 1 deletion x/slashing/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func WeightedOperations(appParams simulation.AppParams, cdc *codec.Codec, ak typ
)

return simulation.WeightedOperations{
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgUnjail,
SimulateMsgUnjail(ak, k, sk),
),
Expand Down
10 changes: 5 additions & 5 deletions x/staking/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,23 @@ func WeightedOperations(appParams simulation.AppParams, cdc *codec.Codec, ak typ
)

return simulation.WeightedOperations{
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgCreateValidator,
SimulateMsgCreateValidator(ak, k),
),
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgEditValidator,
SimulateMsgEditValidator(ak, k),
),
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgDelegate,
SimulateMsgDelegate(ak, k),
),
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgUndelegate,
SimulateMsgUndelegate(ak, k),
),
simulation.NewWeigthedOperation(
simulation.NewWeightedOperation(
weightMsgBeginRedelegate,
SimulateMsgBeginRedelegate(ak, k),
),
Expand Down