Skip to content

Commit

Permalink
Increasing allowed wasm bytecode size (#4174)
Browse files Browse the repository at this point in the history
* Increasing allowed wasm bytecode size

* go imports
  • Loading branch information
nicolaslara authored Feb 2, 2023
1 parent 786a53a commit 8550c87
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"reflect"
"strings"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
"github.com/osmosis-labs/osmosis/osmoutils"

Expand Down Expand Up @@ -158,6 +160,14 @@ func initReusablePackageInjections() {
}
}

// overrideWasmVariables overrides the wasm variables to:
// - allow for larger wasm files
func overrideWasmVariables() {
// Override Wasm size limitation from WASMD.
wasmtypes.MaxWasmSize = 2 * 1024 * 1024
wasmtypes.MaxProposalWasmSize = wasmtypes.MaxWasmSize
}

// NewOsmosisApp returns a reference to an initialized Osmosis.
func NewOsmosisApp(
logger log.Logger,
Expand All @@ -173,6 +183,7 @@ func NewOsmosisApp(
baseAppOptions ...func(*baseapp.BaseApp),
) *OsmosisApp {
initReusablePackageInjections() // This should run before anything else to make sure the variables are properly initialized
overrideWasmVariables()
encodingConfig := GetEncodingConfig()
appCodec := encodingConfig.Marshaler
cdc := encodingConfig.Amino
Expand Down
7 changes: 7 additions & 0 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ func (s *IntegrationTestSuite) TestIBCTokenTransferRateLimiting() {
node.WasmExecute(contracts[0], `{"remove_path": {"channel_id": "channel-0", "denom": "uosmo"}}`, initialization.ValidatorWalletName)
}

func (s *IntegrationTestSuite) TestLargeWasmUpload() {
chainA := s.configurer.GetChainConfig(0)
node, err := chainA.GetDefaultNode()
s.NoError(err)
node.StoreWasmCode("large.wasm", initialization.ValidatorWalletName)
}

func (s *IntegrationTestSuite) TestIBCWasmHooks() {
if s.skipIBC {
s.T().Skip("Skipping IBC tests")
Expand Down
Binary file added tests/e2e/scripts/large.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/ibc-hooks/ibc_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ func (suite *HooksTestSuite) TestBadCrosschainSwapsNextMemoMessages() {
{fmt.Sprintf(innerMsg, `null`), true},
{fmt.Sprintf(innerMsg, `"{\"ibc_callback\": \"something\"}"`), false},
{fmt.Sprintf(innerMsg, `"{\"myKey\": \"myValue\"}"`), false}, // JSON memo should not be escaped
{fmt.Sprintf(innerMsg, `"{}""`), true}, // wasm not routed
{fmt.Sprintf(innerMsg, `"{}""`), true}, // wasm not routed
{fmt.Sprintf(innerMsg, `{}`), true},
{fmt.Sprintf(innerMsg, `{"myKey": "myValue"}`), true},
}
Expand Down

0 comments on commit 8550c87

Please sign in to comment.