diff --git a/docs/architecture/adr-027-ibc-wasm.md b/docs/architecture/adr-027-ibc-wasm.md index e1d201cfc56..26ba89a1d77 100644 --- a/docs/architecture/adr-027-ibc-wasm.md +++ b/docs/architecture/adr-027-ibc-wasm.md @@ -76,7 +76,7 @@ func (k Keeper) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*type return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority: expected %s, got %s", k.authority, msg.Signer) } - codeID, err := k.storeWasmCode(ctx, msg.Code) + codeHash, err := k.storeWasmCode(ctx, msg.Code) if err != nil { return nil, sdkerrors.Wrap(err, "storing wasm code failed") } @@ -84,7 +84,7 @@ func (k Keeper) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*type ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( clienttypes.EventTypeStoreWasmCode, - sdk.NewAttribute(clienttypes.AttributeKeyWasmCodeID, hex.EncodeToString(codeID)), + sdk.NewAttribute(clienttypes.AttributeKeyWasmCodeHash, hex.EncodeToString(codeHash)), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -93,12 +93,12 @@ func (k Keeper) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*type }) return &types.MsgStoreCodeResponse{ - CodeId: codeID, + CodeHash: codeHash, }, nil } ``` -The contract's bytecode is stored in state in an entry indexed by the code ID: `codeId/{code ID}`. The code ID is simply +The contract's bytecode is stored in state in an entry indexed by the code hash: `codeHash/{code hash}`. The code hash is simply the hash of the bytecode of the contract. ### How light client proxy works? diff --git a/docs/client/swagger-ui/swagger.yaml b/docs/client/swagger-ui/swagger.yaml index caa6573f413..c26828c49c9 100644 --- a/docs/client/swagger-ui/swagger.yaml +++ b/docs/client/swagger-ui/swagger.yaml @@ -698,6 +698,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -737,7 +741,6 @@ paths: name "y.z". - JSON @@ -1041,6 +1044,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -1080,7 +1087,6 @@ paths: name "y.z". - JSON @@ -1325,6 +1331,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -1364,7 +1374,6 @@ paths: name "y.z". - JSON @@ -1545,6 +1554,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -1584,7 +1597,6 @@ paths: name "y.z". - JSON @@ -1866,6 +1878,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -1905,7 +1921,6 @@ paths: name "y.z". - JSON @@ -2115,6 +2130,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -2154,7 +2173,6 @@ paths: name "y.z". - JSON @@ -2358,6 +2376,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -2397,7 +2419,6 @@ paths: name "y.z". - JSON @@ -2601,6 +2622,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -2640,7 +2665,6 @@ paths: name "y.z". - JSON @@ -2858,6 +2882,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -2897,7 +2925,6 @@ paths: name "y.z". - JSON @@ -3255,6 +3282,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -3294,7 +3325,6 @@ paths: name "y.z". - JSON @@ -3516,6 +3546,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -3555,7 +3589,6 @@ paths: name "y.z". - JSON @@ -3749,6 +3782,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -3788,7 +3825,6 @@ paths: name "y.z". - JSON @@ -3994,6 +4030,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -4033,7 +4073,6 @@ paths: name "y.z". - JSON @@ -4224,6 +4263,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -4263,7 +4306,6 @@ paths: name "y.z". - JSON @@ -4440,6 +4482,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -4479,7 +4525,6 @@ paths: name "y.z". - JSON @@ -4671,6 +4716,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -4710,7 +4759,6 @@ paths: name "y.z". - JSON @@ -4903,6 +4951,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -4942,7 +4994,6 @@ paths: name "y.z". - JSON @@ -5240,6 +5291,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -5279,7 +5334,6 @@ paths: name "y.z". - JSON @@ -5494,6 +5548,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -5533,7 +5591,6 @@ paths: name "y.z". - JSON @@ -5729,6 +5786,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -5768,7 +5829,6 @@ paths: name "y.z". - JSON @@ -5981,6 +6041,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -6020,7 +6084,6 @@ paths: name "y.z". - JSON @@ -6169,6 +6232,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -6208,7 +6275,6 @@ paths: name "y.z". - JSON @@ -6361,6 +6427,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -6400,7 +6470,6 @@ paths: name "y.z". - JSON @@ -6549,6 +6618,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -6588,7 +6661,6 @@ paths: name "y.z". - JSON @@ -6741,6 +6813,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -6780,7 +6856,6 @@ paths: name "y.z". - JSON @@ -6987,6 +7062,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -7026,7 +7105,6 @@ paths: name "y.z". - JSON @@ -7346,6 +7424,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -7385,7 +7467,6 @@ paths: name "y.z". - JSON @@ -7740,6 +7821,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -7779,7 +7864,6 @@ paths: name "y.z". - JSON @@ -7944,6 +8028,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -7983,7 +8071,6 @@ paths: name "y.z". - JSON @@ -8177,6 +8264,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -8216,7 +8307,6 @@ paths: name "y.z". - JSON @@ -8373,6 +8463,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -8412,7 +8506,6 @@ paths: name "y.z". - JSON @@ -8601,6 +8694,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -8640,7 +8737,6 @@ paths: name "y.z". - JSON @@ -8839,6 +8935,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -8878,7 +8978,6 @@ paths: name "y.z". - JSON @@ -9183,6 +9282,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -9222,7 +9325,6 @@ paths: name "y.z". - JSON @@ -9558,6 +9660,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -9597,7 +9703,6 @@ paths: name "y.z". - JSON @@ -9769,6 +9874,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -9808,7 +9917,6 @@ paths: name "y.z". - JSON @@ -10002,6 +10110,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10041,7 +10153,6 @@ paths: name "y.z". - JSON @@ -10203,6 +10314,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10242,7 +10357,6 @@ paths: name "y.z". - JSON @@ -10431,6 +10545,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10470,7 +10588,6 @@ paths: name "y.z". - JSON @@ -10699,6 +10816,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10738,7 +10859,6 @@ paths: name "y.z". - JSON @@ -10953,6 +11073,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10992,7 +11116,6 @@ paths: name "y.z". - JSON @@ -11261,6 +11384,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -11300,7 +11427,6 @@ paths: name "y.z". - JSON @@ -11584,6 +11710,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -11623,7 +11753,6 @@ paths: name "y.z". - JSON @@ -11896,6 +12025,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -11935,7 +12068,6 @@ paths: name "y.z". - JSON @@ -12208,6 +12340,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -12247,7 +12383,6 @@ paths: name "y.z". - JSON @@ -12474,6 +12609,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -12513,7 +12652,6 @@ paths: name "y.z". - JSON @@ -12743,6 +12881,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -12782,7 +12924,6 @@ paths: name "y.z". - JSON @@ -13011,6 +13152,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -13050,7 +13195,6 @@ paths: name "y.z". - JSON @@ -13374,6 +13518,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -13413,7 +13561,6 @@ paths: name "y.z". - JSON @@ -13516,17 +13663,17 @@ paths: type: boolean tags: - Query - /ibc/lightclients/wasm/v1/code_ids: + /ibc/lightclients/wasm/v1/code_hashes: get: - summary: Get all Wasm code IDs - operationId: CodeIds + summary: Get all Wasm code hashes + operationId: CodeHashes responses: '200': description: A successful response. schema: type: object properties: - code_ids: + code_hashes: type: array items: type: string @@ -13550,8 +13697,8 @@ paths: was set, its value is undefined otherwise description: >- - QueryCodeIdsResponse is the response type for the Query/CodeIds - RPC method. + QueryCodeHashesResponse is the response type for the + Query/CodeHashes RPC method. default: description: An unexpected error response. schema: @@ -13633,9 +13780,9 @@ paths: type: boolean tags: - Query - /ibc/lightclients/wasm/v1/code_ids/{code_id}/code: + /ibc/lightclients/wasm/v1/code_hashes/{code_hash}/code: get: - summary: Get Wasm code for given code ID + summary: Get Wasm code for given code hash operationId: Code responses: '200': @@ -13643,7 +13790,7 @@ paths: schema: type: object properties: - code: + data: type: string format: byte description: >- @@ -13672,7 +13819,7 @@ paths: type: string format: byte parameters: - - name: code_id + - name: code_hash in: path required: true type: string @@ -13856,6 +14003,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -13891,7 +14042,6 @@ definitions: name "y.z". - JSON @@ -14032,6 +14182,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -14067,7 +14221,6 @@ definitions: name "y.z". - JSON @@ -15207,6 +15360,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -15242,7 +15399,6 @@ definitions: name "y.z". - JSON @@ -15406,6 +15562,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -15441,7 +15601,6 @@ definitions: name "y.z". - JSON @@ -15614,6 +15773,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -15649,7 +15812,6 @@ definitions: name "y.z". - JSON @@ -15833,6 +15995,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -15871,7 +16037,6 @@ definitions: name "y.z". - JSON @@ -16120,6 +16285,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -16155,7 +16324,6 @@ definitions: name "y.z". - JSON @@ -16370,6 +16538,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -16408,7 +16580,6 @@ definitions: name "y.z". - JSON @@ -16575,6 +16746,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -16610,7 +16785,6 @@ definitions: name "y.z". - JSON @@ -16743,6 +16917,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -16778,7 +16956,6 @@ definitions: name "y.z". - JSON @@ -17189,6 +17366,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -17225,7 +17406,6 @@ definitions: name "y.z". - JSON @@ -17394,6 +17574,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -17429,7 +17613,6 @@ definitions: name "y.z". - JSON @@ -18117,6 +18300,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -18153,7 +18340,6 @@ definitions: name "y.z". - JSON @@ -18322,6 +18508,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -18357,7 +18547,6 @@ definitions: name "y.z". - JSON @@ -19309,10 +19498,10 @@ definitions: ready to send and receive packets. - STATE_CLOSED: A channel has been closed and can no longer be used to send or receive packets. - ibc.lightclients.wasm.v1.QueryCodeIdsResponse: + ibc.lightclients.wasm.v1.QueryCodeHashesResponse: type: object properties: - code_ids: + code_hashes: type: array items: type: string @@ -19336,12 +19525,12 @@ definitions: was set, its value is undefined otherwise description: >- - QueryCodeIdsResponse is the response type for the Query/CodeIds RPC + QueryCodeHashesResponse is the response type for the Query/CodeHashes RPC method. ibc.lightclients.wasm.v1.QueryCodeResponse: type: object properties: - code: + data: type: string format: byte description: QueryCodeResponse is the response type for the Query/Code RPC method. diff --git a/modules/core/02-client/types/events.go b/modules/core/02-client/types/events.go index af68628c557..409528a3d51 100644 --- a/modules/core/02-client/types/events.go +++ b/modules/core/02-client/types/events.go @@ -17,7 +17,7 @@ const ( AttributeKeyUpgradeStore = "upgrade_store" AttributeKeyUpgradePlanHeight = "upgrade_plan_height" AttributeKeyUpgradePlanTitle = "title" - AttributeKeyWasmCodeID = "wasm_code_id" + AttributeKeyWasmCodeHash = "wasm_code_hash" ) // IBC client events vars diff --git a/modules/light-clients/08-wasm/client/cli/cli.go b/modules/light-clients/08-wasm/client/cli/cli.go index 921397376b2..208c74108dd 100644 --- a/modules/light-clients/08-wasm/client/cli/cli.go +++ b/modules/light-clients/08-wasm/client/cli/cli.go @@ -18,7 +18,7 @@ func GetQueryCmd() *cobra.Command { queryCmd.AddCommand( getCmdCode(), - getCmdCodeIDs(), + getCmdCodeHashes(), ) return queryCmd diff --git a/modules/light-clients/08-wasm/client/cli/query.go b/modules/light-clients/08-wasm/client/cli/query.go index 2b0ac66fa86..412de2b36e9 100644 --- a/modules/light-clients/08-wasm/client/cli/query.go +++ b/modules/light-clients/08-wasm/client/cli/query.go @@ -14,13 +14,13 @@ import ( ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ) -// getCmdCode defines the command to query wasm code for given code ID. +// getCmdCode defines the command to query wasm code for given code hash. func getCmdCode() *cobra.Command { cmd := &cobra.Command{ - Use: "code [code-id]", + Use: "code [code-hash]", Short: "Query wasm code", - Long: "Query wasm code for a light client wasm contract with a given code ID", - Example: fmt.Sprintf("%s query %s wasm code [code-id]", version.AppName, ibcexported.ModuleName), + Long: "Query wasm code for a light client wasm contract with a given code hash", + Example: fmt.Sprintf("%s query %s wasm code [code-hash]", version.AppName, ibcexported.ModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -29,9 +29,9 @@ func getCmdCode() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - codeID := args[0] + codeHash := args[0] req := types.QueryCodeRequest{ - CodeId: codeID, + CodeHash: codeHash, } res, err := queryClient.Code(context.Background(), &req) @@ -48,13 +48,13 @@ func getCmdCode() *cobra.Command { return cmd } -// getCmdCodeIDs defines the command to query all wasm code IDs. -func getCmdCodeIDs() *cobra.Command { +// getCmdCodeHashes defines the command to query all wasm code hashes. +func getCmdCodeHashes() *cobra.Command { cmd := &cobra.Command{ - Use: "code-ids", - Short: "Query all code IDs", - Long: "Query all code IDs for all deployed light client wasm contracts", - Example: fmt.Sprintf("%s query %s wasm code-ids", version.AppName, ibcexported.ModuleName), + Use: "code-hashes", + Short: "Query all code hashes", + Long: "Query all code hashes for all deployed light client wasm contracts", + Example: fmt.Sprintf("%s query %s wasm code-hashes", version.AppName, ibcexported.ModuleName), Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -68,11 +68,11 @@ func getCmdCodeIDs() *cobra.Command { return err } - req := types.QueryCodeIdsRequest{ + req := types.QueryCodeHashesRequest{ Pagination: pageReq, } - res, err := queryClient.CodeIds(context.Background(), &req) + res, err := queryClient.CodeHashes(context.Background(), &req) if err != nil { return err } diff --git a/modules/light-clients/08-wasm/client/cli/tx.go b/modules/light-clients/08-wasm/client/cli/tx.go index 398a6738b42..330640ca898 100644 --- a/modules/light-clients/08-wasm/client/cli/tx.go +++ b/modules/light-clients/08-wasm/client/cli/tx.go @@ -37,8 +37,8 @@ func newStoreCodeCmd() *cobra.Command { } msg := &types.MsgStoreCode{ - Code: code, - Signer: clientCtx.GetFromAddress().String(), + Signer: clientCtx.GetFromAddress().String(), + WasmByteCode: code, } if err := msg.ValidateBasic(); err != nil { diff --git a/modules/light-clients/08-wasm/keeper/events.go b/modules/light-clients/08-wasm/keeper/events.go index a16a1ce0cb9..d67e79a7b7f 100644 --- a/modules/light-clients/08-wasm/keeper/events.go +++ b/modules/light-clients/08-wasm/keeper/events.go @@ -9,11 +9,11 @@ import ( ) // emitCreateClientEvent emits a create client event -func emitStoreWasmCodeEvent(ctx sdk.Context, codeID []byte) { +func emitStoreWasmCodeEvent(ctx sdk.Context, codeHash []byte) { ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( clienttypes.EventTypeStoreWasmCode, - sdk.NewAttribute(clienttypes.AttributeKeyWasmCodeID, hex.EncodeToString(codeID)), + sdk.NewAttribute(clienttypes.AttributeKeyWasmCodeHash, hex.EncodeToString(codeHash)), ), sdk.NewEvent( sdk.EventTypeMessage, diff --git a/modules/light-clients/08-wasm/keeper/genesis.go b/modules/light-clients/08-wasm/keeper/genesis.go index 97e6b22af8b..39612cb1c6d 100644 --- a/modules/light-clients/08-wasm/keeper/genesis.go +++ b/modules/light-clients/08-wasm/keeper/genesis.go @@ -10,7 +10,7 @@ import ( // state. func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) error { for _, contract := range gs.Contracts { - _, err := k.storeWasmCode(ctx, contract.ContractCode) + _, err := k.storeWasmCode(ctx, contract.CodeBytes) if err != nil { return err } @@ -21,13 +21,13 @@ func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) error { // ExportGenesis returns the 08-wasm module's exported genesis. func (k Keeper) ExportGenesis(ctx sdk.Context) types.GenesisState { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, []byte(types.KeyCodeIDPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte(types.KeyCodeHashPrefix)) defer iterator.Close() var genesisState types.GenesisState for ; iterator.Valid(); iterator.Next() { - genesisState.Contracts = append(genesisState.Contracts, types.GenesisContract{ - ContractCode: iterator.Value(), + genesisState.Contracts = append(genesisState.Contracts, types.Contract{ + CodeBytes: iterator.Value(), }) } return genesisState diff --git a/modules/light-clients/08-wasm/keeper/genesis_test.go b/modules/light-clients/08-wasm/keeper/genesis_test.go index ff32a4fde48..39b04018c7f 100644 --- a/modules/light-clients/08-wasm/keeper/genesis_test.go +++ b/modules/light-clients/08-wasm/keeper/genesis_test.go @@ -12,8 +12,8 @@ import ( func (suite *KeeperTestSuite) TestInitGenesis() { var ( - genesisState types.GenesisState - expCodeIds []string + genesisState types.GenesisState + expCodeHashes []string ) testCases := []struct { @@ -23,26 +23,26 @@ func (suite *KeeperTestSuite) TestInitGenesis() { { "success", func() { - codeID := "c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64" + codeHash := "c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64" contractCode, err := os.ReadFile("../test_data/ics07_tendermint_cw.wasm.gz") suite.Require().NoError(err) genesisState = *types.NewGenesisState( - []types.GenesisContract{ + []types.Contract{ { - ContractCode: contractCode, + CodeBytes: contractCode, }, }, ) - expCodeIds = []string{codeID} + expCodeHashes = []string{codeHash} }, }, { "success with empty genesis contract", func() { - genesisState = *types.NewGenesisState([]types.GenesisContract{}) - expCodeIds = []string{} + genesisState = *types.NewGenesisState([]types.Contract{}) + expCodeHashes = []string{} }, }, } @@ -56,12 +56,12 @@ func (suite *KeeperTestSuite) TestInitGenesis() { err := suite.chainA.GetSimApp().WasmClientKeeper.InitGenesis(ctx, genesisState) suite.Require().NoError(err) - req := &types.QueryCodeIdsRequest{} - res, err := suite.chainA.GetSimApp().WasmClientKeeper.CodeIds(ctx, req) + req := &types.QueryCodeHashesRequest{} + res, err := suite.chainA.GetSimApp().WasmClientKeeper.CodeHashes(ctx, req) suite.Require().NoError(err) suite.Require().NotNil(res) - suite.Require().Equal(len(expCodeIds), len(res.CodeIds)) - suite.Require().ElementsMatch(expCodeIds, res.CodeIds) + suite.Require().Equal(len(expCodeHashes), len(res.CodeHashes)) + suite.Require().ElementsMatch(expCodeHashes, res.CodeHashes) }) } } @@ -70,7 +70,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() { suite.SetupTest() ctx := suite.chainA.GetContext() - expCodeID := "c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64" + expCodeHash := "c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64" signer := authtypes.NewModuleAddress(govtypes.ModuleName).String() contractCode, err := os.ReadFile("../test_data/ics07_tendermint_cw.wasm.gz") @@ -79,9 +79,9 @@ func (suite *KeeperTestSuite) TestExportGenesis() { msg := types.NewMsgStoreCode(signer, contractCode) res, err := suite.chainA.GetSimApp().WasmClientKeeper.StoreCode(ctx, msg) suite.Require().NoError(err) - suite.Require().Equal(expCodeID, hex.EncodeToString(res.CodeId)) + suite.Require().Equal(expCodeHash, hex.EncodeToString(res.Checksum)) genesisState := suite.chainA.GetSimApp().WasmClientKeeper.ExportGenesis(ctx) suite.Require().Len(genesisState.Contracts, 1) - suite.Require().NotEmpty(genesisState.Contracts[0].ContractCode) + suite.Require().NotEmpty(genesisState.Contracts[0].CodeBytes) } diff --git a/modules/light-clients/08-wasm/keeper/grpc_query.go b/modules/light-clients/08-wasm/keeper/grpc_query.go index cff132e715a..2143563458b 100644 --- a/modules/light-clients/08-wasm/keeper/grpc_query.go +++ b/modules/light-clients/08-wasm/keeper/grpc_query.go @@ -19,7 +19,7 @@ import ( var _ types.QueryServer = (*Keeper)(nil) -// Code implements the Query/CodeId gRPC method +// Code implements the Query/Code gRPC method func (k Keeper) Code(c context.Context, req *types.QueryCodeRequest) (*types.QueryCodeResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") @@ -28,33 +28,33 @@ func (k Keeper) Code(c context.Context, req *types.QueryCodeRequest) (*types.Que ctx := sdk.UnwrapSDKContext(c) store := ctx.KVStore(k.storeKey) - codeID, err := hex.DecodeString(req.CodeId) + codeHash, err := hex.DecodeString(req.CodeHash) if err != nil { - return nil, status.Error(codes.InvalidArgument, "invalid code ID") + return nil, status.Error(codes.InvalidArgument, "invalid code hash") } - codeKey := types.CodeIDKey(codeID) + codeKey := types.CodeHashKey(codeHash) code := store.Get(codeKey) if code == nil { - return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrWasmCodeIDNotFound, req.CodeId).Error()) + return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrWasmCodeHashNotFound, req.CodeHash).Error()) } return &types.QueryCodeResponse{ - Code: code, + Data: code, }, nil } -// CodeIds implements the Query/CodeIds gRPC method -func (k Keeper) CodeIds(c context.Context, req *types.QueryCodeIdsRequest) (*types.QueryCodeIdsResponse, error) { - var codeIDs []string +// CodeHashes implements the Query/CodeHashes gRPC method +func (k Keeper) CodeHashes(c context.Context, req *types.QueryCodeHashesRequest) (*types.QueryCodeHashesResponse, error) { + var codeHashes []string ctx := sdk.UnwrapSDKContext(c) store := ctx.KVStore(k.storeKey) - prefixStore := prefix.NewStore(store, []byte(fmt.Sprintf("%s/", types.KeyCodeIDPrefix))) + prefixStore := prefix.NewStore(store, []byte(fmt.Sprintf("%s/", types.KeyCodeHashPrefix))) pageRes, err := sdkquery.FilteredPaginate(prefixStore, req.Pagination, func(key []byte, _ []byte, accumulate bool) (bool, error) { if accumulate { - codeIDs = append(codeIDs, string(key)) + codeHashes = append(codeHashes, string(key)) } return true, nil }) @@ -62,8 +62,8 @@ func (k Keeper) CodeIds(c context.Context, req *types.QueryCodeIdsRequest) (*typ return nil, err } - return &types.QueryCodeIdsResponse{ - CodeIds: codeIDs, + return &types.QueryCodeHashesResponse{ + CodeHashes: codeHashes, Pagination: pageRes, }, nil } diff --git a/modules/light-clients/08-wasm/keeper/grpc_query_test.go b/modules/light-clients/08-wasm/keeper/grpc_query_test.go index 221e1cc1f90..3dbc8676d2b 100644 --- a/modules/light-clients/08-wasm/keeper/grpc_query_test.go +++ b/modules/light-clients/08-wasm/keeper/grpc_query_test.go @@ -29,7 +29,7 @@ func (suite *KeeperTestSuite) TestQueryCode() { res, err := suite.chainA.GetSimApp().WasmClientKeeper.StoreCode(suite.chainA.GetContext(), msg) suite.Require().NoError(err) - req = &types.QueryCodeRequest{CodeId: hex.EncodeToString(res.CodeId)} + req = &types.QueryCodeRequest{CodeHash: hex.EncodeToString(res.Checksum)} }, true, }, @@ -41,9 +41,9 @@ func (suite *KeeperTestSuite) TestQueryCode() { false, }, { - "fails with non-existent code ID", + "fails with non-existent code hash", func() { - req = &types.QueryCodeRequest{CodeId: "test"} + req = &types.QueryCodeRequest{CodeHash: "test"} }, false, }, @@ -60,7 +60,7 @@ func (suite *KeeperTestSuite) TestQueryCode() { if tc.expPass { suite.Require().NoError(err) suite.Require().NotNil(res) - suite.Require().NotEmpty(res.Code) + suite.Require().NotEmpty(res.Data) } else { suite.Require().Error(err) } @@ -68,8 +68,8 @@ func (suite *KeeperTestSuite) TestQueryCode() { } } -func (suite *KeeperTestSuite) TestQueryCodeIDs() { - var expCodeIds []string +func (suite *KeeperTestSuite) TestQueryCodeHashes() { + var expCodeHashes []string testCases := []struct { name string @@ -77,14 +77,14 @@ func (suite *KeeperTestSuite) TestQueryCodeIDs() { expPass bool }{ { - "success with no code IDs", + "success with no code hashes", func() { - expCodeIds = []string{} + expCodeHashes = []string{} }, true, }, { - "success with one code ID", + "success with one code hash", func() { signer := authtypes.NewModuleAddress(govtypes.ModuleName).String() code, err := os.ReadFile("../test_data/ics10_grandpa_cw.wasm.gz") @@ -94,7 +94,7 @@ func (suite *KeeperTestSuite) TestQueryCodeIDs() { res, err := suite.chainA.GetSimApp().WasmClientKeeper.StoreCode(suite.chainA.GetContext(), msg) suite.Require().NoError(err) - expCodeIds = append(expCodeIds, hex.EncodeToString(res.CodeId)) + expCodeHashes = append(expCodeHashes, hex.EncodeToString(res.Checksum)) }, true, }, @@ -106,14 +106,14 @@ func (suite *KeeperTestSuite) TestQueryCodeIDs() { tc.malleate() - req := &types.QueryCodeIdsRequest{} - res, err := suite.chainA.GetSimApp().WasmClientKeeper.CodeIds(suite.chainA.GetContext(), req) + req := &types.QueryCodeHashesRequest{} + res, err := suite.chainA.GetSimApp().WasmClientKeeper.CodeHashes(suite.chainA.GetContext(), req) if tc.expPass { suite.Require().NoError(err) suite.Require().NotNil(res) - suite.Require().Equal(len(expCodeIds), len(res.CodeIds)) - suite.Require().ElementsMatch(expCodeIds, res.CodeIds) + suite.Require().Equal(len(expCodeHashes), len(res.CodeHashes)) + suite.Require().ElementsMatch(expCodeHashes, res.CodeHashes) } else { suite.Require().Error(err) } diff --git a/modules/light-clients/08-wasm/keeper/keeper.go b/modules/light-clients/08-wasm/keeper/keeper.go index ca6a9c602ff..dd2cf2b2f78 100644 --- a/modules/light-clients/08-wasm/keeper/keeper.go +++ b/modules/light-clients/08-wasm/keeper/keeper.go @@ -76,8 +76,8 @@ func (k Keeper) storeWasmCode(ctx sdk.Context, code []byte) ([]byte, error) { // Check to see if the store has a code with the same code it expectedHash := generateWasmCodeHash(code) - codeIDKey := types.CodeIDKey(expectedHash) - if store.Has(codeIDKey) { + codeHashKey := types.CodeHashKey(expectedHash) + if store.Has(codeHashKey) { return nil, types.ErrWasmCodeExists } @@ -95,14 +95,14 @@ func (k Keeper) storeWasmCode(ctx sdk.Context, code []byte) ([]byte, error) { // pin the code to the vm in-memory cache if err := k.wasmVM.Pin(codeHash); err != nil { - return nil, errorsmod.Wrapf(err, "failed to pin contract to vm cache %s", codeHash) + return nil, errorsmod.Wrapf(err, "failed to pin contract with code hash (%) to vm cache", codeHash) } - // safety check to assert that code ID returned by WasmVM equals to code hash + // safety check to assert that code hash returned by WasmVM equals to code hash if !bytes.Equal(codeHash, expectedHash) { - return nil, errorsmod.Wrapf(types.ErrInvalidCodeID, "expected %s, got %s", hex.EncodeToString(expectedHash), hex.EncodeToString(codeHash)) + return nil, errorsmod.Wrapf(types.ErrInvalidCodeHash, "expected %s, got %s", hex.EncodeToString(expectedHash), hex.EncodeToString(codeHash)) } - store.Set(codeIDKey, code) + store.Set(codeHashKey, code) return codeHash, nil -} +} \ No newline at end of file diff --git a/modules/light-clients/08-wasm/keeper/msg_server.go b/modules/light-clients/08-wasm/keeper/msg_server.go index cb50cfb335b..7972f5b1fb5 100644 --- a/modules/light-clients/08-wasm/keeper/msg_server.go +++ b/modules/light-clients/08-wasm/keeper/msg_server.go @@ -20,14 +20,14 @@ func (k Keeper) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*type } ctx := sdk.UnwrapSDKContext(goCtx) - codeID, err := k.storeWasmCode(ctx, msg.Code) + codeHash, err := k.storeWasmCode(ctx, msg.WasmByteCode) if err != nil { return nil, errorsmod.Wrap(err, "failed to store wasm bytecode") } - emitStoreWasmCodeEvent(ctx, codeID) + emitStoreWasmCodeEvent(ctx, codeHash) return &types.MsgStoreCodeResponse{ - CodeId: codeID, + Checksum: codeHash, }, nil } diff --git a/modules/light-clients/08-wasm/keeper/msg_server_test.go b/modules/light-clients/08-wasm/keeper/msg_server_test.go index 53666f925c4..b79a1b28ce4 100644 --- a/modules/light-clients/08-wasm/keeper/msg_server_test.go +++ b/modules/light-clients/08-wasm/keeper/msg_server_test.go @@ -74,13 +74,13 @@ func (suite *KeeperTestSuite) TestMsgStoreCode() { if tc.expPass { suite.Require().NoError(err) suite.Require().NotNil(res) - suite.Require().NotEmpty(res.CodeId) + suite.Require().NotEmpty(res.Checksum) // Verify events expectedEvents := sdk.Events{ sdk.NewEvent( "store_wasm_code", - sdk.NewAttribute(clienttypes.AttributeKeyWasmCodeID, hex.EncodeToString(res.CodeId)), + sdk.NewAttribute(clienttypes.AttributeKeyWasmCodeHash, hex.EncodeToString(res.Checksum)), ), } diff --git a/modules/light-clients/08-wasm/module.go b/modules/light-clients/08-wasm/module.go index fe07b321501..add51209859 100644 --- a/modules/light-clients/08-wasm/module.go +++ b/modules/light-clients/08-wasm/module.go @@ -48,7 +48,7 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) // DefaultGenesis returns an empty state, i.e. no contracts func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(&types.GenesisState{ - Contracts: []types.GenesisContract{}, + Contracts: []types.Contract{}, }) } diff --git a/modules/light-clients/08-wasm/test_data/genesis.json b/modules/light-clients/08-wasm/test_data/genesis.json index 19419b97b1e..753f609474a 100644 --- a/modules/light-clients/08-wasm/test_data/genesis.json +++ b/modules/light-clients/08-wasm/test_data/genesis.json @@ -648,7 +648,7 @@ "client_id": "08-wasm-0", "client_state": { "@type": "/ibc.lightclients.wasm.v1.ClientState", - "code_id": "FrOrNYQLE9a8AWwO57QzGsyGD5Azg9Sd5pi1VLi+mMo=", + "code_hash": "FrOrNYQLE9a8AWwO57QzGsyGD5Azg9Sd5pi1VLi+mMo=", "data": "CigvaWJjLmxpZ2h0Y2xpZW50cy5ncmFuZHBhLnYxLkNsaWVudFN0YXRlEusBCiDb1LgDSYdWIAxOBxlur/FVditMmWNzpKsAZKMEpAd0qhBZGAMoAjDQDzghQiQKIIjcNBfVBY7EtFA+DBLqGgqJviAP6YkiQj1DNAFPprDuEAFCJAog0XwteCPr8mD9E48tfifRFMAUXZaLX/UAYSXyQU+trmkQAUIkCiBDlmCzbGwDr6/KAnuRC0/s+ZgBg0xipeYAbyfZeN4jTxABQiQKIF5jm0PgBSxHRH2sh9b9K27FC91ND2FOQpnGZSSbvQnZEAFCJAogVoy0pXTG0Xj+s5wn38iz94nl9UI+GccWM8dIuazwhrUQAQ==", "latest_height": { "revision_height": "33", diff --git a/modules/light-clients/08-wasm/types/client_state.go b/modules/light-clients/08-wasm/types/client_state.go index cd5ba2e1bfc..13f0c7c9c7d 100644 --- a/modules/light-clients/08-wasm/types/client_state.go +++ b/modules/light-clients/08-wasm/types/client_state.go @@ -19,10 +19,10 @@ import ( var _ exported.ClientState = (*ClientState)(nil) // NewClientState creates a new ClientState instance. -func NewClientState(data []byte, codeID []byte, height clienttypes.Height) *ClientState { +func NewClientState(data []byte, codeHash []byte, height clienttypes.Height) *ClientState { return &ClientState{ Data: data, - CodeId: codeID, + CodeHash: codeHash, LatestHeight: height, } } @@ -43,12 +43,12 @@ func (cs ClientState) Validate() error { return errorsmod.Wrap(ErrInvalidData, "data cannot be empty") } - lenCodeID := len(cs.CodeId) - if lenCodeID == 0 { - return errorsmod.Wrap(ErrInvalidCodeID, "code ID cannot be empty") + lenCodeHash := len(cs.CodeHash) + if lenCodeHash == 0 { + return errorsmod.Wrap(ErrInvalidCodeHash, "code hash cannot be empty") } - if lenCodeID > 32 { // sha256 output is 256 bits long - return errorsmod.Wrapf(ErrInvalidCodeID, "expected 32, got %d", lenCodeID) + if lenCodeHash != 32 { // sha256 output is 256 bits long + return errorsmod.Wrapf(ErrInvalidCodeHash, "expected length of 32 bytes, got %d", lenCodeHash) } return nil @@ -78,7 +78,7 @@ func (cs ClientState) Status(ctx sdk.Context, clientStore sdk.KVStore, _ codec.B return exported.Unknown } - response, err := queryContract(ctx, clientStore, cs.CodeId, encodedData) + response, err := queryContract(ctx, clientStore, cs.CodeHash, encodedData) if err != nil { return exported.Unknown } @@ -122,7 +122,7 @@ func (cs ClientState) Initialize(ctx sdk.Context, marshaler codec.BinaryCodec, c setClientState(clientStore, marshaler, &cs) setConsensusState(clientStore, marshaler, consensusState, cs.GetLatestHeight()) - _, err := initContract(ctx, clientStore, cs.CodeId) + _, err := initContract(ctx, clientStore, cs.CodeHash) if err != nil { return errorsmod.Wrapf(err, "failed to initialize contract") } @@ -251,7 +251,7 @@ func call[T ContractResult](ctx sdk.Context, clientStore sdk.KVStore, cs *Client if err != nil { return output, errorsmod.Wrapf(err, "failed to marshal wasm contract payload") } - out, err := callContract(ctx, clientStore, cs.CodeId, encodedData) + out, err := callContract(ctx, clientStore, cs.CodeHash, encodedData) if err != nil { return output, errorsmod.Wrapf(err, "call to wasm contract failed") } @@ -259,7 +259,7 @@ func call[T ContractResult](ctx sdk.Context, clientStore sdk.KVStore, cs *Client return output, errorsmod.Wrapf(err, "failed unmarshal wasm contract payload") } if !output.Validate() { - return output, errorsmod.Wrapf(errors.New(output.Error()), "error occurred while calling contract with code ID %s", hex.EncodeToString(cs.CodeId)) + return output, errorsmod.Wrapf(errors.New(output.Error()), "error occurred while calling contract with code hash %s", hex.EncodeToString(cs.CodeHash)) } return output, nil } diff --git a/modules/light-clients/08-wasm/types/client_state_test.go b/modules/light-clients/08-wasm/types/client_state_test.go index c5436658e08..afb8a446237 100644 --- a/modules/light-clients/08-wasm/types/client_state_test.go +++ b/modules/light-clients/08-wasm/types/client_state_test.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" - + transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" @@ -43,7 +43,7 @@ func (suite *TypesTestSuite) TestStatusGrandpa() { clientStateData, err := base64.StdEncoding.DecodeString(suite.testData["client_state_frozen"]) suite.Require().NoError(err) - clientState = types.NewClientState(clientStateData, suite.codeID, clienttypes.NewHeight(2000, 5)) + clientState = types.NewClientState(clientStateData, suite.codeHash, clienttypes.NewHeight(2000, 5)) suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.ctx, grandpaClientID, clientState) }, @@ -55,7 +55,7 @@ func (suite *TypesTestSuite) TestStatusGrandpa() { clientStateData, err := base64.StdEncoding.DecodeString(suite.testData["client_state_no_consensus"]) suite.Require().NoError(err) - clientState = types.NewClientState(clientStateData, suite.codeID, clienttypes.NewHeight(2000, 36 /* This doesn't matter, but the grandpa client state is set to this */)) + clientState = types.NewClientState(clientStateData, suite.codeHash, clienttypes.NewHeight(2000, 36 /* This doesn't matter, but the grandpa client state is set to this */)) suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.ctx, grandpaClientID, clientState) }, @@ -67,8 +67,8 @@ func (suite *TypesTestSuite) TestStatusGrandpa() { clientStateData, err := base64.StdEncoding.DecodeString(suite.testData["client_state_data"]) suite.Require().NoError(err) - codeID := sha256.Sum256([]byte("bytes-of-light-client-wasm-contract-that-does-not-exist")) // code ID for a contract that does not exists in store - clientState = types.NewClientState(clientStateData, codeID[:], clienttypes.NewHeight(2000, 5)) + codeHash := sha256.Sum256([]byte("bytes-of-light-client-wasm-contract-that-does-not-exist")) // code hash for a contract that does not exists in store + clientState = types.NewClientState(clientStateData, codeHash[:], clienttypes.NewHeight(2000, 5)) }, exported.Unknown, }, @@ -188,17 +188,17 @@ func (suite *TypesTestSuite) TestValidate() { expPass: false, }, { - name: "nil code id", + name: "nil code hash", clientState: types.NewClientState([]byte{0}, nil, clienttypes.ZeroHeight()), expPass: false, }, { - name: "empty code id", + name: "empty code hash", clientState: types.NewClientState([]byte{0}, []byte{}, clienttypes.ZeroHeight()), expPass: false, }, { - name: "longer than 32 bytes code id", + name: "longer than 32 bytes code hash", clientState: types.NewClientState( []byte{0}, []byte{ @@ -248,7 +248,7 @@ func (suite *TypesTestSuite) TestInitializeGrandpa() { suite.SetupWasmGrandpa() clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.ctx, grandpaClientID) - clientState := types.NewClientState([]byte("data"), suite.codeID, clienttypes.NewHeight(2000, 4)) + clientState := types.NewClientState([]byte("data"), suite.codeHash, clienttypes.NewHeight(2000, 4)) err := clientState.Initialize(suite.ctx, suite.chainA.Codec, clientStore, tc.consensusState) if tc.expPass { @@ -299,7 +299,7 @@ func (suite *TypesTestSuite) TestInitializeTendermint() { tmClientStateData, err := suite.chainA.Codec.MarshalInterface(tmClientState) suite.Require().NoError(err) - wasmClientState := types.NewClientState(tmClientStateData, suite.codeID, tmClientState.LatestHeight) + wasmClientState := types.NewClientState(tmClientStateData, suite.codeHash, tmClientState.LatestHeight) clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.ctx, path.EndpointA.ClientID) err = wasmClientState.Initialize(suite.ctx, suite.chainA.Codec, clientStore, tc.consensusState) diff --git a/modules/light-clients/08-wasm/types/errors.go b/modules/light-clients/08-wasm/types/errors.go index 44d31fbe688..0ebf1ae2c39 100644 --- a/modules/light-clients/08-wasm/types/errors.go +++ b/modules/light-clients/08-wasm/types/errors.go @@ -3,12 +3,12 @@ package types import errorsmod "cosmossdk.io/errors" var ( - ErrInvalid = errorsmod.Register(ModuleName, 1, "invalid") - ErrInvalidData = errorsmod.Register(ModuleName, 2, "invalid data") - ErrInvalidCodeID = errorsmod.Register(ModuleName, 3, "invalid code ID") + ErrInvalid = errorsmod.Register(ModuleName, 1, "invalid") + ErrInvalidData = errorsmod.Register(ModuleName, 2, "invalid data") + ErrInvalidCodeHash = errorsmod.Register(ModuleName, 3, "invalid code hash") // Wasm specific - ErrWasmEmptyCode = errorsmod.Register(ModuleName, 4, "empty wasm code") - ErrWasmCodeTooLarge = errorsmod.Register(ModuleName, 5, "wasm code too large") - ErrWasmCodeExists = errorsmod.Register(ModuleName, 6, "wasm code already exists") - ErrWasmCodeIDNotFound = errorsmod.Register(ModuleName, 7, "wasm code id not found") + ErrWasmEmptyCode = errorsmod.Register(ModuleName, 4, "empty wasm code") + ErrWasmCodeTooLarge = errorsmod.Register(ModuleName, 5, "wasm code too large") + ErrWasmCodeExists = errorsmod.Register(ModuleName, 6, "wasm code already exists") + ErrWasmCodeHashNotFound = errorsmod.Register(ModuleName, 7, "wasm code hash not found") ) diff --git a/modules/light-clients/08-wasm/types/genesis.go b/modules/light-clients/08-wasm/types/genesis.go index 4fbbf953173..46b6c3768a1 100644 --- a/modules/light-clients/08-wasm/types/genesis.go +++ b/modules/light-clients/08-wasm/types/genesis.go @@ -19,7 +19,7 @@ type ( ) // NewGenesisState creates an 08-wasm GenesisState instance. -func NewGenesisState(contracts []GenesisContract) *GenesisState { +func NewGenesisState(contracts []Contract) *GenesisState { return &GenesisState{Contracts: contracts} } @@ -34,7 +34,7 @@ func (cs ClientState) ExportMetadata(store sdk.KVStore) []exported.GenesisMetada } ctx := sdk.NewContext(nil, tmproto.Header{Height: 1, Time: time.Now()}, true, nil) // context with infinite gas meter - response, err := queryContract(ctx, store, cs.CodeId, encodedData) + response, err := queryContract(ctx, store, cs.CodeHash, encodedData) if err != nil { panic(err) } diff --git a/modules/light-clients/08-wasm/types/genesis.pb.go b/modules/light-clients/08-wasm/types/genesis.pb.go index ecfdab236d3..d142dfd1ddb 100644 --- a/modules/light-clients/08-wasm/types/genesis.pb.go +++ b/modules/light-clients/08-wasm/types/genesis.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines 08-wasm's keeper genesis state type GenesisState struct { // uploaded light client wasm contracts - Contracts []GenesisContract `protobuf:"bytes,1,rep,name=contracts,proto3" json:"contracts"` + Contracts []Contract `protobuf:"bytes,1,rep,name=contracts,proto3" json:"contracts"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -62,31 +62,31 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetContracts() []GenesisContract { +func (m *GenesisState) GetContracts() []Contract { if m != nil { return m.Contracts } return nil } -// GenesisContract stores contract code -type GenesisContract struct { - // metadata value - ContractCode []byte `protobuf:"bytes,1,opt,name=contract_code,json=contractCode,proto3" json:"contract_code,omitempty"` +// Contract stores contract code +type Contract struct { + // contract byte code + CodeBytes []byte `protobuf:"bytes,1,opt,name=code_bytes,json=codeBytes,proto3" json:"code_bytes,omitempty"` } -func (m *GenesisContract) Reset() { *m = GenesisContract{} } -func (m *GenesisContract) String() string { return proto.CompactTextString(m) } -func (*GenesisContract) ProtoMessage() {} -func (*GenesisContract) Descriptor() ([]byte, []int) { +func (m *Contract) Reset() { *m = Contract{} } +func (m *Contract) String() string { return proto.CompactTextString(m) } +func (*Contract) ProtoMessage() {} +func (*Contract) Descriptor() ([]byte, []int) { return fileDescriptor_05e250654f164e20, []int{1} } -func (m *GenesisContract) XXX_Unmarshal(b []byte) error { +func (m *Contract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GenesisContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Contract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GenesisContract.Marshal(b, m, deterministic) + return xxx_messageInfo_Contract.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -96,21 +96,21 @@ func (m *GenesisContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } -func (m *GenesisContract) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisContract.Merge(m, src) +func (m *Contract) XXX_Merge(src proto.Message) { + xxx_messageInfo_Contract.Merge(m, src) } -func (m *GenesisContract) XXX_Size() int { +func (m *Contract) XXX_Size() int { return m.Size() } -func (m *GenesisContract) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisContract.DiscardUnknown(m) +func (m *Contract) XXX_DiscardUnknown() { + xxx_messageInfo_Contract.DiscardUnknown(m) } -var xxx_messageInfo_GenesisContract proto.InternalMessageInfo +var xxx_messageInfo_Contract proto.InternalMessageInfo func init() { proto.RegisterType((*GenesisState)(nil), "ibc.lightclients.wasm.v1.GenesisState") - proto.RegisterType((*GenesisContract)(nil), "ibc.lightclients.wasm.v1.GenesisContract") + proto.RegisterType((*Contract)(nil), "ibc.lightclients.wasm.v1.Contract") } func init() { @@ -118,24 +118,24 @@ func init() { } var fileDescriptor_05e250654f164e20 = []byte{ - // 263 bytes of a gzipped FileDescriptorProto + // 261 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcb, 0x4c, 0x4a, 0xd6, 0xcf, 0xc9, 0x4c, 0xcf, 0x28, 0x49, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0x29, 0xd6, 0x2f, 0x4f, 0x2c, 0xce, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xc8, 0x4c, 0x4a, 0xd6, 0x43, 0x56, 0xa7, 0x07, 0x52, 0xa7, 0x57, 0x66, - 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x2b, 0xc5, 0x72, - 0xf1, 0xb8, 0x43, 0x0c, 0x08, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0xf2, 0xe5, 0xe2, 0x4c, 0xce, 0xcf, - 0x2b, 0x29, 0x4a, 0x4c, 0x2e, 0x29, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0xd2, 0xd4, 0xc3, - 0x65, 0xa6, 0x1e, 0x54, 0xab, 0x33, 0x54, 0x87, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x08, - 0x13, 0x94, 0x6c, 0xb8, 0xf8, 0xd1, 0xd4, 0x08, 0x29, 0x73, 0xf1, 0xc2, 0xe4, 0xe3, 0x93, 0xf3, - 0x53, 0x52, 0x25, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0x78, 0x60, 0x82, 0xce, 0xf9, 0x29, 0xa9, - 0x56, 0x2c, 0x1d, 0x0b, 0xe4, 0x19, 0x9c, 0xc2, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, - 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, - 0x8e, 0x21, 0xca, 0x26, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0x39, - 0xbf, 0x38, 0x37, 0xbf, 0x58, 0x3f, 0x33, 0x29, 0x59, 0x37, 0x3d, 0x5f, 0x3f, 0x37, 0x3f, 0xa5, - 0x34, 0x27, 0xb5, 0x18, 0x12, 0x56, 0xba, 0xb0, 0xc0, 0x32, 0xb0, 0xd0, 0x05, 0x87, 0x57, 0x49, - 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0xef, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x41, - 0x91, 0x76, 0xf6, 0x55, 0x01, 0x00, 0x00, + 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x2b, 0x85, 0x71, + 0xf1, 0xb8, 0x43, 0x0c, 0x08, 0x2e, 0x49, 0x2c, 0x49, 0x15, 0x72, 0xe3, 0xe2, 0x4c, 0xce, 0xcf, + 0x2b, 0x29, 0x4a, 0x4c, 0x2e, 0x29, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x52, 0xd2, 0xc3, + 0x65, 0xa6, 0x9e, 0x33, 0x54, 0xa9, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x08, 0xad, 0x4a, + 0xfa, 0x5c, 0x1c, 0x30, 0x49, 0x21, 0x59, 0x2e, 0xae, 0xe4, 0xfc, 0x94, 0xd4, 0xf8, 0xa4, 0xca, + 0x92, 0x54, 0x90, 0xa1, 0x8c, 0x1a, 0x3c, 0x20, 0xa5, 0x29, 0xa9, 0x4e, 0x20, 0x01, 0x2b, 0x96, + 0x8e, 0x05, 0xf2, 0x0c, 0x4e, 0x61, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, + 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, + 0x65, 0x93, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x9c, 0x5f, 0x9c, + 0x9b, 0x5f, 0xac, 0x9f, 0x99, 0x94, 0xac, 0x9b, 0x9e, 0xaf, 0x9f, 0x9b, 0x9f, 0x52, 0x9a, 0x93, + 0x5a, 0x0c, 0x09, 0x17, 0x5d, 0x58, 0xc0, 0x18, 0x58, 0xe8, 0x82, 0xc3, 0xa6, 0xa4, 0xb2, 0x20, + 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x4f, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x06, 0xb3, 0x17, + 0x15, 0x41, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -175,7 +175,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *GenesisContract) Marshal() (dAtA []byte, err error) { +func (m *Contract) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -185,20 +185,20 @@ func (m *GenesisContract) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GenesisContract) MarshalTo(dAtA []byte) (int, error) { +func (m *Contract) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GenesisContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Contract) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ContractCode) > 0 { - i -= len(m.ContractCode) - copy(dAtA[i:], m.ContractCode) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ContractCode))) + if len(m.CodeBytes) > 0 { + i -= len(m.CodeBytes) + copy(dAtA[i:], m.CodeBytes) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.CodeBytes))) i-- dAtA[i] = 0xa } @@ -231,13 +231,13 @@ func (m *GenesisState) Size() (n int) { return n } -func (m *GenesisContract) Size() (n int) { +func (m *Contract) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ContractCode) + l = len(m.CodeBytes) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } @@ -308,7 +308,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Contracts = append(m.Contracts, GenesisContract{}) + m.Contracts = append(m.Contracts, Contract{}) if err := m.Contracts[len(m.Contracts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -334,7 +334,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } -func (m *GenesisContract) Unmarshal(dAtA []byte) error { +func (m *Contract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -357,15 +357,15 @@ func (m *GenesisContract) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GenesisContract: wiretype end group for non-group") + return fmt.Errorf("proto: Contract: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisContract: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Contract: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractCode", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CodeBytes", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -392,9 +392,9 @@ func (m *GenesisContract) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractCode = append(m.ContractCode[:0], dAtA[iNdEx:postIndex]...) - if m.ContractCode == nil { - m.ContractCode = []byte{} + m.CodeBytes = append(m.CodeBytes[:0], dAtA[iNdEx:postIndex]...) + if m.CodeBytes == nil { + m.CodeBytes = []byte{} } iNdEx = postIndex default: diff --git a/modules/light-clients/08-wasm/types/genesis_test.go b/modules/light-clients/08-wasm/types/genesis_test.go index 5d920ec85c9..57edb0d0b5f 100644 --- a/modules/light-clients/08-wasm/types/genesis_test.go +++ b/modules/light-clients/08-wasm/types/genesis_test.go @@ -17,7 +17,7 @@ func (suite *TypesTestSuite) TestExportGenesisGrandpa() { clientStateData, err := base64.StdEncoding.DecodeString(suite.testData["client_state_data"]) suite.Require().NoError(err) - clientState := types.NewClientState(clientStateData, suite.codeID, clienttypes.NewHeight(2000, 4)) + clientState := types.NewClientState(clientStateData, suite.codeHash, clienttypes.NewHeight(2000, 4)) gm := clientState.ExportMetadata(suite.store) suite.Require().NotNil(gm, "client returned nil") suite.Require().Len(gm, 0, "exported metadata has unexpected length") diff --git a/modules/light-clients/08-wasm/types/keys.go b/modules/light-clients/08-wasm/types/keys.go index c58d1a45d41..ca33a8de2f2 100644 --- a/modules/light-clients/08-wasm/types/keys.go +++ b/modules/light-clients/08-wasm/types/keys.go @@ -12,11 +12,11 @@ const ( // StoreKey is the store key string for 08-wasm StoreKey = ModuleName - KeyCodeIDPrefix = "codeId" + KeyCodeHashPrefix = "codeHash" ) -// CodeIDKey returns a store key under which the wasm code for a light client +// CodeHashKey returns a store key under which the wasm code for a light client // is stored in a client prefixed store -func CodeIDKey(codeID []byte) []byte { - return []byte(fmt.Sprintf("%s/%s", KeyCodeIDPrefix, hex.EncodeToString(codeID))) +func CodeHashKey(codeHash []byte) []byte { + return []byte(fmt.Sprintf("%s/%s", KeyCodeHashPrefix, hex.EncodeToString(codeHash))) } diff --git a/modules/light-clients/08-wasm/types/msgs.go b/modules/light-clients/08-wasm/types/msgs.go index 21c4917bb08..ef97213e0ea 100644 --- a/modules/light-clients/08-wasm/types/msgs.go +++ b/modules/light-clients/08-wasm/types/msgs.go @@ -11,14 +11,14 @@ var _ sdk.Msg = (*MsgStoreCode)(nil) //nolint:interfacer func NewMsgStoreCode(signer string, code []byte) *MsgStoreCode { return &MsgStoreCode{ - Signer: signer, - Code: code, + Signer: signer, + WasmByteCode: code, } } // ValidateBasic implements sdk.Msg func (m MsgStoreCode) ValidateBasic() error { - if len(m.Code) == 0 { + if len(m.WasmByteCode) == 0 { return ErrWasmEmptyCode } diff --git a/modules/light-clients/08-wasm/types/proposal_handle_test.go b/modules/light-clients/08-wasm/types/proposal_handle_test.go index c3ac22c0f7f..425d2a301ef 100644 --- a/modules/light-clients/08-wasm/types/proposal_handle_test.go +++ b/modules/light-clients/08-wasm/types/proposal_handle_test.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" - + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" "github.com/cosmos/ibc-go/v7/modules/core/exported" @@ -48,7 +48,7 @@ func (suite *TypesTestSuite) TestCheckSubstituteAndUpdateStateGrandpa() { substituteClientState = &types.ClientState{ Data: clientStateData, - CodeId: suite.codeID, + CodeHash: suite.codeHash, LatestHeight: clienttypes.NewHeight(2000, 4), } consensusStateData, err := base64.StdEncoding.DecodeString(suite.testData["consensus_state_data"]) diff --git a/modules/light-clients/08-wasm/types/query.pb.go b/modules/light-clients/08-wasm/types/query.pb.go index 35a790f70b4..0d070800db7 100644 --- a/modules/light-clients/08-wasm/types/query.pb.go +++ b/modules/light-clients/08-wasm/types/query.pb.go @@ -29,24 +29,24 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryCodeIdsRequest is the request type for the Query/CodeIds RPC method. -type QueryCodeIdsRequest struct { +// QueryCodeHashesRequest is the request type for the Query/CodeHashes RPC method. +type QueryCodeHashesRequest struct { // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryCodeIdsRequest) Reset() { *m = QueryCodeIdsRequest{} } -func (m *QueryCodeIdsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryCodeIdsRequest) ProtoMessage() {} -func (*QueryCodeIdsRequest) Descriptor() ([]byte, []int) { +func (m *QueryCodeHashesRequest) Reset() { *m = QueryCodeHashesRequest{} } +func (m *QueryCodeHashesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCodeHashesRequest) ProtoMessage() {} +func (*QueryCodeHashesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9e3718a8cb915777, []int{0} } -func (m *QueryCodeIdsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryCodeHashesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryCodeIdsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCodeHashesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryCodeIdsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCodeHashesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -56,44 +56,44 @@ func (m *QueryCodeIdsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryCodeIdsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCodeIdsRequest.Merge(m, src) +func (m *QueryCodeHashesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCodeHashesRequest.Merge(m, src) } -func (m *QueryCodeIdsRequest) XXX_Size() int { +func (m *QueryCodeHashesRequest) XXX_Size() int { return m.Size() } -func (m *QueryCodeIdsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCodeIdsRequest.DiscardUnknown(m) +func (m *QueryCodeHashesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCodeHashesRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryCodeIdsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryCodeHashesRequest proto.InternalMessageInfo -func (m *QueryCodeIdsRequest) GetPagination() *query.PageRequest { +func (m *QueryCodeHashesRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -// QueryCodeIdsResponse is the response type for the Query/CodeIds RPC method. -type QueryCodeIdsResponse struct { - CodeIds []string `protobuf:"bytes,1,rep,name=code_ids,json=codeIds,proto3" json:"code_ids,omitempty"` +// QueryCodeHashesResponse is the response type for the Query/CodeHashes RPC method. +type QueryCodeHashesResponse struct { + CodeHashes []string `protobuf:"bytes,1,rep,name=code_hashes,json=codeHashes,proto3" json:"code_hashes,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryCodeIdsResponse) Reset() { *m = QueryCodeIdsResponse{} } -func (m *QueryCodeIdsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryCodeIdsResponse) ProtoMessage() {} -func (*QueryCodeIdsResponse) Descriptor() ([]byte, []int) { +func (m *QueryCodeHashesResponse) Reset() { *m = QueryCodeHashesResponse{} } +func (m *QueryCodeHashesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCodeHashesResponse) ProtoMessage() {} +func (*QueryCodeHashesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9e3718a8cb915777, []int{1} } -func (m *QueryCodeIdsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryCodeHashesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryCodeIdsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryCodeHashesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryCodeIdsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryCodeHashesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -103,26 +103,26 @@ func (m *QueryCodeIdsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *QueryCodeIdsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCodeIdsResponse.Merge(m, src) +func (m *QueryCodeHashesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCodeHashesResponse.Merge(m, src) } -func (m *QueryCodeIdsResponse) XXX_Size() int { +func (m *QueryCodeHashesResponse) XXX_Size() int { return m.Size() } -func (m *QueryCodeIdsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCodeIdsResponse.DiscardUnknown(m) +func (m *QueryCodeHashesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCodeHashesResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryCodeIdsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryCodeHashesResponse proto.InternalMessageInfo -func (m *QueryCodeIdsResponse) GetCodeIds() []string { +func (m *QueryCodeHashesResponse) GetCodeHashes() []string { if m != nil { - return m.CodeIds + return m.CodeHashes } return nil } -func (m *QueryCodeIdsResponse) GetPagination() *query.PageResponse { +func (m *QueryCodeHashesResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -131,7 +131,7 @@ func (m *QueryCodeIdsResponse) GetPagination() *query.PageResponse { // QueryCodeRequest is the request type for the Query/Code RPC method. type QueryCodeRequest struct { - CodeId string `protobuf:"bytes,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + CodeHash string `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` } func (m *QueryCodeRequest) Reset() { *m = QueryCodeRequest{} } @@ -167,16 +167,16 @@ func (m *QueryCodeRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryCodeRequest proto.InternalMessageInfo -func (m *QueryCodeRequest) GetCodeId() string { +func (m *QueryCodeRequest) GetCodeHash() string { if m != nil { - return m.CodeId + return m.CodeHash } return "" } // QueryCodeResponse is the response type for the Query/Code RPC method. type QueryCodeResponse struct { - Code []byte `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` } func (m *QueryCodeResponse) Reset() { *m = QueryCodeResponse{} } @@ -212,16 +212,16 @@ func (m *QueryCodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryCodeResponse proto.InternalMessageInfo -func (m *QueryCodeResponse) GetCode() []byte { +func (m *QueryCodeResponse) GetData() []byte { if m != nil { - return m.Code + return m.Data } return nil } func init() { - proto.RegisterType((*QueryCodeIdsRequest)(nil), "ibc.lightclients.wasm.v1.QueryCodeIdsRequest") - proto.RegisterType((*QueryCodeIdsResponse)(nil), "ibc.lightclients.wasm.v1.QueryCodeIdsResponse") + proto.RegisterType((*QueryCodeHashesRequest)(nil), "ibc.lightclients.wasm.v1.QueryCodeHashesRequest") + proto.RegisterType((*QueryCodeHashesResponse)(nil), "ibc.lightclients.wasm.v1.QueryCodeHashesResponse") proto.RegisterType((*QueryCodeRequest)(nil), "ibc.lightclients.wasm.v1.QueryCodeRequest") proto.RegisterType((*QueryCodeResponse)(nil), "ibc.lightclients.wasm.v1.QueryCodeResponse") } @@ -231,34 +231,35 @@ func init() { } var fileDescriptor_9e3718a8cb915777 = []byte{ - // 430 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x8a, 0x13, 0x31, - 0x18, 0xc7, 0x9b, 0xba, 0x6e, 0xdd, 0xe8, 0x41, 0xa3, 0x60, 0x2d, 0x32, 0x2c, 0xc3, 0xe2, 0x96, - 0x96, 0x49, 0x9c, 0xf6, 0xa2, 0xe0, 0x49, 0x41, 0xf1, 0xa6, 0x73, 0xf0, 0x20, 0x88, 0x64, 0x32, - 0x61, 0x1a, 0x98, 0x99, 0x4c, 0x9b, 0x4c, 0xa5, 0x8a, 0x17, 0x9f, 0x40, 0xd0, 0x93, 0xaf, 0xe2, - 0x0b, 0x78, 0x2c, 0x78, 0xf1, 0x28, 0xad, 0x0f, 0x22, 0x93, 0x64, 0xb4, 0x85, 0x2d, 0xed, 0x2d, - 0xb4, 0xbf, 0xef, 0xff, 0xfb, 0x27, 0xf3, 0xc1, 0x33, 0x11, 0x33, 0x92, 0x89, 0x74, 0xa2, 0x59, - 0x26, 0x78, 0xa1, 0x15, 0x79, 0x47, 0x55, 0x4e, 0xe6, 0x21, 0x99, 0x56, 0x7c, 0xb6, 0xc0, 0xe5, - 0x4c, 0x6a, 0x89, 0xba, 0x22, 0x66, 0x78, 0x93, 0xc2, 0x35, 0x85, 0xe7, 0x61, 0xef, 0x6e, 0x2a, - 0x65, 0x9a, 0x71, 0x42, 0x4b, 0x41, 0x68, 0x51, 0x48, 0x4d, 0xb5, 0x90, 0x85, 0xb2, 0x73, 0xbd, - 0x01, 0x93, 0x2a, 0x97, 0x8a, 0xc4, 0x54, 0x71, 0x1b, 0x48, 0xe6, 0x61, 0xcc, 0x35, 0x0d, 0x49, - 0x49, 0x53, 0x51, 0x18, 0xd8, 0xb2, 0xfe, 0x1b, 0x78, 0xf3, 0x65, 0x4d, 0x3c, 0x91, 0x09, 0x7f, - 0x9e, 0xa8, 0x88, 0x4f, 0x2b, 0xae, 0x34, 0x7a, 0x0a, 0xe1, 0x7f, 0xb4, 0x0b, 0x4e, 0x41, 0xff, - 0xea, 0xe8, 0x1e, 0xb6, 0xb9, 0xb8, 0xce, 0xc5, 0xb6, 0xa8, 0xcb, 0xc5, 0x2f, 0x68, 0xca, 0xdd, - 0x6c, 0xb4, 0x31, 0xe9, 0xbf, 0x87, 0xb7, 0xb6, 0xe3, 0x55, 0x29, 0x0b, 0xc5, 0xd1, 0x1d, 0x78, - 0x85, 0xc9, 0x84, 0xbf, 0x15, 0x89, 0xea, 0x82, 0xd3, 0x4b, 0xfd, 0x93, 0xa8, 0xc3, 0x2c, 0x82, - 0x9e, 0x6d, 0xa9, 0xdb, 0x46, 0x7d, 0xbe, 0x57, 0x6d, 0x73, 0xb7, 0xdc, 0x43, 0x78, 0xfd, 0x9f, - 0xbb, 0xb9, 0xd7, 0x6d, 0xd8, 0x71, 0x5e, 0x73, 0xa9, 0x93, 0xe8, 0xd8, 0x6a, 0xfd, 0x73, 0x78, - 0x63, 0x03, 0x76, 0x2d, 0x11, 0x3c, 0xaa, 0xff, 0x36, 0xe8, 0xb5, 0xc8, 0x9c, 0x47, 0xdf, 0xdb, - 0xf0, 0xb2, 0x21, 0xd1, 0x57, 0x00, 0x3b, 0xee, 0x5e, 0x28, 0xc0, 0xbb, 0xbe, 0x15, 0xbe, 0xe0, - 0x79, 0x7b, 0xf8, 0x50, 0xdc, 0x16, 0xf1, 0x07, 0x9f, 0x7e, 0xfe, 0xf9, 0xd2, 0x3e, 0x43, 0x3e, - 0xd9, 0xb9, 0x38, 0xcd, 0x73, 0xa2, 0x6f, 0x00, 0x1e, 0xd5, 0xf3, 0x68, 0x70, 0x80, 0xa4, 0x29, - 0x34, 0x3c, 0x88, 0x75, 0x6d, 0x1e, 0x9a, 0x36, 0x63, 0x14, 0xee, 0x6f, 0x43, 0x3e, 0xb8, 0xd3, - 0x47, 0xf3, 0xd3, 0xe3, 0x57, 0x3f, 0x56, 0x1e, 0x58, 0xae, 0x3c, 0xf0, 0x7b, 0xe5, 0x81, 0xcf, - 0x6b, 0xaf, 0xb5, 0x5c, 0x7b, 0xad, 0x5f, 0x6b, 0xaf, 0xf5, 0xfa, 0x51, 0x2a, 0xf4, 0xa4, 0x8a, - 0x31, 0x93, 0x39, 0x71, 0xfb, 0x2b, 0x62, 0x16, 0xa4, 0x92, 0xe4, 0x32, 0xa9, 0x32, 0xae, 0xac, - 0x28, 0x68, 0x4c, 0xf7, 0x1f, 0x04, 0x46, 0xa6, 0x17, 0x25, 0x57, 0xf1, 0xb1, 0xd9, 0xe6, 0xf1, - 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xfa, 0x1c, 0x74, 0x59, 0x03, 0x00, 0x00, + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xbf, 0x8e, 0xd3, 0x30, + 0x1c, 0xc7, 0xeb, 0x72, 0x20, 0xea, 0x63, 0x00, 0x0f, 0x50, 0x15, 0x14, 0x4e, 0x11, 0xd0, 0xd3, + 0xa1, 0xd8, 0x97, 0x43, 0x42, 0x37, 0x20, 0x06, 0x90, 0x80, 0x11, 0x32, 0x30, 0xb0, 0x80, 0xe3, + 0x58, 0x89, 0xa5, 0x24, 0x4e, 0x6b, 0xa7, 0xa8, 0x42, 0x2c, 0xf0, 0x02, 0x48, 0x3c, 0x00, 0x3c, + 0x0e, 0x03, 0x43, 0x25, 0x16, 0x46, 0xd4, 0xf2, 0x20, 0x28, 0x76, 0x92, 0xa6, 0x82, 0x8a, 0xde, + 0x96, 0x58, 0xdf, 0x3f, 0x9f, 0x9f, 0xfd, 0x83, 0xb7, 0x44, 0xc8, 0x48, 0x2a, 0xe2, 0x44, 0xb3, + 0x54, 0xf0, 0x5c, 0x2b, 0xf2, 0x96, 0xaa, 0x8c, 0xcc, 0x7c, 0x32, 0x29, 0xf9, 0x74, 0x8e, 0x8b, + 0xa9, 0xd4, 0x12, 0x0d, 0x45, 0xc8, 0x70, 0x57, 0x85, 0x2b, 0x15, 0x9e, 0xf9, 0xa3, 0x1b, 0xb1, + 0x94, 0x71, 0xca, 0x09, 0x2d, 0x04, 0xa1, 0x79, 0x2e, 0x35, 0xd5, 0x42, 0xe6, 0xca, 0xfa, 0x46, + 0x47, 0x4c, 0xaa, 0x4c, 0x2a, 0x12, 0x52, 0xc5, 0x6d, 0x20, 0x99, 0xf9, 0x21, 0xd7, 0xd4, 0x27, + 0x05, 0x8d, 0x45, 0x6e, 0xc4, 0x56, 0xeb, 0xbe, 0x81, 0x57, 0x5f, 0x54, 0x8a, 0xc7, 0x32, 0xe2, + 0xcf, 0xa8, 0x4a, 0xb8, 0x0a, 0xf8, 0xa4, 0xe4, 0x4a, 0xa3, 0x27, 0x10, 0xae, 0xd5, 0x43, 0x70, + 0x00, 0x0e, 0xf7, 0x4f, 0xee, 0x60, 0x1b, 0x8d, 0xab, 0x68, 0x6c, 0x59, 0xeb, 0x68, 0xfc, 0x9c, + 0xc6, 0xbc, 0xf6, 0x06, 0x1d, 0xa7, 0xfb, 0x11, 0xc0, 0x6b, 0x7f, 0x55, 0xa8, 0x42, 0xe6, 0x8a, + 0xa3, 0x9b, 0x70, 0x9f, 0xc9, 0x88, 0xbf, 0x4e, 0xcc, 0xf1, 0x10, 0x1c, 0x9c, 0x3b, 0x1c, 0x04, + 0x90, 0xb5, 0x42, 0xf4, 0x74, 0x03, 0xa2, 0x6f, 0x20, 0xc6, 0xff, 0x85, 0xb0, 0xe9, 0x1b, 0x14, + 0x04, 0x5e, 0x6e, 0x21, 0x9a, 0x09, 0xaf, 0xc3, 0x41, 0xdb, 0x6e, 0x06, 0x1c, 0x04, 0x17, 0x9b, + 0x6e, 0x77, 0x0c, 0xaf, 0x74, 0x0c, 0x35, 0x2f, 0x82, 0x7b, 0x11, 0xd5, 0xd4, 0x88, 0x2f, 0x05, + 0xe6, 0xfb, 0xe4, 0x7b, 0x1f, 0x9e, 0x37, 0x4a, 0xf4, 0x15, 0x40, 0xb8, 0x1e, 0x12, 0x1d, 0xe3, + 0x6d, 0xef, 0x87, 0xff, 0x7d, 0xe5, 0x23, 0xff, 0x0c, 0x0e, 0x4b, 0xe4, 0x7a, 0x1f, 0x7e, 0xfc, + 0xfe, 0xdc, 0x1f, 0xa3, 0xdb, 0x64, 0xeb, 0x4a, 0x75, 0x6e, 0x18, 0x7d, 0x01, 0x70, 0xaf, 0x4a, + 0x41, 0x47, 0x3b, 0x54, 0x35, 0x58, 0x77, 0x77, 0xd2, 0xd6, 0x40, 0x0f, 0x0d, 0xd0, 0x29, 0xba, + 0xbf, 0x13, 0x10, 0x79, 0xd7, 0xfe, 0xbc, 0x37, 0xe7, 0x8f, 0x5e, 0x7e, 0x5b, 0x3a, 0x60, 0xb1, + 0x74, 0xc0, 0xaf, 0xa5, 0x03, 0x3e, 0xad, 0x9c, 0xde, 0x62, 0xe5, 0xf4, 0x7e, 0xae, 0x9c, 0xde, + 0xab, 0x07, 0xb1, 0xd0, 0x49, 0x19, 0x62, 0x26, 0x33, 0x52, 0x6f, 0xb8, 0x08, 0x99, 0x17, 0x4b, + 0x92, 0xc9, 0xa8, 0x4c, 0xb9, 0xb2, 0x6d, 0x5e, 0x53, 0x77, 0x7c, 0xea, 0x99, 0x46, 0x3d, 0x2f, + 0xb8, 0x0a, 0x2f, 0x98, 0x7d, 0xbf, 0xf7, 0x27, 0x00, 0x00, 0xff, 0xff, 0x89, 0x19, 0x66, 0xd6, + 0x7b, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -273,9 +274,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Get all Wasm code IDs - CodeIds(ctx context.Context, in *QueryCodeIdsRequest, opts ...grpc.CallOption) (*QueryCodeIdsResponse, error) - // Get Wasm code for given code ID + // Get all Wasm code hashes + CodeHashes(ctx context.Context, in *QueryCodeHashesRequest, opts ...grpc.CallOption) (*QueryCodeHashesResponse, error) + // Get Wasm code for given code hash Code(ctx context.Context, in *QueryCodeRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) } @@ -287,9 +288,9 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) CodeIds(ctx context.Context, in *QueryCodeIdsRequest, opts ...grpc.CallOption) (*QueryCodeIdsResponse, error) { - out := new(QueryCodeIdsResponse) - err := c.cc.Invoke(ctx, "/ibc.lightclients.wasm.v1.Query/CodeIds", in, out, opts...) +func (c *queryClient) CodeHashes(ctx context.Context, in *QueryCodeHashesRequest, opts ...grpc.CallOption) (*QueryCodeHashesResponse, error) { + out := new(QueryCodeHashesResponse) + err := c.cc.Invoke(ctx, "/ibc.lightclients.wasm.v1.Query/CodeHashes", in, out, opts...) if err != nil { return nil, err } @@ -307,9 +308,9 @@ func (c *queryClient) Code(ctx context.Context, in *QueryCodeRequest, opts ...gr // QueryServer is the server API for Query service. type QueryServer interface { - // Get all Wasm code IDs - CodeIds(context.Context, *QueryCodeIdsRequest) (*QueryCodeIdsResponse, error) - // Get Wasm code for given code ID + // Get all Wasm code hashes + CodeHashes(context.Context, *QueryCodeHashesRequest) (*QueryCodeHashesResponse, error) + // Get Wasm code for given code hash Code(context.Context, *QueryCodeRequest) (*QueryCodeResponse, error) } @@ -317,8 +318,8 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) CodeIds(ctx context.Context, req *QueryCodeIdsRequest) (*QueryCodeIdsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CodeIds not implemented") +func (*UnimplementedQueryServer) CodeHashes(ctx context.Context, req *QueryCodeHashesRequest) (*QueryCodeHashesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CodeHashes not implemented") } func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryCodeRequest) (*QueryCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") @@ -328,20 +329,20 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_CodeIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryCodeIdsRequest) +func _Query_CodeHashes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCodeHashesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).CodeIds(ctx, in) + return srv.(QueryServer).CodeHashes(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.lightclients.wasm.v1.Query/CodeIds", + FullMethod: "/ibc.lightclients.wasm.v1.Query/CodeHashes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CodeIds(ctx, req.(*QueryCodeIdsRequest)) + return srv.(QueryServer).CodeHashes(ctx, req.(*QueryCodeHashesRequest)) } return interceptor(ctx, in, info, handler) } @@ -369,8 +370,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "CodeIds", - Handler: _Query_CodeIds_Handler, + MethodName: "CodeHashes", + Handler: _Query_CodeHashes_Handler, }, { MethodName: "Code", @@ -381,7 +382,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "ibc/lightclients/wasm/v1/query.proto", } -func (m *QueryCodeIdsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryCodeHashesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -391,12 +392,12 @@ func (m *QueryCodeIdsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryCodeIdsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCodeHashesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryCodeIdsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCodeHashesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -416,7 +417,7 @@ func (m *QueryCodeIdsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryCodeIdsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryCodeHashesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -426,12 +427,12 @@ func (m *QueryCodeIdsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryCodeIdsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryCodeHashesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryCodeIdsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryCodeHashesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -448,11 +449,11 @@ func (m *QueryCodeIdsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.CodeIds) > 0 { - for iNdEx := len(m.CodeIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.CodeIds[iNdEx]) - copy(dAtA[i:], m.CodeIds[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeIds[iNdEx]))) + if len(m.CodeHashes) > 0 { + for iNdEx := len(m.CodeHashes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.CodeHashes[iNdEx]) + copy(dAtA[i:], m.CodeHashes[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHashes[iNdEx]))) i-- dAtA[i] = 0xa } @@ -480,10 +481,10 @@ func (m *QueryCodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.CodeId) > 0 { - i -= len(m.CodeId) - copy(dAtA[i:], m.CodeId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeId))) + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) i-- dAtA[i] = 0xa } @@ -510,10 +511,10 @@ func (m *QueryCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Code) > 0 { - i -= len(m.Code) - copy(dAtA[i:], m.Code) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Code))) + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Data))) i-- dAtA[i] = 0xa } @@ -531,7 +532,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryCodeIdsRequest) Size() (n int) { +func (m *QueryCodeHashesRequest) Size() (n int) { if m == nil { return 0 } @@ -544,14 +545,14 @@ func (m *QueryCodeIdsRequest) Size() (n int) { return n } -func (m *QueryCodeIdsResponse) Size() (n int) { +func (m *QueryCodeHashesResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.CodeIds) > 0 { - for _, s := range m.CodeIds { + if len(m.CodeHashes) > 0 { + for _, s := range m.CodeHashes { l = len(s) n += 1 + l + sovQuery(uint64(l)) } @@ -569,7 +570,7 @@ func (m *QueryCodeRequest) Size() (n int) { } var l int _ = l - l = len(m.CodeId) + l = len(m.CodeHash) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -582,7 +583,7 @@ func (m *QueryCodeResponse) Size() (n int) { } var l int _ = l - l = len(m.Code) + l = len(m.Data) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -595,7 +596,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryCodeIdsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryCodeHashesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -618,10 +619,10 @@ func (m *QueryCodeIdsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCodeIdsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCodeHashesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCodeIdsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCodeHashesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -681,7 +682,7 @@ func (m *QueryCodeIdsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCodeIdsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryCodeHashesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -704,15 +705,15 @@ func (m *QueryCodeIdsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCodeIdsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryCodeHashesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCodeIdsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryCodeHashesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeIds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CodeHashes", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -740,7 +741,7 @@ func (m *QueryCodeIdsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CodeIds = append(m.CodeIds, string(dAtA[iNdEx:postIndex])) + m.CodeHashes = append(m.CodeHashes, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 2 { @@ -830,7 +831,7 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -858,7 +859,7 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CodeId = string(dAtA[iNdEx:postIndex]) + m.CodeHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -912,7 +913,7 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -939,9 +940,9 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Code = append(m.Code[:0], dAtA[iNdEx:postIndex]...) - if m.Code == nil { - m.Code = []byte{} + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} } iNdEx = postIndex default: diff --git a/modules/light-clients/08-wasm/types/query.pb.gw.go b/modules/light-clients/08-wasm/types/query.pb.gw.go index 3fc8e3b92dd..cae21daac57 100644 --- a/modules/light-clients/08-wasm/types/query.pb.gw.go +++ b/modules/light-clients/08-wasm/types/query.pb.gw.go @@ -34,37 +34,37 @@ var _ = descriptor.ForMessage var _ = metadata.Join var ( - filter_Query_CodeIds_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_CodeHashes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_CodeIds_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCodeIdsRequest +func request_Query_CodeHashes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCodeHashesRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CodeIds_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CodeHashes_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.CodeIds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CodeHashes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_CodeIds_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCodeIdsRequest +func local_request_Query_CodeHashes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCodeHashesRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CodeIds_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CodeHashes_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.CodeIds(ctx, &protoReq) + msg, err := server.CodeHashes(ctx, &protoReq) return msg, metadata, err } @@ -80,15 +80,15 @@ func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, clie _ = err ) - val, ok = pathParams["code_id"] + val, ok = pathParams["code_hash"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_hash") } - protoReq.CodeId, err = runtime.String(val) + protoReq.CodeHash, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_hash", err) } msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -107,15 +107,15 @@ func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler _ = err ) - val, ok = pathParams["code_id"] + val, ok = pathParams["code_hash"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code_hash") } - protoReq.CodeId, err = runtime.String(val) + protoReq.CodeHash, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code_hash", err) } msg, err := server.Code(ctx, &protoReq) @@ -129,7 +129,7 @@ func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_CodeIds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CodeHashes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -140,7 +140,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_CodeIds_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CodeHashes_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -148,7 +148,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_CodeIds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CodeHashes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -216,7 +216,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_CodeIds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CodeHashes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -225,14 +225,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_CodeIds_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_CodeHashes_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_CodeIds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CodeHashes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -260,13 +260,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_CodeIds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "lightclients", "wasm", "v1", "code_ids"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_CodeHashes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "lightclients", "wasm", "v1", "code_hashes"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Code_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "lightclients", "wasm", "v1", "code_ids", "code_id", "code"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Code_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "lightclients", "wasm", "v1", "code_hashes", "code_hash", "code"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_CodeIds_0 = runtime.ForwardResponseMessage + forward_Query_CodeHashes_0 = runtime.ForwardResponseMessage forward_Query_Code_0 = runtime.ForwardResponseMessage ) diff --git a/modules/light-clients/08-wasm/types/tx.pb.go b/modules/light-clients/08-wasm/types/tx.pb.go index 2011fbe35ac..ab2c3d77c6a 100644 --- a/modules/light-clients/08-wasm/types/tx.pb.go +++ b/modules/light-clients/08-wasm/types/tx.pb.go @@ -31,7 +31,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgStoreCode defines the request type for the StoreCode rpc. type MsgStoreCode struct { Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - Code []byte `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` + // wasm byte code of light client contract. It can be raw or gzip compressed + WasmByteCode []byte `protobuf:"bytes,2,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"` } func (m *MsgStoreCode) Reset() { *m = MsgStoreCode{} } @@ -74,16 +75,17 @@ func (m *MsgStoreCode) GetSigner() string { return "" } -func (m *MsgStoreCode) GetCode() []byte { +func (m *MsgStoreCode) GetWasmByteCode() []byte { if m != nil { - return m.Code + return m.WasmByteCode } return nil } // MsgStoreCodeResponse defines the response type for the StoreCode rpc type MsgStoreCodeResponse struct { - CodeId []byte `protobuf:"bytes,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // the sha256 hash of the stored code + Checksum []byte `protobuf:"bytes,1,opt,name=checksum,proto3" json:"checksum,omitempty"` } func (m *MsgStoreCodeResponse) Reset() { *m = MsgStoreCodeResponse{} } @@ -119,9 +121,9 @@ func (m *MsgStoreCodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgStoreCodeResponse proto.InternalMessageInfo -func (m *MsgStoreCodeResponse) GetCodeId() []byte { +func (m *MsgStoreCodeResponse) GetChecksum() []byte { if m != nil { - return m.CodeId + return m.Checksum } return nil } @@ -134,26 +136,27 @@ func init() { func init() { proto.RegisterFile("ibc/lightclients/wasm/v1/tx.proto", fileDescriptor_1d9737363bf1e38d) } var fileDescriptor_1d9737363bf1e38d = []byte{ - // 297 bytes of a gzipped FileDescriptorProto + // 312 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0x4c, 0x4a, 0xd6, 0xcf, 0xc9, 0x4c, 0xcf, 0x28, 0x49, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0x29, 0xd6, 0x2f, 0x4f, 0x2c, 0xce, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xc8, 0x4c, 0x4a, 0xd6, 0x43, 0x56, 0xa2, 0x07, 0x52, 0xa2, 0x57, 0x66, 0x28, 0x25, 0x9e, 0x9c, 0x5f, - 0x9c, 0x9b, 0x5f, 0xac, 0x9f, 0x5b, 0x9c, 0x0e, 0xd2, 0x91, 0x5b, 0x9c, 0x0e, 0xd1, 0xa2, 0xe4, - 0xce, 0xc5, 0xe3, 0x5b, 0x9c, 0x1e, 0x5c, 0x92, 0x5f, 0x94, 0xea, 0x9c, 0x9f, 0x92, 0x2a, 0x24, + 0x9c, 0x9b, 0x5f, 0xac, 0x9f, 0x5b, 0x9c, 0x0e, 0xd2, 0x91, 0x5b, 0x9c, 0x0e, 0xd1, 0xa2, 0x14, + 0xc9, 0xc5, 0xe3, 0x5b, 0x9c, 0x1e, 0x5c, 0x92, 0x5f, 0x94, 0xea, 0x9c, 0x9f, 0x92, 0x2a, 0x24, 0xc6, 0xc5, 0x56, 0x9c, 0x99, 0x9e, 0x97, 0x5a, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, - 0xe5, 0x09, 0x09, 0x71, 0xb1, 0x24, 0xe7, 0xa7, 0xa4, 0x4a, 0x30, 0x29, 0x30, 0x6a, 0xf0, 0x04, - 0x81, 0xd9, 0x56, 0xdc, 0x4d, 0xcf, 0x37, 0x68, 0x41, 0x15, 0x28, 0xe9, 0x73, 0x89, 0x20, 0x1b, - 0x14, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x2a, 0x24, 0xce, 0xc5, 0x0e, 0x52, 0x1c, 0x9f, - 0x99, 0x02, 0x36, 0x91, 0x27, 0x88, 0x0d, 0xc4, 0xf5, 0x4c, 0x31, 0x2a, 0xe4, 0x62, 0xf6, 0x2d, - 0x4e, 0x17, 0x4a, 0xe6, 0xe2, 0x44, 0xd8, 0xae, 0xa6, 0x87, 0xcb, 0x07, 0x7a, 0xc8, 0x86, 0x4b, - 0xe9, 0x11, 0xa7, 0x0e, 0xe6, 0x08, 0x29, 0xd6, 0x86, 0xe7, 0x1b, 0xb4, 0x18, 0x9d, 0xc2, 0x4e, - 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, - 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x26, 0x3d, 0xb3, 0x24, 0xa3, 0x34, - 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x1a, 0x54, 0x99, 0x49, 0xc9, 0xba, 0xe9, 0xf9, 0xfa, 0xb9, - 0xf9, 0x29, 0xa5, 0x39, 0xa9, 0xc5, 0x90, 0x90, 0xd7, 0x85, 0x05, 0xbd, 0x81, 0x85, 0x2e, 0x38, - 0xf4, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x61, 0x69, 0x0c, 0x08, 0x00, 0x00, 0xff, - 0xff, 0x5f, 0x9f, 0x96, 0x49, 0xa3, 0x01, 0x00, 0x00, + 0xe5, 0x09, 0xa9, 0x70, 0xf1, 0x81, 0xcc, 0x8a, 0x4f, 0xaa, 0x2c, 0x49, 0x8d, 0x4f, 0xce, 0x4f, + 0x49, 0x95, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x09, 0xe2, 0x01, 0x89, 0x3a, 0x55, 0x96, 0x80, 0x75, + 0x5b, 0x71, 0x37, 0x3d, 0xdf, 0xa0, 0x05, 0xd5, 0xa2, 0x64, 0xc4, 0x25, 0x82, 0x6c, 0x74, 0x50, + 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x90, 0x14, 0x17, 0x47, 0x72, 0x46, 0x6a, 0x72, 0x76, + 0x71, 0x69, 0x2e, 0xd8, 0x12, 0x9e, 0x20, 0x38, 0xdf, 0xa8, 0x90, 0x8b, 0xd9, 0xb7, 0x38, 0x5d, + 0x28, 0x99, 0x8b, 0x13, 0xe1, 0x24, 0x35, 0x3d, 0x5c, 0xde, 0xd2, 0x43, 0x36, 0x5f, 0x4a, 0x8f, + 0x38, 0x75, 0x30, 0x77, 0x48, 0xb1, 0x36, 0x3c, 0xdf, 0xa0, 0xc5, 0xe8, 0x14, 0x76, 0xe2, 0x91, + 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, + 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x36, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, + 0xc9, 0xf9, 0xb9, 0xfa, 0xd0, 0xf0, 0xcb, 0x4c, 0x4a, 0xd6, 0x4d, 0xcf, 0xd7, 0xcf, 0xcd, 0x4f, + 0x29, 0xcd, 0x49, 0x2d, 0x86, 0x44, 0x87, 0x2e, 0x2c, 0x3e, 0x0c, 0x2c, 0x74, 0xc1, 0x51, 0x52, + 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x60, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xea, 0x8d, 0x6f, 0x6d, 0xb8, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -258,10 +261,10 @@ func (m *MsgStoreCode) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Code) > 0 { - i -= len(m.Code) - copy(dAtA[i:], m.Code) - i = encodeVarintTx(dAtA, i, uint64(len(m.Code))) + if len(m.WasmByteCode) > 0 { + i -= len(m.WasmByteCode) + copy(dAtA[i:], m.WasmByteCode) + i = encodeVarintTx(dAtA, i, uint64(len(m.WasmByteCode))) i-- dAtA[i] = 0x12 } @@ -295,10 +298,10 @@ func (m *MsgStoreCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.CodeId) > 0 { - i -= len(m.CodeId) - copy(dAtA[i:], m.CodeId) - i = encodeVarintTx(dAtA, i, uint64(len(m.CodeId))) + if len(m.Checksum) > 0 { + i -= len(m.Checksum) + copy(dAtA[i:], m.Checksum) + i = encodeVarintTx(dAtA, i, uint64(len(m.Checksum))) i-- dAtA[i] = 0xa } @@ -326,7 +329,7 @@ func (m *MsgStoreCode) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Code) + l = len(m.WasmByteCode) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -339,7 +342,7 @@ func (m *MsgStoreCodeResponse) Size() (n int) { } var l int _ = l - l = len(m.CodeId) + l = len(m.Checksum) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -415,7 +418,7 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WasmByteCode", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -442,9 +445,9 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Code = append(m.Code[:0], dAtA[iNdEx:postIndex]...) - if m.Code == nil { - m.Code = []byte{} + m.WasmByteCode = append(m.WasmByteCode[:0], dAtA[iNdEx:postIndex]...) + if m.WasmByteCode == nil { + m.WasmByteCode = []byte{} } iNdEx = postIndex default: @@ -499,7 +502,7 @@ func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Checksum", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -526,9 +529,9 @@ func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CodeId = append(m.CodeId[:0], dAtA[iNdEx:postIndex]...) - if m.CodeId == nil { - m.CodeId = []byte{} + m.Checksum = append(m.Checksum[:0], dAtA[iNdEx:postIndex]...) + if m.Checksum == nil { + m.Checksum = []byte{} } iNdEx = postIndex default: diff --git a/modules/light-clients/08-wasm/types/types_test.go b/modules/light-clients/08-wasm/types/types_test.go index 574893b5d25..8921ad3ae7d 100644 --- a/modules/light-clients/08-wasm/types/types_test.go +++ b/modules/light-clients/08-wasm/types/types_test.go @@ -49,7 +49,7 @@ type TypesTestSuite struct { ctx sdk.Context store sdk.KVStore - codeID []byte + codeHash []byte testData map[string]string } @@ -78,15 +78,15 @@ func (suite *TypesTestSuite) SetupWasmTendermint() { msg := types.NewMsgStoreCode(authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmContract) response, err := suite.chainA.App.GetWasmKeeper().StoreCode(suite.chainA.GetContext(), msg) suite.Require().NoError(err) - suite.Require().NotNil(response.CodeId) - suite.codeID = response.CodeId + suite.Require().NotNil(response.Checksum) + suite.codeHash = response.Checksum response, err = suite.chainB.App.GetWasmKeeper().StoreCode(suite.chainB.GetContext(), msg) suite.Require().NoError(err) - suite.Require().NotNil(response.CodeId) - suite.codeID = response.CodeId + suite.Require().NotNil(response.Checksum) + suite.codeHash = response.Checksum - suite.coordinator.SetCodeID(suite.codeID) + suite.coordinator.SetCodeHash(suite.codeHash) suite.coordinator.CommitNBlocks(suite.chainA, 2) suite.coordinator.CommitNBlocks(suite.chainB, 2) } @@ -113,8 +113,8 @@ func (suite *TypesTestSuite) SetupWasmGrandpa() { msg := types.NewMsgStoreCode(authtypes.NewModuleAddress(govtypes.ModuleName).String(), wasmContract) response, err := suite.chainA.App.GetWasmKeeper().StoreCode(suite.ctx, msg) suite.Require().NoError(err) - suite.Require().NotNil(response.CodeId) - suite.codeID = response.CodeId + suite.Require().NotNil(response.Checksum) + suite.codeHash = response.Checksum } func SetupTestingWithChannel() (ibctesting.TestingApp, map[string]json.RawMessage) { diff --git a/modules/light-clients/08-wasm/types/update_test.go b/modules/light-clients/08-wasm/types/update_test.go index d3496b47b95..096f31b084c 100644 --- a/modules/light-clients/08-wasm/types/update_test.go +++ b/modules/light-clients/08-wasm/types/update_test.go @@ -42,7 +42,7 @@ func (suite *TypesTestSuite) TestVerifyHeaderGrandpa() { clientState = &types.ClientState{ Data: clientStateData, - CodeId: suite.codeID, + CodeHash: suite.codeHash, LatestHeight: clienttypes.NewHeight(2000, 39), } suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.ctx, grandpaClientID, clientState) diff --git a/modules/light-clients/08-wasm/types/upgrade_test.go b/modules/light-clients/08-wasm/types/upgrade_test.go index 37329f5c60c..67b84532a9e 100644 --- a/modules/light-clients/08-wasm/types/upgrade_test.go +++ b/modules/light-clients/08-wasm/types/upgrade_test.go @@ -157,7 +157,7 @@ func (suite *TypesTestSuite) TestVerifyUpgradeTendermint() { tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) suite.Require().NoError(err) - upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) + upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeHash, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient) suite.Require().NoError(err) @@ -216,7 +216,7 @@ func (suite *TypesTestSuite) TestVerifyUpgradeTendermint() { tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) suite.Require().NoError(err) - upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) + upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeHash, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient) suite.Require().NoError(err) @@ -258,7 +258,7 @@ func (suite *TypesTestSuite) TestVerifyUpgradeTendermint() { tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) suite.Require().NoError(err) - upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) + upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeHash, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) suite.coordinator.CommitBlock(suite.chainB) err = path.EndpointA.UpdateClient() @@ -286,7 +286,7 @@ func (suite *TypesTestSuite) TestVerifyUpgradeTendermint() { tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) suite.Require().NoError(err) - upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) + upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeHash, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) suite.coordinator.CommitBlock(suite.chainB) err = path.EndpointA.UpdateClient() @@ -540,7 +540,7 @@ func (suite *TypesTestSuite) TestVerifyUpgradeTendermint() { tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) suite.Require().NoError(err) - upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeID, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) + upgradedClient = types.NewClientState(tmUpgradedClientBz, suite.codeHash, clienttypes.NewHeight(tmUpgradedClient.GetLatestHeight().GetRevisionNumber(), tmUpgradedClient.GetLatestHeight().GetRevisionHeight())) upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient) suite.Require().NoError(err) @@ -592,7 +592,7 @@ func (suite *TypesTestSuite) TestVerifyUpgradeTendermint() { tmUpgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), tmUpgradedClient) suite.Require().NoError(err) - upgradedClient = types.NewClientState(tmUpgradedClientBz, clientState.CodeId, clienttypes.NewHeight(revisionNumber+1, clientState.GetLatestHeight().GetRevisionHeight()+1)) + upgradedClient = types.NewClientState(tmUpgradedClientBz, clientState.CodeHash, clienttypes.NewHeight(revisionNumber+1, clientState.GetLatestHeight().GetRevisionHeight()+1)) upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient) suite.Require().NoError(err) diff --git a/modules/light-clients/08-wasm/types/vm.go b/modules/light-clients/08-wasm/types/vm.go index 85d06aca010..a8e563145c8 100644 --- a/modules/light-clients/08-wasm/types/vm.go +++ b/modules/light-clients/08-wasm/types/vm.go @@ -41,7 +41,7 @@ func (r contractResult) Error() string { } // initContract calls vm.Init with appropriate arguments. -func initContract(ctx sdk.Context, clientStore sdk.KVStore, codeID []byte) (*wasmvmtypes.Response, error) { +func initContract(ctx sdk.Context, clientStore sdk.KVStore, codeHash []byte) (*wasmvmtypes.Response, error) { sdkGasMeter := ctx.GasMeter() multipliedGasMeter := NewMultipliedGasMeter(sdkGasMeter, VMGasRegister) gasLimit := VMGasRegister.runtimeGasForContract(ctx) @@ -55,13 +55,13 @@ func initContract(ctx sdk.Context, clientStore sdk.KVStore, codeID []byte) (*was initMsg := []byte("{}") ctx.GasMeter().ConsumeGas(VMGasRegister.NewContractInstanceCosts(len(initMsg)), "Loading CosmWasm module: instantiate") - response, gasUsed, err := WasmVM.Instantiate(codeID, env, msgInfo, initMsg, newStoreAdapter(clientStore), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization) + response, gasUsed, err := WasmVM.Instantiate(codeHash, env, msgInfo, initMsg, newStoreAdapter(clientStore), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization) VMGasRegister.consumeRuntimeGas(ctx, gasUsed) return response, err } // callContract calls vm.Execute with internally constructed gas meter and environment. -func callContract(ctx sdk.Context, clientStore sdk.KVStore, codeID []byte, msg []byte) (*wasmvmtypes.Response, error) { +func callContract(ctx sdk.Context, clientStore sdk.KVStore, codeHash []byte, msg []byte) (*wasmvmtypes.Response, error) { sdkGasMeter := ctx.GasMeter() multipliedGasMeter := NewMultipliedGasMeter(sdkGasMeter, VMGasRegister) gasLimit := VMGasRegister.runtimeGasForContract(ctx) @@ -73,13 +73,13 @@ func callContract(ctx sdk.Context, clientStore sdk.KVStore, codeID []byte, msg [ Funds: nil, } ctx.GasMeter().ConsumeGas(VMGasRegister.InstantiateContractCosts(len(msg)), "Loading CosmWasm module: execute") - resp, gasUsed, err := WasmVM.Execute(codeID, env, msgInfo, msg, newStoreAdapter(clientStore), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization) + resp, gasUsed, err := WasmVM.Execute(codeHash, env, msgInfo, msg, newStoreAdapter(clientStore), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization) VMGasRegister.consumeRuntimeGas(ctx, gasUsed) return resp, err } // queryContract calls vm.Query. -func queryContract(ctx sdk.Context, clientStore sdk.KVStore, codeID []byte, msg []byte) ([]byte, error) { +func queryContract(ctx sdk.Context, clientStore sdk.KVStore, codeHash []byte, msg []byte) ([]byte, error) { sdkGasMeter := ctx.GasMeter() multipliedGasMeter := NewMultipliedGasMeter(sdkGasMeter, VMGasRegister) gasLimit := VMGasRegister.runtimeGasForContract(ctx) @@ -87,7 +87,7 @@ func queryContract(ctx sdk.Context, clientStore sdk.KVStore, codeID []byte, msg env := getEnv(ctx) ctx.GasMeter().ConsumeGas(VMGasRegister.InstantiateContractCosts(len(msg)), "Loading CosmWasm module: query") - resp, gasUsed, err := WasmVM.Query(codeID, env, msg, newStoreAdapter(clientStore), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization) + resp, gasUsed, err := WasmVM.Query(codeHash, env, msg, newStoreAdapter(clientStore), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization) VMGasRegister.consumeRuntimeGas(ctx, gasUsed) return resp, err } diff --git a/modules/light-clients/08-wasm/types/wasm.pb.go b/modules/light-clients/08-wasm/types/wasm.pb.go index 4854d71ae89..cb185e14fe6 100644 --- a/modules/light-clients/08-wasm/types/wasm.pb.go +++ b/modules/light-clients/08-wasm/types/wasm.pb.go @@ -29,7 +29,7 @@ type ClientState struct { // bytes encoding the client state of the underlying light client // implemented as a Wasm contract. Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - CodeId []byte `protobuf:"bytes,2,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + CodeHash []byte `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` LatestHeight types.Height `protobuf:"bytes,3,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height"` } @@ -198,30 +198,30 @@ func init() { } var fileDescriptor_678928ebbdee1807 = []byte{ - // 358 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x4a, 0xc3, 0x30, - 0x1c, 0xc6, 0x9b, 0x59, 0x2a, 0x66, 0xd3, 0x43, 0x11, 0x2c, 0x43, 0xba, 0x31, 0x2f, 0xbb, 0x2c, - 0x71, 0x7a, 0x19, 0xe2, 0x69, 0x43, 0x98, 0x07, 0x2f, 0x13, 0x3c, 0x88, 0x30, 0xd2, 0x34, 0xb4, - 0x81, 0x76, 0x19, 0x4b, 0x5a, 0xf1, 0x09, 0xf4, 0xe8, 0x23, 0xf8, 0x38, 0x3b, 0xee, 0xe8, 0x49, - 0x64, 0x7b, 0x11, 0x49, 0x52, 0xd1, 0xc3, 0x04, 0x4f, 0xfd, 0xf7, 0xcb, 0x2f, 0xdf, 0xff, 0x83, - 0x7c, 0xf0, 0x84, 0x47, 0x14, 0x67, 0x3c, 0x49, 0x15, 0xcd, 0x38, 0x9b, 0x29, 0x89, 0x1f, 0x89, - 0xcc, 0x71, 0xd9, 0x37, 0x5f, 0x34, 0x5f, 0x08, 0x25, 0xfc, 0x80, 0x47, 0x14, 0xfd, 0x86, 0x90, - 0x39, 0x2c, 0xfb, 0xcd, 0xc3, 0x44, 0x24, 0xc2, 0x40, 0x58, 0x4f, 0x96, 0x6f, 0xb6, 0xb4, 0x29, - 0x15, 0x0b, 0x86, 0x2d, 0xaf, 0xed, 0xec, 0x64, 0x81, 0xce, 0x33, 0x80, 0xf5, 0x91, 0x11, 0x6e, - 0x15, 0x51, 0xcc, 0xf7, 0xa1, 0x1b, 0x13, 0x45, 0x02, 0xd0, 0x06, 0xdd, 0xc6, 0xc4, 0xcc, 0xfe, - 0x11, 0xdc, 0xa5, 0x22, 0x66, 0x53, 0x1e, 0x07, 0x35, 0x23, 0x7b, 0xfa, 0xf7, 0x3a, 0xf6, 0xaf, - 0xe0, 0x7e, 0x46, 0x14, 0x93, 0x6a, 0x9a, 0x32, 0x9d, 0x29, 0xd8, 0x69, 0x83, 0x6e, 0xfd, 0xac, - 0x89, 0x74, 0x4a, 0xbd, 0x15, 0x55, 0xbb, 0xca, 0x3e, 0x1a, 0x1b, 0x62, 0xe8, 0x2e, 0x3f, 0x5a, - 0xce, 0xa4, 0x61, 0xaf, 0x59, 0xed, 0xc2, 0x7d, 0x79, 0x6b, 0x39, 0x9d, 0x31, 0x3c, 0x18, 0x89, - 0x99, 0x64, 0x33, 0x59, 0xc8, 0xbf, 0xb3, 0x1c, 0xc3, 0x3d, 0xc5, 0x73, 0x26, 0x15, 0xc9, 0xe7, - 0x26, 0x8d, 0x3b, 0xf9, 0x11, 0x2a, 0xa7, 0x07, 0xe8, 0x8d, 0x19, 0x89, 0xd9, 0x62, 0xab, 0xc3, - 0x00, 0x7a, 0x55, 0xda, 0xda, 0x3f, 0xd3, 0x56, 0x7c, 0xe5, 0xde, 0x85, 0x8d, 0x1b, 0x2e, 0x23, - 0x96, 0x92, 0x92, 0x8b, 0x62, 0xeb, 0x0e, 0x4b, 0x0e, 0xef, 0x96, 0xeb, 0x10, 0xac, 0xd6, 0x21, - 0xf8, 0x5c, 0x87, 0xe0, 0x75, 0x13, 0x3a, 0xab, 0x4d, 0xe8, 0xbc, 0x6f, 0x42, 0xe7, 0xfe, 0x32, - 0xe1, 0x2a, 0x2d, 0x22, 0x44, 0x45, 0x8e, 0xa9, 0x90, 0xb9, 0x90, 0x98, 0x47, 0xb4, 0x97, 0x08, - 0x9c, 0x8b, 0xb8, 0xc8, 0x98, 0xb4, 0x45, 0xe8, 0x7d, 0x37, 0xe1, 0x74, 0xd0, 0x33, 0x65, 0x50, - 0x4f, 0x73, 0x26, 0x23, 0xcf, 0x3c, 0xdd, 0xf9, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x14, - 0x16, 0xed, 0x32, 0x02, 0x00, 0x00, + // 361 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x31, 0x4b, 0xc3, 0x40, + 0x18, 0x86, 0x93, 0x1a, 0x8a, 0xbd, 0x56, 0x87, 0xe0, 0x10, 0xaa, 0xa4, 0xa5, 0x2e, 0x5d, 0x9a, + 0xb3, 0xba, 0x14, 0x71, 0x6a, 0x11, 0xb2, 0xb8, 0x54, 0x70, 0x10, 0xa1, 0x5c, 0x2e, 0x47, 0x72, + 0x90, 0xf4, 0x4a, 0xbf, 0x4b, 0xc4, 0x7f, 0x20, 0xb8, 0xf8, 0x13, 0xfc, 0x39, 0x1d, 0x3b, 0x3a, + 0x89, 0xb4, 0x7f, 0x44, 0xee, 0x2e, 0xa2, 0x43, 0x05, 0xa7, 0x7c, 0xbc, 0xdf, 0x93, 0xf7, 0x7b, + 0xe1, 0x5e, 0x74, 0xca, 0x23, 0x8a, 0x33, 0x9e, 0xa4, 0x92, 0x66, 0x9c, 0xcd, 0x25, 0xe0, 0x47, + 0x02, 0x39, 0x2e, 0x87, 0xfa, 0x1b, 0x2c, 0x96, 0x42, 0x0a, 0xd7, 0xe3, 0x11, 0x0d, 0x7e, 0x43, + 0x81, 0x5e, 0x96, 0xc3, 0xf6, 0x51, 0x22, 0x12, 0xa1, 0x21, 0xac, 0x26, 0xc3, 0xb7, 0x3b, 0xca, + 0x94, 0x8a, 0x25, 0xc3, 0x86, 0x57, 0x76, 0x66, 0x32, 0x40, 0xef, 0xc5, 0x46, 0xcd, 0x89, 0x16, + 0x6e, 0x25, 0x91, 0xcc, 0x75, 0x91, 0x13, 0x13, 0x49, 0x3c, 0xbb, 0x6b, 0xf7, 0x5b, 0x53, 0x3d, + 0xbb, 0xc7, 0xa8, 0x41, 0x45, 0xcc, 0x66, 0x29, 0x81, 0xd4, 0xab, 0xe9, 0xc5, 0xbe, 0x12, 0x42, + 0x02, 0xa9, 0x7b, 0x8d, 0x0e, 0x32, 0x22, 0x19, 0xc8, 0x59, 0xca, 0x54, 0x2e, 0x6f, 0xaf, 0x6b, + 0xf7, 0x9b, 0xe7, 0xed, 0x40, 0x25, 0x55, 0x97, 0x83, 0xea, 0x5e, 0x39, 0x0c, 0x42, 0x4d, 0x8c, + 0x9d, 0xd5, 0x47, 0xc7, 0x9a, 0xb6, 0xcc, 0x6f, 0x46, 0xbb, 0x74, 0x9e, 0xdf, 0x3a, 0x56, 0x2f, + 0x44, 0x87, 0x13, 0x31, 0x07, 0x36, 0x87, 0x02, 0xfe, 0xce, 0x73, 0x82, 0x1a, 0x92, 0xe7, 0x0c, + 0x24, 0xc9, 0x17, 0x3a, 0x8f, 0x33, 0xfd, 0x11, 0x2a, 0xa7, 0x07, 0x54, 0x0f, 0x19, 0x89, 0xd9, + 0x72, 0xa7, 0xc3, 0x08, 0xd5, 0xab, 0xb4, 0xb5, 0x7f, 0xa6, 0xad, 0xf8, 0xca, 0xbd, 0x8f, 0x5a, + 0x37, 0x1c, 0x22, 0x96, 0x92, 0x92, 0x8b, 0x62, 0xe7, 0x0d, 0x43, 0x8e, 0xef, 0x56, 0x1b, 0xdf, + 0x5e, 0x6f, 0x7c, 0xfb, 0x73, 0xe3, 0xdb, 0xaf, 0x5b, 0xdf, 0x5a, 0x6f, 0x7d, 0xeb, 0x7d, 0xeb, + 0x5b, 0xf7, 0x57, 0x09, 0x97, 0x69, 0x11, 0x05, 0x54, 0xe4, 0x98, 0x0a, 0xc8, 0x05, 0x60, 0x1e, + 0xd1, 0x41, 0x22, 0x70, 0x2e, 0xe2, 0x22, 0x63, 0x60, 0xca, 0x30, 0xf8, 0x6e, 0xc3, 0xd9, 0x68, + 0xa0, 0x0b, 0x21, 0x9f, 0x16, 0x0c, 0xa2, 0xba, 0x7e, 0xbe, 0x8b, 0xaf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x4c, 0x4e, 0x00, 0xda, 0x36, 0x02, 0x00, 0x00, } func (m *ClientState) Marshal() (dAtA []byte, err error) { @@ -254,10 +254,10 @@ func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x1a - if len(m.CodeId) > 0 { - i -= len(m.CodeId) - copy(dAtA[i:], m.CodeId) - i = encodeVarintWasm(dAtA, i, uint64(len(m.CodeId))) + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintWasm(dAtA, i, uint64(len(m.CodeHash))) i-- dAtA[i] = 0x12 } @@ -397,7 +397,7 @@ func (m *ClientState) Size() (n int) { if l > 0 { n += 1 + l + sovWasm(uint64(l)) } - l = len(m.CodeId) + l = len(m.CodeHash) if l > 0 { n += 1 + l + sovWasm(uint64(l)) } @@ -521,7 +521,7 @@ func (m *ClientState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -548,9 +548,9 @@ func (m *ClientState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CodeId = append(m.CodeId[:0], dAtA[iNdEx:postIndex]...) - if m.CodeId == nil { - m.CodeId = []byte{} + m.CodeHash = append(m.CodeHash[:0], dAtA[iNdEx:postIndex]...) + if m.CodeHash == nil { + m.CodeHash = []byte{} } iNdEx = postIndex case 3: diff --git a/proto/ibc/lightclients/wasm/v1/genesis.proto b/proto/ibc/lightclients/wasm/v1/genesis.proto index 15859a42e8c..637ba1677e3 100644 --- a/proto/ibc/lightclients/wasm/v1/genesis.proto +++ b/proto/ibc/lightclients/wasm/v1/genesis.proto @@ -9,12 +9,12 @@ option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/type // GenesisState defines 08-wasm's keeper genesis state message GenesisState { // uploaded light client wasm contracts - repeated GenesisContract contracts = 1 [(gogoproto.nullable) = false]; + repeated Contract contracts = 1 [(gogoproto.nullable) = false]; } -// GenesisContract stores contract code -message GenesisContract { +// Contract stores contract code +message Contract { option (gogoproto.goproto_getters) = false; - // metadata value - bytes contract_code = 1; + // contract byte code + bytes code_bytes = 1; } \ No newline at end of file diff --git a/proto/ibc/lightclients/wasm/v1/query.proto b/proto/ibc/lightclients/wasm/v1/query.proto index 0522b00aeb9..5310a26a0b3 100644 --- a/proto/ibc/lightclients/wasm/v1/query.proto +++ b/proto/ibc/lightclients/wasm/v1/query.proto @@ -8,36 +8,36 @@ option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/type // Query service for wasm module service Query { - // Get all Wasm code IDs - rpc CodeIds(QueryCodeIdsRequest) returns (QueryCodeIdsResponse) { - option (google.api.http).get = "/ibc/lightclients/wasm/v1/code_ids"; + // Get all Wasm code hashes + rpc CodeHashes(QueryCodeHashesRequest) returns (QueryCodeHashesResponse) { + option (google.api.http).get = "/ibc/lightclients/wasm/v1/code_hashes"; } - // Get Wasm code for given code ID + // Get Wasm code for given code hash rpc Code(QueryCodeRequest) returns (QueryCodeResponse) { - option (google.api.http).get = "/ibc/lightclients/wasm/v1/code_ids/{code_id}/code"; + option (google.api.http).get = "/ibc/lightclients/wasm/v1/code_hashes/{code_hash}/code"; } } -// QueryCodeIdsRequest is the request type for the Query/CodeIds RPC method. -message QueryCodeIdsRequest { +// QueryCodeHashesRequest is the request type for the Query/CodeHashes RPC method. +message QueryCodeHashesRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; } -// QueryCodeIdsResponse is the response type for the Query/CodeIds RPC method. -message QueryCodeIdsResponse { - repeated string code_ids = 1; +// QueryCodeHashesResponse is the response type for the Query/CodeHashes RPC method. +message QueryCodeHashesResponse { + repeated string code_hashes = 1; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryCodeRequest is the request type for the Query/Code RPC method. message QueryCodeRequest { - string code_id = 1; + string code_hash = 1; } // QueryCodeResponse is the response type for the Query/Code RPC method. message QueryCodeResponse { - bytes code = 1; + bytes data = 1; } \ No newline at end of file diff --git a/proto/ibc/lightclients/wasm/v1/tx.proto b/proto/ibc/lightclients/wasm/v1/tx.proto index bd373bd3f34..7a94449437d 100644 --- a/proto/ibc/lightclients/wasm/v1/tx.proto +++ b/proto/ibc/lightclients/wasm/v1/tx.proto @@ -18,10 +18,12 @@ message MsgStoreCode { option (cosmos.msg.v1.signer) = "signer"; string signer = 1; - bytes code = 2; + // wasm byte code of light client contract. It can be raw or gzip compressed + bytes wasm_byte_code = 2; } // MsgStoreCodeResponse defines the response type for the StoreCode rpc message MsgStoreCodeResponse { - bytes code_id = 1; + // the sha256 hash of the stored code + bytes checksum = 1; } \ No newline at end of file diff --git a/proto/ibc/lightclients/wasm/v1/wasm.proto b/proto/ibc/lightclients/wasm/v1/wasm.proto index 643957549a8..55ef9391a75 100644 --- a/proto/ibc/lightclients/wasm/v1/wasm.proto +++ b/proto/ibc/lightclients/wasm/v1/wasm.proto @@ -13,7 +13,7 @@ message ClientState { // bytes encoding the client state of the underlying light client // implemented as a Wasm contract. bytes data = 1; - bytes code_id = 2; + bytes code_hash = 2; ibc.core.client.v1.Height latest_height = 3 [(gogoproto.nullable) = false]; } diff --git a/testing/coordinator.go b/testing/coordinator.go index 1e1f14c0a58..15b44902fdf 100644 --- a/testing/coordinator.go +++ b/testing/coordinator.go @@ -26,7 +26,7 @@ type Coordinator struct { CurrentTime time.Time Chains map[string]*TestChain - CodeID []byte + CodeHash []byte } // NewCoordinator initializes Coordinator with N TestChain's @@ -47,9 +47,9 @@ func NewCoordinator(t *testing.T, n int) *Coordinator { return coord } -// SetCodeID sets the code ID of a wasm ligh client contract -func (coord *Coordinator) SetCodeID(codeID []byte) { - coord.CodeID = codeID +// SetCodeHash sets the code hash of a wasm ligh client contract +func (coord *Coordinator) SetCodeHash(codeHash []byte) { + coord.CodeHash = codeHash } // IncrementTime iterates through all the TestChain's and increments their current header time diff --git a/testing/endpoint.go b/testing/endpoint.go index 6b2126585bb..544750a0459 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -117,7 +117,7 @@ func (endpoint *Endpoint) CreateClient() (err error) { if err != nil { return err } - clientState = wasmtypes.NewClientState(wasmClientState, endpoint.Chain.Coordinator.CodeID, height) + clientState = wasmtypes.NewClientState(wasmClientState, endpoint.Chain.Coordinator.CodeHash, height) wasmConsensusState, err := endpoint.Chain.Codec.MarshalInterface(tmConsensusState) if err != nil {