Skip to content

Commit

Permalink
get 08-wasm compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed Sep 8, 2024
1 parent ad88b3c commit fec6f52
Show file tree
Hide file tree
Showing 13 changed files with 185 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ func (m msgServer) ModuleQuerySafe(goCtx context.Context, msg *types.MsgModuleQu
}

// UpdateParams updates the host submodule's params.
func (m msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
func (m msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
if m.GetAuthority() != msg.Signer {
return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected %s, got %s", m.GetAuthority(), msg.Signer)
}

ctx := sdk.UnwrapSDKContext(goCtx)
m.SetParams(ctx, msg.Params)

return &types.MsgUpdateParamsResponse{}, nil
Expand Down
16 changes: 4 additions & 12 deletions modules/apps/29-fee/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ var _ types.MsgServer = (*Keeper)(nil)
// payee to which reverse and timeout relayer packet fees will be paid out. The payee should be registered on
// the source chain from which packets originate as this is where fee distribution takes place. This function may be
// called more than once by a relayer, in which case, the latest payee is always used.
func (k Keeper) RegisterPayee(goCtx context.Context, msg *types.MsgRegisterPayee) (*types.MsgRegisterPayeeResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

func (k Keeper) RegisterPayee(ctx context.Context, msg *types.MsgRegisterPayee) (*types.MsgRegisterPayeeResponse, error) {
payee, err := sdk.AccAddressFromBech32(msg.Payee)
if err != nil {
return nil, err
Expand Down Expand Up @@ -54,9 +52,7 @@ func (k Keeper) RegisterPayee(goCtx context.Context, msg *types.MsgRegisterPayee
// payee address before relaying. This ensures they will be properly compensated for forward relaying since
// the destination chain must include the registered counterparty payee address in the acknowledgement. This function
// may be called more than once by a relayer, in which case, the latest counterparty payee address is always used.
func (k Keeper) RegisterCounterpartyPayee(goCtx context.Context, msg *types.MsgRegisterCounterpartyPayee) (*types.MsgRegisterCounterpartyPayeeResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

func (k Keeper) RegisterCounterpartyPayee(ctx context.Context, msg *types.MsgRegisterCounterpartyPayee) (*types.MsgRegisterCounterpartyPayeeResponse, error) {
// only register counterparty payee if the channel exists and is fee enabled
if _, found := k.channelKeeper.GetChannel(ctx, msg.PortId, msg.ChannelId); !found {
return nil, channeltypes.ErrChannelNotFound
Expand All @@ -77,9 +73,7 @@ func (k Keeper) RegisterCounterpartyPayee(goCtx context.Context, msg *types.MsgR

// PayPacketFee defines a rpc handler method for MsgPayPacketFee
// PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to relay the packet with the next sequence
func (k Keeper) PayPacketFee(goCtx context.Context, msg *types.MsgPayPacketFee) (*types.MsgPayPacketFeeResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

func (k Keeper) PayPacketFee(ctx context.Context, msg *types.MsgPayPacketFee) (*types.MsgPayPacketFeeResponse, error) {
if !k.IsFeeEnabled(ctx, msg.SourcePortId, msg.SourceChannelId) {
// users may not escrow fees on this channel. Must send packets without a fee message
return nil, types.ErrFeeNotEnabled
Expand Down Expand Up @@ -122,9 +116,7 @@ func (k Keeper) PayPacketFee(goCtx context.Context, msg *types.MsgPayPacketFee)
// PayPacketFeeAsync is an open callback that may be called by any module/user that wishes to escrow funds in order to
// incentivize the relaying of a known packet. Only packets which have been sent and have not gone through the
// packet life cycle may be incentivized.
func (k Keeper) PayPacketFeeAsync(goCtx context.Context, msg *types.MsgPayPacketFeeAsync) (*types.MsgPayPacketFeeAsyncResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

func (k Keeper) PayPacketFeeAsync(ctx context.Context, msg *types.MsgPayPacketFeeAsync) (*types.MsgPayPacketFeeAsyncResponse, error) {
if !k.IsFeeEnabled(ctx, msg.PacketId.PortId, msg.PacketId.ChannelId) {
// users may not escrow fees on this channel. Must send packets without a fee message
return nil, types.ErrFeeNotEnabled
Expand Down
29 changes: 8 additions & 21 deletions modules/core/02-client/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func NewQueryServer(k *Keeper) types.QueryServer {
}

// ClientState implements the Query/ClientState gRPC method
func (q *queryServer) ClientState(c context.Context, req *types.QueryClientStateRequest) (*types.QueryClientStateResponse, error) {
func (q *queryServer) ClientState(ctx context.Context, req *types.QueryClientStateRequest) (*types.QueryClientStateResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand All @@ -48,7 +48,6 @@ func (q *queryServer) ClientState(c context.Context, req *types.QueryClientState
return nil, status.Error(codes.InvalidArgument, err.Error())
}

ctx := sdk.UnwrapSDKContext(c)
clientState, found := q.GetClientState(ctx, req.ClientId)
if !found {
return nil, status.Error(
Expand All @@ -70,13 +69,11 @@ func (q *queryServer) ClientState(c context.Context, req *types.QueryClientState
}

// ClientStates implements the Query/ClientStates gRPC method
func (q *queryServer) ClientStates(c context.Context, req *types.QueryClientStatesRequest) (*types.QueryClientStatesResponse, error) {
func (q *queryServer) ClientStates(ctx context.Context, req *types.QueryClientStatesRequest) (*types.QueryClientStatesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

ctx := sdk.UnwrapSDKContext(c)

var clientStates types.IdentifiedClientStates
store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), host.KeyClientStorePrefix)

Expand Down Expand Up @@ -114,7 +111,7 @@ func (q *queryServer) ClientStates(c context.Context, req *types.QueryClientStat
}

// ConsensusState implements the Query/ConsensusState gRPC method
func (q *queryServer) ConsensusState(c context.Context, req *types.QueryConsensusStateRequest) (*types.QueryConsensusStateResponse, error) {
func (q *queryServer) ConsensusState(ctx context.Context, req *types.QueryConsensusStateRequest) (*types.QueryConsensusStateResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand All @@ -123,8 +120,6 @@ func (q *queryServer) ConsensusState(c context.Context, req *types.QueryConsensu
return nil, status.Error(codes.InvalidArgument, err.Error())
}

ctx := sdk.UnwrapSDKContext(c)

var (
consensusState exported.ConsensusState
found bool
Expand Down Expand Up @@ -161,7 +156,7 @@ func (q *queryServer) ConsensusState(c context.Context, req *types.QueryConsensu
}

// ConsensusStates implements the Query/ConsensusStates gRPC method
func (q *queryServer) ConsensusStates(c context.Context, req *types.QueryConsensusStatesRequest) (*types.QueryConsensusStatesResponse, error) {
func (q *queryServer) ConsensusStates(ctx context.Context, req *types.QueryConsensusStatesRequest) (*types.QueryConsensusStatesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand All @@ -170,8 +165,6 @@ func (q *queryServer) ConsensusStates(c context.Context, req *types.QueryConsens
return nil, status.Error(codes.InvalidArgument, err.Error())
}

ctx := sdk.UnwrapSDKContext(c)

var consensusStates []types.ConsensusStateWithHeight
store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), host.FullClientKey(req.ClientId, []byte(fmt.Sprintf("%s/", host.KeyConsensusStatePrefix))))

Expand Down Expand Up @@ -205,7 +198,7 @@ func (q *queryServer) ConsensusStates(c context.Context, req *types.QueryConsens
}

// ConsensusStateHeights implements the Query/ConsensusStateHeights gRPC method
func (q *queryServer) ConsensusStateHeights(c context.Context, req *types.QueryConsensusStateHeightsRequest) (*types.QueryConsensusStateHeightsResponse, error) {
func (q *queryServer) ConsensusStateHeights(ctx context.Context, req *types.QueryConsensusStateHeightsRequest) (*types.QueryConsensusStateHeightsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand All @@ -214,8 +207,6 @@ func (q *queryServer) ConsensusStateHeights(c context.Context, req *types.QueryC
return nil, status.Error(codes.InvalidArgument, err.Error())
}

ctx := sdk.UnwrapSDKContext(c)

var consensusStateHeights []types.Height
store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), host.FullClientKey(req.ClientId, []byte(fmt.Sprintf("%s/", host.KeyConsensusStatePrefix))))

Expand Down Expand Up @@ -244,7 +235,7 @@ func (q *queryServer) ConsensusStateHeights(c context.Context, req *types.QueryC
}

// ClientStatus implements the Query/ClientStatus gRPC method
func (q *queryServer) ClientStatus(c context.Context, req *types.QueryClientStatusRequest) (*types.QueryClientStatusResponse, error) {
func (q *queryServer) ClientStatus(ctx context.Context, req *types.QueryClientStatusRequest) (*types.QueryClientStatusResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand All @@ -253,7 +244,6 @@ func (q *queryServer) ClientStatus(c context.Context, req *types.QueryClientStat
return nil, status.Error(codes.InvalidArgument, err.Error())
}

ctx := sdk.UnwrapSDKContext(c)
clientStatus := q.GetClientStatus(ctx, req.ClientId)

return &types.QueryClientStatusResponse{
Expand All @@ -262,8 +252,7 @@ func (q *queryServer) ClientStatus(c context.Context, req *types.QueryClientStat
}

// ClientParams implements the Query/ClientParams gRPC method
func (q *queryServer) ClientParams(c context.Context, _ *types.QueryClientParamsRequest) (*types.QueryClientParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
func (q *queryServer) ClientParams(ctx context.Context, _ *types.QueryClientParamsRequest) (*types.QueryClientParamsResponse, error) {
params := q.GetParams(ctx)

return &types.QueryClientParamsResponse{
Expand All @@ -272,13 +261,11 @@ func (q *queryServer) ClientParams(c context.Context, _ *types.QueryClientParams
}

// UpgradedClientState implements the Query/UpgradedClientState gRPC method
func (q *queryServer) UpgradedClientState(c context.Context, req *types.QueryUpgradedClientStateRequest) (*types.QueryUpgradedClientStateResponse, error) {
func (q *queryServer) UpgradedClientState(ctx context.Context, req *types.QueryUpgradedClientStateRequest) (*types.QueryUpgradedClientStateResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

ctx := sdk.UnwrapSDKContext(c)

plan, err := q.GetUpgradePlan(ctx)
if err != nil {
return nil, status.Error(codes.NotFound, err.Error())
Expand Down
4 changes: 4 additions & 0 deletions modules/light-clients/08-wasm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
cosmossdk.io/math v1.3.0
cosmossdk.io/store v1.1.1-0.20240815194237-858ec2fcb897
cosmossdk.io/tools/confix v0.1.2
cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91
cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000
cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91
cosmossdk.io/x/circuit v0.1.1
Expand Down Expand Up @@ -56,8 +57,11 @@ require (
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.9 // indirect
cloud.google.com/go/storage v1.42.0 // indirect
cosmossdk.io/core/testing v0.0.0-20240906090851-36d9b25e8981 // indirect
cosmossdk.io/depinject v1.0.0 // indirect
cosmossdk.io/schema v0.2.0 // indirect
cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 // indirect
cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000 // indirect
cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 // indirect
cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
Expand Down
Loading

0 comments on commit fec6f52

Please sign in to comment.