-
Notifications
You must be signed in to change notification settings - Fork 608
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 wasmd module #769
Add wasmd module #769
Changes from all commits
1aa6334
d6a08e1
ce4260f
4042188
a973f9a
8ca1a8b
fadb2f6
9bfe8eb
cc6e12c
7b41652
418451e
a7d2afb
5c62a13
46c507a
166e436
2b48ad0
c062467
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ package app | |
|
||
import ( | ||
"encoding/json" | ||
"github.com/CosmWasm/wasmd/x/wasm" | ||
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" | ||
) | ||
|
||
// The genesis state of the blockchain is represented here as a map of raw json | ||
|
@@ -13,8 +15,25 @@ import ( | |
// object provided to it during init. | ||
type GenesisState map[string]json.RawMessage | ||
|
||
const ( | ||
// DefaultMaxWasmCodeSize limit max bytes read to prevent gzip bombs | ||
// 600 KB is copied from x/wasm, but you can customize here as desired | ||
DefaultMaxWasmCodeSize = 600 * 1024 * 2 | ||
) | ||
|
||
// NewDefaultGenesisState generates the default state for the application. | ||
func NewDefaultGenesisState() GenesisState { | ||
encCfg := MakeEncodingConfig() | ||
return ModuleBasics.DefaultGenesis(encCfg.Marshaler) | ||
gen := ModuleBasics.DefaultGenesis(encCfg.Marshaler) | ||
|
||
// here we override wasm config to make it permissioned by default | ||
wasmGen := wasm.GenesisState{ | ||
Params: wasmtypes.Params{ | ||
CodeUploadAccess: wasmtypes.AllowNobody, | ||
InstantiateDefaultPermission: wasmtypes.AccessTypeEverybody, | ||
MaxWasmCodeSize: DefaultMaxWasmCodeSize, | ||
}, | ||
Comment on lines
+29
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh cool! So when we do the upgrade to cosmwasm, do we need to override these in InitGenesis as well? Heres what we had to do for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we will need a migration step, that will set the params explicitly. |
||
} | ||
gen[wasm.ModuleName] = encCfg.Marshaler.MustMarshalJSON(&wasmGen) | ||
return gen | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Wasm Tests | ||
|
||
This contains a few high level test that `x/wasm` is properly integrated. | ||
|
||
Since the code tested is not in this repo, and we are just testing the application | ||
integration (app.go), I figured this is the most suitable location for it |
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.
@ethanfrey
The pinned contracts are not loaded within the
if loadLatest
blockThere 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 good catch. Thank you