From c919d23cedfa7abc491c1056e77c164cd0ad9708 Mon Sep 17 00:00:00 2001 From: nguyen | decentrio <144610611+trinitys7@users.noreply.github.com> Date: Mon, 18 Mar 2024 20:47:32 +0700 Subject: [PATCH] Add max wasm size option on env (#16) --- README.md | 6 ++++++ app/app.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 545b9ef..eacddd3 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,12 @@ export DENOM="urax" export MONIKER="$ROLLAPP_CHAIN_ID-sequencer" ``` +if you want to change the max wasm size: + +```shell +export MAX_WASM_SIZE=YOUR_MAX_WASM_SIZE +``` + And initialize the rollapp: ```shell diff --git a/app/app.go b/app/app.go index 0485904..aa58fbd 100644 --- a/app/app.go +++ b/app/app.go @@ -6,6 +6,7 @@ import ( "net/http" "os" "path/filepath" + "strconv" "strings" "github.com/gorilla/mux" @@ -284,6 +285,13 @@ func NewRollapp( tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + if maxSize := os.Getenv("MAX_WASM_SIZE"); maxSize != "" { + // https://github.com/CosmWasm/wasmd#compile-time-parameters + val, _ := strconv.ParseInt(maxSize, 10, 32) + wasmtypes.MaxWasmSize = int(val) + wasmtypes.MaxProposalWasmSize = int(val) + } + // load state streaming if enabled if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, keys); err != nil { panic("failed to load state streaming services: " + err.Error())