diff --git a/a.wasm b/a.wasm new file mode 100644 index 000000000..28fed8117 Binary files /dev/null and b/a.wasm differ diff --git a/app/app.go b/app/app.go index 269ac5f94..94b25bab5 100644 --- a/app/app.go +++ b/app/app.go @@ -57,6 +57,7 @@ import ( customauthtx "github.com/classic-terra/core/v2/custom/auth/tx" "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" // unnamed import of statik for swagger UI support _ "github.com/classic-terra/core/v2/client/docs/statik" @@ -237,6 +238,18 @@ func NewTerraApp( app.SetPostHandler(postHandler) app.SetEndBlocker(app.EndBlocker) + // must be before Loading version + // requires the snapshot store to be created and registered as a BaseAppOption + // see cmd/wasmd/root.go: 206 - 214 approx + if manager := app.SnapshotManager(); manager != nil { + err := manager.RegisterExtensions( + wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper), + ) + if err != nil { + panic(fmt.Errorf("failed to register snapshot extension: %s", err)) + } + } + if loadLatest { if err := app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error()) diff --git a/lmao.json b/lmao.json new file mode 100644 index 000000000..a85440647 --- /dev/null +++ b/lmao.json @@ -0,0 +1,15 @@ +{ + "code_bytes": "lmao", + "code_id": "3", + "code_info": { + "code_hash": "+bSrIgKlEQtlPn3+PkE7M20UI07UR9iC4dm9VRK0SJE=", + "creator": "terra15kc4dkquya20yx09avpdw8796unj709xuyxjyc", + "instantiate_config": { + "address": "", + "addresses": [], + "permission": "Everybody" + } + }, + "pinned": false + } + \ No newline at end of file diff --git a/prop.json b/prop.json new file mode 100644 index 000000000..c3dc91685 --- /dev/null +++ b/prop.json @@ -0,0 +1,17 @@ +{ + "title": "Proposal to decrease MaxBlockSize", + "description": "Proposal to decrease MaxBlockSize from 5mb to 2mb to avoid peer-to-peer spams", + + "changes": [ + { + "subspace": "baseapp", + "key": "BlockParams", + "value": { + "max_bytes": "2000000", + "max_gas": "100000000" + } + } + ], + "metadata": "AQ==", + "deposit": "1000000000000uluna" +} diff --git a/test2.wasm b/test2.wasm new file mode 100644 index 000000000..8194957c7 Binary files /dev/null and b/test2.wasm differ diff --git a/verify.py b/verify.py new file mode 100644 index 000000000..b325eb4e6 --- /dev/null +++ b/verify.py @@ -0,0 +1,52 @@ +import json + +# Load the JSON file +with open('mytestnet/config/genesis.json', 'r') as f: + data = json.load(f) + +# Define the expected structure +expected_structure = { + "code_bytes": str, + "code_id": str, + "code_info": { + "code_hash": str, + "creator": str, + "instantiate_config": { + "address": str, + "addresses": list, + "permission": str + } + }, + "pinned": bool +} + +# Function to check if a dictionary matches the expected structure +# def check_structure(obj, expected): +# if isinstance(obj, dict): +# for key, value in expected.items(): +# if key not in obj or not isinstance(obj[key], value): +# return False +# if isinstance(value, dict) and not check_structure(obj[key], value): +# return False +# return True +# return False + +def check_structure(obj, expected): + if isinstance(obj, dict): + for key, value in expected.items(): + if key not in obj: + return False + if isinstance(value, dict): + if not isinstance(obj[key], dict): + return False + if not check_structure(obj[key], value): + return False + elif not isinstance(obj[key], value): + return False + return True + return False + +# Check each element in the codes array +for code in data['app_state']['wasm']['codes']: + if not check_structure(code, expected_structure): + print("Code structure is not as expected:", code) \ No newline at end of file diff --git a/x/wasm/keeper/testdata/test.wasm b/x/wasm/keeper/testdata/test.wasm new file mode 100644 index 000000000..8194957c7 Binary files /dev/null and b/x/wasm/keeper/testdata/test.wasm differ