Skip to content

Commit

Permalink
Set max proposal wasm code size to 3MB
Browse files Browse the repository at this point in the history
  • Loading branch information
pinosu committed Nov 17, 2022
1 parent 3ce27e1 commit af91fdb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ file of your custom chain.

* `wasmtypes.MaxLabelSize = 64` to set the maximum label size on instantiation (default 128)
* `wasmtypes.MaxWasmSize=777000` to set the max size of compiled wasm to be accepted (default 819200)
* `wasmtypes.MaxProposalWasmSize=888000` to set the max size of gov proposal compiled wasm to be accepted (default 4194304)
* `wasmtypes.MaxProposalWasmSize=888000` to set the max size of gov proposal compiled wasm to be accepted (default 3145728)

## Genesis Configuration
We strongly suggest **to limit the max block gas in the genesis** and not use the default value (`-1` for infinite).
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (c Code) ValidateBasic() error {
if err := c.CodeInfo.ValidateBasic(); err != nil {
return sdkerrors.Wrap(err, "code info")
}
if err := validateWasmCode(c.CodeBytes, MaxWasmSize); err != nil {
if err := validateWasmCode(c.CodeBytes, MaxProposalWasmSize); err != nil {
return sdkerrors.Wrap(err, "code bytes")
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func TestCodeValidateBasic(t *testing.T) {
},
"codeBytes greater limit": {
srcMutator: func(c *Code) {
c.CodeBytes = bytes.Repeat([]byte{0x1}, MaxWasmSize+1)
c.CodeBytes = bytes.Repeat([]byte{0x1}, MaxProposalWasmSize+1)
},
expError: true,
},
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/types/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
MaxWasmSize = 800 * 1024 // extension point for chains to customize via compile flag.

// MaxProposalWasmSize is the largest a gov proposal compiled contract code can be when storing code on chain
MaxProposalWasmSize = 4 * 1024 * 1024 // extension point for chains to customize via compile flag.
MaxProposalWasmSize = 3 * 1024 * 1024 // extension point for chains to customize via compile flag.
)

func validateWasmCode(s []byte, maxSize int) error {
Expand Down

0 comments on commit af91fdb

Please sign in to comment.