Merge pull request #404 from secret2830/secret/remove-wasm-limit-for-rest

Remove redundant wasm bytes limit in rest
This commit is contained in:
Alexander Peters
2021-02-05 13:16:11 +01:00
committed by GitHub

View File

@@ -19,9 +19,6 @@ func registerTxRoutes(cliCtx client.Context, r *mux.Router) {
r.HandleFunc("/wasm/contract/{contractAddr}", executeContractHandlerFn(cliCtx)).Methods("POST")
}
// limit max bytes read to prevent gzip bombs
const maxSize = 400 * 1024
type storeCodeReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
WasmBytes []byte `json:"wasm_bytes"`
@@ -55,10 +52,6 @@ func storeCodeHandlerFn(cliCtx client.Context) http.HandlerFunc {
var err error
wasm := req.WasmBytes
if len(wasm) > maxSize {
rest.WriteErrorResponse(w, http.StatusBadRequest, "Binary size exceeds maximum limit")
return
}
// gzip the wasm file
if wasmUtils.IsWasm(wasm) {