Repository: axone-protocol/axoned
Pull request #908: Feat/configurable wasm size
Author: login: ccamel
Created: 2025-03-18T14:28:37Z | Merged: 2025-03-18T15:41:25Z

This PR introduces a compile-time configuration for the [`MaxWasmSize`](https://github.com/CosmWasm/wasmd/blob/main/README.md#compile-time-parameters) parameter, which defines the maximum size for smart contracts that can be deployed on the [Axone](https://axone.xyz) chain.

To improve flexibility and anticipate future [smart contract](https://github.com/axone-protocol/contracts) changes, this limit is now set at `1MB` during build time (previously `800KB`), allowing for larger contract deployments.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - Improved build output now dynamically displays the application version.
  - Added a configurable maximum WebAssembly upload size with built‐in validation to enforce file size limits.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/Makefile b/Makefile
index 7cf3933ae..a2ef074f1 100644
--- a/Makefile
+++ b/Makefile
@@ -53,8 +53,16 @@ DAEMON_NAME 	:= axoned
 DAEMON_HOME 	:= `pwd`/${CHAIN_HOME}
 
 # Binary information
-VERSION  := $(shell cat version)
-COMMIT   := $(shell git log -1 --format='%H')
+VERSION       := $(shell cat version)
+MAJOR_VERSION := $(shell cat version | cut -d. -f1)
+COMMIT        := $(shell git log -1 --format='%H')
+
+# Modules
+MODULE_COSMOS_SDK := github.com/cosmos/cosmos-sdk
+MODULE_AXONED     := github.com/axone-protocol/axoned/v$(MAJOR_VERSION)
+
+# Build options
+MAX_WASM_SIZE := $(shell echo "$$((1 * 1024 * 1024))")
 
 build_tags += netgo
 build_tags := $(strip $(build_tags))
@@ -69,7 +77,7 @@ ifeq ($(LEDGER_ENABLED),true)
   else
     UNAME_S = $(shell uname -s)
     ifeq ($(UNAME_S),OpenBSD)
-      $(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
+      $(warning OpenBSD detected, disabling ledger support (https://$(MODULE_COSMOS_SDK)/issues/1988))
     else
       GCC = $(shell command -v gcc 2> /dev/null)
       ifeq ($(GCC),)
@@ -89,13 +97,14 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))
 
 # Flags
 ldflags  = \
-    -X github.com/cosmos/cosmos-sdk/version.AppName=axoned      \
-	-X github.com/cosmos/cosmos-sdk/version.Name=axoned         \
-	-X github.com/cosmos/cosmos-sdk/version.ServerName=axoned   \
-	-X github.com/cosmos/cosmos-sdk/version.ClientName=axoned   \
-	-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-	-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)   \
-    -X github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)
+    -X $(MODULE_COSMOS_SDK)/version.AppName=axoned                    \
+	-X $(MODULE_COSMOS_SDK)/version.Name=axoned                       \
+	-X $(MODULE_COSMOS_SDK)/version.ServerName=axoned                 \
+	-X $(MODULE_COSMOS_SDK)/version.ClientName=axoned                 \
+	-X $(MODULE_COSMOS_SDK)/version.Version=$(VERSION)                \
+	-X $(MODULE_COSMOS_SDK)/version.Commit=$(COMMIT)                  \
+    -X $(MODULE_COSMOS_SDK)/version.BuildTags=$(build_tags_comma_sep) \
+    -X $(MODULE_AXONED)/app.MaxWasmSize=$(MAX_WASM_SIZE)              \
 
 ifeq (,$(findstring nostrip,$(BUILD_OPTIONS)))
 	ldflags += -w -s
@@ -177,7 +186,7 @@ build: build-go build-docker ## Build all available artefacts (executable, docke
 
 .PHONY: build-go
 build-go: ## Build node executable for the current environment (default build)
-	@echo "${COLOR_CYAN} 🏗️ Building project ${COLOR_RESET}${CMD_ROOT}${COLOR_CYAN}${COLOR_RESET} into ${COLOR_YELLOW}${DIST_FOLDER}${COLOR_RESET}"
+	@echo "${COLOR_CYAN} 🏗️ Building project ${COLOR_RESET}${CMD_ROOT}${COLOR_CYAN} ${COLOR_GREEN}(v${VERSION})${COLOR_RESET} into ${COLOR_YELLOW}${DIST_FOLDER}${COLOR_RESET}"
 	@$(call build-go,"","",${DIST_FOLDER}/${BINARY_NAME})
 
 build-go-all: $(ENVIRONMENTS_TARGETS) ## Build node executables for all available environments
@@ -268,7 +277,7 @@ chain-upgrade: build-go ## Test the chain upgrade from the given FROM_VERSION to
 	@echo "${COLOR_CYAN} ⬆️ Upgrade the chain ${COLOR_RESET}${CHAIN}${COLOR_CYAN} from ${COLOR_YELLOW}${FROM_VERSION}${COLOR_RESET}${COLOR_CYAN} to ${COLOR_YELLOW}${TO_VERSION}${COLOR_RESET}"
 	@killall cosmovisor || \
 	rm -rf ${TARGET_FOLDER}/${FROM_VERSION}; \
-	git clone -b ${FROM_VERSION} https://github.com/axone-protocol/axoned.git ${TARGET_FOLDER}/${FROM_VERSION}; \
+	git clone -b ${FROM_VERSION} https://$(MODULE_AXONED).git ${TARGET_FOLDER}/${FROM_VERSION}; \
 	echo "${COLOR_CYAN} 🏗 Build the ${COLOR_YELLOW}${FROM_VERSION}${COLOR_RESET}${COLOR_CYAN} binary...${COLOR_RESET}"; \
 	cd ${TARGET_FOLDER}/${FROM_VERSION}; \
 	make build-go; \
@@ -397,7 +406,7 @@ mock: ## Generate all the mocks (for tests)
 	@mockgen -destination x/logic/testutil/gas_mocks.go -package testutil cosmossdk.io/store/types GasMeter
 	@mockgen -destination x/logic/testutil/fs_mocks.go -package testutil io/fs FS
 	@mockgen -destination x/logic/testutil/read_file_fs_mocks.go -package testutil io/fs ReadFileFS
-	@mockgen -source "$$(go list -f '{{.Dir}}' github.com/cosmos/cosmos-sdk/codec/types)/interface_registry.go" \
+	@mockgen -source "$$(go list -f '{{.Dir}}' $(MODULE_COSMOS_SDK)/codec/types)/interface_registry.go" \
     	-package testutil \
     	-destination x/logic/testutil/interface_registry_mocks.go
 
diff --git a/app/app.go b/app/app.go
index 9d87ce066..edcaf27c5 100644
--- a/app/app.go
+++ b/app/app.go
@@ -10,6 +10,7 @@ import (
 	"os"
 	"path/filepath"
 	"sort"
+	"strconv"
 
 	"github.com/CosmWasm/wasmd/x/wasm"
 	wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
@@ -170,6 +171,11 @@ var (
 		ibcfeetypes.ModuleName:         nil,
 		wasmtypes.ModuleName:           {authtypes.Burner},
 	}
+
+	// MaxWasmSize defines the maximum allowed size (in bytes) for uploaded Wasm code.
+	// This parameter can be set at compile time.
+	// More details: https://github.com/CosmWasm/wasmd/blob/main/README.md#compile-time-parameters
+	MaxWasmSize string
 )
 
 var _ servertypes.Application = (*App)(nil)
@@ -584,6 +590,8 @@ func New(
 		panic(fmt.Sprintf("error while reading wasm config: %s", err))
 	}
 
+	mustConfigureWasmExtensionPoints()
+
 	var wasmOpts []wasmkeeper.Option
 	if cast.ToBool(appOpts.Get("telemetry.enabled")) {
 		wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer))
