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

Add Weighted Operations to simulation #825

Closed
wants to merge 7 commits into from
Closed

Conversation

pinosu
Copy link
Contributor

@pinosu pinosu commented Apr 28, 2022

See #797

Add support for:

  • MsgStoreCode
  • MsgInstantiateContract

Simulations can be run with test-sim-multi-seed-short and make test-sim-import-export

@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #825 (283bde0) into main (8ca55b7) will decrease coverage by 0.07%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #825      +/-   ##
==========================================
- Coverage   59.37%   59.30%   -0.08%     
==========================================
  Files          51       51              
  Lines        5898     5885      -13     
==========================================
- Hits         3502     3490      -12     
+ Misses       2144     2143       -1     
  Partials      252      252              
Impacted Files Coverage Δ
x/wasm/types/params.go 60.21% <ø> (-1.33%) ⬇️
x/wasm/types/validation.go 100.00% <ø> (ø)
x/wasm/module.go 49.45% <75.00%> (+1.13%) ⬆️
app/app.go 88.94% <100.00%> (ø)
x/wasm/keeper/keeper.go 87.39% <100.00%> (-0.44%) ⬇️

alpe and others added 5 commits April 29, 2022 10:47
* Convert MaxWasmSize to var

Also removes redundant maxWasmSize param

* Convert MaxWasmSize to int

* Update CHANGELOG

* Complete max wasm size changes

* Update compile flags

Co-authored-by: Cole Brown <[email protected]>
@pinosu pinosu marked this pull request as ready for review May 2, 2022 10:05
@pinosu pinosu requested a review from alpe as a code owner May 2, 2022 10:05
Copy link
Contributor

@alpe alpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice start!
Please rebase and use CodeInfos to find a code id

@@ -2,6 +2,10 @@

## [Unreleased](https://github.com/CosmWasm/wasmd/tree/HEAD)

**Merged pull requests:**

- Consolidate MaxWasmSize constraints into a single var [\#826](https://github.com/CosmWasm/wasmd/pull/826)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 this is in main already. I think you PR was not rebased proper

@@ -20,4 +20,6 @@ const (
DefaultWeightCommunitySpendProposal int = 5
DefaultWeightTextProposal int = 5
DefaultWeightParamChangeProposal int = 5
DefaultWeightMsgStoreCode int = 100
DefaultWeightMsgInstantiateContract int = 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this high as well to get some load on our module

return true
})

if contractInfo.Equal(types.ContractInfo{}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to look for a CodeInfo here. The system won't have contract instances in the beginning and you abort here so that none will be created

return simtypes.NoOpMsg(types.ModuleName, types.MsgInstantiateContract{}.Type(), "no contracts available"), nil, nil
}

spendable := bk.SpendableCoins(ctx, simAccount.Address)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice to send some tokens. 💸
Test accounts will get broke fast though. How about sending a random amount with simtypes.RandSubset as the sdk does?


msg := types.MsgInstantiateContract{
Sender: simAccount.Address.String(),
Admin: contractInfo.Admin,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a random account address here. Empty string is valid too.

Sender: simAccount.Address.String(),
Admin: contractInfo.Admin,
CodeID: contractInfo.CodeID,
Label: simtypes.RandStringOfLength(r, 10),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Admin: contractInfo.Admin,
CodeID: contractInfo.CodeID,
Label: simtypes.RandStringOfLength(r, 10),
Msg: []byte(fmt.Sprintf(`{"%s": "%s"}`, simtypes.RandStringOfLength(r, 10), simtypes.RandStringOfLength(r, 10))),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reflect contract expects an empty object on instantiation

@pinosu
Copy link
Contributor Author

pinosu commented May 2, 2022

Closing in favour of #831

@pinosu pinosu closed this May 2, 2022
@alpe alpe deleted the 797-add_ops_simulation branch May 10, 2023 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants