Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wasm)!: increase contract size limit to 3MB #1906

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

k-yang
Copy link
Member

@k-yang k-yang commented Jun 3, 2024

Purpose / Abstract

Increases the contract size limit to 3MB (up from 800KB). I originally tried to set the config via compile time flag (-X github.com/CosmWasm/wasmd/x/wasm/types.MaxWasmSize=3145728) but got an error github.com/CosmWasm/wasmd/x/wasm/types.MaxWasmSize: cannot set with -X: not a var of type string (type:int). Seems like it's not possible to set an int variable with a compile time flag.

I took inspiration from Osmosis' overrideWasmVariables().

Summary by CodeRabbit

  • New Features
    • Increased the contract size limit to 3MB in the Nibiru EVM, allowing for larger contracts.
  • Enhancements
    • Adjusted wasm size limitations to support larger wasm files.

Copy link
Contributor

coderabbitai bot commented Jun 3, 2024

Walkthrough

The recent update increases the contract size limit to 3MB in the Nibiru EVM. This change involves adding a new function overrideWasmVariables in app.go to adjust the wasm size limitations, allowing for larger wasm files. This enhancement ensures that the contract size limit exceeds 2.5MB, addressing the requirements specified in issue #1905.

Changes

File(s) Change Summary
CHANGELOG.md Added a summary of the change, highlighting the increase in contract size limit.
app/app.go Introduced overrideWasmVariables function to adjust wasm size limitations.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant Nibiru EVM
    participant App

    User->>Nibiru EVM: Deploy contract (>2.5MB)
    Nibiru EVM->>App: Check wasm size
    App->>App: overrideWasmVariables()
    App->>Nibiru EVM: Allow deployment (size limit 3MB)
    Nibiru EVM->>User: Contract deployed successfully
Loading

Assessment against linked issues

Objective Addressed Explanation
Increase contract size limit to >2.5MB (#1905)

Poem

In the land of code, a change did rise,
To let the contracts grow in size.
From two-point-five to three megabytes,
Now wasm files reach new heights.
With overrideWasmVariables in play,
Bigger contracts deploy without delay.
🎉🐇💻


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@k-yang k-yang marked this pull request as ready for review June 3, 2024 16:19
@k-yang k-yang requested a review from a team as a code owner June 3, 2024 16:19
@k-yang k-yang changed the title feat(wasm): increase contract size limit to 3MB feat(wasm)!: increase contract size limit to 3MB Jun 3, 2024
Copy link

codecov bot commented Jun 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.14%. Comparing base (e7e708d) to head (9fa8b71).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1906   +/-   ##
=======================================
  Coverage   62.13%   62.14%           
=======================================
  Files         245      245           
  Lines       16006    16010    +4     
=======================================
+ Hits         9946     9950    +4     
  Misses       5323     5323           
  Partials      737      737           
Files Coverage Δ
app/app.go 55.92% <100.00%> (+1.19%) ⬆️

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (4)
app/app.go (4)

Line range hint 94-94: The AppKeepers is referenced but not defined or imported. Please ensure it is correctly defined or imported to avoid runtime errors.


Line range hint 68-68: ModuleBasicManager is used but not defined or imported. Please define or import it to ensure the application can compile and run correctly.


Line range hint 71-71: ModuleAccPerms is referenced but not defined or imported. This needs to be addressed to ensure the application functions as expected.


Line range hint 75-75: NibiruApp does not implement all methods of the runtime.AppI interface. Please implement the missing methods to ensure full compatibility.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e7e708d and 9fa8b71.

Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • app/app.go (2 hunks)
Additional context used
golangci-lint
app/app.go

[error] 94-94: undefined: AppKeepers


[error] 68-68: undefined: ModuleBasicManager


[error] 71-71: undefined: ModuleAccPerms


[error] 75-75: cannot use (*NibiruApp)(nil) (value of type *NibiruApp) as "github.com/cosmos/cosmos-sdk/runtime".AppI value in variable declaration: *NibiruApp does not implement "github.com/cosmos/cosmos-sdk/runtime".AppI (missing method ExportAppStateAndValidators)


[error] 144-144: undefined: EncodingConfig


[error] 417-417: app.ibcKeeper undefined (type *NibiruApp has no field or method ibcKeeper)


[error] 421-421: app.ScopedIBCKeeper undefined (type *NibiruApp has no field or method ScopedIBCKeeper)


[error] 413-413: app.StakingKeeper undefined (type *NibiruApp has no field or method StakingKeeper)


[error] 428-428: undefined: MakeEncodingConfig


[error] 168-168: undefined: initStoreKeys


[error] 179-179: app.InitKeepers undefined (type *NibiruApp has no field or method InitKeepers)


[error] 188-188: app.initModuleManager undefined (type *NibiruApp has no field or method initModuleManager)


[error] 190-190: app.setupUpgrades undefined (type *NibiruApp has no field or method setupUpgrades)


[error] 198-198: app.initSimulationManager undefined (type *NibiruApp has no field or method initSimulationManager)


[error] 208-208: undefined: NewAnteHandler


[error] 210-210: app.AccountKeeper undefined (type *NibiruApp has no field or method AccountKeeper)


[error] 211-211: app.BankKeeper undefined (type *NibiruApp has no field or method BankKeeper)


[error] 212-212: app.FeeGrantKeeper undefined (type *NibiruApp has no field or method FeeGrantKeeper)


[error] 217-217: app.ibcKeeper undefined (type *NibiruApp has no field or method ibcKeeper)


[error] 220-220: app.DevGasKeeper undefined (type *NibiruApp has no field or method DevGasKeeper)


[error] 221-221: app.BankKeeper undefined (type *NibiruApp has no field or method BankKeeper)


[error] 233-233: app.WasmKeeper undefined (type *NibiruApp has no field or method WasmKeeper)


[error] 259-259: app.capabilityKeeper undefined (type *NibiruApp has no field or method capabilityKeeper)


[error] 280-280: undefined: GenesisState


[error] 284-284: app.upgradeKeeper undefined (type *NibiruApp has no field or method upgradeKeeper)


[error] 353-353: app.paramsKeeper undefined (type *NibiruApp has no field or method paramsKeeper)

Additional comments not posted (2)
app/app.go (1)

130-136: The implementation of overrideWasmVariables correctly sets the wasm size limits to 3MB as intended.

CHANGELOG.md (1)

51-51: The changelog entry for PR #1906 is correctly documented and provides clear information about the increase in wasm contract size limit to 3MB.

@k-yang k-yang merged commit 3a60458 into main Jun 4, 2024
17 checks passed
@k-yang k-yang deleted the feat/wasm/increase-contract-size-limit branch June 4, 2024 02:37
k-yang added a commit that referenced this pull request Jun 4, 2024
* feat(wasm): increase contract size limit to 3MB

* chore: update changelog
@k-yang k-yang restored the feat/wasm/increase-contract-size-limit branch January 3, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(wasm): increase contract size limit
2 participants