diff --git a/CHANGELOG.md b/CHANGELOG.md index 539f72bb84..50706bbc61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) + [Full Changelog](https://github.com/CosmWasm/wasmd/compare/v0.26.0...HEAD) **Implemented Enhancements** diff --git a/README.md b/README.md index 68d3a1f44f..3689c70ab4 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,7 @@ used by stateless `ValidateBasic()`. Thus, we made them public `var` and these c 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) ## Genesis Configuration We strongly suggest **to limit the max block gas in the genesis** and not use the default value (`-1` for infinite). diff --git a/app/app.go b/app/app.go index b6ba2ddab9..644a7281be 100644 --- a/app/app.go +++ b/app/app.go @@ -515,7 +515,7 @@ func NewWasmApp( distr.NewAppModule(appCodec, app.distrKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper), upgrade.NewAppModule(app.upgradeKeeper), - wasm.NewAppModule(appCodec, &app.wasmKeeper, app.stakingKeeper), + wasm.NewAppModule(appCodec, &app.wasmKeeper, app.stakingKeeper, app.accountKeeper, app.bankKeeper), evidence.NewAppModule(app.evidenceKeeper), feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), @@ -632,7 +632,7 @@ func NewWasmApp( slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper), params.NewAppModule(app.paramsKeeper), evidence.NewAppModule(app.evidenceKeeper), - wasm.NewAppModule(appCodec, &app.wasmKeeper, app.stakingKeeper), + wasm.NewAppModule(appCodec, &app.wasmKeeper, app.stakingKeeper, app.accountKeeper, app.bankKeeper), ibc.NewAppModule(app.ibcKeeper), transferModule, ) diff --git a/app/params/weights.go b/app/params/weights.go index 0ba377b009..59ef509f34 100644 --- a/app/params/weights.go +++ b/app/params/weights.go @@ -20,4 +20,6 @@ const ( DefaultWeightCommunitySpendProposal int = 5 DefaultWeightTextProposal int = 5 DefaultWeightParamChangeProposal int = 5 + DefaultWeightMsgStoreCode int = 100 + DefaultWeightMsgInstantiateContract int = 5 ) diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index 20b66d9ea1..f660cbbe90 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -219,7 +219,6 @@ Params defines the set of wasm parameters. | ----- | ---- | ----- | ----------- | | `code_upload_access` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | | | `instantiate_default_permission` | [AccessType](#cosmwasm.wasm.v1.AccessType) | | | -| `max_wasm_code_size` | [uint64](#uint64) | | | diff --git a/proto/cosmwasm/wasm/v1/types.proto b/proto/cosmwasm/wasm/v1/types.proto index 7ee2f639ee..739aed2af7 100644 --- a/proto/cosmwasm/wasm/v1/types.proto +++ b/proto/cosmwasm/wasm/v1/types.proto @@ -49,8 +49,6 @@ message Params { ]; AccessType instantiate_default_permission = 2 [ (gogoproto.moretags) = "yaml:\"instantiate_default_permission\"" ]; - uint64 max_wasm_code_size = 3 - [ (gogoproto.moretags) = "yaml:\"max_wasm_code_size\"" ]; } // CodeInfo is data for the uploaded contract WASM code diff --git a/x/wasm/alias.go b/x/wasm/alias.go index b625111bc7..67a79ac541 100644 --- a/x/wasm/alias.go +++ b/x/wasm/alias.go @@ -17,7 +17,6 @@ const ( TStoreKey = types.TStoreKey QuerierRoute = types.QuerierRoute RouterKey = types.RouterKey - MaxWasmSize = types.MaxWasmSize WasmModuleEventType = types.WasmModuleEventType AttributeKeyContractAddr = types.AttributeKeyContractAddr ProposalTypeStoreCode = types.ProposalTypeStoreCode diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index 9711741d3b..0ec93e1f6a 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -463,8 +463,7 @@ func TestImportContractWithCodeHistoryReset(t *testing.T) { "code_upload_access": { "permission": "Everybody" }, - "instantiate_default_permission": "Everybody", - "max_wasm_code_size": 500000 + "instantiate_default_permission": "Everybody" }, "codes": [ { diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 5e6fe1b8b2..92db816ccb 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -139,12 +139,6 @@ func (k Keeper) getInstantiateAccessConfig(ctx sdk.Context) types.AccessType { return a } -func (k Keeper) GetMaxWasmCodeSize(ctx sdk.Context) uint64 { - var a uint64 - k.paramSpace.Get(ctx, types.ParamStoreKeyMaxWasmCodeSize, &a) - return a -} - // GetParams returns the total set of wasm parameters. func (k Keeper) GetParams(ctx sdk.Context) types.Params { var params types.Params @@ -164,7 +158,7 @@ func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, if !authZ.CanCreateCode(k.getUploadAccessConfig(ctx), creator) { return 0, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not create code") } - wasmCode, err = uncompress(wasmCode, k.GetMaxWasmCodeSize(ctx)) + wasmCode, err = uncompress(wasmCode, uint64(types.MaxWasmSize)) if err != nil { return 0, sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) } @@ -206,7 +200,7 @@ func (k Keeper) storeCodeInfo(ctx sdk.Context, codeID uint64, codeInfo types.Cod } func (k Keeper) importCode(ctx sdk.Context, codeID uint64, codeInfo types.CodeInfo, wasmCode []byte) error { - wasmCode, err := uncompress(wasmCode, k.GetMaxWasmCodeSize(ctx)) + wasmCode, err := uncompress(wasmCode, uint64(types.MaxWasmSize)) if err != nil { return sdkerrors.Wrap(types.ErrCreateFailed, err.Error()) } diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 1951e22849..ffdcf823f8 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -126,7 +126,6 @@ func TestCreateStoresInstantiatePermission(t *testing.T) { keepers.WasmKeeper.SetParams(ctx, types.Params{ CodeUploadAccess: types.AllowEverybody, InstantiateDefaultPermission: spec.srcPermission, - MaxWasmCodeSize: types.DefaultMaxWasmCodeSize, }) fundAccounts(t, ctx, accKeeper, bankKeeper, myAddr, deposit) diff --git a/x/wasm/keeper/proposal_integration_test.go b/x/wasm/keeper/proposal_integration_test.go index f01dc6ba6f..acf2e74f02 100644 --- a/x/wasm/keeper/proposal_integration_test.go +++ b/x/wasm/keeper/proposal_integration_test.go @@ -29,7 +29,6 @@ func TestStoreCodeProposal(t *testing.T) { wasmKeeper.SetParams(ctx, types.Params{ CodeUploadAccess: types.AllowNobody, InstantiateDefaultPermission: types.AccessTypeNobody, - MaxWasmCodeSize: types.DefaultMaxWasmCodeSize, }) wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") require.NoError(t, err) @@ -67,7 +66,6 @@ func TestInstantiateProposal(t *testing.T) { wasmKeeper.SetParams(ctx, types.Params{ CodeUploadAccess: types.AllowNobody, InstantiateDefaultPermission: types.AccessTypeNobody, - MaxWasmCodeSize: types.DefaultMaxWasmCodeSize, }) wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") @@ -131,7 +129,6 @@ func TestMigrateProposal(t *testing.T) { wasmKeeper.SetParams(ctx, types.Params{ CodeUploadAccess: types.AllowNobody, InstantiateDefaultPermission: types.AccessTypeNobody, - MaxWasmCodeSize: types.DefaultMaxWasmCodeSize, }) wasmCode, err := ioutil.ReadFile("./testdata/hackatom.wasm") @@ -383,7 +380,6 @@ func TestAdminProposals(t *testing.T) { wasmKeeper.SetParams(ctx, types.Params{ CodeUploadAccess: types.AllowNobody, InstantiateDefaultPermission: types.AccessTypeNobody, - MaxWasmCodeSize: types.DefaultMaxWasmCodeSize, }) codeInfoFixture := types.CodeInfoFixture(types.WithSHA256CodeHash(wasmCode)) diff --git a/x/wasm/module.go b/x/wasm/module.go index 9453cf09a0..9f078bb12f 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -13,6 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + simKeeper "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cast" @@ -103,6 +104,8 @@ type AppModule struct { cdc codec.Codec keeper *Keeper validatorSetSource keeper.ValidatorSetSource + accountKeeper types.AccountKeeper // for simulation + bankKeeper simKeeper.BankKeeper } // ConsensusVersion is a sequence number for state-breaking change of the @@ -112,12 +115,20 @@ type AppModule struct { func (AppModule) ConsensusVersion() uint64 { return 1 } // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper *Keeper, validatorSetSource keeper.ValidatorSetSource) AppModule { +func NewAppModule( + cdc codec.Codec, + keeper *Keeper, + validatorSetSource keeper.ValidatorSetSource, + ak types.AccountKeeper, + bk simKeeper.BankKeeper, +) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, cdc: cdc, keeper: keeper, validatorSetSource: validatorSetSource, + accountKeeper: ak, + bankKeeper: bk, } } @@ -196,7 +207,7 @@ func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { // WeightedOperations returns the all the gov module operations with their respective weights. func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return nil + return simulation.WeightedOperations(&simState, am.accountKeeper, am.bankKeeper, am.keeper) } // ____________________________________________________________________________ diff --git a/x/wasm/module_test.go b/x/wasm/module_test.go index 360743a125..ff39b27521 100644 --- a/x/wasm/module_test.go +++ b/x/wasm/module_test.go @@ -36,7 +36,7 @@ func setupTest(t *testing.T) testData { ctx, keepers := CreateTestInput(t, false, "iterator,staking,stargate") cdc := keeper.MakeTestCodec(t) data := testData{ - module: NewAppModule(cdc, keepers.WasmKeeper, keepers.StakingKeeper), + module: NewAppModule(cdc, keepers.WasmKeeper, keepers.StakingKeeper, keepers.AccountKeeper, keepers.BankKeeper), ctx: ctx, acctKeeper: keepers.AccountKeeper, keeper: *keepers.WasmKeeper, diff --git a/x/wasm/simulation/operations.go b/x/wasm/simulation/operations.go new file mode 100644 index 0000000000..8c8b501f25 --- /dev/null +++ b/x/wasm/simulation/operations.go @@ -0,0 +1,161 @@ +package simulation + +import ( + _ "embed" + "fmt" + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + simappparams "github.com/cosmos/cosmos-sdk/simapp/params" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/CosmWasm/wasmd/app/params" + "github.com/CosmWasm/wasmd/x/wasm/types" +) + +//go:embed testdata/reflect.wasm +var reflectContract []byte + +// Simulation operation weights constants +//nolint:gosec +const ( + OpWeightMsgStoreCode = "op_weight_msg_store_code" + OpWeightMsgInstantiateContract = "op_weight_msg_instantiate_contract" +) + +// WasmKeeper is a subset of the wasm keeper used by simulations +type WasmKeeper interface { + GetParams(ctx sdk.Context) types.Params + IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool) +} + +// WeightedOperations returns all the operations from the module with their respective weights +func WeightedOperations( + simstate *module.SimulationState, + ak types.AccountKeeper, + bk simulation.BankKeeper, + wasmKeeper WasmKeeper, +) simulation.WeightedOperations { + var ( + weightMsgStoreCode int + weightMsgInstantiateContract int + ) + + simstate.AppParams.GetOrGenerate(simstate.Cdc, OpWeightMsgStoreCode, &weightMsgStoreCode, nil, + func(_ *rand.Rand) { + weightMsgStoreCode = params.DefaultWeightMsgStoreCode + }, + ) + + simstate.AppParams.GetOrGenerate(simstate.Cdc, OpWeightMsgInstantiateContract, &weightMsgInstantiateContract, nil, + func(_ *rand.Rand) { + weightMsgInstantiateContract = params.DefaultWeightMsgInstantiateContract + }, + ) + + return simulation.WeightedOperations{ + simulation.NewWeightedOperation( + weightMsgStoreCode, + SimulateMsgStoreCode(ak, bk, wasmKeeper), + ), + simulation.NewWeightedOperation( + weightMsgInstantiateContract, + SimulateMsgInstantiateContract(ak, bk, wasmKeeper), + ), + } +} + +// SimulateMsgStoreCode generates a MsgStoreCode with random values +func SimulateMsgStoreCode(ak types.AccountKeeper, bk simulation.BankKeeper, wasmKeeper WasmKeeper) simtypes.Operation { + return func( + r *rand.Rand, + app *baseapp.BaseApp, + ctx sdk.Context, + accs []simtypes.Account, + chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + if wasmKeeper.GetParams(ctx).CodeUploadAccess.Permission != types.AccessTypeEverybody { + return simtypes.NoOpMsg(types.ModuleName, types.MsgStoreCode{}.Type(), "no chain permission"), nil, nil + } + + config := &types.AccessConfig{ + Permission: types.AccessTypeEverybody, + } + + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := types.MsgStoreCode{ + Sender: simAccount.Address.String(), + WASMByteCode: reflectContract, + InstantiatePermission: config, + } + + txCtx := simulation.OperationInput{ + R: r, + App: app, + TxGen: simappparams.MakeTestEncodingConfig().TxConfig, + Cdc: nil, + Msg: &msg, + MsgType: msg.Type(), + Context: ctx, + SimAccount: simAccount, + AccountKeeper: ak, + Bankkeeper: bk, + ModuleName: types.ModuleName, + } + + return simulation.GenAndDeliverTxWithRandFees(txCtx) + } +} + +// SimulateMsgInstantiateContract generates a MsgInstantiateContract with random values +func SimulateMsgInstantiateContract(ak types.AccountKeeper, bk simulation.BankKeeper, wasmKeeper WasmKeeper) simtypes.Operation { + return func( + r *rand.Rand, + app *baseapp.BaseApp, + ctx sdk.Context, + accs []simtypes.Account, + chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + + var contractInfo types.ContractInfo + wasmKeeper.IterateContractInfo(ctx, func(address sdk.AccAddress, info types.ContractInfo) bool { + contractInfo = info + return true + }) + + if contractInfo.Equal(types.ContractInfo{}) { + return simtypes.NoOpMsg(types.ModuleName, types.MsgInstantiateContract{}.Type(), "no contracts available"), nil, nil + } + + spendable := bk.SpendableCoins(ctx, simAccount.Address) + + msg := types.MsgInstantiateContract{ + Sender: simAccount.Address.String(), + 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))), + Funds: spendable, + } + + txCtx := simulation.OperationInput{ + R: r, + App: app, + TxGen: simappparams.MakeTestEncodingConfig().TxConfig, + Cdc: nil, + Msg: &msg, + MsgType: msg.Type(), + Context: ctx, + SimAccount: simAccount, + AccountKeeper: ak, + Bankkeeper: bk, + ModuleName: types.ModuleName, + } + + return simulation.GenAndDeliverTxWithRandFees(txCtx) + } +} diff --git a/x/wasm/simulation/params.go b/x/wasm/simulation/params.go index 1f953cca7f..0de0d0b4ad 100644 --- a/x/wasm/simulation/params.go +++ b/x/wasm/simulation/params.go @@ -28,11 +28,6 @@ func ParamChanges(r *rand.Rand, cdc codec.Codec) []simtypes.ParamChange { return fmt.Sprintf("%q", params.CodeUploadAccess.Permission.String()) }, ), - simulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyMaxWasmCodeSize), - func(r *rand.Rand) string { - return fmt.Sprintf(`"%d"`, params.MaxWasmCodeSize) - }, - ), } } @@ -43,6 +38,5 @@ func RandomParams(r *rand.Rand) types.Params { return types.Params{ CodeUploadAccess: accessConfig, InstantiateDefaultPermission: accessConfig.Permission, - MaxWasmCodeSize: uint64(simtypes.RandIntBetween(r, 1, 600) * 1024), } } diff --git a/x/wasm/simulation/testdata/reflect.wasm b/x/wasm/simulation/testdata/reflect.wasm new file mode 100644 index 0000000000..312f45768d Binary files /dev/null and b/x/wasm/simulation/testdata/reflect.wasm differ diff --git a/x/wasm/types/params.go b/x/wasm/types/params.go index c3b21d2e84..430ce7db74 100644 --- a/x/wasm/types/params.go +++ b/x/wasm/types/params.go @@ -12,14 +12,8 @@ import ( "gopkg.in/yaml.v2" ) -const ( - // DefaultMaxWasmCodeSize limit max bytes read to prevent gzip bombs - DefaultMaxWasmCodeSize = 600 * 1024 * 2 -) - var ParamStoreKeyUploadAccess = []byte("uploadAccess") var ParamStoreKeyInstantiateAccess = []byte("instantiateAccess") -var ParamStoreKeyMaxWasmCodeSize = []byte("maxWasmCodeSize") var AllAccessTypes = []AccessType{ AccessTypeNobody, @@ -96,7 +90,6 @@ func DefaultParams() Params { return Params{ CodeUploadAccess: AllowEverybody, InstantiateDefaultPermission: AccessTypeEverybody, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, } } @@ -113,7 +106,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(ParamStoreKeyUploadAccess, &p.CodeUploadAccess, validateAccessConfig), paramtypes.NewParamSetPair(ParamStoreKeyInstantiateAccess, &p.InstantiateDefaultPermission, validateAccessType), - paramtypes.NewParamSetPair(ParamStoreKeyMaxWasmCodeSize, &p.MaxWasmCodeSize, validateMaxWasmCodeSize), } } @@ -125,9 +117,6 @@ func (p Params) ValidateBasic() error { if err := validateAccessConfig(p.CodeUploadAccess); err != nil { return errors.Wrap(err, "upload access") } - if err := validateMaxWasmCodeSize(p.MaxWasmCodeSize); err != nil { - return errors.Wrap(err, "max wasm code size") - } return nil } @@ -155,17 +144,6 @@ func validateAccessType(i interface{}) error { return sdkerrors.Wrapf(ErrInvalid, "unknown type: %q", a) } -func validateMaxWasmCodeSize(i interface{}) error { - a, ok := i.(uint64) - if !ok { - return sdkerrors.Wrapf(ErrInvalid, "type: %T", i) - } - if a == 0 { - return sdkerrors.Wrap(ErrInvalid, "must be greater 0") - } - return nil -} - func (a AccessConfig) ValidateBasic() error { switch a.Permission { case AccessTypeUnspecified: diff --git a/x/wasm/types/params_test.go b/x/wasm/types/params_test.go index 4cf9bab832..4cd28bf8d4 100644 --- a/x/wasm/types/params_test.go +++ b/x/wasm/types/params_test.go @@ -28,27 +28,23 @@ func TestValidateParams(t *testing.T) { src: Params{ CodeUploadAccess: AllowNobody, InstantiateDefaultPermission: AccessTypeNobody, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, }, }, "all good with everybody": { src: Params{ CodeUploadAccess: AllowEverybody, InstantiateDefaultPermission: AccessTypeEverybody, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, }, }, "all good with only address": { src: Params{ CodeUploadAccess: AccessTypeOnlyAddress.With(anyAddress), InstantiateDefaultPermission: AccessTypeOnlyAddress, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, }, }, "reject empty type in instantiate permission": { src: Params{ CodeUploadAccess: AllowNobody, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, }, expErr: true, }, @@ -56,7 +52,6 @@ func TestValidateParams(t *testing.T) { src: Params{ CodeUploadAccess: AllowNobody, InstantiateDefaultPermission: 1111, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, }, expErr: true, }, @@ -64,7 +59,6 @@ func TestValidateParams(t *testing.T) { src: Params{ CodeUploadAccess: AccessConfig{Permission: AccessTypeOnlyAddress, Address: invalidAddress}, InstantiateDefaultPermission: AccessTypeOnlyAddress, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, }, expErr: true, }, @@ -72,7 +66,6 @@ func TestValidateParams(t *testing.T) { src: Params{ CodeUploadAccess: AccessConfig{Permission: AccessTypeEverybody, Address: anyAddress.String()}, InstantiateDefaultPermission: AccessTypeOnlyAddress, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, }, expErr: true, }, @@ -80,14 +73,12 @@ func TestValidateParams(t *testing.T) { src: Params{ CodeUploadAccess: AccessConfig{Permission: AccessTypeNobody, Address: anyAddress.String()}, InstantiateDefaultPermission: AccessTypeOnlyAddress, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, }, expErr: true, }, "reject empty CodeUploadAccess": { src: Params{ InstantiateDefaultPermission: AccessTypeOnlyAddress, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, }, expErr: true, }, @@ -95,14 +86,6 @@ func TestValidateParams(t *testing.T) { src: Params{ CodeUploadAccess: AccessConfig{Permission: AccessTypeUnspecified}, InstantiateDefaultPermission: AccessTypeOnlyAddress, - MaxWasmCodeSize: DefaultMaxWasmCodeSize, - }, - expErr: true, - }, - "reject empty max wasm code size": { - src: Params{ - CodeUploadAccess: AllowNobody, - InstantiateDefaultPermission: AccessTypeNobody, }, expErr: true, }, @@ -167,8 +150,7 @@ func TestParamsUnmarshalJson(t *testing.T) { "defaults": { src: `{"code_upload_access": {"permission": "Everybody"}, - "instantiate_default_permission": "Everybody", - "max_wasm_code_size": 1228800}`, + "instantiate_default_permission": "Everybody"}`, exp: DefaultParams(), }, } diff --git a/x/wasm/types/types.pb.go b/x/wasm/types/types.pb.go index 4adacd95e9..a1c726fc61 100644 --- a/x/wasm/types/types.pb.go +++ b/x/wasm/types/types.pb.go @@ -177,7 +177,6 @@ var xxx_messageInfo_AccessConfig proto.InternalMessageInfo type Params struct { CodeUploadAccess AccessConfig `protobuf:"bytes,1,opt,name=code_upload_access,json=codeUploadAccess,proto3" json:"code_upload_access" yaml:"code_upload_access"` InstantiateDefaultPermission AccessType `protobuf:"varint,2,opt,name=instantiate_default_permission,json=instantiateDefaultPermission,proto3,enum=cosmwasm.wasm.v1.AccessType" json:"instantiate_default_permission,omitempty" yaml:"instantiate_default_permission"` - MaxWasmCodeSize uint64 `protobuf:"varint,3,opt,name=max_wasm_code_size,json=maxWasmCodeSize,proto3" json:"max_wasm_code_size,omitempty" yaml:"max_wasm_code_size"` } func (m *Params) Reset() { *m = Params{} } @@ -451,80 +450,78 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/types.proto", fileDescriptor_e6155d98fa173e02) } var fileDescriptor_e6155d98fa173e02 = []byte{ - // 1164 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcb, 0x6f, 0x1b, 0xc5, - 0x1f, 0xf7, 0xda, 0xce, 0xc3, 0xd3, 0xfc, 0x5a, 0x77, 0x7e, 0x09, 0x75, 0x4c, 0xb1, 0xdd, 0xa5, - 0x40, 0xfa, 0xb2, 0x69, 0x40, 0x80, 0x7a, 0xa8, 0xe4, 0xc7, 0xd2, 0x6c, 0x44, 0x6c, 0x6b, 0xec, - 0x52, 0x05, 0xa9, 0x5a, 0x8d, 0x77, 0x27, 0xce, 0xa8, 0xbb, 0x3b, 0xd6, 0xce, 0x38, 0xf5, 0xf6, - 0x2f, 0x40, 0x91, 0x90, 0xb8, 0xc1, 0x25, 0x12, 0x02, 0x84, 0xfa, 0x07, 0x70, 0xe5, 0x5e, 0x71, - 0xea, 0x11, 0x09, 0xc9, 0x82, 0xf4, 0x02, 0xd7, 0x1c, 0xcb, 0x05, 0xed, 0x4c, 0x2c, 0xaf, 0x9a, - 0xb6, 0x31, 0x97, 0xd5, 0x7c, 0x1f, 0x9f, 0xcf, 0xf7, 0x35, 0xf3, 0xd5, 0x82, 0x8b, 0x36, 0xe3, - 0xde, 0x43, 0xcc, 0xbd, 0x8a, 0xfc, 0xec, 0xdd, 0xac, 0x88, 0x70, 0x40, 0x78, 0x79, 0x10, 0x30, - 0xc1, 0x60, 0x76, 0x62, 0x2d, 0xcb, 0xcf, 0xde, 0xcd, 0xfc, 0x6a, 0xa4, 0x61, 0xdc, 0x92, 0xf6, - 0x8a, 0x12, 0x94, 0x73, 0x7e, 0xb9, 0xcf, 0xfa, 0x4c, 0xe9, 0xa3, 0xd3, 0xb1, 0x76, 0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81, 0xe6, 0x23, 0x93, 0xe9, - 0xbc, 0x26, 0xe1, 0x65, 0x30, 0x87, 0x1d, 0x8f, 0xfa, 0xb2, 0x73, 0x19, 0xa4, 0x84, 0x48, 0xeb, - 0xe2, 0x1e, 0x71, 0x73, 0x69, 0xa5, 0x95, 0x02, 0xbc, 0x7d, 0xcc, 0x42, 0x9c, 0xe3, 0x8a, 0x2e, - 0xbf, 0xa4, 0xa2, 0x1e, 0x67, 0xee, 0x50, 0x90, 0xee, 0xa8, 0xcd, 0x38, 0x15, 0x94, 0xf9, 0x68, - 0x02, 0x82, 0x37, 0xc0, 0x19, 0xda, 0xb3, 0xad, 0x01, 0x0b, 0x44, 0x94, 0xee, 0xbc, 0xbc, 0xf6, - 0xff, 0x3b, 0x1c, 0x17, 0x33, 0x66, 0xad, 0xde, 0x66, 0x81, 0x30, 0x1b, 0x28, 0x43, 0x7b, 0xb6, - 0x3c, 0x3a, 0x70, 0x0b, 0x64, 0xc8, 0x48, 0x10, 0x5f, 0xde, 0xad, 0x05, 0x19, 0x70, 0xb9, 0xac, - 0xb6, 0x42, 0x79, 0xb2, 0x15, 0xca, 0x55, 0x3f, 0xac, 0xad, 0xfe, 0xfa, 0xf3, 0x8d, 0x95, 0x78, - 0x53, 0x8c, 0x09, 0x0c, 0x4d, 0x19, 0x6e, 0xa5, 0xff, 0x8a, 0x9e, 0xd0, 0x3f, 0x1a, 0xc8, 0x4d, - 0x5c, 0xa3, 0x26, 0x6d, 0x50, 0x2e, 0x58, 0x10, 0x1a, 0xbe, 0x08, 0x42, 0xd8, 0x06, 0x19, 0x36, - 0x20, 0x01, 0x16, 0xd3, 0x77, 0xbe, 0x7e, 0xb2, 0xc4, 0x97, 0xc0, 0x5b, 0x13, 0x54, 0x74, 0xc7, - 0xd1, 0x94, 0x24, 0x3e, 0x9d, 0xe4, 0x2b, 0xa7, 0x73, 0x1b, 0x2c, 0x0c, 0x07, 0x8e, 0xec, 0x6b, - 0xea, 0xbf, 0xf4, 0xf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fd, 0x1d, 0xa3, 0x69, 0x74, 0xcc, 0x4e, 0x36, 0x35, 0x1b, 0xfd, 0x1d, 0xe2, 0x13, 0x4e, 0x79, - 0x3e, 0x1d, 0x0d, 0xab, 0xb6, 0xf1, 0xe4, 0xcf, 0x42, 0xe2, 0xf1, 0x61, 0x41, 0x7b, 0x72, 0x58, - 0xd0, 0x9e, 0x1e, 0x16, 0xb4, 0x3f, 0x0e, 0x0b, 0xda, 0xd7, 0xcf, 0x0a, 0x89, 0xa7, 0xcf, 0x0a, - 0x89, 0xdf, 0x9e, 0x15, 0x12, 0x5f, 0xbc, 0x1b, 0x7b, 0x07, 0x75, 0xc6, 0xbd, 0x7b, 0x93, 0xdf, - 0x26, 0xa7, 0x32, 0x52, 0xbf, 0x4f, 0xf2, 0xdf, 0xa9, 0x37, 0x2f, 0xb7, 0xda, 0x07, 0xff, 0x06, - 0x00, 0x00, 0xff, 0xff, 0x18, 0x23, 0xa5, 0x9f, 0x5c, 0x09, 0x00, 0x00, + // 1123 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcd, 0x8f, 0xdb, 0x44, + 0x14, 0x8f, 0x93, 0xec, 0xd7, 0x34, 0x14, 0x77, 0xd8, 0xa5, 0x49, 0xa8, 0x9c, 0xd4, 0x14, 0xd8, + 0x7e, 0x25, 0x74, 0x41, 0x80, 0x7a, 0xa8, 0x94, 0x0f, 0xd3, 0xb8, 0x62, 0x93, 0x68, 0x92, 0x52, + 0x2d, 0x52, 0x65, 0x39, 0xf6, 0x6c, 0x62, 0xd5, 0xf1, 0x44, 0x9e, 0xc9, 0x36, 0xfe, 0x0f, 0x50, + 0x24, 0x04, 0x37, 0xb8, 0x44, 0x42, 0x80, 0x50, 0xff, 0x00, 0xae, 0xdc, 0x2b, 0x4e, 0x3d, 0x72, + 0x8a, 0x20, 0xbd, 0xc0, 0x75, 0x8f, 0xe5, 0x82,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dd, 0x1d, 0x4f, 0xf2, 0x97, 0x4e, 0xe3, 0xd7, 0x3d, 0x87, 0xc1, 0xfb, 0xe0, 0xda, + 0x4a, 0xc4, 0xfb, 0xfa, 0x6d, 0x54, 0x6a, 0x6b, 0x72, 0x3c, 0x7b, 0x75, 0x3c, 0xc9, 0xbf, 0x77, + 0x1a, 0xf7, 0xbe, 0xd3, 0xf5, 0x4d, 0x86, 0x57, 0xa6, 0xbf, 0xad, 0xd5, 0xb5, 0x96, 0xde, 0x92, + 0x13, 0xab, 0xd1, 0xdf, 0xc6, 0x1e, 0xa6, 0x0e, 0xcd, 0x26, 0xc3, 0xcb, 0x2a, 0xd7, 0x1e, 0xff, + 0xa9, 0xc4, 0x1e, 0xcd, 0x14, 0xe9, 0xf1, 0x4c, 0x91, 0x9e, 0xcc, 0x14, 0xe9, 0x8f, 0x99, 0x22, + 0x7d, 0xf3, 0x54, 0x89, 0x3d, 0x79, 0xaa, 0xc4, 0x7e, 0x7f, 0xaa, 0xc4, 0xbe, 0x78, 0x37, 0xb2, + 0x07, 0x15, 0x42, 0xfb, 0xf7, 0x16, 0xbf, 0x3a, 0x76, 0x71, 0x24, 0x7e, 0x79, 0xf8, 0xff, 0x4e, + 0x67, 0x9d, 0x7f, 0xd5, 0x3e, 0xf8, 0x37, 0x00, 0x00, 0xff, 0xff, 0x21, 0x8c, 0xa0, 0x70, 0x10, + 0x09, 0x00, 0x00, } func (this *AccessTypeParam) Equal(that interface{}) bool { @@ -603,9 +600,6 @@ func (this *Params) Equal(that interface{}) bool { if this.InstantiateDefaultPermission != that1.InstantiateDefaultPermission { return false } - if this.MaxWasmCodeSize != that1.MaxWasmCodeSize { - return false - } return true } func (this *CodeInfo) Equal(that interface{}) bool { @@ -850,11 +844,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.MaxWasmCodeSize != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.MaxWasmCodeSize)) - i-- - dAtA[i] = 0x18 - } if m.InstantiateDefaultPermission != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.InstantiateDefaultPermission)) i-- @@ -1172,9 +1161,6 @@ func (m *Params) Size() (n int) { if m.InstantiateDefaultPermission != 0 { n += 1 + sovTypes(uint64(m.InstantiateDefaultPermission)) } - if m.MaxWasmCodeSize != 0 { - n += 1 + sovTypes(uint64(m.MaxWasmCodeSize)) - } return n } @@ -1545,25 +1531,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxWasmCodeSize", wireType) - } - m.MaxWasmCodeSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxWasmCodeSize |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/x/wasm/types/validation.go b/x/wasm/types/validation.go index c7a8123a08..4984fa28dd 100644 --- a/x/wasm/types/validation.go +++ b/x/wasm/types/validation.go @@ -4,13 +4,12 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const ( - MaxWasmSize = 500 * 1024 -) - var ( // MaxLabelSize is the longest label that can be used when Instantiating a contract - MaxLabelSize = 128 + MaxLabelSize = 128 // extension point for chains to customize via compile flag. + + // MaxWasmSize is the largest a compiled contract code can be when storing code on chain + MaxWasmSize = 800 * 1024 // extension point for chains to customize via compile flag. ) func validateWasmCode(s []byte) error {