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

Increasing allowed wasm bytecode size #4174

Merged
merged 2 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Comment on lines +165 to +169
Copy link
Member

Choose a reason for hiding this comment

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

Should we later make this a wasm option, and move this function elsewhere?

https://github.com/CosmWasm/wasmd/blob/88e01a98ab8a87b98dc26c03715e6aef5c92781b/x/wasm/keeper/keeper.go#L43-L45

If so we can make a followup issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I feel like wasmd configs are all over the place, but I don't know if there's a reason for that. For example, I often use a local fork to override defaultContractDebugMode (using --trace also adds that, but I think that doesn't work on tests and I don't want other side effects of adding trace).

But maybe there's something I'm missing. Do you know the right way to do this with apply()? Is that something we can define on osmosis or would it need to change in wasmd?

Copy link
Member

Choose a reason for hiding this comment

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

OH its a lowercase apply not uppercase. I dont think we can implement the interface outside the repo, RIP.

Lets at least bundle all our wasm options, into perhaps an app/wasm.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added #4206 to reorganize this in the future.


// 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