@@ -907,6 +915,15 @@ func New(
 	return app
 }
 
+func mustConfigureWasmExtensionPoints() {
+	var err error
+	if MaxWasmSize != "" {
+		if wasmtypes.MaxWasmSize, err = strconv.Atoi(MaxWasmSize); err != nil {
+			panic(fmt.Sprintf("error while parsing MaxWasmSize: %s", err))
+		}
+	}
+}
+
 func (app *App) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.WasmConfig, txCounterStoreKey *storetypes.KVStoreKey) {
 	anteHandler, err := NewAnteHandler(
 		HandlerOptions{
diff --git a/app/app_test.go b/app/app_test.go
new file mode 100644
index 000000000..920facf1d
--- /dev/null
+++ b/app/app_test.go
@@ -0,0 +1,50 @@
+package app
+
+import (
+	"fmt"
+	"testing"
+
+	wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
+
+	. "github.com/smartystreets/goconvey/convey"
+)
+
+func TestMaxWasmSizeParsing(t *testing.T) {
+	const defaultMaxWasmSize = 42
+
+	Convey("Given a test cases", t, func() {
+		cases := []struct {
+			name          string
+			maxWasmSize   string
+			expectedPanic bool
+			expectedValue int
+		}{
+			{"empty string", "", false, defaultMaxWasmSize},
+			{"valid number", "1048576", false, 1048576},
+			{"invalid input", "not-a-number", true, defaultMaxWasmSize},
+		}
+
+		Convey(fmt.Sprintf("With default MaxWasmSize set to %d", defaultMaxWasmSize), func() {
+			wasmtypes.MaxWasmSize = defaultMaxWasmSize
+
+			for _, tc := range cases {
+				Convey(fmt.Sprintf("When MaxWasmSize is '%s'", tc.maxWasmSize), func() {
+					MaxWasmSize = tc.maxWasmSize
+
+					Convey("Calling initialization should match expectations", func() {
+						if tc.expectedPanic {
+							So(mustConfigureWasmExtensionPoints, ShouldPanic)
+						} else {
+							mustConfigureWasmExtensionPoints()
+							So(wasmtypes.MaxWasmSize, ShouldEqual, tc.expectedValue)
+						}
+					})
+
+					Reset(func() {
+						wasmtypes.MaxWasmSize = defaultMaxWasmSize
+					})
+				})
+			}
+		})
+	})
+}


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 1**

<details>
<summary>🧹 Nitpick comments (2)</summary><blockquote>

<details>
<summary>Makefile (2)</summary><blockquote>

`65-65`: **MaxWasmSize variable definition.**

The variable sets a 1MB limit for WebAssembly binaries. Consider adding a comment to explain the purpose and impact of this setting.

```diff
-MAX_WASM_SIZE := $(shell echo "$$((1 * 1024 * 1024))")
+# Maximum size of WebAssembly binaries allowed (1MB)
+MAX_WASM_SIZE := $(shell echo "$$((1 * 1024 * 1024))")
```

---

`100-107`: **Updated ldflags with module variables and added MaxWasmSize.**

The ldflags section now properly uses module variables and includes the MaxWasmSize parameter. However, there's inconsistent indentation.

```diff
 ldflags  = \
     -X $(MODULE_COSMOS_SDK)/version.AppName=axoned                    \
-	-X $(MODULE_COSMOS_SDK)/version.Name=axoned                       \
-	-X $(MODULE_COSMOS_SDK)/version.ServerName=axoned                 \
-	-X $(MODULE_COSMOS_SDK)/version.ClientName=axoned                 \
-	-X $(MODULE_COSMOS_SDK)/version.Version=$(VERSION)                \
-	-X $(MODULE_COSMOS_SDK)/version.Commit=$(COMMIT)                  \
+    -X $(MODULE_COSMOS_SDK)/version.Name=axoned                       \
+    -X $(MODULE_COSMOS_SDK)/version.ServerName=axoned                 \
+    -X $(MODULE_COSMOS_SDK)/version.ClientName=axoned                 \
+    -X $(MODULE_COSMOS_SDK)/version.Version=$(VERSION)                \
+    -X $(MODULE_COSMOS_SDK)/version.Commit=$(COMMIT)                  \
     -X $(MODULE_COSMOS_SDK)/version.BuildTags=$(build_tags_comma_sep) \
     -X $(MODULE_AXONED)/app.MaxWasmSize=$(MAX_WASM_SIZE)              \
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: .coderabbit.yaml**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 6f4d18ebbde92a89b0ec002781ea4f04f02ccec9 and 09994d537517b7aaa3f8f1c48e1d39756243f0f3.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `Makefile` (6 hunks)
* `app/app.go` (3 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>📓 Path-based instructions (1)</summary>

<details>
<summary>`**/*.go`: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.</summary>

> `**/*.go`: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

- `app/app.go`

</details>

</details><details>
<summary>🪛 GitHub Check: codecov/patch</summary>

<details>
<summary>app/app.go</summary>

[warning] 593-595: app/app.go#L593-L595
Added lines #L593 - L595 were not covered by tests

</details>

</details>

</details>

<details>
<summary>🔇 Additional comments (8)</summary><blockquote>

<details>
<summary>app/app.go (2)</summary>

`13-13`: **Addition of strconv import for MaxWasmSize parsing.**

The strconv package import is appropriate for the new functionality that parses the MaxWasmSize string parameter into an integer.

---

`175-178`: **Well-documented global configuration variable.**

The MaxWasmSize variable with its accompanying documentation clearly explains its purpose, configuration method, and includes a helpful link to further documentation. This follows best practices for exposing compile-time configuration parameters.

</details>
<details>
<summary>Makefile (6)</summary>

`57-58`: **Improved version extraction approach.**

Extracting the version from a file and parsing the major version number separately is a good practice that centralizes version management.

---

`61-63`: **Well-defined module path variables.**

Creating module path variables improves maintainability by centralizing these paths in one place, reducing the risk of inconsistencies when paths need to be updated.

---

`80-80`: **Updated warning message with module variable.**

Using the module variable in the warning message improves maintainability.

---

`189-189`: **Enhanced build message with version information.**

Adding the version number to the build message provides helpful context.

---

`280-280`: **Updated git clone command with module variable.**

Using the module variable in the git clone command improves maintainability.

---

`409-409`: **Updated mockgen source path with module variable.**

Using the module variable in the mockgen command improves maintainability.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-18T14:41:54Z
user: login: ccamel
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-18T15:38:32Z
user: login: coderabbitai[bot]
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-18T15:39:29Z
user: login: coderabbitai[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-18T15:40:03Z

Review comments:
diff_hunk: @@ -584,6 +590,12 @@
 		panic(fmt.Sprintf("error while reading wasm config: %s", err))
 	}
 
+	if MaxWasmSize != "" {
+		if wasmtypes.MaxWasmSize, err = strconv.Atoi(MaxWasmSize); err != nil {
+			panic(fmt.Sprintf("error while parsing MaxWasmSize: %s", err))
+		}
+	}
path: app/app.go
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Effective implementation of MaxWasmSize parsing.**

The code appropriately checks if MaxWasmSize is provided before attempting conversion, and includes a clear panic message if parsing fails. However, this logic isn't covered by tests, which could lead to undiscovered issues.


Add unit tests to ensure this initialization logic works properly with various inputs, including empty string, valid numeric strings, and invalid inputs that should trigger panics.

```go
func TestMaxWasmSizeParsing(t *testing.T) {
    testCases := []struct {
        name          string
        maxWasmSize   string
        expectedPanic bool
    }{
        {"empty string", "", false},
        {"valid number", "1048576", false},
        {"invalid input", "not-a-number", true},
    }
    
    for _, tc := range testCases {
        t.Run(tc.name, func(t *testing.T) {
            // Set up test environment
            defer func() {
                r := recover()
                if tc.expectedPanic && r == nil {
                    t.Error("expected a panic but got none")
                } else if !tc.expectedPanic && r != nil {
                    t.Errorf("unexpected panic: %v", r)
                }
                // Reset global state after each test
                wasmtypes.MaxWasmSize = wasmtypes.DefaultMaxWasmSize
            }()
            
            // Set the global variable for testing
            MaxWasmSize = tc.maxWasmSize
            
            // Mock the minimal environment needed
            if MaxWasmSize != "" {
                if wasmtypes.MaxWasmSize, err := strconv.Atoi(MaxWasmSize); err != nil {
                    panic(fmt.Sprintf("error while parsing MaxWasmSize: %s", err))
                } else {
                    // Verify the parsed value if no panic occurred
                    if !tc.expectedPanic {
                        expectedValue, _ := strconv.Atoi(tc.maxWasmSize)
                        if expectedValue != 0 && wasmtypes.MaxWasmSize != expectedValue {
                            t.Errorf("expected %d, got %d", expectedValue, wasmtypes.MaxWasmSize)
                        }
                    }
                }
            }
        })
    }
}
```

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 GitHub Check: codecov/patch</summary>

[warning] 593-595: app/app.go#L593-L595
Added lines #L593 - L595 were not covered by tests

</details>

</details>

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-03-18T14:41:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -584,6 +590,12 @@
 		panic(fmt.Sprintf("error while reading wasm config: %s", err))
 	}
 
+	if MaxWasmSize != "" {
+		if wasmtypes.MaxWasmSize, err = strconv.Atoi(MaxWasmSize); err != nil {
+			panic(fmt.Sprintf("error while parsing MaxWasmSize: %s", err))
+		}
+	}
path: app/app.go
user: login: ccamel
body: Hey! I couldn’t agree more - every change deserves proper test coverage. Good catch on this one, and thanks for pushing it! 😌 

However, the proposed test isn’t entirely correct, as the _System Under Test_ (SUT) should be the `app`, which isn’t the case here. In commit 278c70b, I’ve added a test that ensures correct `MaxWasmSize` parsing, using [goconvey](https://github.com/smartystreets/goconvey) (the testing framework we use in this project). I think we’re good now.
created_at: 2025-03-18T15:38:32Z
author_association: MEMBER
diff_hunk: @@ -584,6 +590,12 @@
 		panic(fmt.Sprintf("error while reading wasm config: %s", err))
 	}
 
+	if MaxWasmSize != "" {
+		if wasmtypes.MaxWasmSize, err = strconv.Atoi(MaxWasmSize); err != nil {
+			panic(fmt.Sprintf("error while parsing MaxWasmSize: %s", err))
+		}
+	}
path: app/app.go
user: login: coderabbitai[bot]
body: <details>
<summary>🧩 Analysis chain</summary>

🏁 Script executed:
```
#!/bin/bash
# Check if commit 278c70b exists in the PR
git show 278c70b 2>/dev/null || echo "Commit 278c70b not found"

# Search for tests related to MaxWasmSize
git log -n 1 278c70b --patch || echo "Couldn't find details of commit 278c70b"

# Look for all test files related to MaxWasmSize
rg -l "TestMaxWasmSize|goconvey.*MaxWasmSize" --type go
```

Length of output: 69631

---

🏁 Script executed:
```
#!/bin/bash
# Look for the file changes in commit 278c70b that might contain the test
git show 278c70b --name-only

# Check specifically for app test changes
rg "TestMaxWasmSize|testMaxWasmSize|Convey.*MaxWasmSize" --type go

# Check any app test files
find . -name "*app*_test.go" | xargs cat
```

Length of output: 29250

---



</details> @ccamel Thanks for adding the test coverage! I reviewed the `TestMaxWasmSizeParsing` implementation and it looks excellent. You've covered all the important scenarios:

1. Empty string (using default value)
2. Valid numeric input (setting to 1MB)
3. Invalid input (ensuring it panics appropriately)

The test is well-structured using GoConvey and includes proper state management between test cases. This addresses the concern about untested code that I originally raised.

Great job implementing comprehensive test coverage for this functionality!

--- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI &text =Great%20advice%20from%20%40coderabbitai!%20%F0%9F%9B%A0%EF%B8%8F%20Ensuring%20proper%20test%20coverage%20for%20MaxWasmSize%20parsing%20is%20crucial%20to%20catch%20potential%20issues%20early.%20Let's%20keep%20our%20code%20robust!%20%F0%9F%9A%80 &url =https%3A%2F%2Fgithub.com%2Faxone-protocol%2Faxoned%2Fpull%2F908%23discussion_r2001219534)?
							Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai -->



<!-- <agentComponentType>chat-answer</agentComponentType> -->

<!-- <rawResChunk><answer><details>
<summary>🧩 Analysis chain</summary>

🏁 Script executed:
```
#!/bin/bash
# Check if commit 278c70b exists in the PR
git show 278c70b 2>/dev/null || echo "Commit 278c70b not found"

# Search for tests related to MaxWasmSize
git log -n 1 278c70b --patch || echo "Couldn't find details of commit 278c70b"

# Look for all test files related to MaxWasmSize
rg -l "TestMaxWasmSize|goconvey.*MaxWasmSize" --type go
```

Length of output: 69631

---

🏁 Script executed:
```
#!/bin/bash
# Look for the file changes in commit 278c70b that might contain the test
git show 278c70b --name-only

# Check specifically for app test changes
rg "TestMaxWasmSize|testMaxWasmSize|Convey.*MaxWasmSize" --type go

# Check any app test files
find . -name "*app*_test.go" | xargs cat
```

Length of output: 29250

---



</details>

@ccamel Thanks for adding the test coverage! I reviewed the `TestMaxWasmSizeParsing` implementation and it looks excellent. You've covered all the important scenarios:

1. Empty string (using default value)
2. Valid numeric input (setting to 1MB)
3. Invalid input (ensuring it panics appropriately)

The test is well-structured using GoConvey and includes proper state management between test cases. This addresses the concern about untested code that I originally raised.

Great job implementing comprehensive test coverage for this functionality!

---

&lt;!-- This is an auto-generated comment: tweet message by coderabbit.ai --&gt;

If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Great%20advice%20from%20%40coderabbitai!%20%F0%9F%9B%A0%EF%B8%8F%20Ensuring%20proper%20test%20coverage%20for%20MaxWasmSize%20parsing%20is%20crucial%20to%20catch%20potential%20issues%20early.%20Let's%20keep%20our%20code%20robust!%20%F0%9F%9A%80&url=https%3A%2F%2Fgithub.com%2Faxone-protocol%2Faxoned%2Fpull%2F908%23discussion_r2001219534)?
							Thank you for using CodeRabbit!

&lt;!-- end of auto-generated comment: tweet message by coderabbit.ai --&gt;</answer></rawResChunk> -->

<!-- This is an auto-generated reply by CodeRabbit -->
created_at: 2025-03-18T15:40:03Z
author_association: CONTRIBUTOR

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-03-18T14:28:46Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: skip review by coderabbit.ai -->

> [!IMPORTANT]
> ## Review skipped
> 
> Auto incremental reviews are disabled on this repository.
> 
> Please check the settings in the CodeRabbit UI or the `.coderabbit.yaml` file in this repository. To trigger a single review, invoke the `@coderabbitai review` command.
> 
> You can disable this status message by setting the `reviews.review_status` to `false` in the CodeRabbit configuration file.

<!-- end of auto-generated comment: skip review by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough
The pull request introduces modifications to both the build configuration and application initialization. In the Makefile, several new variables are defined—including one to extract the major version, two for module paths, and one for setting a maximum WebAssembly binary size. References in build flags, warning messages, and repository URLs are updated to use these variables. In `app/app.go`, a new variable for specifying the maximum Wasm size is added along with logic to parse its value and trigger a panic if conversion fails.

## Changes

| File(s)      | Change Summary |
|--------------|----------------|
| Makefile     | Added variables: `MAJOR_VERSION` (extracts the major version from the `version` file), `MODULE_COSMOS_SDK`, `MODULE_AXONED` (dynamically set using `MAJOR_VERSION`), and `MAX_WASM_SIZE` (defines the max size for Wasm binaries). Updated warning messages, `ldflags` references, build output formatting, and the `git clone` command to use module variables. |
| app/app.go   | Added a new exported variable `MaxWasmSize` of type `string` along with conditional logic in the `New` function. This block converts the string value to an integer using `strconv.Atoi` and panics on failure, thereby enforcing a configuration for maximum Wasm upload size. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant App as New()
    participant V as MaxWasmSize Variable
    participant Parser as strconv.Atoi
    participant Err as Panic/Error Handler

    App->>V: Check if MaxWasmSize is set
    alt If value provided
        App->>Parser: Convert MaxWasmSize string to integer
        Parser-->>App: Returns integer value
    else No value provided
        App-->>App: Proceed without conversion
    end
    alt Conversion error occurs
        Parser->>Err: Return error
        App->>Err: Panic with error message
    end
```

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAO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nEIFIAACpIAgTmAAJgACzmstTa21bI2QxElWS9yFKohUr8jEIwEAwBGDQHA2B8CiD4B8r6gKAyQr8UMtEbelkorBgqZsssqbsoCjyugL+pUaVzX1IaVBWVooNKlp+Fq5Vrjk3tKOJ0jMrizk9NbX0/pMIXATYGHEji5A0EQGyCO5YUwnWiMgkotlVyoHXnkQYQdxCvhNPQReTpRTGVInM8iVxg7qGQGiCg8zgm9j3r49YmAEz5VkXGFgEo8gyhIMsTML9pneyMZ/SaqQ6rPtfAmFMDB8wxVEPmZA9UGWFpQSaIhE1YTDgbOKDplboLLBWMGdQtFiwiimm+EgdpUPUBoHBjqqRCphBJKgBDu9jZYGpiQSiQTg6akrURjQmYCDwE1Eh4MnoiNPSTmkbQhscMkfKkQSiGGJxBwYAUf4MHKC0j4IIxAwi+R1W6K1GCa4+OSmyFnesE4KDBLSkgotEHJ3IBTH8STs6aDuPCtTMha5NT7W/j9bAzZn12nyA6J0qAJbzIwGUPZXMt3zq7OUYOnpg3JlHCMksCUYqYGSuk5sajqxwK7Kp0aAByZAqQhqKmfdZdA5xsI3CtgwrcgYHaGiHfgE6HUtiS1EAEsWQsbryGUaohsN8HpNloF2HCcS1x6bKG1Tj3I5R5ZGiqPTlprR9OjUFIZhlRpjIIqIciU3/OzLBPMsM6Y+DLPS2s1+0h/XbPzfss6MKwNGkDORogpLPyRdDRocNPr/LMVUi5diTSPy6T4gZQS0Q12iTMhFFwnsbIzwUg5ZSLF1LCXUKtIYiBVoBAfN/Ogq0Wo0WcgjuYMxCe2toAAVgAMwAHYScgQpwICnaAGdk7SAsP5DBbULBICBWgZOZhU4AGx2qZ3MNIZOVKGAMAj/sSOUdo/vMPfIWOOJi6AA -->

<!-- internal state end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=axone-protocol/axoned&utm_content=908):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: codecov[bot]
created_at: 2025-03-18T14:38:25Z
body: ## [Codecov](https://app.codecov.io/gh/axone-protocol/axoned/pull/908?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=axone-protocol) Report
Attention: Patch coverage is `71.42857%` with `2 lines` in your changes missing coverage. Please review.

| [Files with missing lines](https://app.codecov.io/gh/axone-protocol/axoned/pull/908?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=axone-protocol) | Patch % | Lines |
|---|---|---|
| [app/app.go](https://app.codecov.io/gh/axone-protocol/axoned/pull/908?src=pr&el=tree&filepath=app%2Fapp.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=axone-protocol#diff-YXBwL2FwcC5nbw==) | 71.42% | [2 Missing :warning: ](https://app.codecov.io/gh/axone-protocol/axoned/pull/908?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=axone-protocol) |

[![Impacted file tree graph](https://app.codecov.io/gh/axone-protocol/axoned/pull/908/graphs/tree.svg?width=650&height=150&src=pr&token=O3FJO5QDCA&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=axone-protocol)](https://app.codecov.io/gh/axone-protocol/axoned/pull/908?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=axone-protocol)

```diff
@@            Coverage Diff             @@
##             main     #908      +/-   ##
==========================================
+ Coverage   45.03%   45.06%   +0.02%     
==========================================
  Files         113      113              
  Lines        6395     6402       +7     
==========================================
+ Hits         2880     2885       +5     
- Misses       3380     3382       +2     
  Partials      135      135              
```

| [Files with missing lines](https://app.codecov.io/gh/axone-protocol/axoned/pull/908?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=axone-protocol) | Coverage Δ | |
|---|---|---|
| [app/app.go](https://app.codecov.io/gh/axone-protocol/axoned/pull/908?src=pr&el=tree&filepath=app%2Fapp.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=axone-protocol#diff-YXBwL2FwcC5nbw==) | `0.99% <71.42%> (+0.61%)` | :arrow_up: |

<details><summary>🚀 New features to boost your workflow: </summary>

- ❄ [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
author_association: NONE
user: login: ccamel
created_at: 2025-03-18T15:39:17Z
body: @coderabbitai resolve
author_association: MEMBER
user: login: coderabbitai[bot]
created_at: 2025-03-18T15:39:26Z
body: <!-- This is an auto-generated reply by CodeRabbit -->
<details>
<summary>:white_check_mark: Actions performed</summary>

Comments resolved and changes approved.

</details>
author_association: CONTRIBUTOR