Skip to content

Commit

Permalink
use sudo (#4131)
Browse files Browse the repository at this point in the history
  • Loading branch information
crodriguezvega committed Jul 20, 2023
1 parent 62ed4fb commit 341350a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions modules/light-clients/08-wasm/types/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,15 @@ func initContract(ctx sdk.Context, clientStore sdk.KVStore, codeHash []byte) (*w
return response, err
}

// callContract calls vm.Execute with internally constructed gas meter and environment.
// callContract calls vm.Sudo with internally constructed gas meter and environment.
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)

env := getEnv(ctx)

msgInfo := wasmvmtypes.MessageInfo{
Sender: "",
Funds: nil,
}
ctx.GasMeter().ConsumeGas(VMGasRegister.InstantiateContractCosts(len(msg)), "Loading CosmWasm module: execute")
resp, gasUsed, err := WasmVM.Execute(codeHash, env, msgInfo, msg, newStoreAdapter(clientStore), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization)
ctx.GasMeter().ConsumeGas(VMGasRegister.InstantiateContractCosts(len(msg)), "Loading CosmWasm module: sudo")
resp, gasUsed, err := WasmVM.Sudo(codeHash, env, msg, newStoreAdapter(clientStore), cosmwasm.GoAPI{}, nil, multipliedGasMeter, gasLimit, costJSONDeserialization)
VMGasRegister.consumeRuntimeGas(ctx, gasUsed)
return resp, err
}
Expand Down

0 comments on commit 341350a

Please sign in to comment.