Merge pull request #404 from secret2830/secret/remove-wasm-limit-for-rest
Remove redundant wasm bytes limit in rest
This commit is contained in:
@@ -19,9 +19,6 @@ func registerTxRoutes(cliCtx client.Context, r *mux.Router) {
|
|||||||
r.HandleFunc("/wasm/contract/{contractAddr}", executeContractHandlerFn(cliCtx)).Methods("POST")
|
r.HandleFunc("/wasm/contract/{contractAddr}", executeContractHandlerFn(cliCtx)).Methods("POST")
|
||||||
}
|
}
|
||||||
|
|
||||||
// limit max bytes read to prevent gzip bombs
|
|
||||||
const maxSize = 400 * 1024
|
|
||||||
|
|
||||||
type storeCodeReq struct {
|
type storeCodeReq struct {
|
||||||
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
|
||||||
WasmBytes []byte `json:"wasm_bytes"`
|
WasmBytes []byte `json:"wasm_bytes"`
|
||||||
@@ -55,10 +52,6 @@ func storeCodeHandlerFn(cliCtx client.Context) http.HandlerFunc {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
wasm := req.WasmBytes
|
wasm := req.WasmBytes
|
||||||
if len(wasm) > maxSize {
|
|
||||||
rest.WriteErrorResponse(w, http.StatusBadRequest, "Binary size exceeds maximum limit")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// gzip the wasm file
|
// gzip the wasm file
|
||||||
if wasmUtils.IsWasm(wasm) {
|
if wasmUtils.IsWasm(wasm) {
|
||||||
|
|||||||
Reference in New Issue
Block a user