Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
osmosis
Commits
e8642532
Unverified
Commit
e8642532
authored
3 years ago
by
Ethan Frey
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Add migration step to make x/wasm permissioned (#832)
* Add migration step to make x/wasm permissioned * go fmt
parent
c42447df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/genesis.go
+4
-7
app/genesis.go
app/upgrades/v7/upgrades.go
+9
-1
app/upgrades/v7/upgrades.go
with
13 additions
and
8 deletions
+13
-8
app/genesis.go
+
4
-
7
View file @
e8642532
...
...
@@ -2,6 +2,7 @@ package app
import
(
"encoding/json"
"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes
"github.com/CosmWasm/wasmd/x/wasm/types"
)
...
...
@@ -15,12 +16,6 @@ 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
()
...
...
@@ -31,7 +26,9 @@ func NewDefaultGenesisState() GenesisState {
Params
:
wasmtypes
.
Params
{
CodeUploadAccess
:
wasmtypes
.
AllowNobody
,
InstantiateDefaultPermission
:
wasmtypes
.
AccessTypeEverybody
,
MaxWasmCodeSize
:
DefaultMaxWasmCodeSize
,
// DefaultMaxWasmCodeSize limit max bytes read to prevent gzip bombs
// It is 1200 KB in x/wasm, update it later via governance if really needed
MaxWasmCodeSize
:
wasmtypes
.
DefaultMaxWasmCodeSize
,
},
}
gen
[
wasm
.
ModuleName
]
=
encCfg
.
Marshaler
.
MustMarshalJSON
(
&
wasmGen
)
...
...
This diff is collapsed.
Click to expand it.
app/upgrades/v7/upgrades.go
+
9
-
1
View file @
e8642532
...
...
@@ -3,9 +3,10 @@ package v7
import
(
sdk
"github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/CosmWasm/wasmd/x/wasm"
upgrade
types
"github.com/
c
osm
os/cosmos-sdk/x/upgrade
/types"
wasm
types
"github.com/
C
osm
Wasm/wasmd/x/wasm
/types"
)
func
CreateUpgradeHandler
(
mm
*
module
.
Manager
,
configurator
module
.
Configurator
,
...
...
@@ -23,6 +24,13 @@ func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator,
return
newVM
,
err
}
// Since we provide custom DefaultGenesis (privileges StoreCode) in app/genesis.go rather than
// the wasm module, we need to set the params here when migrating (is it is not customized).
params
:=
wasmKeeper
.
GetParams
(
ctx
)
params
.
CodeUploadAccess
=
wasmtypes
.
AllowNobody
wasmKeeper
.
SetParams
(
ctx
,
params
)
// override here
return
newVM
,
err
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets