diff --git a/app/app.go b/app/app.go
index dabbe2c..7c94197 100644
--- a/app/app.go
+++ b/app/app.go
@@ -630,12 +630,12 @@ func NewSimApp(
)
// TODO: How are the domains registered selected.. using 12345 as a placeholder
- //domain := uint32(12345)
+ // domain := uint32(12345)
app.IgpKeeper = igpkeeper.NewKeeper(appCodec, keys[igptypes.StoreKey], app.BankKeeper.(bankkeeper.SendKeeper), app.StakingKeeper, "")
app.IsmKeeper = ismkeeper.NewKeeper(appCodec, keys[ismtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String())
app.MailboxKeeper = mailboxkeeper.NewKeeper(appCodec, keys[mailboxtypes.StoreKey], &app.WasmKeeper, &app.IsmKeeper)
- //app.MailboxKeeper.SetDomain(domain)
+ // app.MailboxKeeper.SetDomain(domain)
// The gov proposal types can be individually enabled
if len(enabledProposals) != 0 {
diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md
index f558228..5178450 100644
--- a/docs/proto/proto-docs.md
+++ b/docs/proto/proto-docs.md
@@ -4,82 +4,87 @@
## Table of Contents
-- [hyperlane/mailbox/v1/types.proto](#hyperlane/mailbox/v1/types.proto)
- - [MessageDelivered](#hyperlane.mailbox.v1.MessageDelivered)
- - [Tree](#hyperlane.mailbox.v1.Tree)
- - [TreeEntry](#hyperlane.mailbox.v1.TreeEntry)
+- [hyperlane/ism/v1/ism.proto](#hyperlane/ism/v1/ism.proto)
+ - [Ism](#hyperlane.ism.v1.Ism)
-- [hyperlane/mailbox/v1/genesis.proto](#hyperlane/mailbox/v1/genesis.proto)
- - [GenesisState](#hyperlane.mailbox.v1.GenesisState)
+- [hyperlane/ism/v1/genesis.proto](#hyperlane/ism/v1/genesis.proto)
+ - [GenesisState](#hyperlane.ism.v1.GenesisState)
-- [hyperlane/mailbox/v1/query.proto](#hyperlane/mailbox/v1/query.proto)
- - [QueryCurrentTreeMetadataRequest](#hyperlane.mailbox.v1.QueryCurrentTreeMetadataRequest)
- - [QueryCurrentTreeMetadataResponse](#hyperlane.mailbox.v1.QueryCurrentTreeMetadataResponse)
- - [QueryDomainRequest](#hyperlane.mailbox.v1.QueryDomainRequest)
- - [QueryDomainResponse](#hyperlane.mailbox.v1.QueryDomainResponse)
+- [hyperlane/ism/v1/legacy_multisig.proto](#hyperlane/ism/v1/legacy_multisig.proto)
+ - [LegacyMultiSig](#hyperlane.ism.v1.LegacyMultiSig)
- - [Query](#hyperlane.mailbox.v1.Query)
+- [hyperlane/ism/v1/merkle_root_multisig.proto](#hyperlane/ism/v1/merkle_root_multisig.proto)
+ - [MerkleRootMultiSig](#hyperlane.ism.v1.MerkleRootMultiSig)
-- [hyperlane/mailbox/v1/tx.proto](#hyperlane/mailbox/v1/tx.proto)
- - [MsgDispatch](#hyperlane.mailbox.v1.MsgDispatch)
- - [MsgDispatchResponse](#hyperlane.mailbox.v1.MsgDispatchResponse)
- - [MsgProcess](#hyperlane.mailbox.v1.MsgProcess)
- - [MsgProcessResponse](#hyperlane.mailbox.v1.MsgProcessResponse)
+- [hyperlane/ism/v1/message_id_multisig.proto](#hyperlane/ism/v1/message_id_multisig.proto)
+ - [MessageIdMultiSig](#hyperlane.ism.v1.MessageIdMultiSig)
- - [Msg](#hyperlane.mailbox.v1.Msg)
+- [hyperlane/ism/v1/query.proto](#hyperlane/ism/v1/query.proto)
+ - [QueryAllDefaultIsmsRequest](#hyperlane.ism.v1.QueryAllDefaultIsmsRequest)
+ - [QueryAllDefaultIsmsResponse](#hyperlane.ism.v1.QueryAllDefaultIsmsResponse)
+ - [QueryOriginsDefaultIsmRequest](#hyperlane.ism.v1.QueryOriginsDefaultIsmRequest)
+ - [QueryOriginsDefaultIsmResponse](#hyperlane.ism.v1.QueryOriginsDefaultIsmResponse)
+
+ - [Query](#hyperlane.ism.v1.Query)
+
+- [hyperlane/ism/v1/tx.proto](#hyperlane/ism/v1/tx.proto)
+ - [MsgSetDefaultIsm](#hyperlane.ism.v1.MsgSetDefaultIsm)
+ - [MsgSetDefaultIsmResponse](#hyperlane.ism.v1.MsgSetDefaultIsmResponse)
+
+ - [Msg](#hyperlane.ism.v1.Msg)
- [Scalar Value Types](#scalar-value-types)
-
+
Top
-## hyperlane/mailbox/v1/types.proto
+## hyperlane/ism/v1/ism.proto
-
+
-### MessageDelivered
-Mailbox delivered message
+### Ism
+Hyperlane's default ISM
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `id` | [string](#string) | | Message id (hash) |
+| `origin` | [uint32](#uint32) | | |
+| `abstract_ism` | [google.protobuf.Any](#google.protobuf.Any) | | |
+
-
+
-### Tree
-Hyperlane's tree
+
+
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| `count` | [uint32](#uint32) | | Count of items inserted to tree |
-| `tree_entries` | [TreeEntry](#hyperlane.mailbox.v1.TreeEntry) | repeated | Each item inserted |
+
+Top
+## hyperlane/ism/v1/genesis.proto
-
+
-### TreeEntry
-Hyperlane's tree entry
+### GenesisState
+Hyperlane ISM's keeper genesis state
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `index` | [uint32](#uint32) | | index |
-| `message` | [bytes](#bytes) | | message |
+| `default_ism` | [Ism](#hyperlane.ism.v1.Ism) | repeated | Genesis default ISM |
@@ -95,24 +100,23 @@ Hyperlane's tree entry
-
+
Top
-## hyperlane/mailbox/v1/genesis.proto
+## hyperlane/ism/v1/legacy_multisig.proto
-
+
-### GenesisState
-Hyperlane mailbox's keeper genesis state
+### LegacyMultiSig
+LegacyMultiSig ISM for a specific origin
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `tree` | [Tree](#hyperlane.mailbox.v1.Tree) | | Each genesis tree entry |
-| `delivered_messages` | [MessageDelivered](#hyperlane.mailbox.v1.MessageDelivered) | repeated | Each message that has been delivered |
-| `domain` | [uint32](#uint32) | | The domain of this chain module, assigned by hyperlane |
+| `validator_pub_keys` | [string](#string) | repeated | Validator pub keys |
+| `threshold` | [uint32](#uint32) | | number of validators required |
@@ -128,44 +132,81 @@ Hyperlane mailbox's keeper genesis state
-
+
Top
-## hyperlane/mailbox/v1/query.proto
+## hyperlane/ism/v1/merkle_root_multisig.proto
-
+
-### QueryCurrentTreeMetadataRequest
-QueryCurrentTreeMetadataRequest is the request type for the Query/Tree RPC
-method.
+### MerkleRootMultiSig
+MerkleRootMultiSig ISM for a specific origin
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `validator_pub_keys` | [string](#string) | repeated | Validator pub keys |
+| `threshold` | [uint32](#uint32) | | number of validators required |
-
-### QueryCurrentTreeMetadataResponse
-QueryTreeResponse is the response type for the Query/Tree RPC method.
+
+
+
+
+
+
+
+
+
+
+
+Top
+
+## hyperlane/ism/v1/message_id_multisig.proto
+
+
+
+
+
+### MessageIdMultiSig
+MessageIdMultiSig ISM for a specific origin
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `root` | [bytes](#bytes) | | |
-| `count` | [uint32](#uint32) | | |
+| `validator_pub_keys` | [string](#string) | repeated | Validator pub keys |
+| `threshold` | [uint32](#uint32) | | number of validators required |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Top
+## hyperlane/ism/v1/query.proto
-
+
-### QueryDomainRequest
-QueryDomain is the request type for the Query/Domain RPC
+### QueryAllDefaultIsmsRequest
+QueryAllDefaultIsmRequest is the request type for the AllDefaultIsms RPC
method.
@@ -173,102 +214,99 @@ method.
-
+
-### QueryDomainResponse
-QueryDomainResponse is the response type for the Query/Domain RPC method.
+### QueryAllDefaultIsmsResponse
+QueryAllDefaultIsmResponse is the response type for the AllDefaultIsms RPC
+method.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `domain` | [uint32](#uint32) | | |
+| `default_isms` | [Ism](#hyperlane.ism.v1.Ism) | repeated | |
-
-
+
-
+### QueryOriginsDefaultIsmRequest
+QueryDefaultIsmRequest is the request type for the DefaultIsm RPC method.
-
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `origin` | [uint32](#uint32) | | |
-### Query
-Query service for hyperlane mailbox module
-| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
-| ----------- | ------------ | ------------- | ------------| ------- | -------- |
-| `CurrentTreeMetadata` | [QueryCurrentTreeMetadataRequest](#hyperlane.mailbox.v1.QueryCurrentTreeMetadataRequest) | [QueryCurrentTreeMetadataResponse](#hyperlane.mailbox.v1.QueryCurrentTreeMetadataResponse) | Get current tree metadata | GET|/hyperlane/mailbox/v1/tree|
-| `Domain` | [QueryDomainRequest](#hyperlane.mailbox.v1.QueryDomainRequest) | [QueryDomainResponse](#hyperlane.mailbox.v1.QueryDomainResponse) | Get domain | GET|/hyperlane/mailbox/v1/domain|
-
-
-Top
+
-## hyperlane/mailbox/v1/tx.proto
+### QueryOriginsDefaultIsmResponse
+QueryDefaultIsmResponse is the response type for the DefaultIsm RPC method.
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `default_ism` | [google.protobuf.Any](#google.protobuf.Any) | | |
-
-### MsgDispatch
-MsgDispatch defines the request type for the Dispatch rpc.
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| `sender` | [string](#string) | | |
-| `destination_domain` | [uint32](#uint32) | | |
-| `recipient_address` | [string](#string) | | |
-| `message_body` | [string](#string) | | |
+
+
+
+
-
+### Query
+Query service for hyperlane ISM module
-### MsgDispatchResponse
-MsgDispatchResponse defines the Dispatch response type.
+| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
+| ----------- | ------------ | ------------- | ------------| ------- | -------- |
+| `OriginsDefaultIsm` | [QueryOriginsDefaultIsmRequest](#hyperlane.ism.v1.QueryOriginsDefaultIsmRequest) | [QueryOriginsDefaultIsmResponse](#hyperlane.ism.v1.QueryOriginsDefaultIsmResponse) | Get current default multisig ISM for an origin | GET|/hyperlane/ism/v1/origins_default_ism|
+| `AllDefaultIsms` | [QueryAllDefaultIsmsRequest](#hyperlane.ism.v1.QueryAllDefaultIsmsRequest) | [QueryAllDefaultIsmsResponse](#hyperlane.ism.v1.QueryAllDefaultIsmsResponse) | Get all current default multisig ISMs | GET|/hyperlane/ism/v1/all_default_isms|
+
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| `message_id` | [string](#string) | | |
+
+Top
+## hyperlane/ism/v1/tx.proto
-
+
-### MsgProcess
-MsgProcess defines the request type for the Process rpc.
+### MsgSetDefaultIsm
+MsgSetDefaultIsm defines the request type for the SetDefaultIsm rpc.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `sender` | [string](#string) | | |
-| `metadata` | [string](#string) | | |
-| `message` | [string](#string) | | |
+| `signer` | [string](#string) | | |
+| `isms` | [Ism](#hyperlane.ism.v1.Ism) | repeated | |
-
+
-### MsgProcessResponse
-MsgProcessResponse defines the Process response type.
+### MsgSetDefaultIsmResponse
+MsgSetDefaultIsmResponse defines the Msg/SetDefaultIsm response type
@@ -281,15 +319,14 @@ MsgProcessResponse defines the Process response type.
-
+
### Msg
-Msg defines the hyperlane mailbox Msg service.
+Msg defines the hyperlane ISM Msg service.
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
-| `Dispatch` | [MsgDispatch](#hyperlane.mailbox.v1.MsgDispatch) | [MsgDispatchResponse](#hyperlane.mailbox.v1.MsgDispatchResponse) | Dispatch sends interchain messages | |
-| `Process` | [MsgProcess](#hyperlane.mailbox.v1.MsgProcess) | [MsgProcessResponse](#hyperlane.mailbox.v1.MsgProcessResponse) | Process delivers interchain messages | |
+| `SetDefaultIsm` | [MsgSetDefaultIsm](#hyperlane.ism.v1.MsgSetDefaultIsm) | [MsgSetDefaultIsmResponse](#hyperlane.ism.v1.MsgSetDefaultIsmResponse) | SetDefaultIsm defines a rpc handler method for MsgSetDefaultIsm. | |
diff --git a/interchaintest/helpers/mailbox.go b/interchaintest/helpers/mailbox.go
index 929c96c..edf749f 100644
--- a/interchaintest/helpers/mailbox.go
+++ b/interchaintest/helpers/mailbox.go
@@ -126,7 +126,7 @@ func QueryCurrentTreeMetadata(
chain *cosmos.CosmosChain,
) (stdout []byte) {
cmd := []string{
- "simd", "query", "hyperlane-mailbox", "tree",
+ "simd", "query", "hyperlane-mailbox", "tree-metadata",
"--node", chain.GetRPCAddress(),
"--home", chain.HomeDir(),
"--chain-id", chain.Config().ChainID,
@@ -141,6 +141,26 @@ func QueryCurrentTreeMetadata(
return stdout
}
+// simd query hyperlane-mailbox tree
+func QueryCurrentTree(
+ t *testing.T,
+ ctx context.Context,
+ chain *cosmos.CosmosChain,
+) (stdout []byte) {
+ cmd := []string{
+ "simd", "query", "hyperlane-mailbox", "tree",
+ "--node", chain.GetRPCAddress(),
+ "--home", chain.HomeDir(),
+ "--chain-id", chain.Config().ChainID,
+ }
+ stdout, _, err := chain.Exec(ctx, cmd, nil)
+ require.NoError(t, err)
+
+ fmt.Println("QueryCurrentTree stdout: ", string(stdout))
+
+ return stdout
+}
+
func ParseQueryTreeMetadata(input string) (root string, count string) {
r, _ := regexp.Compile(`(?m)^root:\s(?P.*)$`)
diff --git a/interchaintest/tests/cosmos_e2e_test.go b/interchaintest/tests/cosmos_e2e_test.go
index 17fdf04..950f649 100644
--- a/interchaintest/tests/cosmos_e2e_test.go
+++ b/interchaintest/tests/cosmos_e2e_test.go
@@ -6,11 +6,12 @@ import (
"runtime"
"testing"
- "github.com/strangelove-ventures/hyperlane-cosmos/interchaintest/docker"
interchaintest "github.com/strangelove-ventures/interchaintest/v7"
hyperlane "github.com/strangelove-ventures/interchaintest/v7/chain/hyperlane"
"go.uber.org/zap/zaptest"
+ "github.com/strangelove-ventures/hyperlane-cosmos/interchaintest/docker"
+
"github.com/strangelove-ventures/interchaintest/v7/ibc"
"github.com/strangelove-ventures/interchaintest/v7/testreporter"
"github.com/stretchr/testify/require"
diff --git a/interchaintest/tests/module_mailbox_test.go b/interchaintest/tests/module_mailbox_test.go
index b7483ac..7c1ef02 100644
--- a/interchaintest/tests/module_mailbox_test.go
+++ b/interchaintest/tests/module_mailbox_test.go
@@ -41,6 +41,7 @@ func TestHyperlaneMailbox(t *testing.T) {
// Chains
simd := chains[0].(*cosmos.CosmosChain)
t.Log("simd.GetHostRPCAddress()", simd.GetHostRPCAddress())
+ t.Log("simd.GetHostGRPCAddress()", simd.GetHostGRPCAddress())
users := icv7.GetAndFundTestUsers(t, ctx, "default", int64(10_000_000_000), simd)
user := users[0]
@@ -58,7 +59,7 @@ func TestHyperlaneMailbox(t *testing.T) {
// Set default isms for counter chains
helpers.SetDefaultIsm(t, ctx, simd, user.KeyName(), counterChain1, counterChain2, counterChain3)
- res := helpers.QueryAllDefaultIsms(t, ctx, simd)
+ /*res := helpers.QueryAllDefaultIsms(t, ctx, simd)
var abstractIsm ismtypes.AbstractIsm
@@ -69,7 +70,7 @@ func TestHyperlaneMailbox(t *testing.T) {
require.Equal(t, counterChain1.ValSet.Threshold, uint8(legacyMultiSig.Threshold))
for i, val := range counterChain1.ValSet.Vals {
require.Equal(t, val.Addr, legacyMultiSig.ValidatorPubKeys[i])
- }
+ }*/
// Create first legacy multisig message from counter chain 1
sender := "0xbcb815f38D481a5EBA4D7ac4c9E74D9D0FC2A7e7"
@@ -109,7 +110,7 @@ func TestHyperlaneMailbox(t *testing.T) {
require.NoError(t, err)
simd.ExecuteContract(ctx, user.KeyName(), contract, string(dipatchMsg))
- err = testutil.WaitForBlocks(ctx, 2, simd)
+ err = testutil.WaitForBlocks(ctx, 125, simd)
require.NoError(t, err)
}
diff --git a/interchaintest/tests/setup.go b/interchaintest/tests/setup.go
index a6c678e..fed9474 100644
--- a/interchaintest/tests/setup.go
+++ b/interchaintest/tests/setup.go
@@ -216,7 +216,7 @@ func ModifyGenesisProposalTime(votingPeriod string, maxDepositPeriod string, dom
// "domain": domain,
// },
// }
- //return modifyGenesisAtPath(out, "app_state", "hyperlane-mailbox", domain)
+ // return modifyGenesisAtPath(out, "app_state", "hyperlane-mailbox", domain)
}
}
diff --git a/proto/hyperlane/mailbox/v1/query.proto b/proto/hyperlane/mailbox/v1/query.proto
index 213b6e4..c319df2 100644
--- a/proto/hyperlane/mailbox/v1/query.proto
+++ b/proto/hyperlane/mailbox/v1/query.proto
@@ -10,25 +10,40 @@ service Query {
// Get current tree metadata
rpc CurrentTreeMetadata(QueryCurrentTreeMetadataRequest)
returns (QueryCurrentTreeMetadataResponse) {
- option (google.api.http).get = "/hyperlane/mailbox/v1/tree";
+ option (google.api.http).get = "/hyperlane/mailbox/v1/tree_metadata";
}
// Get domain
rpc Domain(QueryDomainRequest) returns (QueryDomainResponse) {
option (google.api.http).get = "/hyperlane/mailbox/v1/domain";
}
+
+ // Get current tree
+ rpc CurrentTree(QueryCurrentTreeRequest) returns (QueryCurrentTreeResponse) {
+ option (google.api.http).get = "/hyperlane/mailbox/v1/tree";
+ }
}
-// QueryCurrentTreeMetadataRequest is the request type for the Query/Tree RPC
-// method.
+// QueryCurrentTreeMetadataRequest is the request type for the Query/Tree
+// metadata RPC method.
message QueryCurrentTreeMetadataRequest {}
-// QueryTreeResponse is the response type for the Query/Tree RPC method.
+// QueryCurrentTreeResponseResponse is the response type for the Query/Tree
+// metadata RPC method.
message QueryCurrentTreeMetadataResponse {
bytes root = 1;
uint32 count = 2;
}
+// QueryCurrentTreeRequest is the request type for the Query/Tree RPC method
+message QueryCurrentTreeRequest {}
+
+// QueryCurrentTreeResponse is the response type for the Query/Tree RPC method
+message QueryCurrentTreeResponse {
+ repeated bytes branches = 1;
+ uint32 count = 2;
+}
+
// QueryDomain is the request type for the Query/Domain RPC
// method.
message QueryDomainRequest {}
diff --git a/x/mailbox/client/cli/cli.go b/x/mailbox/client/cli/cli.go
index 1c99995..25a3ccd 100644
--- a/x/mailbox/client/cli/cli.go
+++ b/x/mailbox/client/cli/cli.go
@@ -19,6 +19,7 @@ func GetQueryCmd() *cobra.Command {
queryCmd.AddCommand(
getCurrentTreeMetadataCmd(),
+ getCurrentTreeCmd(),
getDomain(),
)
diff --git a/x/mailbox/client/cli/query.go b/x/mailbox/client/cli/query.go
index 405eda2..45abb36 100644
--- a/x/mailbox/client/cli/query.go
+++ b/x/mailbox/client/cli/query.go
@@ -15,10 +15,10 @@ import (
// getCurrentTreeMetadataCmd defines the command to query the current tree metadata
func getCurrentTreeMetadataCmd() *cobra.Command {
cmd := &cobra.Command{
- Use: "tree",
- Short: "Query tree",
+ Use: "tree-metadata",
+ Short: "Query tree-metadata",
Long: "Query current tree metadata",
- Example: fmt.Sprintf("%s query %s tree", version.AppName, types.ModuleName),
+ Example: fmt.Sprintf("%s query %s tree-metadata", version.AppName, types.ModuleName),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
@@ -43,6 +43,37 @@ func getCurrentTreeMetadataCmd() *cobra.Command {
return cmd
}
+// getCurrentTreeCmd defines the command to query the current tree
+func getCurrentTreeCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "tree",
+ Short: "Query tree",
+ Long: "Query current tree",
+ Example: fmt.Sprintf("%s query %s tree", version.AppName, types.ModuleName),
+ Args: cobra.ExactArgs(0),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientQueryContext(cmd)
+ if err != nil {
+ return err
+ }
+ queryClient := types.NewQueryClient(clientCtx)
+
+ req := types.QueryCurrentTreeRequest{}
+
+ res, err := queryClient.CurrentTree(context.Background(), &req)
+ if err != nil {
+ return err
+ }
+
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+
+ return cmd
+}
+
// getCurrentTreeMetadataCmd defines the command to query the current tree metadata
func getDomain() *cobra.Command {
cmd := &cobra.Command{
diff --git a/x/mailbox/keeper/grpc_query.go b/x/mailbox/keeper/grpc_query.go
index cd8e44c..94dc982 100644
--- a/x/mailbox/keeper/grpc_query.go
+++ b/x/mailbox/keeper/grpc_query.go
@@ -8,6 +8,7 @@ import (
"google.golang.org/grpc/status"
sdk "github.com/cosmos/cosmos-sdk/types"
+
"github.com/strangelove-ventures/hyperlane-cosmos/x/mailbox/types"
)
@@ -25,6 +26,22 @@ func (k Keeper) CurrentTreeMetadata(c context.Context, req *types.QueryCurrentTr
}, nil
}
+func (k Keeper) CurrentTree(c context.Context, req *types.QueryCurrentTreeRequest) (*types.QueryCurrentTreeResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ /*branches := [][]byte{}
+ for _, branch := range k.Tree.GetProofForNextIndex() {
+ branches = append(branches, branch[:])
+ }*/
+
+ return &types.QueryCurrentTreeResponse{
+ Branches: k.Tree.Branch[:],
+ Count: k.Tree.Count(),
+ }, nil
+}
+
// Domain implements the Query/Domain gRPC method
func (k Keeper) Domain(c context.Context, req *types.QueryDomainRequest) (*types.QueryDomainResponse, error) {
if req == nil {
diff --git a/x/mailbox/keeper/msg_server.go b/x/mailbox/keeper/msg_server.go
index d220edd..d6f06f3 100644
--- a/x/mailbox/keeper/msg_server.go
+++ b/x/mailbox/keeper/msg_server.go
@@ -147,7 +147,6 @@ func (k Keeper) Process(goCtx context.Context, msg *types.MsgProcess) (*types.Ms
// Verify message signatures
verified, err := k.ismKeeper.Verify(metadataBytes, messageBytes)
-
if err != nil {
return nil, err
}
diff --git a/x/mailbox/keeper/msg_server_test.go b/x/mailbox/keeper/msg_server_test.go
index 4a9e0e3..903583e 100644
--- a/x/mailbox/keeper/msg_server_test.go
+++ b/x/mailbox/keeper/msg_server_test.go
@@ -113,7 +113,6 @@ func (suite *KeeperTestSuite) TestDispatch() {
msgBody := hexutil.Encode([]byte("Hello!"))
msg = types.NewMsgDispatch(sender, domain, recipientHex, msgBody)
hyperlaneMsgHex = createHyperlaneMsg(0, origin, domain, sender, recipientHex, msgBody)
-
},
true,
},
@@ -178,7 +177,7 @@ func (suite *KeeperTestSuite) TestDispatch() {
fmt.Println("ID: ", res.MessageId)
- //zero-pad the sender w/ appropriate hyperlane byte length
+ // zero-pad the sender w/ appropriate hyperlane byte length
senderB, _ := hexutil.Decode(senderHex)
for len(senderB) < (common.DESTINATION_OFFSET - common.SENDER_OFFSET) {
padding := make([]byte, 1)
diff --git a/x/mailbox/types/keys.go b/x/mailbox/types/keys.go
index be3fa04..7ee020a 100644
--- a/x/mailbox/types/keys.go
+++ b/x/mailbox/types/keys.go
@@ -12,9 +12,7 @@ const (
KeyMailboxDelivered = "delivered"
)
-var (
- DomainKey = []byte{0x1}
-)
+var DomainKey = []byte{0x1}
func MailboxIMTKey(index uint32) []byte {
return []byte(fmt.Sprintf("%s/%d", KeyMailboxIMT, index))
diff --git a/x/mailbox/types/query.pb.go b/x/mailbox/types/query.pb.go
index d8515f9..87a1113 100644
--- a/x/mailbox/types/query.pb.go
+++ b/x/mailbox/types/query.pb.go
@@ -31,8 +31,8 @@ var (
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
-// QueryCurrentTreeMetadataRequest is the request type for the Query/Tree RPC
-// method.
+// QueryCurrentTreeMetadataRequest is the request type for the Query/Tree
+// metadata RPC method.
type QueryCurrentTreeMetadataRequest struct{}
func (m *QueryCurrentTreeMetadataRequest) Reset() { *m = QueryCurrentTreeMetadataRequest{} }
@@ -73,7 +73,8 @@ func (m *QueryCurrentTreeMetadataRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryCurrentTreeMetadataRequest proto.InternalMessageInfo
-// QueryTreeResponse is the response type for the Query/Tree RPC method.
+// QueryCurrentTreeResponseResponse is the response type for the Query/Tree
+// metadata RPC method.
type QueryCurrentTreeMetadataResponse struct {
Root []byte `protobuf:"bytes,1,opt,name=root,proto3" json:"root,omitempty"`
Count uint32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
@@ -131,6 +132,105 @@ func (m *QueryCurrentTreeMetadataResponse) GetCount() uint32 {
return 0
}
+// QueryCurrentTreeRequest is the request type for the Query/Tree RPC method
+type QueryCurrentTreeRequest struct{}
+
+func (m *QueryCurrentTreeRequest) Reset() { *m = QueryCurrentTreeRequest{} }
+func (m *QueryCurrentTreeRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryCurrentTreeRequest) ProtoMessage() {}
+func (*QueryCurrentTreeRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_567dd9a34f8715cd, []int{2}
+}
+
+func (m *QueryCurrentTreeRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+
+func (m *QueryCurrentTreeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryCurrentTreeRequest.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 *QueryCurrentTreeRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryCurrentTreeRequest.Merge(m, src)
+}
+
+func (m *QueryCurrentTreeRequest) XXX_Size() int {
+ return m.Size()
+}
+
+func (m *QueryCurrentTreeRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryCurrentTreeRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryCurrentTreeRequest proto.InternalMessageInfo
+
+// QueryCurrentTreeResponse is the response type for the Query/Tree RPC method
+type QueryCurrentTreeResponse struct {
+ Branches [][]byte `protobuf:"bytes,1,rep,name=branches,proto3" json:"branches,omitempty"`
+ Count uint32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
+}
+
+func (m *QueryCurrentTreeResponse) Reset() { *m = QueryCurrentTreeResponse{} }
+func (m *QueryCurrentTreeResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryCurrentTreeResponse) ProtoMessage() {}
+func (*QueryCurrentTreeResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_567dd9a34f8715cd, []int{3}
+}
+
+func (m *QueryCurrentTreeResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+
+func (m *QueryCurrentTreeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryCurrentTreeResponse.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 *QueryCurrentTreeResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryCurrentTreeResponse.Merge(m, src)
+}
+
+func (m *QueryCurrentTreeResponse) XXX_Size() int {
+ return m.Size()
+}
+
+func (m *QueryCurrentTreeResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryCurrentTreeResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryCurrentTreeResponse proto.InternalMessageInfo
+
+func (m *QueryCurrentTreeResponse) GetBranches() [][]byte {
+ if m != nil {
+ return m.Branches
+ }
+ return nil
+}
+
+func (m *QueryCurrentTreeResponse) GetCount() uint32 {
+ if m != nil {
+ return m.Count
+ }
+ return 0
+}
+
// QueryDomain is the request type for the Query/Domain RPC
// method.
type QueryDomainRequest struct{}
@@ -139,7 +239,7 @@ func (m *QueryDomainRequest) Reset() { *m = QueryDomainRequest{} }
func (m *QueryDomainRequest) String() string { return proto.CompactTextString(m) }
func (*QueryDomainRequest) ProtoMessage() {}
func (*QueryDomainRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_567dd9a34f8715cd, []int{2}
+ return fileDescriptor_567dd9a34f8715cd, []int{4}
}
func (m *QueryDomainRequest) XXX_Unmarshal(b []byte) error {
@@ -182,7 +282,7 @@ func (m *QueryDomainResponse) Reset() { *m = QueryDomainResponse{} }
func (m *QueryDomainResponse) String() string { return proto.CompactTextString(m) }
func (*QueryDomainResponse) ProtoMessage() {}
func (*QueryDomainResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_567dd9a34f8715cd, []int{3}
+ return fileDescriptor_567dd9a34f8715cd, []int{5}
}
func (m *QueryDomainResponse) XXX_Unmarshal(b []byte) error {
@@ -226,6 +326,8 @@ func (m *QueryDomainResponse) GetDomain() uint32 {
func init() {
proto.RegisterType((*QueryCurrentTreeMetadataRequest)(nil), "hyperlane.mailbox.v1.QueryCurrentTreeMetadataRequest")
proto.RegisterType((*QueryCurrentTreeMetadataResponse)(nil), "hyperlane.mailbox.v1.QueryCurrentTreeMetadataResponse")
+ proto.RegisterType((*QueryCurrentTreeRequest)(nil), "hyperlane.mailbox.v1.QueryCurrentTreeRequest")
+ proto.RegisterType((*QueryCurrentTreeResponse)(nil), "hyperlane.mailbox.v1.QueryCurrentTreeResponse")
proto.RegisterType((*QueryDomainRequest)(nil), "hyperlane.mailbox.v1.QueryDomainRequest")
proto.RegisterType((*QueryDomainResponse)(nil), "hyperlane.mailbox.v1.QueryDomainResponse")
}
@@ -233,30 +335,34 @@ func init() {
func init() { proto.RegisterFile("hyperlane/mailbox/v1/query.proto", fileDescriptor_567dd9a34f8715cd) }
var fileDescriptor_567dd9a34f8715cd = []byte{
- // 365 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xbf, 0x6a, 0xe3, 0x40,
- 0x10, 0xc6, 0xbd, 0xe6, 0xec, 0x62, 0x39, 0x37, 0x6b, 0x73, 0x18, 0x61, 0x74, 0x3a, 0x71, 0x85,
- 0xaf, 0xb0, 0x16, 0xdf, 0x71, 0xa9, 0x43, 0x92, 0x32, 0x29, 0x22, 0x52, 0xb9, 0x5b, 0xdb, 0x83,
- 0x2c, 0x90, 0x76, 0xe4, 0xdd, 0x95, 0xb0, 0xdb, 0xe4, 0x05, 0x02, 0x79, 0x89, 0x3c, 0x42, 0x1e,
- 0x21, 0xa5, 0x21, 0x4d, 0xca, 0x60, 0xe7, 0x41, 0x42, 0x24, 0xc5, 0xc1, 0xa0, 0xfc, 0xeb, 0x34,
- 0xc3, 0x37, 0xbf, 0xf9, 0xe6, 0xd3, 0x52, 0x67, 0xb6, 0x4c, 0x40, 0x45, 0x42, 0x02, 0x8f, 0x45,
- 0x18, 0x8d, 0x71, 0xc1, 0xb3, 0x21, 0x9f, 0xa7, 0xa0, 0x96, 0x5e, 0xa2, 0xd0, 0x20, 0xeb, 0x6c,
- 0x15, 0x5e, 0xa9, 0xf0, 0xb2, 0xa1, 0xd5, 0x0b, 0x10, 0x83, 0x08, 0xb8, 0x48, 0x42, 0x2e, 0xa4,
- 0x44, 0x23, 0x4c, 0x88, 0x52, 0x17, 0x33, 0xee, 0x2f, 0xfa, 0xf3, 0xf4, 0x19, 0x71, 0x98, 0x2a,
- 0x05, 0xd2, 0x9c, 0x29, 0x80, 0x13, 0x30, 0x62, 0x2a, 0x8c, 0xf0, 0x61, 0x9e, 0x82, 0x36, 0xee,
- 0x31, 0x75, 0xde, 0x96, 0xe8, 0x04, 0xa5, 0x06, 0xc6, 0xe8, 0x37, 0x85, 0x68, 0xba, 0xc4, 0x21,
- 0xfd, 0xef, 0x7e, 0xfe, 0xcd, 0x3a, 0xb4, 0x31, 0xc1, 0x54, 0x9a, 0x6e, 0xdd, 0x21, 0xfd, 0x96,
- 0x5f, 0x14, 0x6e, 0x87, 0xb2, 0x9c, 0x76, 0x84, 0xb1, 0x08, 0xe5, 0xcb, 0x8e, 0x01, 0x6d, 0xef,
- 0x74, 0x4b, 0xec, 0x0f, 0xda, 0x9c, 0xe6, 0x9d, 0x1c, 0xdc, 0xf2, 0xcb, 0xea, 0xef, 0x4d, 0x9d,
- 0x36, 0x72, 0x3d, 0xbb, 0x26, 0xb4, 0x5d, 0x61, 0x8c, 0xfd, 0xf7, 0xaa, 0xc2, 0xf0, 0x3e, 0xb8,
- 0xd5, 0xda, 0xfb, 0xea, 0x58, 0x61, 0xd4, 0x75, 0xcf, 0xef, 0x1e, 0xaf, 0xea, 0x3d, 0x66, 0xf1,
- 0xca, 0xbf, 0x64, 0x14, 0x00, 0xbb, 0x20, 0xb4, 0x59, 0xdc, 0xc7, 0xfa, 0xef, 0xac, 0xd9, 0x09,
- 0xc6, 0xfa, 0xf3, 0x09, 0x65, 0xe9, 0xe1, 0x77, 0xee, 0xc1, 0x66, 0xbd, 0x6a, 0x0f, 0x45, 0x74,
- 0x07, 0xa3, 0xdb, 0xb5, 0x4d, 0x56, 0x6b, 0x9b, 0x3c, 0xac, 0x6d, 0x72, 0xb9, 0xb1, 0x6b, 0xab,
- 0x8d, 0x5d, 0xbb, 0xdf, 0xd8, 0xb5, 0xd1, 0x7e, 0x10, 0x9a, 0x59, 0x3a, 0xf6, 0x26, 0x18, 0x73,
- 0x6d, 0x94, 0x90, 0x01, 0x44, 0x98, 0xc1, 0x20, 0x03, 0x69, 0x52, 0x05, 0xfa, 0x15, 0x3b, 0x98,
- 0xa0, 0x8e, 0x51, 0xf3, 0xc5, 0x96, 0x6f, 0x96, 0x09, 0xe8, 0x71, 0x33, 0x7f, 0x53, 0xff, 0x9e,
- 0x02, 0x00, 0x00, 0xff, 0xff, 0x0c, 0xea, 0x06, 0xa2, 0xab, 0x02, 0x00, 0x00,
+ // 425 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xc1, 0x6e, 0xd3, 0x40,
+ 0x14, 0x45, 0x33, 0x2d, 0x8d, 0xd0, 0xd0, 0x6e, 0xa6, 0x11, 0x04, 0x2b, 0x32, 0xc6, 0x80, 0x64,
+ 0x84, 0xec, 0x51, 0x41, 0xb0, 0x46, 0xc0, 0x12, 0x16, 0x58, 0xac, 0xba, 0x41, 0x63, 0xf7, 0xc9,
+ 0xb1, 0x64, 0xcf, 0x73, 0x67, 0xc6, 0x56, 0xb3, 0x85, 0x1f, 0xa8, 0xc4, 0x97, 0xf0, 0x17, 0x2c,
+ 0x2b, 0xc1, 0x82, 0x25, 0x4a, 0xf8, 0x10, 0xc4, 0xd8, 0x49, 0x09, 0x38, 0x10, 0x76, 0x7e, 0xe3,
+ 0x3b, 0xf7, 0x9e, 0x77, 0x65, 0x53, 0x6f, 0x3a, 0xab, 0x40, 0x15, 0x42, 0x02, 0x2f, 0x45, 0x5e,
+ 0x24, 0x78, 0xc6, 0x9b, 0x23, 0x7e, 0x5a, 0x83, 0x9a, 0x45, 0x95, 0x42, 0x83, 0x6c, 0xb4, 0x52,
+ 0x44, 0x9d, 0x22, 0x6a, 0x8e, 0x9c, 0x49, 0x86, 0x98, 0x15, 0xc0, 0x45, 0x95, 0x73, 0x21, 0x25,
+ 0x1a, 0x61, 0x72, 0x94, 0xba, 0xbd, 0xe3, 0xdf, 0xa6, 0xb7, 0x5e, 0xff, 0xb4, 0x78, 0x5e, 0x2b,
+ 0x05, 0xd2, 0xbc, 0x51, 0x00, 0xaf, 0xc0, 0x88, 0x13, 0x61, 0x44, 0x0c, 0xa7, 0x35, 0x68, 0xe3,
+ 0xbf, 0xa4, 0xde, 0x66, 0x89, 0xae, 0x50, 0x6a, 0x60, 0x8c, 0x5e, 0x51, 0x88, 0x66, 0x4c, 0x3c,
+ 0x12, 0xec, 0xc7, 0xf6, 0x99, 0x8d, 0xe8, 0x5e, 0x8a, 0xb5, 0x34, 0xe3, 0x1d, 0x8f, 0x04, 0x07,
+ 0x71, 0x3b, 0xf8, 0x37, 0xe9, 0x8d, 0xdf, 0xdd, 0x2e, 0x83, 0xc6, 0x7f, 0xbe, 0xea, 0x02, 0x1c,
+ 0x7a, 0x35, 0x51, 0x42, 0xa6, 0x53, 0xd0, 0x63, 0xe2, 0xed, 0x06, 0xfb, 0xf1, 0x6a, 0xde, 0x10,
+ 0x34, 0xa2, 0xcc, 0xba, 0xbd, 0xc0, 0x52, 0xe4, 0x72, 0x99, 0x11, 0xd2, 0xc3, 0xb5, 0xd3, 0xce,
+ 0xfe, 0x3a, 0x1d, 0x9e, 0xd8, 0x13, 0xbb, 0xc1, 0x41, 0xdc, 0x4d, 0x0f, 0xbf, 0xec, 0xd2, 0x3d,
+ 0xab, 0x67, 0x1f, 0x09, 0x3d, 0xec, 0x69, 0x80, 0x3d, 0x8e, 0xfa, 0x5a, 0x8f, 0xfe, 0x51, 0xaa,
+ 0xf3, 0xe4, 0x7f, 0xaf, 0xb5, 0xa0, 0xfe, 0x83, 0x77, 0x9f, 0xbf, 0x7f, 0xd8, 0xb9, 0xc7, 0xee,
+ 0xf0, 0xde, 0xcf, 0xc1, 0x28, 0x80, 0xb7, 0xe5, 0x92, 0xed, 0x3d, 0xa1, 0xc3, 0x76, 0x51, 0x16,
+ 0xfc, 0x25, 0x6f, 0xad, 0x21, 0xe7, 0xfe, 0x16, 0xca, 0x0e, 0xe6, 0xae, 0x85, 0x71, 0xd9, 0xa4,
+ 0x1f, 0xa6, 0xed, 0x90, 0x9d, 0x13, 0x7a, 0xed, 0x97, 0x95, 0x58, 0xb8, 0xdd, 0xea, 0x4b, 0x9e,
+ 0x68, 0x5b, 0x79, 0x07, 0xe5, 0x5b, 0xa8, 0x09, 0x73, 0x36, 0x37, 0xf4, 0xec, 0xf8, 0xd3, 0xdc,
+ 0x25, 0x17, 0x73, 0x97, 0x7c, 0x9b, 0xbb, 0xe4, 0x7c, 0xe1, 0x0e, 0x2e, 0x16, 0xee, 0xe0, 0xeb,
+ 0xc2, 0x1d, 0x1c, 0x3f, 0xcd, 0x72, 0x33, 0xad, 0x93, 0x28, 0xc5, 0x92, 0x6b, 0xa3, 0x84, 0xcc,
+ 0xa0, 0xc0, 0x06, 0xc2, 0x06, 0xa4, 0xa9, 0x15, 0xe8, 0x4b, 0xd3, 0x30, 0x45, 0x5d, 0xa2, 0xe6,
+ 0x67, 0x2b, 0x77, 0x33, 0xab, 0x40, 0x27, 0x43, 0xfb, 0x63, 0x3d, 0xfa, 0x11, 0x00, 0x00, 0xff,
+ 0xff, 0x15, 0x17, 0x10, 0x83, 0xb0, 0x03, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -277,6 +383,8 @@ type QueryClient interface {
CurrentTreeMetadata(ctx context.Context, in *QueryCurrentTreeMetadataRequest, opts ...grpc.CallOption) (*QueryCurrentTreeMetadataResponse, error)
// Get domain
Domain(ctx context.Context, in *QueryDomainRequest, opts ...grpc.CallOption) (*QueryDomainResponse, error)
+ // Get current tree
+ CurrentTree(ctx context.Context, in *QueryCurrentTreeRequest, opts ...grpc.CallOption) (*QueryCurrentTreeResponse, error)
}
type queryClient struct {
@@ -305,12 +413,23 @@ func (c *queryClient) Domain(ctx context.Context, in *QueryDomainRequest, opts .
return out, nil
}
+func (c *queryClient) CurrentTree(ctx context.Context, in *QueryCurrentTreeRequest, opts ...grpc.CallOption) (*QueryCurrentTreeResponse, error) {
+ out := new(QueryCurrentTreeResponse)
+ err := c.cc.Invoke(ctx, "/hyperlane.mailbox.v1.Query/CurrentTree", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// QueryServer is the server API for Query service.
type QueryServer interface {
// Get current tree metadata
CurrentTreeMetadata(context.Context, *QueryCurrentTreeMetadataRequest) (*QueryCurrentTreeMetadataResponse, error)
// Get domain
Domain(context.Context, *QueryDomainRequest) (*QueryDomainResponse, error)
+ // Get current tree
+ CurrentTree(context.Context, *QueryCurrentTreeRequest) (*QueryCurrentTreeResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@@ -324,6 +443,10 @@ func (*UnimplementedQueryServer) Domain(ctx context.Context, req *QueryDomainReq
return nil, status.Errorf(codes.Unimplemented, "method Domain not implemented")
}
+func (*UnimplementedQueryServer) CurrentTree(ctx context.Context, req *QueryCurrentTreeRequest) (*QueryCurrentTreeResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CurrentTree not implemented")
+}
+
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
@@ -364,6 +487,24 @@ func _Query_Domain_Handler(srv interface{}, ctx context.Context, dec func(interf
return interceptor(ctx, in, info, handler)
}
+func _Query_CurrentTree_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryCurrentTreeRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).CurrentTree(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/hyperlane.mailbox.v1.Query/CurrentTree",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).CurrentTree(ctx, req.(*QueryCurrentTreeRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "hyperlane.mailbox.v1.Query",
HandlerType: (*QueryServer)(nil),
@@ -376,6 +517,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Domain",
Handler: _Query_Domain_Handler,
},
+ {
+ MethodName: "CurrentTree",
+ Handler: _Query_CurrentTree_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "hyperlane/mailbox/v1/query.proto",
@@ -439,6 +584,66 @@ func (m *QueryCurrentTreeMetadataResponse) MarshalToSizedBuffer(dAtA []byte) (in
return len(dAtA) - i, nil
}
+func (m *QueryCurrentTreeRequest) 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 *QueryCurrentTreeRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryCurrentTreeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ return len(dAtA) - i, nil
+}
+
+func (m *QueryCurrentTreeResponse) 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 *QueryCurrentTreeResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryCurrentTreeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Count != 0 {
+ i = encodeVarintQuery(dAtA, i, uint64(m.Count))
+ i--
+ dAtA[i] = 0x10
+ }
+ if len(m.Branches) > 0 {
+ for iNdEx := len(m.Branches) - 1; iNdEx >= 0; iNdEx-- {
+ i -= len(m.Branches[iNdEx])
+ copy(dAtA[i:], m.Branches[iNdEx])
+ i = encodeVarintQuery(dAtA, i, uint64(len(m.Branches[iNdEx])))
+ i--
+ dAtA[i] = 0xa
+ }
+ }
+ return len(dAtA) - i, nil
+}
+
func (m *QueryDomainRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -527,6 +732,33 @@ func (m *QueryCurrentTreeMetadataResponse) Size() (n int) {
return n
}
+func (m *QueryCurrentTreeRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ return n
+}
+
+func (m *QueryCurrentTreeResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if len(m.Branches) > 0 {
+ for _, b := range m.Branches {
+ l = len(b)
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ }
+ if m.Count != 0 {
+ n += 1 + sovQuery(uint64(m.Count))
+ }
+ return n
+}
+
func (m *QueryDomainRequest) Size() (n int) {
if m == nil {
return 0
@@ -711,6 +943,159 @@ func (m *QueryCurrentTreeMetadataResponse) Unmarshal(dAtA []byte) error {
return nil
}
+func (m *QueryCurrentTreeRequest) 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: QueryCurrentTreeRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryCurrentTreeRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ 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 *QueryCurrentTreeResponse) 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: QueryCurrentTreeResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryCurrentTreeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Branches", wireType)
+ }
+ var byteLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ byteLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if byteLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Branches = append(m.Branches, make([]byte, postIndex-iNdEx))
+ copy(m.Branches[len(m.Branches)-1], dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType)
+ }
+ m.Count = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Count |= uint32(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ 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 *QueryDomainRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
diff --git a/x/mailbox/types/query.pb.gw.go b/x/mailbox/types/query.pb.gw.go
index 521124b..d4f5404 100644
--- a/x/mailbox/types/query.pb.gw.go
+++ b/x/mailbox/types/query.pb.gw.go
@@ -67,6 +67,22 @@ func local_request_Query_Domain_0(ctx context.Context, marshaler runtime.Marshal
return msg, metadata, err
}
+func request_Query_CurrentTree_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryCurrentTreeRequest
+ var metadata runtime.ServerMetadata
+
+ msg, err := client.CurrentTree(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_Query_CurrentTree_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryCurrentTreeRequest
+ var metadata runtime.ServerMetadata
+
+ msg, err := server.CurrentTree(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.
@@ -116,6 +132,28 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
forward_Query_Domain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle("GET", pattern_Query_CurrentTree_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_CurrentTree_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_CurrentTree_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+
return nil
}
@@ -194,17 +232,40 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
forward_Query_Domain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle("GET", pattern_Query_CurrentTree_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_CurrentTree_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_CurrentTree_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+
return nil
}
var (
- pattern_Query_CurrentTreeMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hyperlane", "mailbox", "v1", "tree"}, "", runtime.AssumeColonVerbOpt(false)))
+ pattern_Query_CurrentTreeMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hyperlane", "mailbox", "v1", "tree_metadata"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Domain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hyperlane", "mailbox", "v1", "domain"}, "", runtime.AssumeColonVerbOpt(false)))
+
+ pattern_Query_CurrentTree_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"hyperlane", "mailbox", "v1", "tree"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_CurrentTreeMetadata_0 = runtime.ForwardResponseMessage
forward_Query_Domain_0 = runtime.ForwardResponseMessage
+
+ forward_Query_CurrentTree_0 = runtime.ForwardResponseMessage
)