Add weighted operations run simulation#1055
Conversation
x/wasm/simulation/operations.go
Outdated
|
|
||
| msg := types.MsgUpdateAdmin{ | ||
| Sender: simAccount.Address.String(), | ||
| NewAdmin: simtypes.RandomAccounts(r, 1)[0].Address.String(), |
There was a problem hiding this comment.
Let's use simtypes.RandomAcc(r, accs) instead to not run dry
| msg := types.MsgInstantiateContract{ | ||
| Sender: simAccount.Address.String(), | ||
| Admin: simtypes.RandomAccounts(r, 1)[0].Address.String(), | ||
| Admin: adminAccount.Address.String(), |
app/params/weights.go
Outdated
| DefaultWeightMsgInstantiateContract int = 100 | ||
|
|
||
| DefaultWeightMsgStoreCode int = 100 | ||
| DefaultWeightMsgInstantiateContract int = 50 |
There was a problem hiding this comment.
Why flipping store and instantiate weights?
app/params/weights.go
Outdated
| DefaultWeightMsgStoreCode int = 100 | ||
| DefaultWeightMsgInstantiateContract int = 50 | ||
| DefaultWeightMsgExecuteContract int = 100 | ||
| DefaultWeightMsgUpdateAdmin int = 100 |
There was a problem hiding this comment.
I would expect this to happen quire rarely. How about 25?
app/params/weights.go
Outdated
| DefaultWeightMsgInstantiateContract int = 50 | ||
| DefaultWeightMsgExecuteContract int = 100 | ||
| DefaultWeightMsgUpdateAdmin int = 100 | ||
| DefaultWeightMsgClearAdmin int = 100 |
There was a problem hiding this comment.
I would expect this to happen quire rarely. How about 10?
app/params/weights.go
Outdated
| DefaultWeightMsgExecuteContract int = 100 | ||
| DefaultWeightMsgUpdateAdmin int = 100 | ||
| DefaultWeightMsgClearAdmin int = 100 | ||
| DefaultWeightMsgMigrateContract int = 100 |
There was a problem hiding this comment.
I would expect more instantiations than migrations. How about 50?
x/wasm/simulation/operations.go
Outdated
| txCtx.SimAccount.PrivKey, | ||
| ) | ||
| if err != nil { | ||
| return simtypes.NoOpMsg(types.ModuleName, types.MsgMigrateContract{}.Type(), "unable to generate mock tx"), nil, err |
There was a problem hiding this comment.
| return simtypes.NoOpMsg(types.ModuleName, types.MsgMigrateContract{}.Type(), "unable to generate mock tx"), nil, err | |
| return simtypes.NoOpMsg(types.ModuleName, types.MsgMigrateContract{}.Type(), "unable to generate tx"), nil, err |
x/wasm/simulation/operations.go
Outdated
| return simtypes.NoOpMsg(types.ModuleName, types.MsgMigrateContract{}.Type(), "unable to read response data"), nil, err | ||
| } | ||
|
|
||
| fmt.Printf("%v\n", result.Data[0].MsgType) |
x/wasm/simulation/operations.go
Outdated
|
|
||
| var wasmBz []byte | ||
| var err error | ||
| wasmBz, err = os.ReadFile("./../x/wasm/keeper/testdata/reflect_1_1.wasm") |
There was a problem hiding this comment.
I tried to avoid hard coding any contracts here. See L106-7.
As we only store reflect contracts you can just pick a different code id and drop the store code part.
There was a problem hiding this comment.
I have fixed to embed
Codecov Report
@@ Coverage Diff @@
## main #1055 +/- ##
==========================================
- Coverage 59.28% 59.19% -0.09%
==========================================
Files 53 53
Lines 6722 6732 +10
==========================================
Hits 3985 3985
- Misses 2442 2452 +10
Partials 295 295
|
|
Let's remove some code to finish this: see 5697af6 |
Got it :3 tysm!!! |
* add WeightedOperations msg update admin * add check contract info condition * add fnc simulate migrate * add weights operations migrate contract * fix simulation msg update admin * add simulation.NewWeightedOperation * add sml msg clear admin * fix lint * remove msg migrate * change admin to use test account * add migrate * add new contract for simulation migrate * correct return log * Polish SimulateMsgMigrateContract Co-authored-by: Alex Peters <alpe@users.noreply.github.com>
* add WeightedOperations msg update admin * add check contract info condition * add fnc simulate migrate * add weights operations migrate contract * fix simulation msg update admin * add simulation.NewWeightedOperation * add sml msg clear admin * fix lint * remove msg migrate * change admin to use test account * add migrate * add new contract for simulation migrate * correct return log * Polish SimulateMsgMigrateContract Co-authored-by: Alex Peters <alpe@users.noreply.github.com>
* add WeightedOperations msg update admin * add check contract info condition * add fnc simulate migrate * add weights operations migrate contract * fix simulation msg update admin * add simulation.NewWeightedOperation * add sml msg clear admin * fix lint * remove msg migrate * change admin to use test account * add migrate * add new contract for simulation migrate * correct return log * Polish SimulateMsgMigrateContract Co-authored-by: Alex Peters <alpe@users.noreply.github.com>
Close #797
add operations run simulation for
add new test contract for simulation migrate contract