diff --git a/modules/light-clients/08-wasm/types/client_state.go b/modules/light-clients/08-wasm/types/client_state.go index b05f0f667a4..08008b3313d 100644 --- a/modules/light-clients/08-wasm/types/client_state.go +++ b/modules/light-clients/08-wasm/types/client_state.go @@ -125,7 +125,7 @@ func (cs ClientState) Initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientS ConsensusState: consensusState, } - return wasmInit(ctx, clientStore, &cs, payload) + return wasmInstantiate(ctx, clientStore, &cs, payload) } // VerifyMembership is a generic proof verification method which verifies a proof of the existence of a value at a given CommitmentPath at the specified height. @@ -169,7 +169,7 @@ func (cs ClientState) VerifyMembership( Value: value, }, } - _, err := wasmCall[EmptyResult](ctx, clientStore, &cs, payload) + _, err := wasmSudo[EmptyResult](ctx, clientStore, &cs, payload) return err } @@ -212,6 +212,6 @@ func (cs ClientState) VerifyNonMembership( Path: merklePath, }, } - _, err := wasmCall[EmptyResult](ctx, clientStore, &cs, payload) + _, err := wasmSudo[EmptyResult](ctx, clientStore, &cs, payload) return err } diff --git a/modules/light-clients/08-wasm/types/export_test.go b/modules/light-clients/08-wasm/types/export_test.go index e10e28bd5a8..e1ad86167f1 100644 --- a/modules/light-clients/08-wasm/types/export_test.go +++ b/modules/light-clients/08-wasm/types/export_test.go @@ -30,12 +30,12 @@ func WasmQuery[T ContractResult](ctx sdk.Context, clientStore storetypes.KVStore return wasmQuery[T](ctx, clientStore, cs, payload) } -// WasmCall wraps wasmCall and is used solely for testing. -func WasmCall[T ContractResult](ctx sdk.Context, clientStore storetypes.KVStore, cs *ClientState, payload SudoMsg) (T, error) { - return wasmCall[T](ctx, clientStore, cs, payload) +// WasmSudo wraps wasmCall and is used solely for testing. +func WasmSudo[T ContractResult](ctx sdk.Context, clientStore storetypes.KVStore, cs *ClientState, payload SudoMsg) (T, error) { + return wasmSudo[T](ctx, clientStore, cs, payload) } -// WasmInit wraps wasmInit and is used solely for testing. -func WasmInit(ctx sdk.Context, clientStore storetypes.KVStore, cs *ClientState, payload InstantiateMessage) error { - return wasmInit(ctx, clientStore, cs, payload) +// WasmInstantiate wraps wasmInit and is used solely for testing. +func WasmInstantiate(ctx sdk.Context, clientStore storetypes.KVStore, cs *ClientState, payload InstantiateMessage) error { + return wasmInstantiate(ctx, clientStore, cs, payload) } diff --git a/modules/light-clients/08-wasm/types/proposal_handle.go b/modules/light-clients/08-wasm/types/proposal_handle.go index 6d600fa94cb..b83cebb0016 100644 --- a/modules/light-clients/08-wasm/types/proposal_handle.go +++ b/modules/light-clients/08-wasm/types/proposal_handle.go @@ -38,6 +38,6 @@ func (cs ClientState) CheckSubstituteAndUpdateState( CheckSubstituteAndUpdateState: &CheckSubstituteAndUpdateStateMsg{}, } - _, err := wasmCall[EmptyResult](ctx, store, &cs, payload) + _, err := wasmSudo[EmptyResult](ctx, store, &cs, payload) return err } diff --git a/modules/light-clients/08-wasm/types/update.go b/modules/light-clients/08-wasm/types/update.go index 5310e7678c0..ac2e93f232b 100644 --- a/modules/light-clients/08-wasm/types/update.go +++ b/modules/light-clients/08-wasm/types/update.go @@ -43,7 +43,7 @@ func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, client UpdateState: &UpdateStateMsg{ClientMessage: clientMessage}, } - result, err := wasmCall[UpdateStateResult](ctx, clientStore, &cs, payload) + result, err := wasmSudo[UpdateStateResult](ctx, clientStore, &cs, payload) if err != nil { panic(err) } @@ -68,7 +68,7 @@ func (cs ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, _ codec.BinaryC UpdateStateOnMisbehaviour: &UpdateStateOnMisbehaviourMsg{ClientMessage: clientMessage}, } - _, err := wasmCall[EmptyResult](ctx, clientStore, &cs, payload) + _, err := wasmSudo[EmptyResult](ctx, clientStore, &cs, payload) if err != nil { panic(err) } diff --git a/modules/light-clients/08-wasm/types/upgrade.go b/modules/light-clients/08-wasm/types/upgrade.go index 496cd9eafef..3915dc6bafb 100644 --- a/modules/light-clients/08-wasm/types/upgrade.go +++ b/modules/light-clients/08-wasm/types/upgrade.go @@ -52,6 +52,6 @@ func (cs ClientState) VerifyUpgradeAndUpdateState( }, } - _, err := wasmCall[EmptyResult](ctx, clientStore, &cs, payload) + _, err := wasmSudo[EmptyResult](ctx, clientStore, &cs, payload) return err } diff --git a/modules/light-clients/08-wasm/types/vm.go b/modules/light-clients/08-wasm/types/vm.go index fcd9951c3b1..0f649da5721 100644 --- a/modules/light-clients/08-wasm/types/vm.go +++ b/modules/light-clients/08-wasm/types/vm.go @@ -77,8 +77,8 @@ func queryContract(ctx sdk.Context, clientStore storetypes.KVStore, codeHash []b return resp, err } -// wasmInit accepts a message to instantiate a wasm contract, JSON encodes it and calls initContract. -func wasmInit(ctx sdk.Context, clientStore storetypes.KVStore, cs *ClientState, payload InstantiateMessage) error { +// wasmInstantiate accepts a message to instantiate a wasm contract, JSON encodes it and calls initContract. +func wasmInstantiate(ctx sdk.Context, clientStore storetypes.KVStore, cs *ClientState, payload InstantiateMessage) error { encodedData, err := json.Marshal(payload) if err != nil { return errorsmod.Wrap(err, "failed to marshal payload for wasm contract instantiation") @@ -90,15 +90,15 @@ func wasmInit(ctx sdk.Context, clientStore storetypes.KVStore, cs *ClientState, return nil } -// wasmCall calls the contract with the given payload and returns the result. -// wasmCall returns an error if: +// wasmSudo calls the contract with the given payload and returns the result. +// wasmSudo returns an error if: // - the payload cannot be marshaled to JSON // - the contract call returns an error // - the response of the contract call contains non-empty messages // - the response of the contract call contains non-empty events // - the response of the contract call contains non-empty attributes // - the data bytes of the response cannot be unmarshaled into the result type -func wasmCall[T ContractResult](ctx sdk.Context, clientStore storetypes.KVStore, cs *ClientState, payload SudoMsg) (T, error) { +func wasmSudo[T ContractResult](ctx sdk.Context, clientStore storetypes.KVStore, cs *ClientState, payload SudoMsg) (T, error) { var result T encodedData, err := json.Marshal(payload) diff --git a/modules/light-clients/08-wasm/types/vm_test.go b/modules/light-clients/08-wasm/types/vm_test.go index dd3c1795362..db3a7e984ac 100644 --- a/modules/light-clients/08-wasm/types/vm_test.go +++ b/modules/light-clients/08-wasm/types/vm_test.go @@ -44,7 +44,7 @@ func (suite *TypesTestSuite) TestWasmInit() { tc.malleate() - err := types.WasmInit(suite.ctx, suite.store, &types.ClientState{}, types.InstantiateMessage{}) + err := types.WasmInstantiate(suite.ctx, suite.store, &types.ClientState{}, types.InstantiateMessage{}) expPass := tc.expError == nil if expPass { @@ -219,7 +219,7 @@ func (suite *TypesTestSuite) TestWasmCall() { tc.malleate() - res, err := types.WasmCall[types.UpdateStateResult](suite.ctx, suite.store, wasmClientState, payload) + res, err := types.WasmSudo[types.UpdateStateResult](suite.ctx, suite.store, wasmClientState, payload) expPass := tc.expError == nil if expPass {