From 43d8acabec1be449fda588fecac7ac9b71521744 Mon Sep 17 00:00:00 2001 From: keruch <53012408+keruch@users.noreply.github.com> Date: Mon, 21 Oct 2024 19:12:14 +0300 Subject: [PATCH] feat(delayedack): fulfill only by packet key and added query for getting recipient packets (#1338) --- app/apptesting/test_suite.go | 38 +- ibctesting/bridging_fee_test.go | 2 +- ibctesting/delayed_ack_test.go | 4 +- ibctesting/eibc_test.go | 6 +- ibctesting/utils_test.go | 29 +- .../dymension/delayedack/query.proto | 16 + .../dymension/delayedack/tx.proto | 36 - x/common/types/key_rollapp_packet.go | 20 + x/common/types/key_rollapp_packet_test.go | 46 + x/delayedack/client/cli/query.go | 31 + x/delayedack/client/cli/tx.go | 59 - x/delayedack/keeper/finalize.go | 73 +- x/delayedack/keeper/finalize_test.go | 61 +- x/delayedack/keeper/grpc_query.go | 35 + x/delayedack/keeper/invariants_test.go | 44 +- x/delayedack/keeper/msg_server.go | 53 - x/delayedack/types/codec.go | 4 +- x/delayedack/types/msgs.go | 60 +- x/delayedack/types/query.pb.go | 640 ++++++++- x/delayedack/types/query.pb.gw.go | 141 ++ x/delayedack/types/tx.pb.go | 1154 +++-------------- 21 files changed, 1149 insertions(+), 1403 deletions(-) create mode 100644 x/common/types/key_rollapp_packet_test.go diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index 4fc839af9..f1b5d4d42 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -4,21 +4,23 @@ import ( "strings" "time" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - - "github.com/dymensionxyz/dymension/v3/app/params" - dymnstypes "github.com/dymensionxyz/dymension/v3/x/dymns/types" - "github.com/cometbft/cometbft/libs/rand" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" bankutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/dymensionxyz/sdk-utils/utils/urand" "github.com/stretchr/testify/suite" "github.com/dymensionxyz/dymension/v3/app" + "github.com/dymensionxyz/dymension/v3/app/params" + delayedackkeeper "github.com/dymensionxyz/dymension/v3/x/delayedack/keeper" + delayedacktypes "github.com/dymensionxyz/dymension/v3/x/delayedack/types" + dymnstypes "github.com/dymensionxyz/dymension/v3/x/dymns/types" rollappkeeper "github.com/dymensionxyz/dymension/v3/x/rollapp/keeper" rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types" sequencerkeeper "github.com/dymensionxyz/dymension/v3/x/sequencer/keeper" @@ -181,3 +183,29 @@ func FundForAliasRegistration( bankKeeper, ctx, sdk.MustAccAddressFromBech32(msgCreateRollApp.Creator), aliasRegistrationCost, ) } + +func (s *KeeperTestHelper) FinalizeAllPendingPackets(rollappID, receiver string) int { + s.T().Helper() + // Query all pending packets by receiver + querier := delayedackkeeper.NewQuerier(s.App.DelayedAckKeeper) + resp, err := querier.GetPendingPacketsByReceiver(s.Ctx, &delayedacktypes.QueryPendingPacketsByReceiverRequest{ + RollappId: rollappID, + Receiver: receiver, + }) + s.Require().NoError(err) + // Finalize all packets and return the num of finalized + for _, packet := range resp.RollappPackets { + handler := s.App.MsgServiceRouter().Handler(new(delayedacktypes.MsgFinalizePacket)) + resp, err := handler(s.Ctx, &delayedacktypes.MsgFinalizePacket{ + Sender: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + RollappId: packet.RollappId, + PacketProofHeight: packet.ProofHeight, + PacketType: packet.Type, + PacketSrcChannel: packet.Packet.SourceChannel, + PacketSequence: packet.Packet.Sequence, + }) + s.Require().NoError(err) + s.Require().NotNil(resp) + } + return len(resp.RollappPackets) +} diff --git a/ibctesting/bridging_fee_test.go b/ibctesting/bridging_fee_test.go index a44aafcd4..dcc031414 100644 --- a/ibctesting/bridging_fee_test.go +++ b/ibctesting/bridging_fee_test.go @@ -97,7 +97,7 @@ func (s *bridgingFeeSuite) TestBridgingFee() { s.Require().NoError(err) // manually finalize packets through x/delayedack - s.finalizeRollappPacketsUntilHeight(currentRollappBlockHeight) + s.finalizeRollappPacketsByReceiver(s.hubChain().SenderAccount.GetAddress().String()) // check balance after finalization expectedFee := s.hubApp().DelayedAckKeeper.BridgingFeeFromAmt(s.hubCtx(), transferredCoins.Amount) diff --git a/ibctesting/delayed_ack_test.go b/ibctesting/delayed_ack_test.go index 98183f5c9..1eb90a508 100644 --- a/ibctesting/delayed_ack_test.go +++ b/ibctesting/delayed_ack_test.go @@ -174,7 +174,7 @@ func (s *delayedAckSuite) TestTransferRollappToHubFinalization() { s.Require().NoError(err) // manually finalize packets through x/delayedack - s.finalizeRollappPacketsUntilHeight(currentRollappBlockHeight) + s.finalizeRollappPacketsByReceiver(s.hubChain().SenderAccount.GetAddress().String()) // Validate ack is found found = hubIBCKeeper.ChannelKeeper.HasPacketAcknowledgement(s.hubCtx(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) @@ -230,7 +230,7 @@ func (s *delayedAckSuite) TestHubToRollappTimeout() { _, err = s.finalizeRollappState(1, currentRollappBlockHeight) s.Require().NoError(err) // manually finalize packets through x/delayedack - s.finalizeRollappPacketsUntilHeight(currentRollappBlockHeight) + s.finalizeRollappPacketsByReceiver(receiverAccount.String()) // Validate funds are returned to the sender postFinalizeBalance := bankKeeper.GetBalance(s.hubCtx(), senderAccount, sdk.DefaultBondDenom) s.Require().Equal(preSendBalance.Amount, postFinalizeBalance.Amount) diff --git a/ibctesting/eibc_test.go b/ibctesting/eibc_test.go index 718921812..aca048633 100644 --- a/ibctesting/eibc_test.go +++ b/ibctesting/eibc_test.go @@ -262,7 +262,7 @@ func (s *eibcSuite) TestEIBCDemandOrderFulfillment() { s.Require().NoError(err) // manually finalize packets through x/delayedack - s.finalizeRollappPacketsUntilHeight(currentRollappBlockHeight) + s.finalizeRollappPacketsByReceiver(fulfiller.String()) // Check the fulfiller balance was updated fully with the IBC amount isUpdated := false @@ -346,7 +346,7 @@ func (s *eibcSuite) TestEIBCDemandOrderFulfillment() { s.Require().NoError(err) // manually finalize packets through x/delayedack - evts := s.finalizeRollappPacketsUntilHeight(currentRollappBlockHeight) + evts := s.finalizeRollappPacketsByReceiver(fulfiller.String()) ack, err := ibctesting.ParseAckFromEvents(evts) s.Require().NoError(err) @@ -509,7 +509,7 @@ func (s *eibcSuite) TestTimeoutEIBCDemandOrderFulfillment() { _, err = s.finalizeRollappState(1, currentRollappBlockHeight) s.Require().NoError(err) // manually finalize packets through x/delayedack - s.finalizeRollappPacketsUntilHeight(currentRollappBlockHeight) + s.finalizeRollappPacketsByReceiver(receiverAccount.String()) // Funds are passed to the fulfiller fulfillerAccountBalanceAfterTimeout := bankKeeper.GetBalance(s.hubCtx(), fulfillerAccount, sdk.DefaultBondDenom) s.Require().True(fulfillerAccountBalanceAfterTimeout.IsEqual(fulfillerInitialBalance.Add(lastDemandOrder.Fee[0]))) diff --git a/ibctesting/utils_test.go b/ibctesting/utils_test.go index e2add65f3..797d6683d 100644 --- a/ibctesting/utils_test.go +++ b/ibctesting/utils_test.go @@ -16,6 +16,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" @@ -27,6 +28,7 @@ import ( "github.com/dymensionxyz/dymension/v3/app" "github.com/dymensionxyz/dymension/v3/app/apptesting" common "github.com/dymensionxyz/dymension/v3/x/common/types" + delayedackkeeper "github.com/dymensionxyz/dymension/v3/x/delayedack/keeper" delayedacktypes "github.com/dymensionxyz/dymension/v3/x/delayedack/types" eibctypes "github.com/dymensionxyz/dymension/v3/x/eibc/types" rollappkeeper "github.com/dymensionxyz/dymension/v3/x/rollapp/keeper" @@ -369,14 +371,27 @@ func (s *utilSuite) newTestChainWithSingleValidator(t *testing.T, coord *ibctest return chain } -func (s *utilSuite) finalizeRollappPacketsUntilHeight(height uint64) sdk.Events { - handler := s.hubApp().MsgServiceRouter().Handler(new(delayedacktypes.MsgFinalizePacketsUntilHeight)) - resp, err := handler(s.hubCtx(), &delayedacktypes.MsgFinalizePacketsUntilHeight{ - Sender: s.rollappChain().SenderAccount.GetAddress().String(), +func (s *utilSuite) finalizeRollappPacketsByReceiver(receiver string) sdk.Events { + s.T().Helper() + // Query all pending packets by receiver + querier := delayedackkeeper.NewQuerier(s.hubApp().DelayedAckKeeper) + resp, err := querier.GetPendingPacketsByReceiver(s.hubCtx(), &delayedacktypes.QueryPendingPacketsByReceiverRequest{ RollappId: rollappChainID(), - Height: height, + Receiver: receiver, }) s.Require().NoError(err) - s.Require().NotNil(resp) - return resp.GetEvents() + // Finalize all packets are collect events + events := make(sdk.Events, 0) + for _, packet := range resp.RollappPackets { + k := common.EncodePacketKey(packet.RollappPacketKey()) + handler := s.hubApp().MsgServiceRouter().Handler(new(delayedacktypes.MsgFinalizePacketByPacketKey)) + resp, err := handler(s.hubCtx(), &delayedacktypes.MsgFinalizePacketByPacketKey{ + Sender: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + PacketKey: k, + }) + s.Require().NoError(err) + s.Require().NotNil(resp) + events = append(events, resp.GetEvents()...) + } + return events } diff --git a/proto/dymensionxyz/dymension/delayedack/query.proto b/proto/dymensionxyz/dymension/delayedack/query.proto index 9e6de52bc..32b33fc6a 100644 --- a/proto/dymensionxyz/dymension/delayedack/query.proto +++ b/proto/dymensionxyz/dymension/delayedack/query.proto @@ -21,6 +21,11 @@ service Query { rpc GetPackets(QueryRollappPacketsRequest) returns (QueryRollappPacketListResponse) { option (google.api.http).get = "/dymensionxyz/dymension/delayedack/packets/{rollappId}/{status}"; } + + // Queries a list of pending RollappPacket items by rollappID and receiver. + rpc GetPendingPacketsByReceiver(QueryPendingPacketsByReceiverRequest) returns (QueryPendingPacketByReceiverListResponse) { + option (google.api.http).get = "/dymensionxyz/dymension/delayedack/pending-receiver-packets/{rollappId}/{receiver}"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -42,4 +47,15 @@ message QueryRollappPacketsRequest { message QueryRollappPacketListResponse { repeated common.RollappPacket rollappPackets = 1 [(gogoproto.nullable) = false]; cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryPendingPacketsByReceiverRequest { + string rollappId = 1; + string receiver = 2; + cosmos.base.query.v1beta1.PageRequest pagination = 3; +} + +message QueryPendingPacketByReceiverListResponse { + repeated common.RollappPacket rollappPackets = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } \ No newline at end of file diff --git a/proto/dymensionxyz/dymension/delayedack/tx.proto b/proto/dymensionxyz/dymension/delayedack/tx.proto index ffced9525..a1c95bc70 100644 --- a/proto/dymensionxyz/dymension/delayedack/tx.proto +++ b/proto/dymensionxyz/dymension/delayedack/tx.proto @@ -14,13 +14,6 @@ service Msg { rpc FinalizePacket(MsgFinalizePacket) returns (MsgFinalizePacketResponse); rpc FinalizePacketByPacketKey(MsgFinalizePacketByPacketKey) returns (MsgFinalizePacketByPacketKeyResponse); - - // FinalizePacketsUntilHeight finalizes the packets for the given rollapp until the given height inclusively. - rpc FinalizePacketsUntilHeight(MsgFinalizePacketsUntilHeight) returns (MsgFinalizePacketsUntilHeightResponse); - - // FinalizeRollappPacketsByReceiver finalizes the rollapp packets for the specified receiver until the latest - // finalized height inclusively. - rpc FinalizeRollappPacketsByReceiver(MsgFinalizeRollappPacketsByReceiver) returns (MsgFinalizeRollappPacketsByReceiverResponse); } // MsgFinalizePacket finalizes a single packet. @@ -54,32 +47,3 @@ message MsgFinalizePacketByPacketKey { } message MsgFinalizePacketByPacketKeyResponse {} - -// MsgFinalizePacketsUntilHeight finalizes packets for the given rollapp until the given height inclusively. -message MsgFinalizePacketsUntilHeight { - option (cosmos.msg.v1.signer) = "sender"; - - // Sender is the signer of the message. - string sender = 1; - // RollappID is the ID of the rollapp. - string rollapp_id = 2; - // Height is a height until which packets are to be finalized. Height is inclusive. - uint64 height = 3; -} - -message MsgFinalizePacketsUntilHeightResponse {} - -// MsgFinalizeRollappPacketsByReceiver finalizes the rollapp packets for the specified receiver until the latest -// finalized height inclusively. -message MsgFinalizeRollappPacketsByReceiver { - option (cosmos.msg.v1.signer) = "sender"; - - // Sender is the signer of the message. - string sender = 1; - // RollappID is the ID of the rollapp. - string rollapp_id = 2; - // Receiver is the one who waits tokens after the finalization. - string receiver = 3; -} - -message MsgFinalizeRollappPacketsByReceiverResponse {} diff --git a/x/common/types/key_rollapp_packet.go b/x/common/types/key_rollapp_packet.go index dfad433e8..3f79ebb16 100644 --- a/x/common/types/key_rollapp_packet.go +++ b/x/common/types/key_rollapp_packet.go @@ -1,6 +1,8 @@ package types import ( + "bytes" + "encoding/base64" "encoding/binary" fmt "fmt" @@ -104,3 +106,21 @@ func MustGetStatusBytes(status Status) []byte { panic(fmt.Sprintf("invalid packet status: %s", status)) } } + +// DecodePacketKey decodes packet key from base64 to bytes. +func DecodePacketKey(packetKey string) ([]byte, error) { + rollappPacketKeyBytes := make([]byte, base64.StdEncoding.DecodedLen(len(packetKey))) + _, err := base64.StdEncoding.Decode(rollappPacketKeyBytes, []byte(packetKey)) + if err != nil { + return nil, err + } + rollappPacketKeyBytes = bytes.TrimRight(rollappPacketKeyBytes, "\x00") // remove padding + return rollappPacketKeyBytes, nil +} + +// EncodePacketKey encodes packet key from bytes to base 64. +func EncodePacketKey(packetKey []byte) string { + rollappPacketKeyBytes := make([]byte, base64.StdEncoding.EncodedLen(len(packetKey))) + base64.StdEncoding.Encode(rollappPacketKeyBytes, packetKey) + return string(rollappPacketKeyBytes) +} diff --git a/x/common/types/key_rollapp_packet_test.go b/x/common/types/key_rollapp_packet_test.go new file mode 100644 index 000000000..53e0954ee --- /dev/null +++ b/x/common/types/key_rollapp_packet_test.go @@ -0,0 +1,46 @@ +package types_test + +import ( + "testing" + + transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + "github.com/stretchr/testify/require" + + "github.com/dymensionxyz/dymension/v3/x/common/types" + commontypes "github.com/dymensionxyz/dymension/v3/x/common/types" +) + +func TestEncodeDecodePacketKey(t *testing.T) { + packet := commontypes.RollappPacket{ + RollappId: "rollapp_1234-1", + Status: commontypes.Status_PENDING, + ProofHeight: 8, + Packet: getNewTestPacket(t), + } + + expectedPK := packet.RollappPacketKey() + + encoded := types.EncodePacketKey(expectedPK) + decoded, err := types.DecodePacketKey(encoded) + require.NoError(t, err) + + require.Equal(t, expectedPK, decoded) +} + +func getNewTestPacket(t *testing.T) *channeltypes.Packet { + t.Helper() + data := &transfertypes.FungibleTokenPacketData{ + Receiver: "testReceiver", + } + pd, err := transfertypes.ModuleCdc.MarshalJSON(data) + require.NoError(t, err) + return &channeltypes.Packet{ + SourcePort: "testSourcePort", + SourceChannel: "testSourceChannel", + DestinationPort: "testDestinationPort", + DestinationChannel: "testDestinationChannel", + Data: pd, + Sequence: 1, + } +} diff --git a/x/delayedack/client/cli/query.go b/x/delayedack/client/cli/query.go index 2002f7189..aac99e140 100644 --- a/x/delayedack/client/cli/query.go +++ b/x/delayedack/client/cli/query.go @@ -27,6 +27,7 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand(CmdGetPacketsByRollapp()) cmd.AddCommand(CmdGetPacketsByStatus()) cmd.AddCommand(CmdGetPacketsByType()) + cmd.AddCommand(CmdGetPendingPacketsByReceiver()) return cmd } @@ -217,3 +218,33 @@ func CmdGetPacketsByType() *cobra.Command { return cmd } + +func CmdGetPendingPacketsByReceiver() *cobra.Command { + cmd := &cobra.Command{ + Use: "pending-packets-by-receiver [rollapp-id] [receiver]", + Short: "Get pending packets by receiver", + Args: cobra.MinimumNArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.GetPendingPacketsByReceiver(cmd.Context(), &types.QueryPendingPacketsByReceiverRequest{ + RollappId: args[0], + Receiver: args[1], + Pagination: nil, // TODO: handle pagination + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/delayedack/client/cli/tx.go b/x/delayedack/client/cli/tx.go index 564340a22..545a9a04d 100644 --- a/x/delayedack/client/cli/tx.go +++ b/x/delayedack/client/cli/tx.go @@ -24,8 +24,6 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand(CmdFinalizePacket()) - cmd.AddCommand(CmdFinalizePacketsUntilHeight()) - cmd.AddCommand(CmdFinalizePacketsByReceiver()) return cmd } @@ -91,60 +89,3 @@ func parsePacketType(packetType string) (commontypes.RollappPacket_Type, error) ) } } - -func CmdFinalizePacketsUntilHeight() *cobra.Command { - cmd := &cobra.Command{ - Use: "finalize-packets-until-height [rollapp-id] [height] --from ", - Short: "Finalize packets for the given rollapp until the given height inclusively", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - height, err := strconv.Atoi(args[1]) - if err != nil { - return err - } - - msg := types.MsgFinalizePacketsUntilHeight{ - Sender: clientCtx.GetFromAddress().String(), - RollappId: args[0], - Height: uint64(height), - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdFinalizePacketsByReceiver() *cobra.Command { - cmd := &cobra.Command{ - Use: "finalize-packets-by-receiver [rollapp-id] [receiver] --from ", - Short: "Finalize packets with the given receiver for the given rollapp until the latest finalized height", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.MsgFinalizeRollappPacketsByReceiver{ - Sender: clientCtx.GetFromAddress().String(), - RollappId: args[0], - Receiver: args[1], - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/delayedack/keeper/finalize.go b/x/delayedack/keeper/finalize.go index eb000f17e..3026f28d3 100644 --- a/x/delayedack/keeper/finalize.go +++ b/x/delayedack/keeper/finalize.go @@ -14,72 +14,12 @@ import ( "github.com/dymensionxyz/dymension/v3/x/delayedack/types" ) -// FinalizeRollappPacketsUntilHeight finalizes the packets for the given rollapp until the given height inclusively. -// Returns the number of finalized packets. stateEndHeight is inclusive. -func (k Keeper) FinalizeRollappPacketsUntilHeight(ctx sdk.Context, ibc porttypes.IBCModule, rollappID string, stateEndHeight uint64) (int, error) { - // Verify the height is finalized - err := k.VerifyHeightFinalized(ctx, rollappID, stateEndHeight) - if err != nil { - return 0, fmt.Errorf("verify height is not finalized: rollapp '%s': %w", rollappID, err) - } - - // Get all pending rollapp packets until the specified height - rollappPendingPackets := k.ListRollappPackets(ctx, types.PendingByRollappIDByMaxHeight(rollappID, stateEndHeight)) - - // Finalize the packets - for _, packet := range rollappPendingPackets { - if err = k.finalizeRollappPacket(ctx, ibc, rollappID, packet); err != nil { - return 0, fmt.Errorf("finalize packet: rollapp '%s': %w", rollappID, err) - } - } - - return len(rollappPendingPackets), nil -} - -type FinalizeRollappPacketsBySenderResult struct { - latestFinalizedHeight uint64 // the latest finalized height of the rollup until which packets are finalized - finalizedNum uint64 // the number of finalized packets -} - -// FinalizeRollappPacketsByReceiver finalizes the rollapp packets from the specified sender until the latest finalized -// height inclusively. Returns the number of finalized packets. -func (k Keeper) FinalizeRollappPacketsByReceiver(ctx sdk.Context, ibc porttypes.IBCModule, rollappID string, receiver string) (FinalizeRollappPacketsBySenderResult, error) { - // Get rollapp's latest finalized height. All packets until this height with the specified receiver will be finalized. - latestFinalizedHeight, err := k.GetRollappLatestFinalizedHeight(ctx, rollappID) - if err != nil { - return FinalizeRollappPacketsBySenderResult{}, fmt.Errorf("get latest finalized height: rollapp '%s': %w", rollappID, err) - } - - // Get all pending rollapp packets until the latest finalized height - rollappPendingPackets := k.ListRollappPackets(ctx, types.PendingByRollappIDByMaxHeight(rollappID, latestFinalizedHeight)) - - // Finalize the packets - for _, packet := range rollappPendingPackets { - // Get packet data - pd, err := packet.GetTransferPacketData() - if err != nil { - return FinalizeRollappPacketsBySenderResult{}, fmt.Errorf("get transfer packet data: rollapp '%s', packet: %w", rollappID, err) - } - // Finalize a packet if its receiver matches the one specified - if pd.Receiver == receiver { - if err = k.finalizeRollappPacket(ctx, ibc, rollappID, packet); err != nil { - return FinalizeRollappPacketsBySenderResult{}, fmt.Errorf("finalize packet: rollapp '%s': %w", rollappID, err) - } - } - } - - return FinalizeRollappPacketsBySenderResult{ - latestFinalizedHeight: latestFinalizedHeight, - finalizedNum: uint64(len(rollappPendingPackets)), - }, nil -} - // FinalizeRollappPacket finalizes a singe packet by its rollapp packet key. func (k Keeper) FinalizeRollappPacket(ctx sdk.Context, ibc porttypes.IBCModule, rollappPacketKey string) (*commontypes.RollappPacket, error) { // Get a rollapp packet packet, err := k.GetRollappPacket(ctx, rollappPacketKey) if err != nil { - return nil, fmt.Errorf("get rollapp packet: %w", err) + return nil, fmt.Errorf("get rollapp packet: %s: %w", rollappPacketKey, err) } // Verify the height is finalized @@ -224,3 +164,14 @@ func (k Keeper) GetRollappLatestFinalizedHeight(ctx sdk.Context, rollappID strin } return stateInfo.GetLatestHeight(), nil } + +func (k Keeper) GetPendingPacketsUntilLatestHeight(ctx sdk.Context, rollappID string) ([]commontypes.RollappPacket, uint64, error) { + // Get rollapp's latest finalized height + latestFinalizedHeight, err := k.GetRollappLatestFinalizedHeight(ctx, rollappID) + if err != nil { + return nil, 0, fmt.Errorf("get latest finalized height: rollapp '%s': %w", rollappID, err) + } + + // Get all pending rollapp packets until the latest finalized height + return k.ListRollappPackets(ctx, types.PendingByRollappIDByMaxHeight(rollappID, latestFinalizedHeight)), latestFinalizedHeight, nil +} diff --git a/x/delayedack/keeper/finalize_test.go b/x/delayedack/keeper/finalize_test.go index 459effe0f..9fa890597 100644 --- a/x/delayedack/keeper/finalize_test.go +++ b/x/delayedack/keeper/finalize_test.go @@ -1,8 +1,6 @@ package keeper_test import ( - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - "github.com/dymensionxyz/dymension/v3/app/apptesting" commontypes "github.com/dymensionxyz/dymension/v3/x/common/types" "github.com/dymensionxyz/dymension/v3/x/delayedack/types" @@ -25,7 +23,7 @@ func (s *DelayedAckTestSuite) TestFinalizePacket() { RollappId: rollapp, Status: commontypes.Status_PENDING, ProofHeight: 8, - Packet: getNewTestPacket(2), + Packet: s.getNewTestPacket(2), }, rollappHeight: 10, expectErr: false, @@ -37,7 +35,7 @@ func (s *DelayedAckTestSuite) TestFinalizePacket() { RollappId: rollapp, Status: commontypes.Status_FINALIZED, ProofHeight: 8, - Packet: getNewTestPacket(2), + Packet: s.getNewTestPacket(2), }, rollappHeight: 10, expectErr: true, @@ -49,7 +47,7 @@ func (s *DelayedAckTestSuite) TestFinalizePacket() { RollappId: rollapp, Status: commontypes.Status_PENDING, ProofHeight: 15, - Packet: getNewTestPacket(2), + Packet: s.getNewTestPacket(2), }, rollappHeight: 10, expectErr: true, @@ -121,14 +119,12 @@ func (s *DelayedAckTestSuite) TestFinalizePacket() { } } -func (s *DelayedAckTestSuite) TestFinalizeRollappPacketsByReceiver() { +func (s *DelayedAckTestSuite) TestFinalizePacketByPacketKey() { rollapp := "rollapp_1234-1" cases := []struct { name string packet commontypes.RollappPacket - packetData transfertypes.FungibleTokenPacketData - packerReceiver string rollappHeight uint64 expectedPacketStatus commontypes.Status expectFinalize bool @@ -139,48 +135,12 @@ func (s *DelayedAckTestSuite) TestFinalizeRollappPacketsByReceiver() { RollappId: rollapp, Status: commontypes.Status_PENDING, ProofHeight: 8, - Packet: getNewTestPacket(2), - }, - packetData: transfertypes.FungibleTokenPacketData{ - Receiver: "test_receiver", + Packet: s.getNewTestPacket(2), }, - packerReceiver: "test_receiver", rollappHeight: 10, expectedPacketStatus: commontypes.Status_FINALIZED, expectFinalize: true, }, - { - name: "nothing to finalize: mismatching packet receiver", - packet: commontypes.RollappPacket{ - RollappId: rollapp, - Status: commontypes.Status_PENDING, - ProofHeight: 8, - Packet: getNewTestPacket(2), - }, - packetData: transfertypes.FungibleTokenPacketData{ - Receiver: "test_receiver", - }, - packerReceiver: "test_receiver_123", - rollappHeight: 10, - expectedPacketStatus: commontypes.Status_PENDING, - expectFinalize: false, - }, - { - name: "nothing to finalize: no pending packets", - packet: commontypes.RollappPacket{ - RollappId: rollapp, - Status: commontypes.Status_FINALIZED, - ProofHeight: 8, - Packet: getNewTestPacket(2), - }, - packetData: transfertypes.FungibleTokenPacketData{ - Receiver: "test_receiver", - }, - packerReceiver: "test_receiver", - rollappHeight: 10, - expectedPacketStatus: commontypes.Status_FINALIZED, - expectFinalize: false, - }, } for _, tc := range cases { @@ -209,18 +169,13 @@ func (s *DelayedAckTestSuite) TestFinalizeRollappPacketsByReceiver() { Index: stateInfo.GetIndex().Index, }) - // save rollapp packets with the provided transfer data - pd, err := transfertypes.ModuleCdc.MarshalJSON(&tc.packetData) - s.Require().NoError(err) - tc.packet.Packet.Data = pd s.App.DelayedAckKeeper.SetRollappPacket(s.Ctx, tc.packet) // try to finalize a packet - handler := s.App.MsgServiceRouter().Handler(new(types.MsgFinalizeRollappPacketsByReceiver)) - resp, err := handler(s.Ctx, &types.MsgFinalizeRollappPacketsByReceiver{ + handler := s.App.MsgServiceRouter().Handler(new(types.MsgFinalizePacketByPacketKey)) + resp, err := handler(s.Ctx, &types.MsgFinalizePacketByPacketKey{ Sender: apptesting.CreateRandomAccounts(1)[0].String(), - RollappId: tc.packet.RollappId, - Receiver: tc.packerReceiver, + PacketKey: commontypes.EncodePacketKey(tc.packet.RollappPacketKey()), }) s.Require().NoError(err) s.Require().NotNil(resp) diff --git a/x/delayedack/keeper/grpc_query.go b/x/delayedack/keeper/grpc_query.go index 290a321a0..70d558627 100644 --- a/x/delayedack/keeper/grpc_query.go +++ b/x/delayedack/keeper/grpc_query.go @@ -2,9 +2,11 @@ package keeper import ( "context" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + commontypes "github.com/dymensionxyz/dymension/v3/x/common/types" "github.com/dymensionxyz/dymension/v3/x/delayedack/types" "google.golang.org/grpc/codes" @@ -52,3 +54,36 @@ func (q Querier) GetPackets(goCtx context.Context, req *types.QueryRollappPacket return res, nil } + +func (q Querier) GetPendingPacketsByReceiver(goCtx context.Context, req *types.QueryPendingPacketsByReceiverRequest) (*types.QueryPendingPacketByReceiverListResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // Get all pending rollapp packets until the latest finalized height + rollappPendingPackets, _, err := q.GetPendingPacketsUntilLatestHeight(ctx, req.RollappId) + if err != nil { + return nil, fmt.Errorf("get pending rollapp packets until the latest finalized height: rollapp '%s': %w", req.RollappId, err) + } + + // Filter packets by receiver + result := make([]commontypes.RollappPacket, 0) + for _, packet := range rollappPendingPackets { + // Get packet data + pd, err := packet.GetTransferPacketData() + if err != nil { + return nil, fmt.Errorf("get transfer packet data: rollapp '%s': %w", req.RollappId, err) + } + // Return a packet if its receiver matches the one specified + if pd.Receiver == req.Receiver { + result = append(result, packet) + } + } + + return &types.QueryPendingPacketByReceiverListResponse{ + RollappPackets: result, + Pagination: nil, // TODO: handle pagination + }, nil +} diff --git a/x/delayedack/keeper/invariants_test.go b/x/delayedack/keeper/invariants_test.go index f153e625e..3b5c63abf 100644 --- a/x/delayedack/keeper/invariants_test.go +++ b/x/delayedack/keeper/invariants_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "github.com/cometbft/cometbft/libs/rand" ibctransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" commontypes "github.com/dymensionxyz/dymension/v3/x/common/types" @@ -52,7 +53,7 @@ func (suite *DelayedAckTestSuite) TestInvariants() { proofHeight := rollappBlocks[rollapp] + k rollappPacket := commontypes.RollappPacket{ RollappId: rollapp, - Packet: getNewTestPacket(sequence), + Packet: suite.getNewTestPacket(sequence), Status: commontypes.Status_PENDING, ProofHeight: proofHeight, } @@ -75,9 +76,8 @@ func (suite *DelayedAckTestSuite) TestInvariants() { // manually finalize packets for all rollapps for rollapp := range seqPerRollapp { - packetsNum, err := suite.App.DelayedAckKeeper.FinalizeRollappPacketsUntilHeight(suite.Ctx, transferStack.NextIBCMiddleware(), rollapp, rollappBlocks[rollapp]) - suite.Require().NoError(err) - suite.Require().Equal(rollappBlocks[rollapp], uint64(packetsNum)) + finalizedNum := suite.FinalizeAllPendingPackets(rollapp, testPacketReceiver) + suite.Require().Equal(rollappBlocks[rollapp], uint64(finalizedNum)) } // test fraud @@ -115,13 +115,13 @@ func (suite *DelayedAckTestSuite) TestRollappPacketsCasesInvariant() { RollappId: rollapp, Status: commontypes.Status_FINALIZED, ProofHeight: 5, - Packet: getNewTestPacket(1), + Packet: suite.getNewTestPacket(1), }, commontypes.RollappPacket{ RollappId: rollapp, Status: commontypes.Status_PENDING, ProofHeight: 15, - Packet: getNewTestPacket(2), + Packet: suite.getNewTestPacket(2), }, false, }, @@ -134,13 +134,13 @@ func (suite *DelayedAckTestSuite) TestRollappPacketsCasesInvariant() { RollappId: rollapp, Status: commontypes.Status_FINALIZED, ProofHeight: 5, - Packet: getNewTestPacket(1), + Packet: suite.getNewTestPacket(1), }, commontypes.RollappPacket{ RollappId: rollapp, Status: commontypes.Status_REVERTED, ProofHeight: 15, - Packet: getNewTestPacket(2), + Packet: suite.getNewTestPacket(2), }, false, }, @@ -153,13 +153,13 @@ func (suite *DelayedAckTestSuite) TestRollappPacketsCasesInvariant() { RollappId: rollapp, Status: commontypes.Status_PENDING, ProofHeight: 5, - Packet: getNewTestPacket(1), + Packet: suite.getNewTestPacket(1), }, commontypes.RollappPacket{ RollappId: rollapp, Status: commontypes.Status_PENDING, ProofHeight: 15, - Packet: getNewTestPacket(2), + Packet: suite.getNewTestPacket(2), }, false, }, @@ -172,13 +172,13 @@ func (suite *DelayedAckTestSuite) TestRollappPacketsCasesInvariant() { RollappId: rollapp, Status: commontypes.Status_FINALIZED, ProofHeight: 5, - Packet: getNewTestPacket(1), + Packet: suite.getNewTestPacket(1), }, commontypes.RollappPacket{ RollappId: rollapp, Status: commontypes.Status_PENDING, ProofHeight: 15, - Packet: getNewTestPacket(2), + Packet: suite.getNewTestPacket(2), }, true, }, @@ -191,13 +191,13 @@ func (suite *DelayedAckTestSuite) TestRollappPacketsCasesInvariant() { RollappId: rollapp, Status: commontypes.Status_FINALIZED, ProofHeight: 5, - Packet: getNewTestPacket(1), + Packet: suite.getNewTestPacket(1), }, commontypes.RollappPacket{ RollappId: rollapp, Status: commontypes.Status_PENDING, ProofHeight: 15, - Packet: getNewTestPacket(2), + Packet: suite.getNewTestPacket(2), }, true, }, @@ -210,13 +210,13 @@ func (suite *DelayedAckTestSuite) TestRollappPacketsCasesInvariant() { RollappId: rollapp, Status: commontypes.Status_FINALIZED, ProofHeight: 5, - Packet: getNewTestPacket(1), + Packet: suite.getNewTestPacket(1), }, commontypes.RollappPacket{ RollappId: rollapp, Status: commontypes.Status_FINALIZED, ProofHeight: 15, - Packet: getNewTestPacket(2), + Packet: suite.getNewTestPacket(2), }, true, }, @@ -300,13 +300,21 @@ func (suite *DelayedAckTestSuite) TestRollappPacketsCasesInvariant() { } } -func getNewTestPacket(sequence uint64) *channeltypes.Packet { +const testPacketReceiver = "testReceiver" + +func (s *DelayedAckTestSuite) getNewTestPacket(sequence uint64) *channeltypes.Packet { + data := &transfertypes.FungibleTokenPacketData{ + Receiver: testPacketReceiver, + } + pd, err := transfertypes.ModuleCdc.MarshalJSON(data) + s.Require().NoError(err) + return &channeltypes.Packet{ SourcePort: "testSourcePort", SourceChannel: testSourceChannel, DestinationPort: "testDestinationPort", DestinationChannel: "testDestinationChannel", - Data: []byte("testData"), + Data: pd, Sequence: sequence, } } diff --git a/x/delayedack/keeper/msg_server.go b/x/delayedack/keeper/msg_server.go index 01a0c7d4c..39e2c5e3d 100644 --- a/x/delayedack/keeper/msg_server.go +++ b/x/delayedack/keeper/msg_server.go @@ -94,56 +94,3 @@ func (m MsgServer) FinalizePacketByPacketKey(goCtx context.Context, msg *types.M return &types.MsgFinalizePacketByPacketKeyResponse{}, nil } - -func (m MsgServer) FinalizePacketsUntilHeight(goCtx context.Context, msg *types.MsgFinalizePacketsUntilHeight) (*types.MsgFinalizePacketsUntilHeightResponse, error) { - err := msg.ValidateBasic() - if err != nil { - return nil, err - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - finalized, err := m.k.FinalizeRollappPacketsUntilHeight(ctx, m.ibc.NextIBCMiddleware(), msg.RollappId, msg.Height) - if err != nil { - return nil, err - } - - err = uevent.EmitTypedEvent(ctx, &types.EventFinalizePacketsUntilHeight{ - Sender: msg.Sender, - RollappId: msg.RollappId, - Height: msg.Height, - FinalizedNum: uint64(finalized), - }) - if err != nil { - return nil, fmt.Errorf("emit event: %w", err) - } - - return &types.MsgFinalizePacketsUntilHeightResponse{}, nil -} - -func (m MsgServer) FinalizeRollappPacketsByReceiver(goCtx context.Context, msg *types.MsgFinalizeRollappPacketsByReceiver) (*types.MsgFinalizeRollappPacketsByReceiverResponse, error) { - err := msg.ValidateBasic() - if err != nil { - return nil, err - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - result, err := m.k.FinalizeRollappPacketsByReceiver(ctx, m.ibc.NextIBCMiddleware(), msg.RollappId, msg.Receiver) - if err != nil { - return nil, err - } - - err = uevent.EmitTypedEvent(ctx, &types.EventFinalizeRollappPacketsByReceiver{ - Sender: msg.Sender, - RollappId: msg.RollappId, - Receiver: msg.Receiver, - Height: result.latestFinalizedHeight, - FinalizedNum: result.finalizedNum, - }) - if err != nil { - return nil, fmt.Errorf("emit event: %w", err) - } - - return &types.MsgFinalizeRollappPacketsByReceiverResponse{}, nil -} diff --git a/x/delayedack/types/codec.go b/x/delayedack/types/codec.go index ed65fefca..f1f321d40 100644 --- a/x/delayedack/types/codec.go +++ b/x/delayedack/types/codec.go @@ -16,7 +16,7 @@ var ( // LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgFinalizePacket{}, "delayedack/FinalizePacket", nil) - cdc.RegisterConcrete(&MsgFinalizePacketsUntilHeight{}, "delayedack/FinalizePacketsUntilHeight", nil) + cdc.RegisterConcrete(&MsgFinalizePacketByPacketKey{}, "delayedack/MsgFinalizePacketByPacketKey", nil) } // RegisterInterfaces registers interfaces types with the interface registry. @@ -24,7 +24,7 @@ func RegisterInterfaces(reg types.InterfaceRegistry) { reg.RegisterImplementations( (*sdk.Msg)(nil), &MsgFinalizePacket{}, - &MsgFinalizePacketsUntilHeight{}, + &MsgFinalizePacketByPacketKey{}, ) msgservice.RegisterMsgServiceDesc(reg, &_Msg_serviceDesc) } diff --git a/x/delayedack/types/msgs.go b/x/delayedack/types/msgs.go index 414e694da..d0f83822d 100644 --- a/x/delayedack/types/msgs.go +++ b/x/delayedack/types/msgs.go @@ -1,8 +1,6 @@ package types import ( - "bytes" - "encoding/base64" "errors" "fmt" @@ -59,7 +57,7 @@ func (m MsgFinalizePacketByPacketKey) ValidateBasic() error { return gerrc.ErrInvalidArgument.Wrap("rollappId must be non-empty") } - if _, err := m.DecodePacketKey(); err != nil { + if _, err := commontypes.DecodePacketKey(m.PacketKey); err != nil { return gerrc.ErrInvalidArgument.Wrap("packet key must be a valid base64 encoded string") } return nil @@ -70,64 +68,10 @@ func (m MsgFinalizePacketByPacketKey) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{signer} } -func (m MsgFinalizePacketByPacketKey) DecodePacketKey() ([]byte, error) { - // decode base64 - rollappPacketKeyBytes := make([]byte, base64.StdEncoding.DecodedLen(len(m.PacketKey))) - _, err := base64.StdEncoding.Decode(rollappPacketKeyBytes, []byte(m.PacketKey)) - if err != nil { - return nil, err - } - - rollappPacketKeyBytes = bytes.TrimRight(rollappPacketKeyBytes, "\x00") // remove padding - return rollappPacketKeyBytes, nil -} - func (m MsgFinalizePacketByPacketKey) MustDecodePacketKey() []byte { - packetKey, err := m.DecodePacketKey() + packetKey, err := commontypes.DecodePacketKey(m.PacketKey) if err != nil { panic(fmt.Errorf("failed to decode base64 packet key: %w", err)) } - return packetKey } - -func (m MsgFinalizePacketsUntilHeight) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Sender) - if err != nil { - return errors.Join( - sdkerrors.ErrInvalidAddress, - errorsmod.Wrapf(err, "sender must be a valid bech32 address: %s", m.Sender), - ) - } - if len(m.RollappId) == 0 { - return gerrc.ErrInvalidArgument.Wrap("rollappId must be non-empty") - } - return nil -} - -func (m MsgFinalizePacketsUntilHeight) GetSigners() []sdk.AccAddress { - signer, _ := sdk.AccAddressFromBech32(m.Sender) - return []sdk.AccAddress{signer} -} - -func (m MsgFinalizeRollappPacketsByReceiver) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(m.Sender) - if err != nil { - return errors.Join( - sdkerrors.ErrInvalidAddress, - errorsmod.Wrapf(err, "sender must be a valid bech32 address: %s", m.Sender), - ) - } - if len(m.RollappId) == 0 { - return gerrc.ErrInvalidArgument.Wrap("rollappId must be non-empty") - } - if len(m.Receiver) == 0 { - return gerrc.ErrInvalidArgument.Wrap("receiver must be non-empty") - } - return nil -} - -func (m MsgFinalizeRollappPacketsByReceiver) GetSigners() []sdk.AccAddress { - signer, _ := sdk.AccAddressFromBech32(m.Sender) - return []sdk.AccAddress{signer} -} diff --git a/x/delayedack/types/query.pb.go b/x/delayedack/types/query.pb.go index 68ac0bb55..ef1414040 100644 --- a/x/delayedack/types/query.pb.go +++ b/x/delayedack/types/query.pb.go @@ -234,11 +234,127 @@ func (m *QueryRollappPacketListResponse) GetPagination() *query.PageResponse { return nil } +type QueryPendingPacketsByReceiverRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollappId,proto3" json:"rollappId,omitempty"` + Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPendingPacketsByReceiverRequest) Reset() { *m = QueryPendingPacketsByReceiverRequest{} } +func (m *QueryPendingPacketsByReceiverRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPendingPacketsByReceiverRequest) ProtoMessage() {} +func (*QueryPendingPacketsByReceiverRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0d5f080aa12bfc36, []int{4} +} +func (m *QueryPendingPacketsByReceiverRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPendingPacketsByReceiverRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPendingPacketsByReceiverRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPendingPacketsByReceiverRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPacketsByReceiverRequest.Merge(m, src) +} +func (m *QueryPendingPacketsByReceiverRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPendingPacketsByReceiverRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPacketsByReceiverRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPendingPacketsByReceiverRequest proto.InternalMessageInfo + +func (m *QueryPendingPacketsByReceiverRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryPendingPacketsByReceiverRequest) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +func (m *QueryPendingPacketsByReceiverRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryPendingPacketByReceiverListResponse struct { + RollappPackets []types.RollappPacket `protobuf:"bytes,1,rep,name=rollappPackets,proto3" json:"rollappPackets"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPendingPacketByReceiverListResponse) Reset() { + *m = QueryPendingPacketByReceiverListResponse{} +} +func (m *QueryPendingPacketByReceiverListResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPendingPacketByReceiverListResponse) ProtoMessage() {} +func (*QueryPendingPacketByReceiverListResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0d5f080aa12bfc36, []int{5} +} +func (m *QueryPendingPacketByReceiverListResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPendingPacketByReceiverListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPendingPacketByReceiverListResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPendingPacketByReceiverListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPacketByReceiverListResponse.Merge(m, src) +} +func (m *QueryPendingPacketByReceiverListResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPendingPacketByReceiverListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPacketByReceiverListResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPendingPacketByReceiverListResponse proto.InternalMessageInfo + +func (m *QueryPendingPacketByReceiverListResponse) GetRollappPackets() []types.RollappPacket { + if m != nil { + return m.RollappPackets + } + return nil +} + +func (m *QueryPendingPacketByReceiverListResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "dymensionxyz.dymension.delayedack.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "dymensionxyz.dymension.delayedack.QueryParamsResponse") proto.RegisterType((*QueryRollappPacketsRequest)(nil), "dymensionxyz.dymension.delayedack.QueryRollappPacketsRequest") proto.RegisterType((*QueryRollappPacketListResponse)(nil), "dymensionxyz.dymension.delayedack.QueryRollappPacketListResponse") + proto.RegisterType((*QueryPendingPacketsByReceiverRequest)(nil), "dymensionxyz.dymension.delayedack.QueryPendingPacketsByReceiverRequest") + proto.RegisterType((*QueryPendingPacketByReceiverListResponse)(nil), "dymensionxyz.dymension.delayedack.QueryPendingPacketByReceiverListResponse") } func init() { @@ -246,42 +362,48 @@ func init() { } var fileDescriptor_0d5f080aa12bfc36 = []byte{ - // 547 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x6b, 0x13, 0x41, - 0x1c, 0xcd, 0x24, 0x31, 0xd0, 0x29, 0xf4, 0x30, 0xf6, 0x10, 0x96, 0xb2, 0xc6, 0x05, 0x35, 0xf5, - 0xcf, 0x0c, 0xd9, 0xa2, 0x9e, 0x8a, 0xb4, 0xa0, 0x41, 0xf0, 0x90, 0xae, 0x9e, 0x7a, 0x50, 0x26, - 0xc9, 0xb0, 0x2e, 0xcd, 0xee, 0x4c, 0x77, 0x26, 0xa5, 0x6b, 0xe9, 0xc5, 0x93, 0x27, 0x11, 0xfc, - 0x16, 0x7e, 0x0f, 0xa1, 0xc7, 0x82, 0x07, 0x3d, 0x89, 0x24, 0x7e, 0x10, 0xd9, 0x99, 0xcd, 0x66, - 0x63, 0x8d, 0x49, 0x7b, 0xcb, 0x6e, 0xde, 0x9b, 0xf7, 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, 0xed, 0x65, 0x95, 0xff, 0x59, 0x5c, 0x6b, 0xe7, 0x4a, 0xf4, - 0xe2, 0xb2, 0x9d, 0xb6, 0xce, 0xb0, 0x83, 0x9e, 0x2c, 0x95, 0x41, 0xab, 0x93, 0x93, 0xfc, 0x72, - 0x9c, 0x92, 0x13, 0x53, 0xf3, 0xd3, 0xdd, 0xbd, 0xb3, 0x91, 0x0d, 0xce, 0x47, 0x36, 0xf8, 0x35, - 0xb2, 0xc1, 0xa7, 0xb1, 0x5d, 0x3a, 0x1f, 0xdb, 0xa5, 0x1f, 0x63, 0xbb, 0xb4, 0xff, 0xd8, 0x0f, - 0xd4, 0xdb, 0x61, 0x37, 0xad, 0xc9, 0x3c, 0x91, 0xa3, 0x2d, 0x72, 0x5c, 0x54, 0x4a, 0x2b, 0x2f, - 0xbb, 0x35, 0xfd, 0xcd, 0xd8, 0xfa, 0x13, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xbb, 0xe9, 0x96, 0x77, - 0x05, 0x00, 0x00, + // 645 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x4f, 0x6f, 0x12, 0x41, + 0x14, 0x67, 0x68, 0x4b, 0xec, 0x34, 0xe9, 0x61, 0xec, 0x81, 0xac, 0xcd, 0x5a, 0x37, 0xfe, 0xa1, + 0x2a, 0x33, 0x81, 0x46, 0x3d, 0x35, 0xa6, 0x24, 0x4a, 0x8c, 0x1e, 0xe8, 0xda, 0x13, 0x07, 0xcd, + 0x00, 0x93, 0x75, 0x53, 0xd8, 0xd9, 0xee, 0x0e, 0xa4, 0x6b, 0xc3, 0xc5, 0x93, 0x37, 0x4d, 0xfc, + 0x02, 0x1e, 0x8d, 0xdf, 0xc3, 0xa4, 0x37, 0x9b, 0x78, 0xd0, 0x93, 0x31, 0xe0, 0x07, 0x31, 0x3b, + 0xb3, 0x2c, 0x50, 0xa0, 0x6c, 0xb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 0xc2, 0x76, 0xfe, 0x05, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xc8, 0xfd, + 0xca, 0x06, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -300,6 +422,8 @@ type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Queries a list of RollappPacket items by rollappID. GetPackets(ctx context.Context, in *QueryRollappPacketsRequest, opts ...grpc.CallOption) (*QueryRollappPacketListResponse, error) + // Queries a list of pending RollappPacket items by rollappID and receiver. + GetPendingPacketsByReceiver(ctx context.Context, in *QueryPendingPacketsByReceiverRequest, opts ...grpc.CallOption) (*QueryPendingPacketByReceiverListResponse, error) } type queryClient struct { @@ -328,12 +452,23 @@ func (c *queryClient) GetPackets(ctx context.Context, in *QueryRollappPacketsReq return out, nil } +func (c *queryClient) GetPendingPacketsByReceiver(ctx context.Context, in *QueryPendingPacketsByReceiverRequest, opts ...grpc.CallOption) (*QueryPendingPacketByReceiverListResponse, error) { + out := new(QueryPendingPacketByReceiverListResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.delayedack.Query/GetPendingPacketsByReceiver", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Queries a list of RollappPacket items by rollappID. GetPackets(context.Context, *QueryRollappPacketsRequest) (*QueryRollappPacketListResponse, error) + // Queries a list of pending RollappPacket items by rollappID and receiver. + GetPendingPacketsByReceiver(context.Context, *QueryPendingPacketsByReceiverRequest) (*QueryPendingPacketByReceiverListResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -346,6 +481,9 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) GetPackets(ctx context.Context, req *QueryRollappPacketsRequest) (*QueryRollappPacketListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetPackets not implemented") } +func (*UnimplementedQueryServer) GetPendingPacketsByReceiver(ctx context.Context, req *QueryPendingPacketsByReceiverRequest) (*QueryPendingPacketByReceiverListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPendingPacketsByReceiver not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -387,6 +525,24 @@ func _Query_GetPackets_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Query_GetPendingPacketsByReceiver_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPendingPacketsByReceiverRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetPendingPacketsByReceiver(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.delayedack.Query/GetPendingPacketsByReceiver", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetPendingPacketsByReceiver(ctx, req.(*QueryPendingPacketsByReceiverRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "dymensionxyz.dymension.delayedack.Query", HandlerType: (*QueryServer)(nil), @@ -399,6 +555,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "GetPackets", Handler: _Query_GetPackets_Handler, }, + { + MethodName: "GetPendingPacketsByReceiver", + Handler: _Query_GetPendingPacketsByReceiver_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "dymensionxyz/dymension/delayedack/query.proto", @@ -561,6 +721,104 @@ func (m *QueryRollappPacketListResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *QueryPendingPacketsByReceiverRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPendingPacketsByReceiverRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingPacketsByReceiverRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x12 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPendingPacketByReceiverListResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPendingPacketByReceiverListResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingPacketByReceiverListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RollappPackets) > 0 { + for iNdEx := len(m.RollappPackets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RollappPackets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -634,6 +892,46 @@ func (m *QueryRollappPacketListResponse) Size() (n int) { return n } +func (m *QueryPendingPacketsByReceiverRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPendingPacketByReceiverListResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RollappPackets) > 0 { + for _, e := range m.RollappPackets { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1049,6 +1347,276 @@ func (m *QueryRollappPacketListResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryPendingPacketsByReceiverRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPendingPacketsByReceiverRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPendingPacketsByReceiverRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPendingPacketByReceiverListResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPendingPacketByReceiverListResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPendingPacketByReceiverListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappPackets", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappPackets = append(m.RollappPackets, types.RollappPacket{}) + if err := m.RollappPackets[len(m.RollappPackets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/delayedack/types/query.pb.gw.go b/x/delayedack/types/query.pb.gw.go index 29443f2bb..2032bdabf 100644 --- a/x/delayedack/types/query.pb.gw.go +++ b/x/delayedack/types/query.pb.gw.go @@ -152,6 +152,100 @@ func local_request_Query_GetPackets_0(ctx context.Context, marshaler runtime.Mar } +var ( + filter_Query_GetPendingPacketsByReceiver_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollappId": 0, "receiver": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_Query_GetPendingPacketsByReceiver_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingPacketsByReceiverRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + val, ok = pathParams["receiver"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "receiver") + } + + protoReq.Receiver, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "receiver", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetPendingPacketsByReceiver_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetPendingPacketsByReceiver(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetPendingPacketsByReceiver_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingPacketsByReceiverRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollappId"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollappId") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollappId", err) + } + + val, ok = pathParams["receiver"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "receiver") + } + + protoReq.Receiver, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "receiver", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetPendingPacketsByReceiver_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetPendingPacketsByReceiver(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -204,6 +298,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_GetPendingPacketsByReceiver_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetPendingPacketsByReceiver_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 { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetPendingPacketsByReceiver_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -285,6 +402,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_GetPendingPacketsByReceiver_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetPendingPacketsByReceiver_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_GetPendingPacketsByReceiver_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -292,10 +429,14 @@ var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"dymensionxyz", "dymension", "delayedack", "params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_GetPackets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"dymensionxyz", "dymension", "delayedack", "packets", "rollappId", "status"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetPendingPacketsByReceiver_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"dymensionxyz", "dymension", "delayedack", "pending-receiver-packets", "rollappId", "receiver"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage forward_Query_GetPackets_0 = runtime.ForwardResponseMessage + + forward_Query_GetPendingPacketsByReceiver_0 = runtime.ForwardResponseMessage ) diff --git a/x/delayedack/types/tx.pb.go b/x/delayedack/types/tx.pb.go index 08ad76162..ac1063778 100644 --- a/x/delayedack/types/tx.pb.go +++ b/x/delayedack/types/tx.pb.go @@ -247,220 +247,11 @@ func (m *MsgFinalizePacketByPacketKeyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgFinalizePacketByPacketKeyResponse proto.InternalMessageInfo -// MsgFinalizePacketsUntilHeight finalizes packets for the given rollapp until the given height inclusively. -type MsgFinalizePacketsUntilHeight struct { - // Sender is the signer of the message. - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - // RollappID is the ID of the rollapp. - RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` - // Height is a height until which packets are to be finalized. Height is inclusive. - Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` -} - -func (m *MsgFinalizePacketsUntilHeight) Reset() { *m = MsgFinalizePacketsUntilHeight{} } -func (m *MsgFinalizePacketsUntilHeight) String() string { return proto.CompactTextString(m) } -func (*MsgFinalizePacketsUntilHeight) ProtoMessage() {} -func (*MsgFinalizePacketsUntilHeight) Descriptor() ([]byte, []int) { - return fileDescriptor_604a74c1ca57f5ed, []int{4} -} -func (m *MsgFinalizePacketsUntilHeight) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgFinalizePacketsUntilHeight) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgFinalizePacketsUntilHeight.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgFinalizePacketsUntilHeight) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFinalizePacketsUntilHeight.Merge(m, src) -} -func (m *MsgFinalizePacketsUntilHeight) XXX_Size() int { - return m.Size() -} -func (m *MsgFinalizePacketsUntilHeight) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFinalizePacketsUntilHeight.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFinalizePacketsUntilHeight proto.InternalMessageInfo - -func (m *MsgFinalizePacketsUntilHeight) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgFinalizePacketsUntilHeight) GetRollappId() string { - if m != nil { - return m.RollappId - } - return "" -} - -func (m *MsgFinalizePacketsUntilHeight) GetHeight() uint64 { - if m != nil { - return m.Height - } - return 0 -} - -type MsgFinalizePacketsUntilHeightResponse struct { -} - -func (m *MsgFinalizePacketsUntilHeightResponse) Reset() { *m = MsgFinalizePacketsUntilHeightResponse{} } -func (m *MsgFinalizePacketsUntilHeightResponse) String() string { return proto.CompactTextString(m) } -func (*MsgFinalizePacketsUntilHeightResponse) ProtoMessage() {} -func (*MsgFinalizePacketsUntilHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_604a74c1ca57f5ed, []int{5} -} -func (m *MsgFinalizePacketsUntilHeightResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgFinalizePacketsUntilHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgFinalizePacketsUntilHeightResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgFinalizePacketsUntilHeightResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFinalizePacketsUntilHeightResponse.Merge(m, src) -} -func (m *MsgFinalizePacketsUntilHeightResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgFinalizePacketsUntilHeightResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFinalizePacketsUntilHeightResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFinalizePacketsUntilHeightResponse proto.InternalMessageInfo - -// MsgFinalizeRollappPacketsByReceiver finalizes the rollapp packets for the specified receiver until the latest -// finalized height inclusively. -type MsgFinalizeRollappPacketsByReceiver struct { - // Sender is the signer of the message. - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - // RollappID is the ID of the rollapp. - RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` - // Receiver is the one who waits tokens after the finalization. - Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` -} - -func (m *MsgFinalizeRollappPacketsByReceiver) Reset() { *m = MsgFinalizeRollappPacketsByReceiver{} } -func (m *MsgFinalizeRollappPacketsByReceiver) String() string { return proto.CompactTextString(m) } -func (*MsgFinalizeRollappPacketsByReceiver) ProtoMessage() {} -func (*MsgFinalizeRollappPacketsByReceiver) Descriptor() ([]byte, []int) { - return fileDescriptor_604a74c1ca57f5ed, []int{6} -} -func (m *MsgFinalizeRollappPacketsByReceiver) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgFinalizeRollappPacketsByReceiver) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgFinalizeRollappPacketsByReceiver.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgFinalizeRollappPacketsByReceiver) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFinalizeRollappPacketsByReceiver.Merge(m, src) -} -func (m *MsgFinalizeRollappPacketsByReceiver) XXX_Size() int { - return m.Size() -} -func (m *MsgFinalizeRollappPacketsByReceiver) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFinalizeRollappPacketsByReceiver.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFinalizeRollappPacketsByReceiver proto.InternalMessageInfo - -func (m *MsgFinalizeRollappPacketsByReceiver) GetSender() string { - if m != nil { - return m.Sender - } - return "" -} - -func (m *MsgFinalizeRollappPacketsByReceiver) GetRollappId() string { - if m != nil { - return m.RollappId - } - return "" -} - -func (m *MsgFinalizeRollappPacketsByReceiver) GetReceiver() string { - if m != nil { - return m.Receiver - } - return "" -} - -type MsgFinalizeRollappPacketsByReceiverResponse struct { -} - -func (m *MsgFinalizeRollappPacketsByReceiverResponse) Reset() { - *m = MsgFinalizeRollappPacketsByReceiverResponse{} -} -func (m *MsgFinalizeRollappPacketsByReceiverResponse) String() string { - return proto.CompactTextString(m) -} -func (*MsgFinalizeRollappPacketsByReceiverResponse) ProtoMessage() {} -func (*MsgFinalizeRollappPacketsByReceiverResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_604a74c1ca57f5ed, []int{7} -} -func (m *MsgFinalizeRollappPacketsByReceiverResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgFinalizeRollappPacketsByReceiverResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgFinalizeRollappPacketsByReceiverResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgFinalizeRollappPacketsByReceiverResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFinalizeRollappPacketsByReceiverResponse.Merge(m, src) -} -func (m *MsgFinalizeRollappPacketsByReceiverResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgFinalizeRollappPacketsByReceiverResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFinalizeRollappPacketsByReceiverResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFinalizeRollappPacketsByReceiverResponse proto.InternalMessageInfo - func init() { proto.RegisterType((*MsgFinalizePacket)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacket") proto.RegisterType((*MsgFinalizePacketResponse)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketResponse") proto.RegisterType((*MsgFinalizePacketByPacketKey)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketByPacketKey") proto.RegisterType((*MsgFinalizePacketByPacketKeyResponse)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketByPacketKeyResponse") - proto.RegisterType((*MsgFinalizePacketsUntilHeight)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketsUntilHeight") - proto.RegisterType((*MsgFinalizePacketsUntilHeightResponse)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketsUntilHeightResponse") - proto.RegisterType((*MsgFinalizeRollappPacketsByReceiver)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizeRollappPacketsByReceiver") - proto.RegisterType((*MsgFinalizeRollappPacketsByReceiverResponse)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizeRollappPacketsByReceiverResponse") } func init() { @@ -468,44 +259,37 @@ func init() { } var fileDescriptor_604a74c1ca57f5ed = []byte{ - // 584 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4d, 0x6f, 0xd3, 0x4c, - 0x10, 0xc7, 0xbb, 0x7d, 0x89, 0x9e, 0x4c, 0xa5, 0x3c, 0xd4, 0x48, 0xc5, 0x35, 0xd4, 0x0a, 0xe1, - 0xa5, 0x51, 0x00, 0x5b, 0x4d, 0x91, 0x90, 0x10, 0x12, 0x28, 0x48, 0xa5, 0x08, 0x15, 0x15, 0x03, - 0x17, 0x2e, 0x91, 0x63, 0x0f, 0x89, 0x15, 0xc7, 0x6b, 0xbc, 0x6e, 0x14, 0x97, 0x0b, 0x42, 0x70, - 0xe7, 0x3b, 0x20, 0x24, 0x8e, 0x15, 0x47, 0x3e, 0x01, 0xc7, 0x1e, 0x39, 0xa2, 0xe4, 0xd0, 0xaf, - 0x81, 0xe2, 0x5d, 0x9b, 0x98, 0x28, 0x29, 0xa4, 0x9c, 0x36, 0xb3, 0x33, 0xf3, 0x9f, 0x5f, 0x66, - 0x76, 0xbd, 0x50, 0xb1, 0xa3, 0x0e, 0x7a, 0xcc, 0xa1, 0x5e, 0x2f, 0x3a, 0xd0, 0x53, 0x43, 0xb7, - 0xd1, 0x35, 0x23, 0xb4, 0x4d, 0xab, 0xad, 0x87, 0x3d, 0xcd, 0x0f, 0x68, 0x48, 0xa5, 0x8b,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5a, 0x85, 0x14, 0xf5, 0x2b, - 0x81, 0xe2, 0x89, 0xa7, 0x72, 0xfb, 0xef, 0xca, 0x4d, 0xd2, 0x51, 0x1e, 0xff, 0x1b, 0x9d, 0x04, - 0x5e, 0x59, 0x7a, 0x73, 0x7c, 0x58, 0x21, 0xb5, 0x27, 0xdf, 0xfa, 0x2a, 0x39, 0xea, 0xab, 0xe4, - 0x47, 0x5f, 0x25, 0x1f, 0x06, 0xea, 0xdc, 0xd1, 0x40, 0x9d, 0xfb, 0x3e, 0x50, 0xe7, 0x5e, 0xdc, - 0x6a, 0x3a, 0x61, 0x6b, 0xbf, 0x31, 0xfc, 0xae, 0xea, 0x13, 0x5e, 0x8e, 0xee, 0x96, 0xde, 0xcb, - 0x3c, 0x53, 0x91, 0x8f, 0xac, 0x91, 0x8b, 0x9f, 0x8e, 0xad, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0xe1, 0xca, 0x2c, 0xf7, 0xd8, 0x06, 0x00, 0x00, + // 473 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x4f, 0x6b, 0x13, 0x41, + 0x14, 0xcf, 0xa4, 0x6d, 0xa0, 0xaf, 0x10, 0xed, 0x08, 0xba, 0x5d, 0x75, 0x89, 0x41, 0x34, 0x04, + 0x99, 0xa5, 0xa9, 0x20, 0x88, 0x20, 0x54, 0xf0, 0x0f, 0x52, 0xa8, 0xab, 0x27, 0x2f, 0x61, 0xb3, + 0xfb, 0xdc, 0x2c, 0xd9, 0x9d, 0x19, 0x77, 0xb6, 0x25, 0xd3, 0x93, 0x88, 0x1f, 0xc0, 0x2f, 0xe1, + 0xbd, 0x78, 0xf5, 0x0b, 0x78, 0xec, 0xd1, 0xa3, 0x24, 0x87, 0x7e, 0x0d, 0xc9, 0xce, 0x6e, 0x6d, + 0x0d, 0xa9, 0xd0, 0x9e, 0x66, 0xdf, 0xfb,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x3b, 0x3e, 0xb3, 0xe1, 0x5a, 0xa2, 0x1a, 0x34, 0x8a, 0xad, 0xdb, 0xfa, 0x13, 0x00, 0x00, 0xff, + 0xff, 0x99, 0xb8, 0x5a, 0x94, 0x13, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -523,11 +307,6 @@ type MsgClient interface { // FinalizePacket finalizes a singe packet. FinalizePacket(ctx context.Context, in *MsgFinalizePacket, opts ...grpc.CallOption) (*MsgFinalizePacketResponse, error) FinalizePacketByPacketKey(ctx context.Context, in *MsgFinalizePacketByPacketKey, opts ...grpc.CallOption) (*MsgFinalizePacketByPacketKeyResponse, error) - // FinalizePacketsUntilHeight finalizes the packets for the given rollapp until the given height inclusively. - FinalizePacketsUntilHeight(ctx context.Context, in *MsgFinalizePacketsUntilHeight, opts ...grpc.CallOption) (*MsgFinalizePacketsUntilHeightResponse, error) - // FinalizeRollappPacketsByReceiver finalizes the rollapp packets for the specified receiver until the latest - // finalized height inclusively. - FinalizeRollappPacketsByReceiver(ctx context.Context, in *MsgFinalizeRollappPacketsByReceiver, opts ...grpc.CallOption) (*MsgFinalizeRollappPacketsByReceiverResponse, error) } type msgClient struct { @@ -556,34 +335,11 @@ func (c *msgClient) FinalizePacketByPacketKey(ctx context.Context, in *MsgFinali return out, nil } -func (c *msgClient) FinalizePacketsUntilHeight(ctx context.Context, in *MsgFinalizePacketsUntilHeight, opts ...grpc.CallOption) (*MsgFinalizePacketsUntilHeightResponse, error) { - out := new(MsgFinalizePacketsUntilHeightResponse) - err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.delayedack.Msg/FinalizePacketsUntilHeight", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) FinalizeRollappPacketsByReceiver(ctx context.Context, in *MsgFinalizeRollappPacketsByReceiver, opts ...grpc.CallOption) (*MsgFinalizeRollappPacketsByReceiverResponse, error) { - out := new(MsgFinalizeRollappPacketsByReceiverResponse) - err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.delayedack.Msg/FinalizeRollappPacketsByReceiver", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // MsgServer is the server API for Msg service. type MsgServer interface { // FinalizePacket finalizes a singe packet. FinalizePacket(context.Context, *MsgFinalizePacket) (*MsgFinalizePacketResponse, error) FinalizePacketByPacketKey(context.Context, *MsgFinalizePacketByPacketKey) (*MsgFinalizePacketByPacketKeyResponse, error) - // FinalizePacketsUntilHeight finalizes the packets for the given rollapp until the given height inclusively. - FinalizePacketsUntilHeight(context.Context, *MsgFinalizePacketsUntilHeight) (*MsgFinalizePacketsUntilHeightResponse, error) - // FinalizeRollappPacketsByReceiver finalizes the rollapp packets for the specified receiver until the latest - // finalized height inclusively. - FinalizeRollappPacketsByReceiver(context.Context, *MsgFinalizeRollappPacketsByReceiver) (*MsgFinalizeRollappPacketsByReceiverResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -596,12 +352,6 @@ func (*UnimplementedMsgServer) FinalizePacket(ctx context.Context, req *MsgFinal func (*UnimplementedMsgServer) FinalizePacketByPacketKey(ctx context.Context, req *MsgFinalizePacketByPacketKey) (*MsgFinalizePacketByPacketKeyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FinalizePacketByPacketKey not implemented") } -func (*UnimplementedMsgServer) FinalizePacketsUntilHeight(ctx context.Context, req *MsgFinalizePacketsUntilHeight) (*MsgFinalizePacketsUntilHeightResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FinalizePacketsUntilHeight not implemented") -} -func (*UnimplementedMsgServer) FinalizeRollappPacketsByReceiver(ctx context.Context, req *MsgFinalizeRollappPacketsByReceiver) (*MsgFinalizeRollappPacketsByReceiverResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FinalizeRollappPacketsByReceiver not implemented") -} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -643,42 +393,6 @@ func _Msg_FinalizePacketByPacketKey_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } -func _Msg_FinalizePacketsUntilHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgFinalizePacketsUntilHeight) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).FinalizePacketsUntilHeight(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/dymensionxyz.dymension.delayedack.Msg/FinalizePacketsUntilHeight", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).FinalizePacketsUntilHeight(ctx, req.(*MsgFinalizePacketsUntilHeight)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_FinalizeRollappPacketsByReceiver_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgFinalizeRollappPacketsByReceiver) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).FinalizeRollappPacketsByReceiver(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/dymensionxyz.dymension.delayedack.Msg/FinalizeRollappPacketsByReceiver", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).FinalizeRollappPacketsByReceiver(ctx, req.(*MsgFinalizeRollappPacketsByReceiver)) - } - return interceptor(ctx, in, info, handler) -} - var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "dymensionxyz.dymension.delayedack.Msg", HandlerType: (*MsgServer)(nil), @@ -691,14 +405,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "FinalizePacketByPacketKey", Handler: _Msg_FinalizePacketByPacketKey_Handler, }, - { - MethodName: "FinalizePacketsUntilHeight", - Handler: _Msg_FinalizePacketsUntilHeight_Handler, - }, - { - MethodName: "FinalizeRollappPacketsByReceiver", - Handler: _Msg_FinalizeRollappPacketsByReceiver_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "dymensionxyz/dymension/delayedack/tx.proto", @@ -846,533 +552,89 @@ func (m *MsgFinalizePacketByPacketKeyResponse) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } -func (m *MsgFinalizePacketsUntilHeight) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgFinalizePacketsUntilHeight) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgFinalizePacketsUntilHeight) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Height != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x18 - } - if len(m.RollappId) > 0 { - i -= len(m.RollappId) - copy(dAtA[i:], m.RollappId) - i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return len(dAtA) - i, nil + dAtA[offset] = uint8(v) + return base } - -func (m *MsgFinalizePacketsUntilHeightResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *MsgFinalizePacket) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *MsgFinalizePacketsUntilHeightResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgFinalizePacketsUntilHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - return len(dAtA) - i, nil -} - -func (m *MsgFinalizeRollappPacketsByReceiver) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgFinalizeRollappPacketsByReceiver) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgFinalizeRollappPacketsByReceiver) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Receiver) > 0 { - i -= len(m.Receiver) - copy(dAtA[i:], m.Receiver) - i = encodeVarintTx(dAtA, i, uint64(len(m.Receiver))) - i-- - dAtA[i] = 0x1a - } - if len(m.RollappId) > 0 { - i -= len(m.RollappId) - copy(dAtA[i:], m.RollappId) - i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgFinalizeRollappPacketsByReceiverResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgFinalizeRollappPacketsByReceiverResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgFinalizeRollappPacketsByReceiverResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgFinalizePacket) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.RollappId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.PacketProofHeight != 0 { - n += 1 + sovTx(uint64(m.PacketProofHeight)) - } - if m.PacketType != 0 { - n += 1 + sovTx(uint64(m.PacketType)) - } - l = len(m.PacketSrcChannel) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.PacketSequence != 0 { - n += 1 + sovTx(uint64(m.PacketSequence)) - } - return n -} - -func (m *MsgFinalizePacketResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgFinalizePacketByPacketKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.PacketKey) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgFinalizePacketByPacketKeyResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgFinalizePacketsUntilHeight) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.RollappId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Height != 0 { - n += 1 + sovTx(uint64(m.Height)) - } - return n -} - -func (m *MsgFinalizePacketsUntilHeightResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgFinalizeRollappPacketsByReceiver) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) } l = len(m.RollappId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Receiver) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgFinalizeRollappPacketsByReceiverResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgFinalizePacket) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgFinalizePacket: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFinalizePacket: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RollappId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketProofHeight", wireType) - } - m.PacketProofHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PacketProofHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketType", wireType) - } - m.PacketType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PacketType |= types.RollappPacket_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketSrcChannel", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PacketSrcChannel = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketSequence", wireType) - } - m.PacketSequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PacketSequence |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgFinalizePacketResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgFinalizePacketResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFinalizePacketResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } + if m.PacketProofHeight != 0 { + n += 1 + sovTx(uint64(m.PacketProofHeight)) + } + if m.PacketType != 0 { + n += 1 + sovTx(uint64(m.PacketType)) + } + l = len(m.PacketSrcChannel) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.PacketSequence != 0 { + n += 1 + sovTx(uint64(m.PacketSequence)) + } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *MsgFinalizePacketResponse) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + return n } -func (m *MsgFinalizePacketByPacketKey) Unmarshal(dAtA []byte) error { + +func (m *MsgFinalizePacketByPacketKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.PacketKey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgFinalizePacketByPacketKeyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgFinalizePacket) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1395,10 +657,10 @@ func (m *MsgFinalizePacketByPacketKey) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgFinalizePacketByPacketKey: wiretype end group for non-group") + return fmt.Errorf("proto: MsgFinalizePacket: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFinalizePacketByPacketKey: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgFinalizePacket: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1435,7 +697,7 @@ func (m *MsgFinalizePacketByPacketKey) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1463,113 +725,13 @@ func (m *MsgFinalizePacketByPacketKey) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PacketKey = string(dAtA[iNdEx:postIndex]) + m.RollappId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgFinalizePacketByPacketKeyResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgFinalizePacketByPacketKeyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFinalizePacketByPacketKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgFinalizePacketsUntilHeight) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgFinalizePacketsUntilHeight: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFinalizePacketsUntilHeight: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PacketProofHeight", wireType) } - var stringLen uint64 + m.PacketProofHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1579,27 +741,33 @@ func (m *MsgFinalizePacketsUntilHeight) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.PacketProofHeight |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PacketType", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + m.PacketType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PacketType |= types.RollappPacket_Type(b&0x7F) << shift + if b < 0x80 { + break + } } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PacketSrcChannel", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1627,13 +795,13 @@ func (m *MsgFinalizePacketsUntilHeight) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RollappId = string(dAtA[iNdEx:postIndex]) + m.PacketSrcChannel = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 6: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PacketSequence", wireType) } - m.Height = 0 + m.PacketSequence = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1643,7 +811,7 @@ func (m *MsgFinalizePacketsUntilHeight) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= uint64(b&0x7F) << shift + m.PacketSequence |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1669,7 +837,7 @@ func (m *MsgFinalizePacketsUntilHeight) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgFinalizePacketsUntilHeightResponse) Unmarshal(dAtA []byte) error { +func (m *MsgFinalizePacketResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1692,10 +860,10 @@ func (m *MsgFinalizePacketsUntilHeightResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgFinalizePacketsUntilHeightResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgFinalizePacketResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFinalizePacketsUntilHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgFinalizePacketResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1719,7 +887,7 @@ func (m *MsgFinalizePacketsUntilHeightResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgFinalizeRollappPacketsByReceiver) Unmarshal(dAtA []byte) error { +func (m *MsgFinalizePacketByPacketKey) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1742,10 +910,10 @@ func (m *MsgFinalizeRollappPacketsByReceiver) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgFinalizeRollappPacketsByReceiver: wiretype end group for non-group") + return fmt.Errorf("proto: MsgFinalizePacketByPacketKey: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFinalizeRollappPacketsByReceiver: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgFinalizePacketByPacketKey: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1782,39 +950,7 @@ func (m *MsgFinalizeRollappPacketsByReceiver) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RollappId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PacketKey", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1842,7 +978,7 @@ func (m *MsgFinalizeRollappPacketsByReceiver) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Receiver = string(dAtA[iNdEx:postIndex]) + m.PacketKey = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1865,7 +1001,7 @@ func (m *MsgFinalizeRollappPacketsByReceiver) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgFinalizeRollappPacketsByReceiverResponse) Unmarshal(dAtA []byte) error { +func (m *MsgFinalizePacketByPacketKeyResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1888,10 +1024,10 @@ func (m *MsgFinalizeRollappPacketsByReceiverResponse) Unmarshal(dAtA []byte) err fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgFinalizeRollappPacketsByReceiverResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgFinalizePacketByPacketKeyResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFinalizeRollappPacketsByReceiverResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgFinalizePacketByPacketKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: