-
Notifications
You must be signed in to change notification settings - Fork 412
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
Add weighted operations run simulation #1055
Add weighted operations run simulation #1055
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice as well!
Only minor changes or discussion needed. Thanks a lot! 💐
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use simtypes.RandomAcc(r, accs)
instead to not run dry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed
msg := types.MsgInstantiateContract{ | ||
Sender: simAccount.Address.String(), | ||
Admin: simtypes.RandomAccounts(r, 1)[0].Address.String(), | ||
Admin: adminAccount.Address.String(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
app/params/weights.go
Outdated
DefaultWeightMsgInstantiateContract int = 100 | ||
|
||
DefaultWeightMsgStoreCode int = 100 | ||
DefaultWeightMsgInstantiateContract int = 50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why flipping store and instantiate weights?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed
app/params/weights.go
Outdated
DefaultWeightMsgExecuteContract int = 100 | ||
DefaultWeightMsgUpdateAdmin int = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect this to happen quire rarely. How about 25?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed
app/params/weights.go
Outdated
DefaultWeightMsgExecuteContract int = 100 | ||
DefaultWeightMsgUpdateAdmin int = 100 | ||
DefaultWeightMsgClearAdmin int = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect this to happen quire rarely. How about 10?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed
app/params/weights.go
Outdated
DefaultWeightMsgExecuteContract int = 100 | ||
DefaultWeightMsgUpdateAdmin int = 100 | ||
DefaultWeightMsgClearAdmin int = 100 | ||
DefaultWeightMsgMigrateContract int = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect more instantiations than migrations. How about 50?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid Printfs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great contribution! 🏄
* 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