From b00074379181aaea847c0ad3b45205c12559449f Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Fri, 3 May 2024 18:29:27 +0900 Subject: [PATCH 1/5] feat: add SeqToBlocknum --- client/docs/swagger-ui/swagger.yaml | 319 ++++++++----- docs/core/proto-docs.md | 47 +- proto/lbm/fbridge/v1/fbridge.proto | 2 +- proto/lbm/fbridge/v1/genesis.proto | 2 +- proto/lbm/fbridge/v1/query.proto | 30 +- x/fbridge/client/cli/query.go | 46 +- x/fbridge/keeper/genesis.go | 23 +- x/fbridge/keeper/grpc_query.go | 18 + x/fbridge/keeper/transfer.go | 18 + x/fbridge/keeper/transfer_test.go | 3 + x/fbridge/types/genesis.pb.go | 90 ++-- x/fbridge/types/keys.go | 13 +- x/fbridge/types/query.pb.go | 708 ++++++++++++++++++++++++---- x/fbridge/types/query.pb.gw.go | 94 +++- 14 files changed, 1106 insertions(+), 307 deletions(-) diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index c56e21d150..30b1c66412 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -29799,17 +29799,17 @@ paths: format: byte tags: - Service - '/lbm/fbridge/v1/commitments/{seq}': + /lbm/fbridge/v1/guardians: get: - summary: Commitments queries commitments of a specific sequence number - operationId: FBridgeCommitments + summary: Guardians queries a list of Guardians registered on the bridge + operationId: FBridgeGuardians responses: '200': description: A successful response. schema: type: object properties: - commitments: + guardians: type: array items: type: string @@ -29835,30 +29835,22 @@ paths: value: type: string format: byte - parameters: - - name: seq - description: the sequence number of the bridge request - in: path - required: true - type: string - format: uint64 tags: - Query - /lbm/fbridge/v1/greatest_confirmed_seq: + /lbm/fbridge/v1/judges: get: - summary: >- - GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence - number confirmed by n-of-m operators - operationId: GreatestConsecutiveConfirmedSeq + summary: Judges queries a list of Judges registered on the bridge + operationId: FBridgeJudges responses: '200': description: A successful response. schema: type: object properties: - seq: - type: string - format: uint64 + judges: + type: array + items: + type: string default: description: An unexpected error response schema: @@ -29883,17 +29875,17 @@ paths: format: byte tags: - Query - /lbm/fbridge/v1/guardians: + /lbm/fbridge/v1/operators: get: - summary: Guardians queries a list of Guardians registered on the bridge - operationId: FBridgeGuardians + summary: Operators queries a list of Operators registered on the bridge + operationId: FBridgeOperators responses: '200': description: A successful response. schema: type: object properties: - guardians: + operators: type: array items: type: string @@ -29921,20 +29913,65 @@ paths: format: byte tags: - Query - /lbm/fbridge/v1/judges: + /lbm/fbridge/v1/params: get: - summary: Judges queries a list of Judges registered on the bridge - operationId: FBridgeJudges + summary: Params queries the parameters of x/fbridge module. + operationId: FBridgeParams responses: '200': description: A successful response. schema: type: object properties: - judges: - type: array - items: - type: string + params: + type: object + properties: + operator_trust_level: + description: >- + ratio of how many operators' confirmations are needed to + be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + guardian_trust_level: + description: >- + ratio of how many guardians' confirmations are needed to + be valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + judge_trust_level: + description: >- + ratio of how many judges' confirmations are needed to be + valid. + type: object + properties: + numerator: + type: string + format: uint64 + denominator: + type: string + format: uint64 + timelock_period: + type: string + format: uint64 + title: >- + default timelock period for each provision (unix + timestamp) + proposal_period: + type: string + format: uint64 + title: default period of the proposal to update the role default: description: An unexpected error response schema: @@ -29959,19 +29996,20 @@ paths: format: byte tags: - Query - /lbm/fbridge/v1/nextseq_send: + '/lbm/fbridge/v1/receiving/commitments/{seq}': get: - summary: NextSeqSend queries the sequence of next bridge request - operationId: NextSeqSend + summary: Commitments queries commitments of a specific sequence number + operationId: FBridgeCommitments responses: '200': description: A successful response. schema: type: object properties: - seq: - type: string - format: uint64 + commitments: + type: array + items: + type: string default: description: An unexpected error response schema: @@ -29994,22 +30032,30 @@ paths: value: type: string format: byte + parameters: + - name: seq + description: the sequence number of the bridge request + in: path + required: true + type: string + format: uint64 tags: - Query - /lbm/fbridge/v1/operators: + /lbm/fbridge/v1/receiving/greatest_confirmed_seq: get: - summary: Operators queries a list of Operators registered on the bridge - operationId: FBridgeOperators + summary: >- + GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence + number confirmed by n-of-m operators + operationId: GreatestConsecutiveConfirmedSeq responses: '200': description: A successful response. schema: type: object properties: - operators: - type: array - items: - type: string + seq: + type: string + format: uint64 default: description: An unexpected error response schema: @@ -30034,7 +30080,7 @@ paths: format: byte tags: - Query - '/lbm/fbridge/v1/operators/{operator}/needed_submission_seqs': + '/lbm/fbridge/v1/receiving/operators/{operator}/needed_submission_seqs': get: summary: >- NeededSubmissionSeqs queries a list of sequence numbers that need to be @@ -30095,7 +30141,7 @@ paths: format: uint64 tags: - Query - '/lbm/fbridge/v1/operators/{operator}/provision/{seq}': + '/lbm/fbridge/v1/receiving/operators/{operator}/provision/{seq}': get: summary: >- SubmittedProvision queries a provision submitted by a particular @@ -30185,7 +30231,7 @@ paths: format: uint64 tags: - Query - '/lbm/fbridge/v1/operators/{operator}/seq': + '/lbm/fbridge/v1/receiving/operators/{operator}/seq': get: summary: >- GreatestSeqByOperator queries a greatest sequence number confirmed by a @@ -30230,90 +30276,7 @@ paths: type: string tags: - Query - /lbm/fbridge/v1/params: - get: - summary: Params queries the parameters of x/fbridge module. - operationId: FBridgeParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - type: object - properties: - operator_trust_level: - description: >- - ratio of how many operators' confirmations are needed to - be valid. - type: object - properties: - numerator: - type: string - format: uint64 - denominator: - type: string - format: uint64 - guardian_trust_level: - description: >- - ratio of how many guardians' confirmations are needed to - be valid. - type: object - properties: - numerator: - type: string - format: uint64 - denominator: - type: string - format: uint64 - judge_trust_level: - description: >- - ratio of how many judges' confirmations are needed to be - valid. - type: object - properties: - numerator: - type: string - format: uint64 - denominator: - type: string - format: uint64 - timelock_period: - type: string - format: uint64 - title: >- - default timelock period for each provision (unix - timestamp) - proposal_period: - type: string - format: uint64 - title: default period of the proposal to update the role - default: - description: An unexpected error response - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - tags: - - Query - '/lbm/fbridge/v1/provision/{seq}': + '/lbm/fbridge/v1/receiving/provision/{seq}': get: summary: ConfirmedProvision queries a particular sequence of confirmed provisions operationId: ConfirmedProvision @@ -30606,6 +30569,94 @@ paths: type: string tags: - Query + /lbm/fbridge/v1/sending/blocknums: + get: + summary: >- + BlocknumToSeqs queries a list of block numbers for which each sequence + has been confirmed. + operationId: SeqToBlocknums + responses: + '200': + description: A successful response. + schema: + type: object + properties: + blocknums: + type: array + items: + type: string + format: uint64 + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: seqs + description: list of sequence number of the bridge request. + in: query + required: false + type: array + items: + type: string + format: uint64 + collectionFormat: multi + tags: + - Query + /lbm/fbridge/v1/sending/nextseq: + get: + summary: NextSeqSend queries the sequence of next bridge request + operationId: NextSeqSend + responses: + '200': + description: A successful response. + schema: + type: object + properties: + seq: + type: string + format: uint64 + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query definitions: cosmos.auth.v1beta1.Params: type: object @@ -50455,6 +50506,14 @@ definitions: type: string format: uint64 title: the unix timestamp the proposal will be expired (unix timestamp) + lbm.fbridge.v1.QuerySeqToBlocknumsResponse: + type: object + properties: + blocknums: + type: array + items: + type: string + format: uint64 lbm.fbridge.v1.QuerySubmittedProvisionResponse: type: object properties: diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 8982d795db..736b4ac62b 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -804,6 +804,8 @@ - [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) - [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) - [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) + - [QuerySeqToBlocknumsRequest](#lbm.fbridge.v1.QuerySeqToBlocknumsRequest) + - [QuerySeqToBlocknumsResponse](#lbm.fbridge.v1.QuerySeqToBlocknumsResponse) - [QuerySubmittedProvisionRequest](#lbm.fbridge.v1.QuerySubmittedProvisionRequest) - [QuerySubmittedProvisionResponse](#lbm.fbridge.v1.QuerySubmittedProvisionResponse) @@ -12079,6 +12081,36 @@ GenesisState defines the fbridge module's genesis state. + + +### QuerySeqToBlocknumsRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seqs` | [uint64](#uint64) | repeated | list of sequence number of the bridge request | + + + + + + + + +### QuerySeqToBlocknumsResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `blocknums` | [uint64](#uint64) | repeated | | + + + + + + ### QuerySubmittedProvisionRequest @@ -12125,13 +12157,14 @@ GenesisState defines the fbridge module's genesis state. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | | `Params` | [QueryParamsRequest](#lbm.fbridge.v1.QueryParamsRequest) | [QueryParamsResponse](#lbm.fbridge.v1.QueryParamsResponse) | Params queries the parameters of x/fbridge module. | GET|/lbm/fbridge/v1/params| -| `NextSeqSend` | [QueryNextSeqSendRequest](#lbm.fbridge.v1.QueryNextSeqSendRequest) | [QueryNextSeqSendResponse](#lbm.fbridge.v1.QueryNextSeqSendResponse) | NextSeqSend queries the sequence of next bridge request | GET|/lbm/fbridge/v1/nextseq_send| -| `GreatestSeqByOperator` | [QueryGreatestSeqByOperatorRequest](#lbm.fbridge.v1.QueryGreatestSeqByOperatorRequest) | [QueryGreatestSeqByOperatorResponse](#lbm.fbridge.v1.QueryGreatestSeqByOperatorResponse) | GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator | GET|/lbm/fbridge/v1/operators/{operator}/seq| -| `GreatestConsecutiveConfirmedSeq` | [QueryGreatestConsecutiveConfirmedSeqRequest](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqRequest) | [QueryGreatestConsecutiveConfirmedSeqResponse](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqResponse) | GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence number confirmed by n-of-m operators | GET|/lbm/fbridge/v1/greatest_confirmed_seq| -| `SubmittedProvision` | [QuerySubmittedProvisionRequest](#lbm.fbridge.v1.QuerySubmittedProvisionRequest) | [QuerySubmittedProvisionResponse](#lbm.fbridge.v1.QuerySubmittedProvisionResponse) | SubmittedProvision queries a provision submitted by a particular operator | GET|/lbm/fbridge/v1/operators/{operator}/provision/{seq}| -| `ConfirmedProvision` | [QueryConfirmedProvisionRequest](#lbm.fbridge.v1.QueryConfirmedProvisionRequest) | [QueryConfirmedProvisionResponse](#lbm.fbridge.v1.QueryConfirmedProvisionResponse) | ConfirmedProvision queries a particular sequence of confirmed provisions | GET|/lbm/fbridge/v1/provision/{seq}| -| `NeededSubmissionSeqs` | [QueryNeededSubmissionSeqsRequest](#lbm.fbridge.v1.QueryNeededSubmissionSeqsRequest) | [QueryNeededSubmissionSeqsResponse](#lbm.fbridge.v1.QueryNeededSubmissionSeqsResponse) | NeededSubmissionSeqs queries a list of sequence numbers that need to be submitted by a particular operator The search scope is [greatest_consecutive_seq_by_operator, min(greatest_consecutive_seq_by_operator + range, greatest_seq_by_operator)] greatest_consecutive_seq_by_operator can be replaced with greatest_consecutive_seq if the operator is newly added | GET|/lbm/fbridge/v1/operators/{operator}/needed_submission_seqs| -| `Commitments` | [QueryCommitmentsRequest](#lbm.fbridge.v1.QueryCommitmentsRequest) | [QueryCommitmentsResponse](#lbm.fbridge.v1.QueryCommitmentsResponse) | Commitments queries commitments of a specific sequence number | GET|/lbm/fbridge/v1/commitments/{seq}| +| `NextSeqSend` | [QueryNextSeqSendRequest](#lbm.fbridge.v1.QueryNextSeqSendRequest) | [QueryNextSeqSendResponse](#lbm.fbridge.v1.QueryNextSeqSendResponse) | NextSeqSend queries the sequence of next bridge request | GET|/lbm/fbridge/v1/sending/nextseq| +| `SeqToBlocknums` | [QuerySeqToBlocknumsRequest](#lbm.fbridge.v1.QuerySeqToBlocknumsRequest) | [QuerySeqToBlocknumsResponse](#lbm.fbridge.v1.QuerySeqToBlocknumsResponse) | BlocknumToSeqs queries a list of block numbers for which each sequence has been confirmed. | GET|/lbm/fbridge/v1/sending/blocknums| +| `GreatestSeqByOperator` | [QueryGreatestSeqByOperatorRequest](#lbm.fbridge.v1.QueryGreatestSeqByOperatorRequest) | [QueryGreatestSeqByOperatorResponse](#lbm.fbridge.v1.QueryGreatestSeqByOperatorResponse) | GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator | GET|/lbm/fbridge/v1/receiving/operators/{operator}/seq| +| `GreatestConsecutiveConfirmedSeq` | [QueryGreatestConsecutiveConfirmedSeqRequest](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqRequest) | [QueryGreatestConsecutiveConfirmedSeqResponse](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqResponse) | GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence number confirmed by n-of-m operators | GET|/lbm/fbridge/v1/receiving/greatest_confirmed_seq| +| `SubmittedProvision` | [QuerySubmittedProvisionRequest](#lbm.fbridge.v1.QuerySubmittedProvisionRequest) | [QuerySubmittedProvisionResponse](#lbm.fbridge.v1.QuerySubmittedProvisionResponse) | SubmittedProvision queries a provision submitted by a particular operator | GET|/lbm/fbridge/v1/receiving/operators/{operator}/provision/{seq}| +| `ConfirmedProvision` | [QueryConfirmedProvisionRequest](#lbm.fbridge.v1.QueryConfirmedProvisionRequest) | [QueryConfirmedProvisionResponse](#lbm.fbridge.v1.QueryConfirmedProvisionResponse) | ConfirmedProvision queries a particular sequence of confirmed provisions | GET|/lbm/fbridge/v1/receiving/provision/{seq}| +| `NeededSubmissionSeqs` | [QueryNeededSubmissionSeqsRequest](#lbm.fbridge.v1.QueryNeededSubmissionSeqsRequest) | [QueryNeededSubmissionSeqsResponse](#lbm.fbridge.v1.QueryNeededSubmissionSeqsResponse) | NeededSubmissionSeqs queries a list of sequence numbers that need to be submitted by a particular operator The search scope is [greatest_consecutive_seq_by_operator, min(greatest_consecutive_seq_by_operator + range, greatest_seq_by_operator)] greatest_consecutive_seq_by_operator can be replaced with greatest_consecutive_seq if the operator is newly added | GET|/lbm/fbridge/v1/receiving/operators/{operator}/needed_submission_seqs| +| `Commitments` | [QueryCommitmentsRequest](#lbm.fbridge.v1.QueryCommitmentsRequest) | [QueryCommitmentsResponse](#lbm.fbridge.v1.QueryCommitmentsResponse) | Commitments queries commitments of a specific sequence number | GET|/lbm/fbridge/v1/receiving/commitments/{seq}| | `Guardians` | [QueryGuardiansRequest](#lbm.fbridge.v1.QueryGuardiansRequest) | [QueryGuardiansResponse](#lbm.fbridge.v1.QueryGuardiansResponse) | Guardians queries a list of Guardians registered on the bridge | GET|/lbm/fbridge/v1/guardians| | `Operators` | [QueryOperatorsRequest](#lbm.fbridge.v1.QueryOperatorsRequest) | [QueryOperatorsResponse](#lbm.fbridge.v1.QueryOperatorsResponse) | Operators queries a list of Operators registered on the bridge | GET|/lbm/fbridge/v1/operators| | `Judges` | [QueryJudgesRequest](#lbm.fbridge.v1.QueryJudgesRequest) | [QueryJudgesResponse](#lbm.fbridge.v1.QueryJudgesResponse) | Judges queries a list of Judges registered on the bridge | GET|/lbm/fbridge/v1/judges| diff --git a/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto index 6db9506e53..fccbf79a22 100644 --- a/proto/lbm/fbridge/v1/fbridge.proto +++ b/proto/lbm/fbridge/v1/fbridge.proto @@ -72,4 +72,4 @@ message RoleProposal { // the unix timestamp the proposal will be expired (unix timestamp) uint64 expired_at = 5; -} \ No newline at end of file +} diff --git a/proto/lbm/fbridge/v1/genesis.proto b/proto/lbm/fbridge/v1/genesis.proto index 087d1acca9..35775047b2 100644 --- a/proto/lbm/fbridge/v1/genesis.proto +++ b/proto/lbm/fbridge/v1/genesis.proto @@ -22,7 +22,7 @@ message SendingState { // the next sequence number of the bridge request (greatest sequence number + 1) uint64 next_seq = 1; // sequence-per-block number mapping - repeated BlockSeqInfo seq_to_blocknum = 2; + repeated BlockSeqInfo seq_to_blocknum = 2 [(gogoproto.nullable) = false]; } message BlockSeqInfo { diff --git a/proto/lbm/fbridge/v1/query.proto b/proto/lbm/fbridge/v1/query.proto index 900aac4e8b..120039df88 100644 --- a/proto/lbm/fbridge/v1/query.proto +++ b/proto/lbm/fbridge/v1/query.proto @@ -16,28 +16,33 @@ service Query { // NextSeqSend queries the sequence of next bridge request rpc NextSeqSend(QueryNextSeqSendRequest) returns (QueryNextSeqSendResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/nextseq_send"; + option (google.api.http).get = "/lbm/fbridge/v1/sending/nextseq"; + } + + // BlocknumToSeqs queries a list of block numbers for which each sequence has been confirmed. + rpc SeqToBlocknums(QuerySeqToBlocknumsRequest) returns (QuerySeqToBlocknumsResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/sending/blocknums"; } // GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator rpc GreatestSeqByOperator(QueryGreatestSeqByOperatorRequest) returns (QueryGreatestSeqByOperatorResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/operators/{operator}/seq"; + option (google.api.http).get = "/lbm/fbridge/v1/receiving/operators/{operator}/seq"; } // GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence number confirmed by n-of-m operators rpc GreatestConsecutiveConfirmedSeq(QueryGreatestConsecutiveConfirmedSeqRequest) returns (QueryGreatestConsecutiveConfirmedSeqResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/greatest_confirmed_seq"; + option (google.api.http).get = "/lbm/fbridge/v1/receiving/greatest_confirmed_seq"; } // SubmittedProvision queries a provision submitted by a particular operator rpc SubmittedProvision(QuerySubmittedProvisionRequest) returns (QuerySubmittedProvisionResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/operators/{operator}/provision/{seq}"; + option (google.api.http).get = "/lbm/fbridge/v1/receiving/operators/{operator}/provision/{seq}"; } // ConfirmedProvision queries a particular sequence of confirmed provisions rpc ConfirmedProvision(QueryConfirmedProvisionRequest) returns (QueryConfirmedProvisionResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/provision/{seq}"; + option (google.api.http).get = "/lbm/fbridge/v1/receiving/provision/{seq}"; } // NeededSubmissionSeqs queries a list of sequence numbers that need to be submitted by a particular operator @@ -45,12 +50,12 @@ service Query { // greatest_seq_by_operator)] greatest_consecutive_seq_by_operator can be replaced with greatest_consecutive_seq if // the operator is newly added rpc NeededSubmissionSeqs(QueryNeededSubmissionSeqsRequest) returns (QueryNeededSubmissionSeqsResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/operators/{operator}/needed_submission_seqs"; + option (google.api.http).get = "/lbm/fbridge/v1/receiving/operators/{operator}/needed_submission_seqs"; } // Commitments queries commitments of a specific sequence number rpc Commitments(QueryCommitmentsRequest) returns (QueryCommitmentsResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/commitments/{seq}"; + option (google.api.http).get = "/lbm/fbridge/v1/receiving/commitments/{seq}"; } // Guardians queries a list of Guardians registered on the bridge @@ -91,6 +96,15 @@ message QueryNextSeqSendResponse { uint64 seq = 1; } +message QuerySeqToBlocknumsRequest { + // list of sequence number of the bridge request + repeated uint64 seqs = 1; +} + +message QuerySeqToBlocknumsResponse { + repeated uint64 blocknums = 1; +} + message QueryGreatestSeqByOperatorRequest { // the address of the operator string operator = 1; @@ -182,4 +196,4 @@ message QueryProposalRequest { message QueryProposalResponse { RoleProposal proposal = 1; -} \ No newline at end of file +} diff --git a/x/fbridge/client/cli/query.go b/x/fbridge/client/cli/query.go index 10cd8c5588..d0714ca4cb 100644 --- a/x/fbridge/client/cli/query.go +++ b/x/fbridge/client/cli/query.go @@ -1,6 +1,8 @@ package cli import ( + "fmt" + "github.com/Finschia/finschia-sdk/version" "github.com/spf13/cobra" "github.com/Finschia/finschia-sdk/client" @@ -8,6 +10,10 @@ import ( "github.com/Finschia/finschia-sdk/x/fbridge/types" ) +const ( + flagSequences = "sequences" +) + // NewQueryCmd returns the query commands for fbridge module func NewQueryCmd() *cobra.Command { cmd := &cobra.Command{ @@ -17,6 +23,7 @@ func NewQueryCmd() *cobra.Command { cmd.AddCommand( NewQueryNextSeqSendCmd(), + NewQuerySeqToBlocknumsCmd(), ) return cmd @@ -24,7 +31,7 @@ func NewQueryCmd() *cobra.Command { func NewQueryNextSeqSendCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "nextseq-send", + Use: "sending-next-seq", Short: "Query the next sequence number for sending", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { @@ -45,3 +52,40 @@ func NewQueryNextSeqSendCmd() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +func NewQuerySeqToBlocknumsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "seq-to-blocknums", + Short: "Query the block number for given sequence numbers", + Args: cobra.NoArgs, + Example: fmt.Sprintf("%s query %s sending seq-to-blocknums --sequences=1,2,3", version.AppName, types.ModuleName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + qc := types.NewQueryClient(clientCtx) + + seqSlice, err := cmd.Flags().GetInt64Slice(flagSequences) + if err != nil { + return err + } + + seqs := make([]uint64, len(seqSlice)) + for i, seq := range seqSlice { + seqs[i] = uint64(seq) + } + + res, err := qc.SeqToBlocknums(cmd.Context(), &types.QuerySeqToBlocknumsRequest{Seqs: seqs}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Int64Slice(flagSequences, []int64{}, "comma separated list of bridge sequnece numbers") + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go index a0b492207e..315b76e8d8 100644 --- a/x/fbridge/keeper/genesis.go +++ b/x/fbridge/keeper/genesis.go @@ -1,12 +1,16 @@ package keeper import ( + "encoding/binary" sdk "github.com/Finschia/finschia-sdk/types" "github.com/Finschia/finschia-sdk/x/fbridge/types" ) func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error { k.setNextSequence(ctx, gs.SendingState.NextSeq) + for _, info := range gs.SendingState.SeqToBlocknum { + k.setSeqToBlocknum(ctx, info.Seq, info.Blocknum) + } return nil } @@ -14,7 +18,24 @@ func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error { func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { return &types.GenesisState{ SendingState: types.SendingState{ - NextSeq: k.GetNextSequence(ctx), + NextSeq: k.GetNextSequence(ctx), + SeqToBlocknum: k.GetAllSeqToBlocknums(ctx), }, } } + +func (k Keeper) GetAllSeqToBlocknums(ctx sdk.Context) []types.BlockSeqInfo { + infos := make([]types.BlockSeqInfo, 0) + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.KeySeqToBlocknumPrefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + seq := binary.BigEndian.Uint64(iterator.Key()[1:]) + v := binary.BigEndian.Uint64(iterator.Value()) + info := types.BlockSeqInfo{Seq: seq, Blocknum: v} + infos = append(infos, info) + } + + return infos +} diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go index 4953a0a5ef..3f6feb5d06 100644 --- a/x/fbridge/keeper/grpc_query.go +++ b/x/fbridge/keeper/grpc_query.go @@ -27,6 +27,24 @@ func (k Keeper) NextSeqSend(goCtx context.Context, req *types.QueryNextSeqSendRe return &types.QueryNextSeqSendResponse{Seq: seq}, nil } +func (k Keeper) SeqToBlocknums(goCtx context.Context, req *types.QuerySeqToBlocknumsRequest) (*types.QuerySeqToBlocknumsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + bhList := make([]uint64, len(req.Seqs)) + for i, seq := range req.Seqs { + bh, err := k.GetSeqToBlocknum(ctx, seq) + if err != nil { + return nil, err + } + bhList[i] = bh + } + + return &types.QuerySeqToBlocknumsResponse{Blocknums: bhList}, nil +} + func (k Keeper) GreatestSeqByOperator(ctx context.Context, request *types.QueryGreatestSeqByOperatorRequest) (*types.QueryGreatestSeqByOperatorResponse, error) { panic("implement me") } diff --git a/x/fbridge/keeper/transfer.go b/x/fbridge/keeper/transfer.go index c1c1f65b6f..8e63588366 100644 --- a/x/fbridge/keeper/transfer.go +++ b/x/fbridge/keeper/transfer.go @@ -32,10 +32,28 @@ func (k Keeper) handleBridgeTransfer(ctx sdk.Context, sender sdk.AccAddress, amo seq := k.GetNextSequence(ctx) k.setNextSequence(ctx, seq+1) + k.setSeqToBlocknum(ctx, seq, uint64(ctx.BlockHeight())) return seq, nil } +func (k Keeper) setSeqToBlocknum(ctx sdk.Context, seq, height uint64) { + store := ctx.KVStore(k.storeKey) + bz := make([]byte, 8) + binary.BigEndian.PutUint64(bz, height) + store.Set(types.SeqToBlocknumKey(seq), bz) +} + +func (k Keeper) GetSeqToBlocknum(ctx sdk.Context, seq uint64) (uint64, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.SeqToBlocknumKey(seq)) + if len(bz) == 0 { + return 0, sdkerrors.ErrNotFound.Wrapf("sequence %d not found", seq) + } + + return binary.BigEndian.Uint64(bz), nil +} + func (k Keeper) GetNextSequence(ctx sdk.Context) uint64 { store := ctx.KVStore(k.storeKey) bz := store.Get(types.KeyNextSeqSend) diff --git a/x/fbridge/keeper/transfer_test.go b/x/fbridge/keeper/transfer_test.go index b0bdc05849..ac0743ad98 100644 --- a/x/fbridge/keeper/transfer_test.go +++ b/x/fbridge/keeper/transfer_test.go @@ -37,6 +37,9 @@ func TestHandleBridgeTransfer(t *testing.T) { require.Equal(t, targetSeq, handledSeq) afterSeq := k.GetNextSequence(ctx) require.Equal(t, targetSeq+1, afterSeq) + h, err := k.GetSeqToBlocknum(ctx, handledSeq) + require.NoError(t, err) + require.Equal(t, uint64(ctx.BlockHeight()), h) } func TestIsValidEthereumAddress(t *testing.T) { diff --git a/x/fbridge/types/genesis.pb.go b/x/fbridge/types/genesis.pb.go index 60dc09d4c7..7b28e12f13 100644 --- a/x/fbridge/types/genesis.pb.go +++ b/x/fbridge/types/genesis.pb.go @@ -91,7 +91,7 @@ type SendingState struct { // the next sequence number of the bridge request (greatest sequence number + 1) NextSeq uint64 `protobuf:"varint,1,opt,name=next_seq,json=nextSeq,proto3" json:"next_seq,omitempty"` // sequence-per-block number mapping - SeqToBlocknum []*BlockSeqInfo `protobuf:"bytes,2,rep,name=seq_to_blocknum,json=seqToBlocknum,proto3" json:"seq_to_blocknum,omitempty"` + SeqToBlocknum []BlockSeqInfo `protobuf:"bytes,2,rep,name=seq_to_blocknum,json=seqToBlocknum,proto3" json:"seq_to_blocknum"` } func (m *SendingState) Reset() { *m = SendingState{} } @@ -475,49 +475,49 @@ func init() { func init() { proto.RegisterFile("lbm/fbridge/v1/genesis.proto", fileDescriptor_0fc3cc4535a29f6d) } var fileDescriptor_0fc3cc4535a29f6d = []byte{ - // 665 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4d, 0x6f, 0xd3, 0x4c, - 0x10, 0xc7, 0xe3, 0xc4, 0x4a, 0xdb, 0x69, 0xfa, 0xa2, 0xd5, 0xf3, 0x54, 0x6e, 0x28, 0x4e, 0x64, - 0x71, 0xe8, 0x01, 0x62, 0x0a, 0x48, 0xbc, 0xa8, 0x12, 0x52, 0x5a, 0xb5, 0x02, 0x09, 0x81, 0x6c, - 0x0e, 0xa8, 0x17, 0xcb, 0x76, 0x36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, 0x4e, 0x18, 0xda, 0x85, 0x65, 0x9f, 0x86, 0x21, 0xe1, 0x21, 0x8e, 0x38, 0xd3, - 0xda, 0xc2, 0x74, 0xb7, 0x6e, 0x7a, 0xaf, 0x90, 0x58, 0x55, 0x39, 0x7a, 0x09, 0x10, 0xa7, 0x74, - 0x46, 0x18, 0xa1, 0x11, 0xd3, 0x16, 0x44, 0xf2, 0xe6, 0x8d, 0x5f, 0x21, 0x57, 0x58, 0x15, 0x31, - 0x72, 0xe1, 0x9e, 0x4f, 0xa3, 0x31, 0x49, 0x43, 0x3c, 0x72, 0xe4, 0x48, 0x95, 0x68, 0x6d, 0x51, - 0xb0, 0x8c, 0x9b, 0x46, 0x64, 0x4a, 0x09, 0xd5, 0x0a, 0x8c, 0x9d, 0xcd, 0x58, 0x69, 0x55, 0x4e, - 0xd9, 0x6b, 0x58, 0xab, 0xdd, 0x79, 0x36, 0x56, 0x95, 0x59, 0x50, 0xb6, 0x97, 0xac, 0x62, 0x9f, - 0x0f, 0x61, 0xb3, 0x18, 0x42, 0xe3, 0x08, 0xa0, 0x84, 0xfe, 0x5b, 0x2e, 0xd2, 0x01, 0x2a, 0x4d, - 0xb5, 0x84, 0xbe, 0x72, 0x62, 0x7c, 0x55, 0x60, 0xa9, 0x68, 0xa5, 0xa6, 0x56, 0xea, 0x6a, 0xb4, - 0x03, 0xea, 0xc8, 0xe5, 0xae, 0x7c, 0x36, 0xee, 0xdf, 0x79, 0xd1, 0xfb, 0x2e, 0x77, 0x2d, 0x21, - 0x45, 0xcf, 0xa1, 0x9d, 0xbd, 0x0f, 0x53, 0x26, 0x1f, 0x88, 0xde, 0x9d, 0x49, 0xb6, 0x90, 0x59, - 0x52, 0x6e, 0x1c, 0x00, 0xba, 0x79, 0xd9, 0xb7, 0xfc, 0xa2, 0xf3, 0x9e, 0x9b, 0x75, 0xcf, 0xc3, - 0xb7, 0xe7, 0x97, 0xba, 0x72, 0x71, 0xa9, 0x2b, 0xbf, 0x2f, 0x75, 0xe5, 0xcb, 0x95, 0xde, 0xb8, - 0xb8, 0xd2, 0x1b, 0x3f, 0xae, 0xf4, 0xc6, 0xd1, 0xe3, 0x80, 0xf0, 0xe3, 0xa9, 0x37, 0xf0, 0x69, - 0x68, 0x1e, 0x90, 0x88, 0xf9, 0xc7, 0xc4, 0x35, 0xc7, 0x72, 0xf1, 0x88, 0x8d, 0x4e, 0xcc, 0xd3, - 0xe2, 0x45, 0xe6, 0x67, 0x31, 0x66, 0x5e, 0x5b, 0xbc, 0xc6, 0x4f, 0xff, 0x04, 0x00, 0x00, 0xff, - 0xff, 0x4e, 0x85, 0xc3, 0xf2, 0xf1, 0x05, 0x00, 0x00, + // 666 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0xe3, 0xc4, 0x4a, 0xdb, 0x69, 0xfa, 0xa1, 0x15, 0x54, 0x6e, 0x28, 0x4e, 0x64, 0x71, + 0xe8, 0x01, 0x62, 0x0a, 0x48, 0x7c, 0xa8, 0x12, 0x52, 0x8a, 0x5a, 0x51, 0x09, 0x81, 0x6c, 0x0e, + 0xa8, 0x17, 0xcb, 0x76, 0x36, 0xee, 0xaa, 0xb1, 0x37, 0xf6, 0x6e, 0xa2, 0x56, 0xbc, 0x00, 0x47, + 0x6e, 0x5c, 0xb9, 0xf0, 0x2e, 0x3d, 0xf6, 0xc8, 0x01, 0x21, 0xd4, 0xbe, 0x08, 0xf2, 0x76, 0xfd, + 0x11, 0x37, 0x95, 0xe0, 0xb6, 0xbb, 0xf3, 0x9f, 0xdf, 0xfc, 0x67, 0x3d, 0x5e, 0xd8, 0x1a, 0x79, + 0xa1, 0x39, 0xf4, 0x12, 0x32, 0x08, 0xb0, 0x39, 0xdd, 0x31, 0x03, 0x1c, 0x61, 0x46, 0x58, 0x6f, + 0x9c, 0x50, 0x4e, 0xd1, 0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 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -1343,7 +1343,7 @@ func (m *SendingState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SeqToBlocknum = append(m.SeqToBlocknum, &BlockSeqInfo{}) + m.SeqToBlocknum = append(m.SeqToBlocknum, BlockSeqInfo{}) if err := m.SeqToBlocknum[len(m.SeqToBlocknum)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go index 03179de065..714c3b4fcf 100644 --- a/x/fbridge/types/keys.go +++ b/x/fbridge/types/keys.go @@ -1,5 +1,7 @@ package types +import "encoding/binary" + const ( // ModuleName is the module name constant used in many places ModuleName = "fbridge" @@ -9,6 +11,13 @@ const ( ) var ( - KeyParams = []byte{0x01} // key for fbridge module params - KeyNextSeqSend = []byte{0x02} // key for the next bridge send sequence + KeyParams = []byte{0x01} // key for fbridge module params + KeyNextSeqSend = []byte{0x02} // key for the next bridge send sequence + KeySeqToBlocknumPrefix = []byte{0x03} // key prefix for the sequence to block number mapping ) + +func SeqToBlocknumKey(seq uint64) []byte { + bz := make([]byte, 8) + binary.BigEndian.PutUint64(bz, seq) + return append(KeySeqToBlocknumPrefix, bz...) +} diff --git a/x/fbridge/types/query.pb.go b/x/fbridge/types/query.pb.go index d43ba5168b..7583ca187f 100644 --- a/x/fbridge/types/query.pb.go +++ b/x/fbridge/types/query.pb.go @@ -190,6 +190,95 @@ func (m *QueryNextSeqSendResponse) GetSeq() uint64 { return 0 } +type QuerySeqToBlocknumsRequest struct { + // list of sequence number of the bridge request + Seqs []uint64 `protobuf:"varint,1,rep,packed,name=seqs,proto3" json:"seqs,omitempty"` +} + +func (m *QuerySeqToBlocknumsRequest) Reset() { *m = QuerySeqToBlocknumsRequest{} } +func (m *QuerySeqToBlocknumsRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySeqToBlocknumsRequest) ProtoMessage() {} +func (*QuerySeqToBlocknumsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{4} +} +func (m *QuerySeqToBlocknumsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySeqToBlocknumsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySeqToBlocknumsRequest.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 *QuerySeqToBlocknumsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySeqToBlocknumsRequest.Merge(m, src) +} +func (m *QuerySeqToBlocknumsRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySeqToBlocknumsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySeqToBlocknumsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySeqToBlocknumsRequest proto.InternalMessageInfo + +func (m *QuerySeqToBlocknumsRequest) GetSeqs() []uint64 { + if m != nil { + return m.Seqs + } + return nil +} + +type QuerySeqToBlocknumsResponse struct { + Blocknums []uint64 `protobuf:"varint,1,rep,packed,name=blocknums,proto3" json:"blocknums,omitempty"` +} + +func (m *QuerySeqToBlocknumsResponse) Reset() { *m = QuerySeqToBlocknumsResponse{} } +func (m *QuerySeqToBlocknumsResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySeqToBlocknumsResponse) ProtoMessage() {} +func (*QuerySeqToBlocknumsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{5} +} +func (m *QuerySeqToBlocknumsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySeqToBlocknumsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySeqToBlocknumsResponse.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 *QuerySeqToBlocknumsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySeqToBlocknumsResponse.Merge(m, src) +} +func (m *QuerySeqToBlocknumsResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySeqToBlocknumsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySeqToBlocknumsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySeqToBlocknumsResponse proto.InternalMessageInfo + +func (m *QuerySeqToBlocknumsResponse) GetBlocknums() []uint64 { + if m != nil { + return m.Blocknums + } + return nil +} + type QueryGreatestSeqByOperatorRequest struct { // the address of the operator Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` @@ -199,7 +288,7 @@ func (m *QueryGreatestSeqByOperatorRequest) Reset() { *m = QueryGreatest func (m *QueryGreatestSeqByOperatorRequest) String() string { return proto.CompactTextString(m) } func (*QueryGreatestSeqByOperatorRequest) ProtoMessage() {} func (*QueryGreatestSeqByOperatorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{4} + return fileDescriptor_5e7780f9db9d346e, []int{6} } func (m *QueryGreatestSeqByOperatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -243,7 +332,7 @@ func (m *QueryGreatestSeqByOperatorResponse) Reset() { *m = QueryGreates func (m *QueryGreatestSeqByOperatorResponse) String() string { return proto.CompactTextString(m) } func (*QueryGreatestSeqByOperatorResponse) ProtoMessage() {} func (*QueryGreatestSeqByOperatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{5} + return fileDescriptor_5e7780f9db9d346e, []int{7} } func (m *QueryGreatestSeqByOperatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -290,7 +379,7 @@ func (m *QueryGreatestConsecutiveConfirmedSeqRequest) String() string { } func (*QueryGreatestConsecutiveConfirmedSeqRequest) ProtoMessage() {} func (*QueryGreatestConsecutiveConfirmedSeqRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{6} + return fileDescriptor_5e7780f9db9d346e, []int{8} } func (m *QueryGreatestConsecutiveConfirmedSeqRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -331,7 +420,7 @@ func (m *QueryGreatestConsecutiveConfirmedSeqResponse) String() string { } func (*QueryGreatestConsecutiveConfirmedSeqResponse) ProtoMessage() {} func (*QueryGreatestConsecutiveConfirmedSeqResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{7} + return fileDescriptor_5e7780f9db9d346e, []int{9} } func (m *QueryGreatestConsecutiveConfirmedSeqResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -378,7 +467,7 @@ func (m *QuerySubmittedProvisionRequest) Reset() { *m = QuerySubmittedPr func (m *QuerySubmittedProvisionRequest) String() string { return proto.CompactTextString(m) } func (*QuerySubmittedProvisionRequest) ProtoMessage() {} func (*QuerySubmittedProvisionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{8} + return fileDescriptor_5e7780f9db9d346e, []int{10} } func (m *QuerySubmittedProvisionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -430,7 +519,7 @@ func (m *QuerySubmittedProvisionResponse) Reset() { *m = QuerySubmittedP func (m *QuerySubmittedProvisionResponse) String() string { return proto.CompactTextString(m) } func (*QuerySubmittedProvisionResponse) ProtoMessage() {} func (*QuerySubmittedProvisionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{9} + return fileDescriptor_5e7780f9db9d346e, []int{11} } func (m *QuerySubmittedProvisionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -484,7 +573,7 @@ func (m *QueryNeededSubmissionSeqsRequest) Reset() { *m = QueryNeededSub func (m *QueryNeededSubmissionSeqsRequest) String() string { return proto.CompactTextString(m) } func (*QueryNeededSubmissionSeqsRequest) ProtoMessage() {} func (*QueryNeededSubmissionSeqsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{10} + return fileDescriptor_5e7780f9db9d346e, []int{12} } func (m *QueryNeededSubmissionSeqsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -535,7 +624,7 @@ func (m *QueryNeededSubmissionSeqsResponse) Reset() { *m = QueryNeededSu func (m *QueryNeededSubmissionSeqsResponse) String() string { return proto.CompactTextString(m) } func (*QueryNeededSubmissionSeqsResponse) ProtoMessage() {} func (*QueryNeededSubmissionSeqsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{11} + return fileDescriptor_5e7780f9db9d346e, []int{13} } func (m *QueryNeededSubmissionSeqsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -580,7 +669,7 @@ func (m *QueryConfirmedProvisionRequest) Reset() { *m = QueryConfirmedPr func (m *QueryConfirmedProvisionRequest) String() string { return proto.CompactTextString(m) } func (*QueryConfirmedProvisionRequest) ProtoMessage() {} func (*QueryConfirmedProvisionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{12} + return fileDescriptor_5e7780f9db9d346e, []int{14} } func (m *QueryConfirmedProvisionRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -625,7 +714,7 @@ func (m *QueryConfirmedProvisionResponse) Reset() { *m = QueryConfirmedP func (m *QueryConfirmedProvisionResponse) String() string { return proto.CompactTextString(m) } func (*QueryConfirmedProvisionResponse) ProtoMessage() {} func (*QueryConfirmedProvisionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{13} + return fileDescriptor_5e7780f9db9d346e, []int{15} } func (m *QueryConfirmedProvisionResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -677,7 +766,7 @@ func (m *QueryCommitmentsRequest) Reset() { *m = QueryCommitmentsRequest func (m *QueryCommitmentsRequest) String() string { return proto.CompactTextString(m) } func (*QueryCommitmentsRequest) ProtoMessage() {} func (*QueryCommitmentsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{14} + return fileDescriptor_5e7780f9db9d346e, []int{16} } func (m *QueryCommitmentsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -721,7 +810,7 @@ func (m *QueryCommitmentsResponse) Reset() { *m = QueryCommitmentsRespon func (m *QueryCommitmentsResponse) String() string { return proto.CompactTextString(m) } func (*QueryCommitmentsResponse) ProtoMessage() {} func (*QueryCommitmentsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{15} + return fileDescriptor_5e7780f9db9d346e, []int{17} } func (m *QueryCommitmentsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -764,7 +853,7 @@ func (m *QueryGuardiansRequest) Reset() { *m = QueryGuardiansRequest{} } func (m *QueryGuardiansRequest) String() string { return proto.CompactTextString(m) } func (*QueryGuardiansRequest) ProtoMessage() {} func (*QueryGuardiansRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{16} + return fileDescriptor_5e7780f9db9d346e, []int{18} } func (m *QueryGuardiansRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -801,7 +890,7 @@ func (m *QueryGuardiansResponse) Reset() { *m = QueryGuardiansResponse{} func (m *QueryGuardiansResponse) String() string { return proto.CompactTextString(m) } func (*QueryGuardiansResponse) ProtoMessage() {} func (*QueryGuardiansResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{17} + return fileDescriptor_5e7780f9db9d346e, []int{19} } func (m *QueryGuardiansResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -844,7 +933,7 @@ func (m *QueryOperatorsRequest) Reset() { *m = QueryOperatorsRequest{} } func (m *QueryOperatorsRequest) String() string { return proto.CompactTextString(m) } func (*QueryOperatorsRequest) ProtoMessage() {} func (*QueryOperatorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{18} + return fileDescriptor_5e7780f9db9d346e, []int{20} } func (m *QueryOperatorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -881,7 +970,7 @@ func (m *QueryOperatorsResponse) Reset() { *m = QueryOperatorsResponse{} func (m *QueryOperatorsResponse) String() string { return proto.CompactTextString(m) } func (*QueryOperatorsResponse) ProtoMessage() {} func (*QueryOperatorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{19} + return fileDescriptor_5e7780f9db9d346e, []int{21} } func (m *QueryOperatorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -924,7 +1013,7 @@ func (m *QueryJudgesRequest) Reset() { *m = QueryJudgesRequest{} } func (m *QueryJudgesRequest) String() string { return proto.CompactTextString(m) } func (*QueryJudgesRequest) ProtoMessage() {} func (*QueryJudgesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{20} + return fileDescriptor_5e7780f9db9d346e, []int{22} } func (m *QueryJudgesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -961,7 +1050,7 @@ func (m *QueryJudgesResponse) Reset() { *m = QueryJudgesResponse{} } func (m *QueryJudgesResponse) String() string { return proto.CompactTextString(m) } func (*QueryJudgesResponse) ProtoMessage() {} func (*QueryJudgesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{21} + return fileDescriptor_5e7780f9db9d346e, []int{23} } func (m *QueryJudgesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1006,7 +1095,7 @@ func (m *QueryProposalsRequest) Reset() { *m = QueryProposalsRequest{} } func (m *QueryProposalsRequest) String() string { return proto.CompactTextString(m) } func (*QueryProposalsRequest) ProtoMessage() {} func (*QueryProposalsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{22} + return fileDescriptor_5e7780f9db9d346e, []int{24} } func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1050,7 +1139,7 @@ func (m *QueryProposalsResponse) Reset() { *m = QueryProposalsResponse{} func (m *QueryProposalsResponse) String() string { return proto.CompactTextString(m) } func (*QueryProposalsResponse) ProtoMessage() {} func (*QueryProposalsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{23} + return fileDescriptor_5e7780f9db9d346e, []int{25} } func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1095,7 +1184,7 @@ func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } func (*QueryProposalRequest) ProtoMessage() {} func (*QueryProposalRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{24} + return fileDescriptor_5e7780f9db9d346e, []int{26} } func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1139,7 +1228,7 @@ func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} } func (m *QueryProposalResponse) String() string { return proto.CompactTextString(m) } func (*QueryProposalResponse) ProtoMessage() {} func (*QueryProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_5e7780f9db9d346e, []int{25} + return fileDescriptor_5e7780f9db9d346e, []int{27} } func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1180,6 +1269,8 @@ func init() { proto.RegisterType((*QueryParamsResponse)(nil), "lbm.fbridge.v1.QueryParamsResponse") proto.RegisterType((*QueryNextSeqSendRequest)(nil), "lbm.fbridge.v1.QueryNextSeqSendRequest") proto.RegisterType((*QueryNextSeqSendResponse)(nil), "lbm.fbridge.v1.QueryNextSeqSendResponse") + proto.RegisterType((*QuerySeqToBlocknumsRequest)(nil), "lbm.fbridge.v1.QuerySeqToBlocknumsRequest") + proto.RegisterType((*QuerySeqToBlocknumsResponse)(nil), "lbm.fbridge.v1.QuerySeqToBlocknumsResponse") proto.RegisterType((*QueryGreatestSeqByOperatorRequest)(nil), "lbm.fbridge.v1.QueryGreatestSeqByOperatorRequest") proto.RegisterType((*QueryGreatestSeqByOperatorResponse)(nil), "lbm.fbridge.v1.QueryGreatestSeqByOperatorResponse") proto.RegisterType((*QueryGreatestConsecutiveConfirmedSeqRequest)(nil), "lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqRequest") @@ -1207,79 +1298,84 @@ func init() { func init() { proto.RegisterFile("lbm/fbridge/v1/query.proto", fileDescriptor_5e7780f9db9d346e) } var fileDescriptor_5e7780f9db9d346e = []byte{ - // 1152 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0xb6, 0x69, 0x14, 0x3f, 0x4b, 0x80, 0x86, 0x34, 0x4d, 0x4d, 0xb0, 0x93, 0x6d, 0x9b, - 0x86, 0x36, 0xd9, 0x8d, 0x4d, 0x94, 0x20, 0x9a, 0x0a, 0x94, 0xa0, 0x22, 0x8a, 0x54, 0x52, 0xa7, - 0x27, 0x2e, 0xd6, 0xda, 0x3b, 0xd9, 0x2e, 0xd8, 0x3b, 0xde, 0x9d, 0x75, 0x94, 0x28, 0xca, 0xa5, - 0x07, 0x2e, 0x08, 0x09, 0x89, 0x13, 0x17, 0xfe, 0x06, 0xa4, 0xfe, 0x03, 0x1c, 0x7b, 0xe0, 0x50, - 0x89, 0x0b, 0x27, 0x84, 0x12, 0xfe, 0x10, 0xb4, 0xb3, 0x6f, 0xc6, 0xf6, 0xae, 0xc7, 0x71, 0xb9, - 0x70, 0x9b, 0x7d, 0xf3, 0xbe, 0xef, 0x7d, 0x6f, 0x7e, 0x7d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0xa0, 0xa0, 0xec, 0x57, 0xd3, 0x72, - 0xd6, 0xff, 0x35, 0x2d, 0xe7, 0x5c, 0xdc, 0x5c, 0x11, 0xc5, 0x97, 0x48, 0x39, 0x5b, 0x3c, 0x62, - 0x6d, 0x6a, 0x2b, 0xc7, 0x26, 0x3f, 0x18, 0x30, 0x2b, 0xd1, 0xe4, 0xf6, 0x58, 0x72, 0x29, 0xe1, - 0xce, 0x25, 0x59, 0xa8, 0x60, 0x53, 0x28, 0xb0, 0xc8, 0xda, 0x78, 0x05, 0xf6, 0xe9, 0xc0, 0x2f, - 0x83, 0xb3, 0xdd, 0xc7, 0xaf, 0xce, 0xcb, 0xc6, 0xeb, 0xf3, 0xb2, 0xf1, 0xf7, 0x79, 0xd9, 0xf8, - 0xf1, 0xa2, 0x3c, 0xf5, 0xfa, 0xa2, 0x3c, 0xf5, 0xe7, 0x45, 0x79, 0xea, 0xeb, 0x0d, 0xcf, 0x8f, - 0x9f, 0xf7, 0x9a, 0x56, 0x8b, 0x75, 0xec, 0x47, 0x7e, 0xc0, 0x5b, 0xcf, 0x7d, 0xc7, 0x3e, 0xc4, - 0xc1, 0x3a, 0x77, 0xbf, 0xb5, 0x8f, 0x55, 0x95, 0xf8, 0xa4, 0x4b, 0x79, 0x73, 0x46, 0xfc, 0xfd, - 0xfc, 0xf0, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x46, 0xe7, 0x3d, 0x95, 0x2a, 0x0f, 0x00, 0x00, + // 1229 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xc1, 0x6e, 0xdb, 0x46, + 0x10, 0x35, 0x13, 0xc7, 0xb0, 0x46, 0x40, 0xd0, 0x6e, 0x1d, 0xc7, 0x61, 0x5c, 0xc9, 0x66, 0x1a, + 0xc7, 0x89, 0x6d, 0xd2, 0x52, 0x8c, 0x38, 0x48, 0xd2, 0x36, 0xb0,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0x28, 0xdc, 0x3c, 0xc3, + 0x8b, 0x33, 0x58, 0x63, 0x0c, 0x4c, 0xb4, 0x3c, 0x9c, 0x81, 0x75, 0xd4, 0xb7, 0xef, 0x1c, 0x6f, + 0x3c, 0x7d, 0x73, 0x52, 0xd2, 0xde, 0x9e, 0x94, 0xb4, 0x7f, 0x4e, 0x4a, 0xda, 0xf7, 0xa7, 0xa5, + 0xb1, 0xb7, 0xa7, 0xa5, 0xb1, 0xbf, 0x4e, 0x4b, 0x63, 0xdf, 0xac, 0xba, 0x5e, 0xf4, 0xa2, 0x53, + 0x37, 0x1b, 0xa4, 0x65, 0x6d, 0x79, 0x3e, 0x6d, 0xbc, 0xf0, 0x6c, 0x6b, 0x9f, 0x3f, 0xac, 0x50, + 0xe7, 0xa5, 0x75, 0x20, 0xb3, 0x44, 0x87, 0x6d, 0x4c, 0xeb, 0x13, 0xec, 0x3f, 0xfc, 0xdd, 0xff, + 0x02, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x73, 0xd4, 0xb9, 0x6f, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1298,6 +1394,8 @@ type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // NextSeqSend queries the sequence of next bridge request NextSeqSend(ctx context.Context, in *QueryNextSeqSendRequest, opts ...grpc.CallOption) (*QueryNextSeqSendResponse, error) + // BlocknumToSeqs queries a list of block numbers for which each sequence has been confirmed. + SeqToBlocknums(ctx context.Context, in *QuerySeqToBlocknumsRequest, opts ...grpc.CallOption) (*QuerySeqToBlocknumsResponse, error) // GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator GreatestSeqByOperator(ctx context.Context, in *QueryGreatestSeqByOperatorRequest, opts ...grpc.CallOption) (*QueryGreatestSeqByOperatorResponse, error) // GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence number confirmed by n-of-m operators @@ -1351,6 +1449,15 @@ func (c *queryClient) NextSeqSend(ctx context.Context, in *QueryNextSeqSendReque return out, nil } +func (c *queryClient) SeqToBlocknums(ctx context.Context, in *QuerySeqToBlocknumsRequest, opts ...grpc.CallOption) (*QuerySeqToBlocknumsResponse, error) { + out := new(QuerySeqToBlocknumsResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/SeqToBlocknums", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) GreatestSeqByOperator(ctx context.Context, in *QueryGreatestSeqByOperatorRequest, opts ...grpc.CallOption) (*QueryGreatestSeqByOperatorResponse, error) { out := new(QueryGreatestSeqByOperatorResponse) err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/GreatestSeqByOperator", in, out, opts...) @@ -1456,6 +1563,8 @@ type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // NextSeqSend queries the sequence of next bridge request NextSeqSend(context.Context, *QueryNextSeqSendRequest) (*QueryNextSeqSendResponse, error) + // BlocknumToSeqs queries a list of block numbers for which each sequence has been confirmed. + SeqToBlocknums(context.Context, *QuerySeqToBlocknumsRequest) (*QuerySeqToBlocknumsResponse, error) // GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator GreatestSeqByOperator(context.Context, *QueryGreatestSeqByOperatorRequest) (*QueryGreatestSeqByOperatorResponse, error) // GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence number confirmed by n-of-m operators @@ -1493,6 +1602,9 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) NextSeqSend(ctx context.Context, req *QueryNextSeqSendRequest) (*QueryNextSeqSendResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NextSeqSend not implemented") } +func (*UnimplementedQueryServer) SeqToBlocknums(ctx context.Context, req *QuerySeqToBlocknumsRequest) (*QuerySeqToBlocknumsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SeqToBlocknums not implemented") +} func (*UnimplementedQueryServer) GreatestSeqByOperator(ctx context.Context, req *QueryGreatestSeqByOperatorRequest) (*QueryGreatestSeqByOperatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GreatestSeqByOperator not implemented") } @@ -1567,6 +1679,24 @@ func _Query_NextSeqSend_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_SeqToBlocknums_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySeqToBlocknumsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SeqToBlocknums(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/SeqToBlocknums", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SeqToBlocknums(ctx, req.(*QuerySeqToBlocknumsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_GreatestSeqByOperator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryGreatestSeqByOperatorRequest) if err := dec(in); err != nil { @@ -1777,6 +1907,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "NextSeqSend", Handler: _Query_NextSeqSend_Handler, }, + { + MethodName: "SeqToBlocknums", + Handler: _Query_SeqToBlocknums_Handler, + }, { MethodName: "GreatestSeqByOperator", Handler: _Query_GreatestSeqByOperator_Handler, @@ -1933,6 +2067,88 @@ func (m *QueryNextSeqSendResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QuerySeqToBlocknumsRequest) 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 *QuerySeqToBlocknumsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySeqToBlocknumsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Seqs) > 0 { + dAtA3 := make([]byte, len(m.Seqs)*10) + var j2 int + for _, num := range m.Seqs { + for num >= 1<<7 { + dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j2++ + } + dAtA3[j2] = uint8(num) + j2++ + } + i -= j2 + copy(dAtA[i:], dAtA3[:j2]) + i = encodeVarintQuery(dAtA, i, uint64(j2)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySeqToBlocknumsResponse) 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 *QuerySeqToBlocknumsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySeqToBlocknumsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Blocknums) > 0 { + dAtA5 := make([]byte, len(m.Blocknums)*10) + var j4 int + for _, num := range m.Blocknums { + for num >= 1<<7 { + dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j4++ + } + dAtA5[j4] = uint8(num) + j4++ + } + i -= j4 + copy(dAtA[i:], dAtA5[:j4]) + i = encodeVarintQuery(dAtA, i, uint64(j4)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *QueryGreatestSeqByOperatorRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2176,20 +2392,20 @@ func (m *QueryNeededSubmissionSeqsResponse) MarshalToSizedBuffer(dAtA []byte) (i var l int _ = l if len(m.Seqs) > 0 { - dAtA5 := make([]byte, len(m.Seqs)*10) - var j4 int + dAtA9 := make([]byte, len(m.Seqs)*10) + var j8 int for _, num := range m.Seqs { for num >= 1<<7 { - dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + dAtA9[j8] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j4++ + j8++ } - dAtA5[j4] = uint8(num) - j4++ + dAtA9[j8] = uint8(num) + j8++ } - i -= j4 - copy(dAtA[i:], dAtA5[:j4]) - i = encodeVarintQuery(dAtA, i, uint64(j4)) + i -= j8 + copy(dAtA[i:], dAtA9[:j8]) + i = encodeVarintQuery(dAtA, i, uint64(j8)) i-- dAtA[i] = 0xa } @@ -2681,6 +2897,38 @@ func (m *QueryNextSeqSendResponse) Size() (n int) { return n } +func (m *QuerySeqToBlocknumsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Seqs) > 0 { + l = 0 + for _, e := range m.Seqs { + l += sovQuery(uint64(e)) + } + n += 1 + sovQuery(uint64(l)) + l + } + return n +} + +func (m *QuerySeqToBlocknumsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Blocknums) > 0 { + l = 0 + for _, e := range m.Blocknums { + l += sovQuery(uint64(e)) + } + n += 1 + sovQuery(uint64(l)) + l + } + return n +} + func (m *QueryGreatestSeqByOperatorRequest) Size() (n int) { if m == nil { return 0 @@ -3224,6 +3472,258 @@ func (m *QueryNextSeqSendResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QuerySeqToBlocknumsRequest) 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: QuerySeqToBlocknumsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySeqToBlocknumsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Seqs = append(m.Seqs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Seqs) == 0 { + m.Seqs = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Seqs = append(m.Seqs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Seqs", wireType) + } + 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 *QuerySeqToBlocknumsResponse) 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: QuerySeqToBlocknumsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySeqToBlocknumsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Blocknums = append(m.Blocknums, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Blocknums) == 0 { + m.Blocknums = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Blocknums = append(m.Blocknums, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Blocknums", wireType) + } + 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 *QueryGreatestSeqByOperatorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/fbridge/types/query.pb.gw.go b/x/fbridge/types/query.pb.gw.go index 8de3ab8ffe..c62ab4e113 100644 --- a/x/fbridge/types/query.pb.gw.go +++ b/x/fbridge/types/query.pb.gw.go @@ -67,6 +67,42 @@ func local_request_Query_NextSeqSend_0(ctx context.Context, marshaler runtime.Ma } +var ( + filter_Query_SeqToBlocknums_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_SeqToBlocknums_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySeqToBlocknumsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SeqToBlocknums_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SeqToBlocknums(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SeqToBlocknums_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySeqToBlocknumsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SeqToBlocknums_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SeqToBlocknums(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_GreatestSeqByOperator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryGreatestSeqByOperatorRequest var metadata runtime.ServerMetadata @@ -585,6 +621,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_SeqToBlocknums_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SeqToBlocknums_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SeqToBlocknums_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_GreatestSeqByOperator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -886,6 +942,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_SeqToBlocknums_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_SeqToBlocknums_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_SeqToBlocknums_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_GreatestSeqByOperator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1112,19 +1188,21 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NextSeqSend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "nextseq_send"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NextSeqSend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"lbm", "fbridge", "v1", "sending", "nextseq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SeqToBlocknums_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"lbm", "fbridge", "v1", "sending", "blocknums"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_GreatestSeqByOperator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"lbm", "fbridge", "v1", "operators", "operator", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_GreatestSeqByOperator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"lbm", "fbridge", "v1", "receiving", "operators", "operator", "seq"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_GreatestConsecutiveConfirmedSeq_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "greatest_confirmed_seq"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_GreatestConsecutiveConfirmedSeq_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"lbm", "fbridge", "v1", "receiving", "greatest_confirmed_seq"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_SubmittedProvision_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"lbm", "fbridge", "v1", "operators", "operator", "provision", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_SubmittedProvision_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"lbm", "fbridge", "v1", "receiving", "operators", "operator", "provision", "seq"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ConfirmedProvision_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"lbm", "fbridge", "v1", "provision", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ConfirmedProvision_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"lbm", "fbridge", "v1", "receiving", "provision", "seq"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NeededSubmissionSeqs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"lbm", "fbridge", "v1", "operators", "operator", "needed_submission_seqs"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NeededSubmissionSeqs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"lbm", "fbridge", "v1", "receiving", "operators", "operator", "needed_submission_seqs"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Commitments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"lbm", "fbridge", "v1", "commitments", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Commitments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"lbm", "fbridge", "v1", "receiving", "commitments", "seq"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Guardians_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "guardians"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1142,6 +1220,8 @@ var ( forward_Query_NextSeqSend_0 = runtime.ForwardResponseMessage + forward_Query_SeqToBlocknums_0 = runtime.ForwardResponseMessage + forward_Query_GreatestSeqByOperator_0 = runtime.ForwardResponseMessage forward_Query_GreatestConsecutiveConfirmedSeq_0 = runtime.ForwardResponseMessage From ae94c6c63bc3422a6bbf0233498163dcd25c9db6 Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Fri, 3 May 2024 18:32:09 +0900 Subject: [PATCH 2/5] lint --- x/fbridge/client/cli/query.go | 3 ++- x/fbridge/keeper/genesis.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/x/fbridge/client/cli/query.go b/x/fbridge/client/cli/query.go index d0714ca4cb..4878af22e7 100644 --- a/x/fbridge/client/cli/query.go +++ b/x/fbridge/client/cli/query.go @@ -2,11 +2,12 @@ package cli import ( "fmt" - "github.com/Finschia/finschia-sdk/version" + "github.com/spf13/cobra" "github.com/Finschia/finschia-sdk/client" "github.com/Finschia/finschia-sdk/client/flags" + "github.com/Finschia/finschia-sdk/version" "github.com/Finschia/finschia-sdk/x/fbridge/types" ) diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go index 315b76e8d8..8ae26b10bc 100644 --- a/x/fbridge/keeper/genesis.go +++ b/x/fbridge/keeper/genesis.go @@ -2,6 +2,7 @@ package keeper import ( "encoding/binary" + sdk "github.com/Finschia/finschia-sdk/types" "github.com/Finschia/finschia-sdk/x/fbridge/types" ) From 530603ae7ccb81beb96fc52f83de411837cb2542 Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Fri, 3 May 2024 18:38:56 +0900 Subject: [PATCH 3/5] add CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fe176f455..fdb019c12f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/fswap) [\#1339](https://github.com/Finschia/finschia-sdk/pull/1339) Implement fswap module's genesis * (x/fbridge) [\#1340](https://github.com/Finschia/finschia-sdk/pull/1340) Initialize fbridge module * (x/fbridge) [\#1347](https://github.com/Finschia/finschia-sdk/pull/1347) Implement bridge transfer feature (sending side) +* (x/fbridge) [\#1351](https://github.com/Finschia/finschia-sdk/pull/1351) Map a sequence to block number for every bridge request (sending side) ### Improvements * (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md From 384dbceedc4a32c6e443f6c9745b4d2b886e3e44 Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Fri, 3 May 2024 20:10:42 +0900 Subject: [PATCH 4/5] add query bound for SeqToBlocknums --- x/fbridge/keeper/grpc_query.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go index 3f6feb5d06..e2460064c2 100644 --- a/x/fbridge/keeper/grpc_query.go +++ b/x/fbridge/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -32,6 +33,12 @@ func (k Keeper) SeqToBlocknums(goCtx context.Context, req *types.QuerySeqToBlock return nil, status.Error(codes.InvalidArgument, "empty request") } + const lowerBound int = 1 + const upperBound int = 1000 + if len(req.Seqs) < lowerBound || len(req.Seqs) > upperBound { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("The number of seqs requested must be between %d and %d", lowerBound, upperBound)) + } + ctx := sdk.UnwrapSDKContext(goCtx) bhList := make([]uint64, len(req.Seqs)) for i, seq := range req.Seqs { From 5cc8070784a476722715af1b44a7e9efafa7132b Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Fri, 3 May 2024 20:13:18 +0900 Subject: [PATCH 5/5] chore --- x/fbridge/keeper/genesis.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go index 8ae26b10bc..9312e18a97 100644 --- a/x/fbridge/keeper/genesis.go +++ b/x/fbridge/keeper/genesis.go @@ -20,12 +20,12 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { return &types.GenesisState{ SendingState: types.SendingState{ NextSeq: k.GetNextSequence(ctx), - SeqToBlocknum: k.GetAllSeqToBlocknums(ctx), + SeqToBlocknum: k.getAllSeqToBlocknums(ctx), }, } } -func (k Keeper) GetAllSeqToBlocknums(ctx sdk.Context) []types.BlockSeqInfo { +func (k Keeper) getAllSeqToBlocknums(ctx sdk.Context) []types.BlockSeqInfo { infos := make([]types.BlockSeqInfo, 0) store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.KeySeqToBlocknumPrefix)