From 427ac1d7a56d9366aeaca99e134d05521220c741 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Thu, 2 May 2024 20:06:20 +0900
Subject: [PATCH 01/49] add submitting role proposal feature
---
docs/core/proto-docs.md | 222 ++++++----
proto/lbm/fbridge/v1/event.proto | 7 +
proto/lbm/fbridge/v1/fbridge.proto | 45 +-
proto/lbm/fbridge/v1/genesis.proto | 8 +
proto/lbm/fbridge/v1/tx.proto | 4 +-
x/fbridge/keeper/auth.go | 150 +++++++
x/fbridge/keeper/auth_test.go | 1 +
x/fbridge/keeper/genesis.go | 12 +
x/fbridge/keeper/msg_server.go | 33 +-
x/fbridge/keeper/params.go | 24 ++
x/fbridge/types/event.pb.go | 221 +++++++++-
x/fbridge/types/fbridge.pb.go | 649 ++++++++++++++++++++++++++---
x/fbridge/types/genesis.go | 16 +-
x/fbridge/types/genesis.pb.go | 326 ++++++++++++---
x/fbridge/types/keys.go | 55 +++
x/fbridge/types/params.go | 11 +
x/fbridge/types/tx.pb.go | 126 +++---
17 files changed, 1622 insertions(+), 288 deletions(-)
create mode 100644 x/fbridge/keeper/auth.go
create mode 100644 x/fbridge/keeper/auth_test.go
create mode 100644 x/fbridge/keeper/params.go
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 8982d795db..66c8bc1cbd 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -754,20 +754,24 @@
- [Msg](#lbm.collection.v1.Msg)
-- [lbm/fbridge/v1/event.proto](#lbm/fbridge/v1/event.proto)
- - [EventClaim](#lbm.fbridge.v1.EventClaim)
- - [EventConfirmProvision](#lbm.fbridge.v1.EventConfirmProvision)
- - [EventProvision](#lbm.fbridge.v1.EventProvision)
- - [EventTransfer](#lbm.fbridge.v1.EventTransfer)
-
- [lbm/fbridge/v1/fbridge.proto](#lbm/fbridge/v1/fbridge.proto)
- [Fraction](#lbm.fbridge.v1.Fraction)
- [Params](#lbm.fbridge.v1.Params)
- [ProvisionData](#lbm.fbridge.v1.ProvisionData)
- [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus)
+ - [RoleMetadata](#lbm.fbridge.v1.RoleMetadata)
- [RoleProposal](#lbm.fbridge.v1.RoleProposal)
+ - [Vote](#lbm.fbridge.v1.Vote)
- [Role](#lbm.fbridge.v1.Role)
+ - [VoteOption](#lbm.fbridge.v1.VoteOption)
+
+- [lbm/fbridge/v1/event.proto](#lbm/fbridge/v1/event.proto)
+ - [EventClaim](#lbm.fbridge.v1.EventClaim)
+ - [EventConfirmProvision](#lbm.fbridge.v1.EventConfirmProvision)
+ - [EventProvision](#lbm.fbridge.v1.EventProvision)
+ - [EventSuggestRole](#lbm.fbridge.v1.EventSuggestRole)
+ - [EventTransfer](#lbm.fbridge.v1.EventTransfer)
- [lbm/fbridge/v1/genesis.proto](#lbm/fbridge/v1/genesis.proto)
- [BlockSeqInfo](#lbm.fbridge.v1.BlockSeqInfo)
@@ -11381,77 +11385,132 @@ Msg defines the collection Msg service.
-
+
Top
-## lbm/fbridge/v1/event.proto
+## lbm/fbridge/v1/fbridge.proto
-
+
+
+### Fraction
+Fraction defines the protobuf message type for tmmath.Fraction that only
+supports positive values.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `numerator` | [uint64](#uint64) | | |
+| `denominator` | [uint64](#uint64) | | |
+
+
+
+
+
+
+
+
+### Params
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `operator_trust_level` | [Fraction](#lbm.fbridge.v1.Fraction) | | ratio of how many operators' confirmations are needed to be valid. |
+| `guardian_trust_level` | [Fraction](#lbm.fbridge.v1.Fraction) | | ratio of how many guardians' confirmations are needed to be valid. |
+| `judge_trust_level` | [Fraction](#lbm.fbridge.v1.Fraction) | | ratio of how many judges' confirmations are needed to be valid. |
+| `timelock_period` | [uint64](#uint64) | | default timelock period for each provision (unix timestamp) |
+| `proposal_period` | [uint64](#uint64) | | default period of the proposal to update the role |
+
-### EventClaim
+
+
+
+### ProvisionData
+Provision is a struct that represents a provision internally.
+
+
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `seq` | [uint64](#uint64) | | the sequence number of the bridge request |
+| `amount` | [string](#string) | | the amount of token to be claimed |
| `sender` | [string](#string) | | the sender address on the source chain |
| `receiver` | [string](#string) | | the recipient address on the destination chain |
-| `amount` | [string](#string) | | the amount of token to be claimed |
-
+
+
+### ProvisionStatus
+ProvisionStatus is a struct that represents the status of a provision.
+To optimize computational cost, we have collected frequently changing values from provision.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `timelock_end` | [uint64](#uint64) | | the unix timestamp the provision will be able to be claimed (unix timestamp) |
+| `confirm_counts` | [int32](#int32) | | a value that tells how many operators have submitted this provision |
+| `is_claimed` | [bool](#bool) | | whether the provision has been claimed |
+
+
-### EventConfirmProvision
+
+
+### RoleMetadata
+RoleMetadata defines the metadata of the role.
+
+
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `seq` | [uint64](#uint64) | | the sequence number of the bridge request |
+| `guardian` | [uint32](#uint32) | | the number of registered guardians |
+| `operator` | [uint32](#uint32) | | the number of the operators |
+| `judge` | [uint32](#uint32) | | the number of the judges |
-
+
-### EventProvision
+### RoleProposal
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `seq` | [uint64](#uint64) | | the sequence number of the bridge request |
-| `sender` | [string](#string) | | the sender address on the source chain |
-| `receiver` | [string](#string) | | the recipient address on the destination chain |
-| `amount` | [string](#string) | | the amount of token to be claimed |
-| `operator` | [string](#string) | | the address of the operator |
-
+| `id` | [uint64](#uint64) | | |
+| `proposer` | [string](#string) | | the proposer address |
+| `target` | [string](#string) | | the address to update the role |
+| `role` | [Role](#lbm.fbridge.v1.Role) | | the role to be updated - unspecified : 0, used to remove the address from a group - guardian : 1 - operator : 2 - judge : 3 |
+| `expired_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | the unix timestamp the proposal will be expired (unix timestamp) |
-
-### EventTransfer
+
+### Vote
+Vote defines a vote on a role proposal.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `seq` | [uint64](#uint64) | | the sequence number of the bridge request |
-| `sender` | [string](#string) | | the sender address on the source chain |
-| `receiver` | [string](#string) | | the recipient address on the destination chain |
-| `amount` | [string](#string) | | the amount of token to be transferred |
+| `proposal_id` | [uint64](#uint64) | | |
+| `voter` | [string](#string) | | |
+| `option` | [VoteOption](#lbm.fbridge.v1.VoteOption) | | |
@@ -11459,6 +11518,33 @@ Msg defines the collection Msg service.
+
+
+
+### Role
+Role defines the role of the operator, guardian, and judge.
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| UNSPECIFIED | 0 | |
+| GUARDIAN | 1 | |
+| OPERATOR | 2 | |
+| JUDGE | 3 | |
+
+
+
+
+
+### VoteOption
+VoteOption enumerates the valid vote options for a given role proposal.
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| VOTE_OPTION_UNSPECIFIED | 0 | VOTE_OPTION_UNSPECIFIED defines a no-op vote option. |
+| VOTE_OPTION_YES | 1 | VOTE_OPTION_YES defines a yes vote option. |
+| VOTE_OPTION_NO | 2 | VOTE_OPTION_NO defines a no vote option. |
+
+
@@ -11467,98 +11553,92 @@ Msg defines the collection Msg service.
-
+
Top
-## lbm/fbridge/v1/fbridge.proto
+## lbm/fbridge/v1/event.proto
-
+
+
+### EventClaim
-### Fraction
-Fraction defines the protobuf message type for tmmath.Fraction that only
-supports positive values.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `numerator` | [uint64](#uint64) | | |
-| `denominator` | [uint64](#uint64) | | |
+| `seq` | [uint64](#uint64) | | the sequence number of the bridge request |
+| `sender` | [string](#string) | | the sender address on the source chain |
+| `receiver` | [string](#string) | | the recipient address on the destination chain |
+| `amount` | [string](#string) | | the amount of token to be claimed |
-
+
-### Params
+### EventConfirmProvision
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `operator_trust_level` | [Fraction](#lbm.fbridge.v1.Fraction) | | ratio of how many operators' confirmations are needed to be valid. |
-| `guardian_trust_level` | [Fraction](#lbm.fbridge.v1.Fraction) | | ratio of how many guardians' confirmations are needed to be valid. |
-| `judge_trust_level` | [Fraction](#lbm.fbridge.v1.Fraction) | | ratio of how many judges' confirmations are needed to be valid. |
-| `timelock_period` | [uint64](#uint64) | | default timelock period for each provision (unix timestamp) |
-| `proposal_period` | [uint64](#uint64) | | default period of the proposal to update the role |
+| `seq` | [uint64](#uint64) | | the sequence number of the bridge request |
-
+
+
+### EventProvision
-### ProvisionData
-Provision is a struct that represents a provision internally.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `seq` | [uint64](#uint64) | | the sequence number of the bridge request |
-| `amount` | [string](#string) | | the amount of token to be claimed |
| `sender` | [string](#string) | | the sender address on the source chain |
| `receiver` | [string](#string) | | the recipient address on the destination chain |
+| `amount` | [string](#string) | | the amount of token to be claimed |
+| `operator` | [string](#string) | | the address of the operator |
-
+
+
+### EventSuggestRole
-### ProvisionStatus
-ProvisionStatus is a struct that represents the status of a provision.
-To optimize computational cost, we have collected frequently changing values from provision.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `timelock_end` | [uint64](#uint64) | | the unix timestamp the provision will be able to be claimed (unix timestamp) |
-| `confirm_counts` | [int32](#int32) | | a value that tells how many operators have submitted this provision |
-| `is_claimed` | [bool](#bool) | | whether the provision has been claimed |
+| `proposal` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | | |
-
+
-### RoleProposal
+### EventTransfer
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `id` | [uint64](#uint64) | | |
-| `proposer` | [string](#string) | | the proposer address |
-| `target` | [string](#string) | | the address to update the role |
-| `role` | [Role](#lbm.fbridge.v1.Role) | | the role to be updated - unspecified : 0, used to remove the address from a group - guardian : 1 - operator : 2 - judge : 3 |
-| `expired_at` | [uint64](#uint64) | | the unix timestamp the proposal will be expired (unix timestamp) |
+| `seq` | [uint64](#uint64) | | the sequence number of the bridge request |
+| `sender` | [string](#string) | | the sender address on the source chain |
+| `receiver` | [string](#string) | | the recipient address on the destination chain |
+| `amount` | [string](#string) | | the amount of token to be transferred |
@@ -11566,20 +11646,6 @@ To optimize computational cost, we have collected frequently changing values fro
-
-
-
-### Role
-Role defines the role of the operator, guardian, and judge.
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| UNSPECIFIED | 0 | |
-| GUARDIAN | 1 | |
-| OPERATOR | 2 | |
-| JUDGE | 3 | |
-
-
@@ -11655,6 +11721,10 @@ GenesisState defines the fbridge module's genesis state.
| `params` | [Params](#lbm.fbridge.v1.Params) | | params defines all the parameters of the module. |
| `sending_state` | [SendingState](#lbm.fbridge.v1.SendingState) | | sending_state defines status saved when sending tokens to a counterpart chain |
| `receiving_state` | [ReceivingState](#lbm.fbridge.v1.ReceivingState) | | receiving_state defines status saved when receiving tokens from a counterpart chain |
+| `next_role_proposal_id` | [uint64](#uint64) | | next_role_proposal_id is the next role proposal ID to be used. |
+| `role_proposals` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | repeated | role_proposals defines all the role proposals present at genesis. |
+| `votes` | [Vote](#lbm.fbridge.v1.Vote) | repeated | votes defines all the votes present for role proposals at genesis. |
+| `role_metadata` | [RoleMetadata](#lbm.fbridge.v1.RoleMetadata) | | role_metadata defines all the role metadata present at genesis. |
@@ -12159,7 +12229,7 @@ GenesisState defines the fbridge module's genesis state.
| ----- | ---- | ----- | ----------- |
| `from` | [string](#string) | | the guardian address |
| `proposal_id` | [uint64](#uint64) | | the proposal ID |
-| `option` | [bool](#bool) | | the vote option - yes : true - no : false |
+| `option` | [VoteOption](#lbm.fbridge.v1.VoteOption) | | the vote option |
diff --git a/proto/lbm/fbridge/v1/event.proto b/proto/lbm/fbridge/v1/event.proto
index e7594d4dc8..2d505eaf1c 100644
--- a/proto/lbm/fbridge/v1/event.proto
+++ b/proto/lbm/fbridge/v1/event.proto
@@ -3,6 +3,9 @@ package lbm.fbridge.v1;
option go_package = "github.com/Finschia/finschia-sdk/x/fbridge/types";
+import "gogoproto/gogo.proto";
+import "lbm/fbridge/v1/fbridge.proto";
+
message EventTransfer {
// the sequence number of the bridge request
uint64 seq = 1;
@@ -14,6 +17,10 @@ message EventTransfer {
string amount = 4;
}
+message EventSuggestRole {
+ RoleProposal proposal = 1 [(gogoproto.nullable) = false];
+}
+
message EventProvision {
// the sequence number of the bridge request
uint64 seq = 1;
diff --git a/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto
index 6db9506e53..6882232936 100644
--- a/proto/lbm/fbridge/v1/fbridge.proto
+++ b/proto/lbm/fbridge/v1/fbridge.proto
@@ -3,6 +3,7 @@ package lbm.fbridge.v1;
option go_package = "github.com/Finschia/finschia-sdk/x/fbridge/types";
+import "google/protobuf/timestamp.proto";
import "gogoproto/gogo.proto";
message Params {
@@ -51,10 +52,12 @@ message Fraction {
// Role defines the role of the operator, guardian, and judge.
enum Role {
- UNSPECIFIED = 0;
- GUARDIAN = 1;
- OPERATOR = 2;
- JUDGE = 3;
+ option (gogoproto.goproto_enum_prefix) = false;
+
+ UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "RoleEmpty"];
+ GUARDIAN = 1 [(gogoproto.enumvalue_customname) = "RoleGuardian"];
+ OPERATOR = 2 [(gogoproto.enumvalue_customname) = "RoleOperator"];
+ JUDGE = 3 [(gogoproto.enumvalue_customname) = "RoleJudge"];
}
message RoleProposal {
@@ -71,5 +74,37 @@ message RoleProposal {
Role role = 4;
// the unix timestamp the proposal will be expired (unix timestamp)
- uint64 expired_at = 5;
+ google.protobuf.Timestamp expired_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
+}
+
+// VoteOption enumerates the valid vote options for a given role proposal.
+enum VoteOption {
+ option (gogoproto.goproto_enum_prefix) = false;
+
+ // VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
+ VOTE_OPTION_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "OptionEmpty"];
+ // VOTE_OPTION_YES defines a yes vote option.
+ VOTE_OPTION_YES = 1 [(gogoproto.enumvalue_customname) = "OptionYes"];
+ // VOTE_OPTION_NO defines a no vote option.
+ VOTE_OPTION_NO = 2 [(gogoproto.enumvalue_customname) = "OptionNo"];
+}
+
+// Vote defines a vote on a role proposal.
+message Vote {
+ option (gogoproto.goproto_stringer) = false;
+ option (gogoproto.equal) = false;
+
+ uint64 proposal_id = 1;
+ string voter = 2;
+ VoteOption option = 3;
+}
+
+// RoleMetadata defines the metadata of the role.
+message RoleMetadata {
+ // the number of registered guardians
+ uint32 guardian = 1;
+ // the number of the operators
+ uint32 operator = 2;
+ // the number of the judges
+ uint32 judge = 3;
}
\ No newline at end of file
diff --git a/proto/lbm/fbridge/v1/genesis.proto b/proto/lbm/fbridge/v1/genesis.proto
index 087d1acca9..a2fadc6e4c 100644
--- a/proto/lbm/fbridge/v1/genesis.proto
+++ b/proto/lbm/fbridge/v1/genesis.proto
@@ -14,6 +14,14 @@ message GenesisState {
SendingState sending_state = 2 [(gogoproto.nullable) = false];
// receiving_state defines status saved when receiving tokens from a counterpart chain
ReceivingState receiving_state = 3 [(gogoproto.nullable) = false];
+ // next_role_proposal_id is the next role proposal ID to be used.
+ uint64 next_role_proposal_id = 4;
+ // role_proposals defines all the role proposals present at genesis.
+ repeated RoleProposal role_proposals = 5 [(gogoproto.nullable) = false];
+ // votes defines all the votes present for role proposals at genesis.
+ repeated Vote votes = 6 [(gogoproto.nullable) = false];
+ // role_metadata defines all the role metadata present at genesis.
+ RoleMetadata role_metadata = 7 [(gogoproto.nullable) = false];
}
message SendingState {
diff --git a/proto/lbm/fbridge/v1/tx.proto b/proto/lbm/fbridge/v1/tx.proto
index 8b114a8645..c8c8d197af 100644
--- a/proto/lbm/fbridge/v1/tx.proto
+++ b/proto/lbm/fbridge/v1/tx.proto
@@ -145,9 +145,7 @@ message MsgAddVoteForRole {
// the proposal ID
uint64 proposal_id = 2;
// the vote option
- // - yes : true
- // - no : false
- bool option = 3;
+ VoteOption option = 3;
}
message MsgAddVoteForRoleResponse {}
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
new file mode 100644
index 0000000000..66d3694131
--- /dev/null
+++ b/x/fbridge/keeper/auth.go
@@ -0,0 +1,150 @@
+package keeper
+
+import (
+ "encoding/binary"
+ "errors"
+ "fmt"
+ sdk "github.com/Finschia/finschia-sdk/types"
+ sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
+ "github.com/Finschia/finschia-sdk/x/fbridge/types"
+ "time"
+)
+
+func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAddress, role types.Role) (types.RoleProposal, error) {
+ if k.GetRoleMetadata(ctx).Guardian < 1 && k.authority != proposer.String() {
+ return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrapf("only %s can submit a role proposal if there are no guardians", k.authority)
+ } else if k.GetRole(ctx, proposer) != types.RoleGuardian {
+ return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrap("only guardian can submit a role proposal")
+ }
+
+ if k.GetRole(ctx, target) == role {
+ return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrap("target already has same role")
+ }
+
+ proposalID := k.GetNextProposalID(ctx)
+ proposal := types.RoleProposal{
+ Id: proposalID,
+ Proposer: proposer.String(),
+ Target: target.String(),
+ Role: role,
+ ExpiredAt: ctx.BlockTime().Add(time.Duration(k.GetParams(ctx).ProposalPeriod)).UTC(),
+ }
+
+ k.setRoleProposal(ctx, proposal)
+ k.setNextProposalID(ctx, proposalID+1)
+
+ return proposal, nil
+}
+
+func (k Keeper) IsValidRole(role types.Role) error {
+ switch role {
+ case types.RoleGuardian, types.RoleOperator, types.RoleJudge:
+ return nil
+ }
+
+ return errors.New("unsupported role")
+}
+
+func (k Keeper) setNextProposalID(ctx sdk.Context, seq uint64) {
+ store := ctx.KVStore(k.storeKey)
+ bz := make([]byte, 8)
+ binary.BigEndian.PutUint64(bz, seq)
+ store.Set(types.KeyNextProposalID, bz)
+}
+
+func (k Keeper) GetNextProposalID(ctx sdk.Context) uint64 {
+ store := ctx.KVStore(k.storeKey)
+ bz := store.Get(types.KeyNextProposalID)
+ if bz == nil {
+ panic("next role proposal ID must be set at genesis")
+ }
+
+ return binary.BigEndian.Uint64(bz)
+}
+
+func (k Keeper) setRoleProposal(ctx sdk.Context, proposal types.RoleProposal) {
+ store := ctx.KVStore(k.storeKey)
+ bz := k.cdc.MustMarshal(&proposal)
+ store.Set(types.ProposalKey(proposal.Id), bz)
+}
+
+func (k Keeper) GetRoleProposal(ctx sdk.Context, id uint64) (proposal types.RoleProposal, found bool) {
+ store := ctx.KVStore(k.storeKey)
+ bz := store.Get(types.ProposalKey(id))
+ if bz == nil {
+ return proposal, false
+ }
+
+ k.cdc.MustUnmarshal(bz, &proposal)
+ return proposal, true
+}
+
+func (k Keeper) DeleteRoleProposal(ctx sdk.Context, id uint64) {
+ store := ctx.KVStore(k.storeKey)
+ if _, found := k.GetRoleProposal(ctx, id); !found {
+ panic(fmt.Sprintf("role proposal #%d not found", id))
+ }
+ store.Delete(types.ProposalKey(id))
+}
+
+// IterateProposals iterates over the all the role proposals and performs a callback function
+func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.RoleProposal) (stop bool)) {
+ store := ctx.KVStore(k.storeKey)
+
+ iterator := sdk.KVStorePrefixIterator(store, types.KeyProposalPrefix)
+ defer iterator.Close()
+
+ for ; iterator.Valid(); iterator.Next() {
+ var proposal types.RoleProposal
+ k.cdc.MustUnmarshal(iterator.Value(), &proposal)
+ if cb(proposal) {
+ break
+ }
+ }
+}
+
+// GetProposals returns all the role proposals from store
+func (k Keeper) GetProposals(ctx sdk.Context) (proposals []types.RoleProposal) {
+ k.IterateProposals(ctx, func(proposal types.RoleProposal) bool {
+ proposals = append(proposals, proposal)
+ return false
+ })
+ return
+}
+
+func (k Keeper) setRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) {
+ store := ctx.KVStore(k.storeKey)
+
+ bz := make([]byte, 4)
+ binary.BigEndian.PutUint32(bz, uint32(role))
+ store.Set(types.RoleKey(addr), bz)
+}
+
+func (k Keeper) GetRole(ctx sdk.Context, addr sdk.AccAddress) types.Role {
+ store := ctx.KVStore(k.storeKey)
+
+ bz := store.Get(types.RoleKey(addr))
+ if bz == nil {
+ return types.RoleEmpty
+ }
+
+ return types.Role(binary.BigEndian.Uint32(bz))
+}
+
+func (k Keeper) setRoleMetadata(ctx sdk.Context, data types.RoleMetadata) {
+ store := ctx.KVStore(k.storeKey)
+ bz := k.cdc.MustMarshal(&data)
+ store.Set(types.KeyRoleMetadata, bz)
+}
+
+func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata {
+ store := ctx.KVStore(k.storeKey)
+
+ data := types.RoleMetadata{}
+ bz := store.Get(types.KeyRoleMetadata)
+ if bz == nil {
+ panic("role metadata must be set at genesis")
+ }
+ k.cdc.MustUnmarshal(bz, &data)
+ return data
+}
diff --git a/x/fbridge/keeper/auth_test.go b/x/fbridge/keeper/auth_test.go
new file mode 100644
index 0000000000..b55569d4a4
--- /dev/null
+++ b/x/fbridge/keeper/auth_test.go
@@ -0,0 +1 @@
+package keeper
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index a0b492207e..e98a5aef5a 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -6,15 +6,27 @@ import (
)
func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error {
+ k.SetParams(ctx, gs.Params)
k.setNextSequence(ctx, gs.SendingState.NextSeq)
+ k.setNextProposalID(ctx, gs.NextRoleProposalId)
+ k.setRoleMetadata(ctx, gs.RoleMetadata)
+
+ for _, proposal := range gs.RoleProposals {
+ k.setRoleProposal(ctx, proposal)
+ }
+ // TODO: we initialize the appropriate genesis parameters whenever the feature is added
return nil
}
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
return &types.GenesisState{
+ Params: k.GetParams(ctx),
SendingState: types.SendingState{
NextSeq: k.GetNextSequence(ctx),
},
+ NextRoleProposalId: k.GetNextProposalID(ctx),
+ RoleMetadata: k.GetRoleMetadata(ctx),
+ RoleProposals: k.GetProposals(ctx),
}
}
diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go
index 491f57c632..c4309f4eaf 100644
--- a/x/fbridge/keeper/msg_server.go
+++ b/x/fbridge/keeper/msg_server.go
@@ -71,11 +71,38 @@ func (m msgServer) Claim(ctx context.Context, msg *types.MsgClaim) (*types.MsgCl
panic("implement me")
}
-func (m msgServer) SuggestRole(ctx context.Context, msg *types.MsgSuggestRole) (*types.MsgSuggestRoleResponse, error) {
- panic("implement me")
+func (m msgServer) SuggestRole(goCtx context.Context, msg *types.MsgSuggestRole) (*types.MsgSuggestRoleResponse, error) {
+ ctx := sdk.UnwrapSDKContext(goCtx)
+
+ proposer, err := sdk.AccAddressFromBech32(msg.From)
+ if err != nil {
+ return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid proposer address (%s)", err)
+ }
+
+ target, err := sdk.AccAddressFromBech32(msg.Target)
+ if err != nil {
+ return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid target address (%s)", err)
+ }
+
+ if err := m.IsValidRole(msg.Role); err != nil {
+ return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
+ }
+
+ proposal, err := m.RegisterRoleProposal(ctx, proposer, target, msg.Role)
+ if err != nil {
+ return nil, err
+ }
+
+ if err := ctx.EventManager().EmitTypedEvent(&types.EventSuggestRole{
+ Proposal: proposal,
+ }); err != nil {
+ panic(err)
+ }
+
+ return &types.MsgSuggestRoleResponse{}, nil
}
-func (m msgServer) AddVoteForRole(ctx context.Context, msg *types.MsgAddVoteForRole) (*types.MsgAddVoteForRoleResponse, error) {
+func (m msgServer) AddVoteForRole(goCtx context.Context, msg *types.MsgAddVoteForRole) (*types.MsgAddVoteForRoleResponse, error) {
panic("implement me")
}
diff --git a/x/fbridge/keeper/params.go b/x/fbridge/keeper/params.go
new file mode 100644
index 0000000000..dcbfc093d7
--- /dev/null
+++ b/x/fbridge/keeper/params.go
@@ -0,0 +1,24 @@
+package keeper
+
+import (
+ sdk "github.com/Finschia/finschia-sdk/types"
+ "github.com/Finschia/finschia-sdk/x/fbridge/types"
+)
+
+func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
+ store := ctx.KVStore(k.storeKey)
+ bz := k.cdc.MustMarshal(¶ms)
+ store.Set(types.KeyParams, bz)
+}
+
+func (k Keeper) GetParams(ctx sdk.Context) types.Params {
+ store := ctx.KVStore(k.storeKey)
+ bz := store.Get(types.KeyParams)
+ if bz == nil {
+ return types.DefaultParams()
+ }
+
+ var params types.Params
+ k.cdc.MustUnmarshal(bz, ¶ms)
+ return params
+}
diff --git a/x/fbridge/types/event.pb.go b/x/fbridge/types/event.pb.go
index 0749710deb..044154a694 100644
--- a/x/fbridge/types/event.pb.go
+++ b/x/fbridge/types/event.pb.go
@@ -5,6 +5,7 @@ package types
import (
fmt "fmt"
+ _ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
@@ -94,6 +95,50 @@ func (m *EventTransfer) GetAmount() string {
return ""
}
+type EventSuggestRole struct {
+ Proposal RoleProposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"`
+}
+
+func (m *EventSuggestRole) Reset() { *m = EventSuggestRole{} }
+func (m *EventSuggestRole) String() string { return proto.CompactTextString(m) }
+func (*EventSuggestRole) ProtoMessage() {}
+func (*EventSuggestRole) Descriptor() ([]byte, []int) {
+ return fileDescriptor_a36aa6e56f2275b8, []int{1}
+}
+func (m *EventSuggestRole) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *EventSuggestRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_EventSuggestRole.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 *EventSuggestRole) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EventSuggestRole.Merge(m, src)
+}
+func (m *EventSuggestRole) XXX_Size() int {
+ return m.Size()
+}
+func (m *EventSuggestRole) XXX_DiscardUnknown() {
+ xxx_messageInfo_EventSuggestRole.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EventSuggestRole proto.InternalMessageInfo
+
+func (m *EventSuggestRole) GetProposal() RoleProposal {
+ if m != nil {
+ return m.Proposal
+ }
+ return RoleProposal{}
+}
+
type EventProvision struct {
// the sequence number of the bridge request
Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"`
@@ -111,7 +156,7 @@ func (m *EventProvision) Reset() { *m = EventProvision{} }
func (m *EventProvision) String() string { return proto.CompactTextString(m) }
func (*EventProvision) ProtoMessage() {}
func (*EventProvision) Descriptor() ([]byte, []int) {
- return fileDescriptor_a36aa6e56f2275b8, []int{1}
+ return fileDescriptor_a36aa6e56f2275b8, []int{2}
}
func (m *EventProvision) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -184,7 +229,7 @@ func (m *EventConfirmProvision) Reset() { *m = EventConfirmProvision{} }
func (m *EventConfirmProvision) String() string { return proto.CompactTextString(m) }
func (*EventConfirmProvision) ProtoMessage() {}
func (*EventConfirmProvision) Descriptor() ([]byte, []int) {
- return fileDescriptor_a36aa6e56f2275b8, []int{2}
+ return fileDescriptor_a36aa6e56f2275b8, []int{3}
}
func (m *EventConfirmProvision) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -235,7 +280,7 @@ func (m *EventClaim) Reset() { *m = EventClaim{} }
func (m *EventClaim) String() string { return proto.CompactTextString(m) }
func (*EventClaim) ProtoMessage() {}
func (*EventClaim) Descriptor() ([]byte, []int) {
- return fileDescriptor_a36aa6e56f2275b8, []int{3}
+ return fileDescriptor_a36aa6e56f2275b8, []int{4}
}
func (m *EventClaim) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -294,6 +339,7 @@ func (m *EventClaim) GetAmount() string {
func init() {
proto.RegisterType((*EventTransfer)(nil), "lbm.fbridge.v1.EventTransfer")
+ proto.RegisterType((*EventSuggestRole)(nil), "lbm.fbridge.v1.EventSuggestRole")
proto.RegisterType((*EventProvision)(nil), "lbm.fbridge.v1.EventProvision")
proto.RegisterType((*EventConfirmProvision)(nil), "lbm.fbridge.v1.EventConfirmProvision")
proto.RegisterType((*EventClaim)(nil), "lbm.fbridge.v1.EventClaim")
@@ -302,25 +348,29 @@ func init() {
func init() { proto.RegisterFile("lbm/fbridge/v1/event.proto", fileDescriptor_a36aa6e56f2275b8) }
var fileDescriptor_a36aa6e56f2275b8 = []byte{
- // 276 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0xbd, 0x4e, 0xc3, 0x30,
- 0x10, 0xc7, 0x63, 0x5a, 0x2a, 0xb0, 0x44, 0x85, 0x22, 0x81, 0xa2, 0x0e, 0x56, 0x95, 0xa9, 0x0c,
- 0xc4, 0x54, 0xbc, 0x01, 0x08, 0x06, 0x26, 0x54, 0x31, 0xb1, 0xe5, 0xe3, 0xd2, 0x1a, 0x62, 0x3b,
- 0x9c, 0x5d, 0x0b, 0x5e, 0x81, 0x89, 0xc7, 0x62, 0xec, 0xc8, 0x88, 0x92, 0x17, 0x41, 0xf9, 0xa0,
- 0x63, 0xb7, 0x6e, 0xf7, 0xd3, 0xff, 0x7e, 0xba, 0xbf, 0x74, 0x74, 0x52, 0x24, 0x92, 0xe7, 0x09,
- 0x8a,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xd7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x5f, 0xda, 0xeb,
- 0x13, 0x02, 0x00, 0x00,
+ // 343 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x92, 0xbd, 0x4e, 0xeb, 0x40,
+ 0x10, 0x85, 0xed, 0x9b, 0xdc, 0x28, 0x77, 0xaf, 0x88, 0x22, 0x0b, 0x90, 0x65, 0x45, 0x26, 0x72,
+ 0x15, 0x0a, 0x6c, 0x02, 0x3d, 0x45, 0x10, 0x14, 0x54, 0x91, 0xa1, 0xa2, 0xb3, 0x93, 0xb1, 0xb3,
+ 0xe0, 0xdd, 0x31, 0xbb, 0x1b, 0x0b, 0x5e, 0x81, 0x8a, 0xc7, 0x4a, 0x99, 0x92, 0x0a, 0xa1, 0xe4,
+ 0x45, 0x90, 0xd7, 0x4e, 0x24, 0x28, 0xe8, 0xd2, 0xcd, 0xd1, 0x39, 0xdf, 0xfc, 0x48, 0x43, 0x9c,
+ 0x2c, 0x66, 0x41, 0x12, 0x0b, 0x3a, 0x4d, 0x21, 0x28, 0x86, 0x01, 0x14, 0xc0, 0x95, 0x9f, 0x0b,
+ 0x54, 0x68, 0x75, 0xb2, 0x98, 0xf9, 0xb5, 0xe7, 0x17, 0x43, 0x67, 0x3f, 0xc5, 0x14, 0xb5, 0x15,
+ 0x94, 0x55, 0x95, 0x72, 0x7a, 0x3f, 0x3a, 0x6c, 0x00, 0xed, 0x7a, 0x8c, 0xec, 0x5d, 0x95, 0x2d,
+ 0xef, 0x44, 0xc4, 0x65, 0x02, 0xc2, 0xea, 0x92, 0x86, 0x84, 0x27, 0xdb, 0xec, 0x9b, 0x83, 0x66,
+ 0x58, 0x96, 0xd6, 0x21, 0x69, 0x49, 0xe0, 0x53, 0x10, 0xf6, 0x9f, 0xbe, 0x39, 0xf8, 0x17, 0xd6,
+ 0xca, 0x72, 0x48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00, 0x00,
}
func (m *EventTransfer) Marshal() (dAtA []byte, err error) {
@@ -372,6 +422,39 @@ func (m *EventTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *EventSuggestRole) 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 *EventSuggestRole) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *EventSuggestRole) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ {
+ size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintEvent(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
+ return len(dAtA) - i, nil
+}
+
func (m *EventProvision) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -540,6 +623,17 @@ func (m *EventTransfer) Size() (n int) {
return n
}
+func (m *EventSuggestRole) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = m.Proposal.Size()
+ n += 1 + l + sovEvent(uint64(l))
+ return n
+}
+
func (m *EventProvision) Size() (n int) {
if m == nil {
return 0
@@ -775,6 +869,89 @@ func (m *EventTransfer) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *EventSuggestRole) 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 ErrIntOverflowEvent
+ }
+ 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: EventSuggestRole: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: EventSuggestRole: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEvent
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthEvent
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthEvent
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipEvent(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthEvent
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *EventProvision) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
diff --git a/x/fbridge/types/fbridge.pb.go b/x/fbridge/types/fbridge.pb.go
index a9b8197a74..45409b28fd 100644
--- a/x/fbridge/types/fbridge.pb.go
+++ b/x/fbridge/types/fbridge.pb.go
@@ -8,15 +8,19 @@ import (
github_com_Finschia_finschia_sdk_types "github.com/Finschia/finschia-sdk/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
+ github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
+ _ "google.golang.org/protobuf/types/known/timestamppb"
io "io"
math "math"
math_bits "math/bits"
+ time "time"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
+var _ = time.Kitchen
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
@@ -28,10 +32,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Role int32
const (
- Role_UNSPECIFIED Role = 0
- Role_GUARDIAN Role = 1
- Role_OPERATOR Role = 2
- Role_JUDGE Role = 3
+ RoleEmpty Role = 0
+ RoleGuardian Role = 1
+ RoleOperator Role = 2
+ RoleJudge Role = 3
)
var Role_name = map[int32]string{
@@ -56,6 +60,38 @@ func (Role) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_62374d75fc6aa1ba, []int{0}
}
+// VoteOption enumerates the valid vote options for a given role proposal.
+type VoteOption int32
+
+const (
+ // VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
+ OptionEmpty VoteOption = 0
+ // VOTE_OPTION_YES defines a yes vote option.
+ OptionYes VoteOption = 1
+ // VOTE_OPTION_NO defines a no vote option.
+ OptionNo VoteOption = 2
+)
+
+var VoteOption_name = map[int32]string{
+ 0: "VOTE_OPTION_UNSPECIFIED",
+ 1: "VOTE_OPTION_YES",
+ 2: "VOTE_OPTION_NO",
+}
+
+var VoteOption_value = map[string]int32{
+ "VOTE_OPTION_UNSPECIFIED": 0,
+ "VOTE_OPTION_YES": 1,
+ "VOTE_OPTION_NO": 2,
+}
+
+func (x VoteOption) String() string {
+ return proto.EnumName(VoteOption_name, int32(x))
+}
+
+func (VoteOption) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_62374d75fc6aa1ba, []int{1}
+}
+
type Params struct {
// ratio of how many operators' confirmations are needed to be valid.
OperatorTrustLevel Fraction `protobuf:"bytes,1,opt,name=operator_trust_level,json=operatorTrustLevel,proto3" json:"operator_trust_level"`
@@ -335,7 +371,7 @@ type RoleProposal struct {
// - judge : 3
Role Role `protobuf:"varint,4,opt,name=role,proto3,enum=lbm.fbridge.v1.Role" json:"role,omitempty"`
// the unix timestamp the proposal will be expired (unix timestamp)
- ExpiredAt uint64 `protobuf:"varint,5,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"`
+ ExpiredAt time.Time `protobuf:"bytes,5,opt,name=expired_at,json=expiredAt,proto3,stdtime" json:"expired_at"`
}
func (m *RoleProposal) Reset() { *m = RoleProposal{} }
@@ -396,68 +432,211 @@ func (m *RoleProposal) GetRole() Role {
if m != nil {
return m.Role
}
- return Role_UNSPECIFIED
+ return RoleEmpty
}
-func (m *RoleProposal) GetExpiredAt() uint64 {
+func (m *RoleProposal) GetExpiredAt() time.Time {
if m != nil {
return m.ExpiredAt
}
+ return time.Time{}
+}
+
+// Vote defines a vote on a role proposal.
+type Vote struct {
+ ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
+ Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"`
+ Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=lbm.fbridge.v1.VoteOption" json:"option,omitempty"`
+}
+
+func (m *Vote) Reset() { *m = Vote{} }
+func (*Vote) ProtoMessage() {}
+func (*Vote) Descriptor() ([]byte, []int) {
+ return fileDescriptor_62374d75fc6aa1ba, []int{5}
+}
+func (m *Vote) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_Vote.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 *Vote) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Vote.Merge(m, src)
+}
+func (m *Vote) XXX_Size() int {
+ return m.Size()
+}
+func (m *Vote) XXX_DiscardUnknown() {
+ xxx_messageInfo_Vote.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Vote proto.InternalMessageInfo
+
+func (m *Vote) GetProposalId() uint64 {
+ if m != nil {
+ return m.ProposalId
+ }
+ return 0
+}
+
+func (m *Vote) GetVoter() string {
+ if m != nil {
+ return m.Voter
+ }
+ return ""
+}
+
+func (m *Vote) GetOption() VoteOption {
+ if m != nil {
+ return m.Option
+ }
+ return OptionEmpty
+}
+
+// RoleMetadata defines the metadata of the role.
+type RoleMetadata struct {
+ // the number of registered guardians
+ Guardian uint32 `protobuf:"varint,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
+ // the number of the operators
+ Operator uint32 `protobuf:"varint,2,opt,name=operator,proto3" json:"operator,omitempty"`
+ // the number of the judges
+ Judge uint32 `protobuf:"varint,3,opt,name=judge,proto3" json:"judge,omitempty"`
+}
+
+func (m *RoleMetadata) Reset() { *m = RoleMetadata{} }
+func (m *RoleMetadata) String() string { return proto.CompactTextString(m) }
+func (*RoleMetadata) ProtoMessage() {}
+func (*RoleMetadata) Descriptor() ([]byte, []int) {
+ return fileDescriptor_62374d75fc6aa1ba, []int{6}
+}
+func (m *RoleMetadata) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *RoleMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_RoleMetadata.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 *RoleMetadata) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_RoleMetadata.Merge(m, src)
+}
+func (m *RoleMetadata) XXX_Size() int {
+ return m.Size()
+}
+func (m *RoleMetadata) XXX_DiscardUnknown() {
+ xxx_messageInfo_RoleMetadata.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_RoleMetadata proto.InternalMessageInfo
+
+func (m *RoleMetadata) GetGuardian() uint32 {
+ if m != nil {
+ return m.Guardian
+ }
+ return 0
+}
+
+func (m *RoleMetadata) GetOperator() uint32 {
+ if m != nil {
+ return m.Operator
+ }
+ return 0
+}
+
+func (m *RoleMetadata) GetJudge() uint32 {
+ if m != nil {
+ return m.Judge
+ }
return 0
}
func init() {
proto.RegisterEnum("lbm.fbridge.v1.Role", Role_name, Role_value)
+ proto.RegisterEnum("lbm.fbridge.v1.VoteOption", VoteOption_name, VoteOption_value)
proto.RegisterType((*Params)(nil), "lbm.fbridge.v1.Params")
proto.RegisterType((*ProvisionData)(nil), "lbm.fbridge.v1.ProvisionData")
proto.RegisterType((*ProvisionStatus)(nil), "lbm.fbridge.v1.ProvisionStatus")
proto.RegisterType((*Fraction)(nil), "lbm.fbridge.v1.Fraction")
proto.RegisterType((*RoleProposal)(nil), "lbm.fbridge.v1.RoleProposal")
+ proto.RegisterType((*Vote)(nil), "lbm.fbridge.v1.Vote")
+ proto.RegisterType((*RoleMetadata)(nil), "lbm.fbridge.v1.RoleMetadata")
}
func init() { proto.RegisterFile("lbm/fbridge/v1/fbridge.proto", fileDescriptor_62374d75fc6aa1ba) }
var fileDescriptor_62374d75fc6aa1ba = []byte{
- // 614 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x41, 0x4f, 0x1b, 0x3d,
- 0x10, 0xcd, 0x86, 0x10, 0x65, 0x27, 0x90, 0xe4, 0xb3, 0xd0, 0x27, 0x84, 0x68, 0xa0, 0x91, 0xaa,
- 0x22, 0xa4, 0x26, 0x85, 0xde, 0x2b, 0x05, 0x12, 0x50, 0xa2, 0x0a, 0x56, 0x06, 0x2e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7, 0xe4, 0x6a, 0xfe, 0x9f,
- 0x60, 0x37, 0x66, 0x5a, 0xb5, 0xbf, 0xf4, 0x37, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x74, 0xf3,
- 0xa0, 0x53, 0x2f, 0x04, 0x00, 0x00,
+ // 865 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcf, 0x6f, 0x1b, 0x45,
+ 0x14, 0xf6, 0x3a, 0x8e, 0x65, 0x3f, 0xc7, 0x3f, 0x18, 0x45, 0x10, 0xad, 0xca, 0xda, 0x58, 0x42,
+ 0x44, 0x15, 0xac, 0xa9, 0xb9, 0x71, 0xcb, 0x0f, 0x27, 0xb2, 0x05, 0xb6, 0x35, 0x71, 0x2a, 0x15,
+ 0x21, 0x59, 0x6b, 0xef, 0x64, 0x3b, 0x74, 0x77, 0x67, 0x99, 0x1d, 0x5b, 0x2d, 0xdc, 0x11, 0xca,
+ 0xa9, 0x47, 0x2e, 0x91, 0x8a, 0xf8, 0x4b, 0xb8, 0x55, 0x9c, 0x7a, 0x44, 0x1c, 0x0a, 0x4a, 0x2e,
+ 0xfc, 0x19, 0x68, 0x66, 0x76, 0x36, 0x4e, 0x2f, 0xe4, 0x36, 0xef, 0x9b, 0xef, 0xbd, 0xf7, 0xed,
+ 0x37, 0xef, 0xd9, 0xf0, 0x20, 0x5c, 0x44, 0xbd, 0x8b, 0x05, 0xa7, 0x7e, 0x40, 0x7a, 0xeb, 0x47,
+ 0xe6, 0xe8, 0x26, 0x9c, 0x09, 0x86, 0x1a, 0xe1, 0x22, 0x72, 0x0d, 0xb4, 0x7e, 0x64, 0xb7, 0x03,
+ 0xc6, 0x82, 0x90, 0xf4, 0xd4, 0xed, 0x62, 0x75, 0xd1, 0x13, 0x34, 0x22, 0xa9, 0xf0, 0xa2, 0x44,
+ 0x27, 0xd8, 0xbb, 0x01, 0x0b, 0x98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92, 0x23, 0x06, 0x00,
+ 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@@ -671,11 +850,14 @@ func (m *RoleProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
- if m.ExpiredAt != 0 {
- i = encodeVarintFbridge(dAtA, i, uint64(m.ExpiredAt))
- i--
- dAtA[i] = 0x28
+ n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpiredAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiredAt):])
+ if err4 != nil {
+ return 0, err4
}
+ i -= n4
+ i = encodeVarintFbridge(dAtA, i, uint64(n4))
+ i--
+ dAtA[i] = 0x2a
if m.Role != 0 {
i = encodeVarintFbridge(dAtA, i, uint64(m.Role))
i--
@@ -703,6 +885,84 @@ func (m *RoleProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *Vote) 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 *Vote) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Option != 0 {
+ i = encodeVarintFbridge(dAtA, i, uint64(m.Option))
+ i--
+ dAtA[i] = 0x18
+ }
+ if len(m.Voter) > 0 {
+ i -= len(m.Voter)
+ copy(dAtA[i:], m.Voter)
+ i = encodeVarintFbridge(dAtA, i, uint64(len(m.Voter)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if m.ProposalId != 0 {
+ i = encodeVarintFbridge(dAtA, i, uint64(m.ProposalId))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *RoleMetadata) 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 *RoleMetadata) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *RoleMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Judge != 0 {
+ i = encodeVarintFbridge(dAtA, i, uint64(m.Judge))
+ i--
+ dAtA[i] = 0x18
+ }
+ if m.Operator != 0 {
+ i = encodeVarintFbridge(dAtA, i, uint64(m.Operator))
+ i--
+ dAtA[i] = 0x10
+ }
+ if m.Guardian != 0 {
+ i = encodeVarintFbridge(dAtA, i, uint64(m.Guardian))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintFbridge(dAtA []byte, offset int, v uint64) int {
offset -= sovFbridge(v)
base := offset
@@ -810,8 +1070,44 @@ func (m *RoleProposal) Size() (n int) {
if m.Role != 0 {
n += 1 + sovFbridge(uint64(m.Role))
}
- if m.ExpiredAt != 0 {
- n += 1 + sovFbridge(uint64(m.ExpiredAt))
+ l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiredAt)
+ n += 1 + l + sovFbridge(uint64(l))
+ return n
+}
+
+func (m *Vote) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.ProposalId != 0 {
+ n += 1 + sovFbridge(uint64(m.ProposalId))
+ }
+ l = len(m.Voter)
+ if l > 0 {
+ n += 1 + l + sovFbridge(uint64(l))
+ }
+ if m.Option != 0 {
+ n += 1 + sovFbridge(uint64(m.Option))
+ }
+ return n
+}
+
+func (m *RoleMetadata) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Guardian != 0 {
+ n += 1 + sovFbridge(uint64(m.Guardian))
+ }
+ if m.Operator != 0 {
+ n += 1 + sovFbridge(uint64(m.Operator))
+ }
+ if m.Judge != 0 {
+ n += 1 + sovFbridge(uint64(m.Judge))
}
return n
}
@@ -1504,10 +1800,251 @@ func (m *RoleProposal) Unmarshal(dAtA []byte) error {
}
}
case 5:
- if wireType != 0 {
+ if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ExpiredAt", wireType)
}
- m.ExpiredAt = 0
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExpiredAt, dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipFbridge(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *Vote) 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 ErrIntOverflowFbridge
+ }
+ 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: Vote: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType)
+ }
+ m.ProposalId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ProposalId |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Voter = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 3:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType)
+ }
+ m.Option = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Option |= VoteOption(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipFbridge(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *RoleMetadata) 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 ErrIntOverflowFbridge
+ }
+ 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: RoleMetadata: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: RoleMetadata: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Guardian", wireType)
+ }
+ m.Guardian = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Guardian |= uint32(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType)
+ }
+ m.Operator = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Operator |= uint32(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 3:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Judge", wireType)
+ }
+ m.Judge = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowFbridge
@@ -1517,7 +2054,7 @@ func (m *RoleProposal) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- m.ExpiredAt |= uint64(b&0x7F) << shift
+ m.Judge |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 07af6f9677..c07db74618 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -1,8 +1,6 @@
package types
import (
- "errors"
-
sdk "github.com/Finschia/finschia-sdk/types"
authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
govtypes "github.com/Finschia/finschia-sdk/x/gov/types"
@@ -13,13 +11,23 @@ func DefaultGenesisState() *GenesisState {
SendingState: SendingState{
NextSeq: 1,
},
- ReceivingState: ReceivingState{},
+ ReceivingState: ReceivingState{},
+ NextRoleProposalId: 1,
+ RoleMetadata: RoleMetadata{Guardian: 0, Operator: 0, Judge: 0},
}
}
func ValidateGenesis(data GenesisState) error {
if data.SendingState.NextSeq < 1 {
- panic(errors.New("next sequence must be positive"))
+ panic("next sequence must be positive")
+ }
+
+ if data.NextRoleProposalId < 1 {
+ panic("next role proposal ID must be positive")
+ }
+
+ if data.RoleMetadata.Guardian < 0 || data.RoleMetadata.Operator < 0 || data.RoleMetadata.Judge < 0 {
+ panic("length of each group must be positive")
}
return nil
diff --git a/x/fbridge/types/genesis.pb.go b/x/fbridge/types/genesis.pb.go
index 60dc09d4c7..4df591827b 100644
--- a/x/fbridge/types/genesis.pb.go
+++ b/x/fbridge/types/genesis.pb.go
@@ -31,6 +31,14 @@ type GenesisState struct {
SendingState SendingState `protobuf:"bytes,2,opt,name=sending_state,json=sendingState,proto3" json:"sending_state"`
// receiving_state defines status saved when receiving tokens from a counterpart chain
ReceivingState ReceivingState `protobuf:"bytes,3,opt,name=receiving_state,json=receivingState,proto3" json:"receiving_state"`
+ // next_role_proposal_id is the next role proposal ID to be used.
+ NextRoleProposalId uint64 `protobuf:"varint,4,opt,name=next_role_proposal_id,json=nextRoleProposalId,proto3" json:"next_role_proposal_id,omitempty"`
+ // role_proposals defines all the role proposals present at genesis.
+ RoleProposals []RoleProposal `protobuf:"bytes,5,rep,name=role_proposals,json=roleProposals,proto3" json:"role_proposals"`
+ // votes defines all the votes present for role proposals at genesis.
+ Votes []Vote `protobuf:"bytes,6,rep,name=votes,proto3" json:"votes"`
+ // role_metadata defines all the role metadata present at genesis.
+ RoleMetadata RoleMetadata `protobuf:"bytes,7,opt,name=role_metadata,json=roleMetadata,proto3" json:"role_metadata"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
@@ -87,6 +95,34 @@ func (m *GenesisState) GetReceivingState() ReceivingState {
return ReceivingState{}
}
+func (m *GenesisState) GetNextRoleProposalId() uint64 {
+ if m != nil {
+ return m.NextRoleProposalId
+ }
+ return 0
+}
+
+func (m *GenesisState) GetRoleProposals() []RoleProposal {
+ if m != nil {
+ return m.RoleProposals
+ }
+ return nil
+}
+
+func (m *GenesisState) GetVotes() []Vote {
+ if m != nil {
+ return m.Votes
+ }
+ return nil
+}
+
+func (m *GenesisState) GetRoleMetadata() RoleMetadata {
+ if m != nil {
+ return m.RoleMetadata
+ }
+ return RoleMetadata{}
+}
+
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"`
@@ -475,49 +511,55 @@ 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, 0xee, 0xaa, 0xb1, 0xd7, 0xf6, 0x6e, 0xa2, 0xf6, 0x1b, 0x70,
- 0xe4, 0xc6, 0x95, 0x0b, 0xdf, 0xa5, 0xc7, 0x1e, 0x39, 0x20, 0x84, 0xda, 0x2f, 0x82, 0xbc, 0x5d,
- 0xbf, 0xc4, 0x6d, 0x25, 0xb8, 0xed, 0xee, 0xfc, 0xe7, 0x37, 0xff, 0x59, 0x8f, 0x17, 0xb6, 0x26,
- 0x5e, 0x68, 0x8e, 0xbd, 0x94, 0x8c, 0x02, 0x6c, 0xce, 0x76, 0xcc, 0x00, 0x47, 0x98, 0x11, 0x36,
- 0x88, 0x53, 0xca, 0x29, 0x5a, 0x9d, 0x78, 0xe1, 0x40, 0x46, 0x07, 0xb3, 0x9d, 0xee, 0x7f, 0x01,
- 0x0d, 0xa8, 0x08, 0x99, 0xd9, 0xea, 0x5a, 0xd5, 0xad, 0x33, 0xf2, 0x04, 0x11, 0x35, 0x7e, 0x2a,
- 0xd0, 0x39, 0xbc, 0xa6, 0xda, 0xdc, 0xe5, 0x18, 0x3d, 0x83, 0x76, 0xec, 0xa6, 0x6e, 0xc8, 0x34,
- 0xa5, 0x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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,
+ // 755 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xcd, 0x4e, 0xdb, 0x40,
+ 0x10, 0xc7, 0xe3, 0xc4, 0x04, 0x18, 0x42, 0x40, 0x2b, 0x40, 0x26, 0xa5, 0x4e, 0x64, 0xf5, 0x90,
+ 0x43, 0x9b, 0x90,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, 0xea,
+ 0x06, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -540,6 +582,49 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
+ {
+ size, err := m.RoleMetadata.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintGenesis(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x3a
+ if len(m.Votes) > 0 {
+ for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- {
+ {
+ size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintGenesis(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x32
+ }
+ }
+ if len(m.RoleProposals) > 0 {
+ for iNdEx := len(m.RoleProposals) - 1; iNdEx >= 0; iNdEx-- {
+ {
+ size, err := m.RoleProposals[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintGenesis(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x2a
+ }
+ }
+ if m.NextRoleProposalId != 0 {
+ i = encodeVarintGenesis(dAtA, i, uint64(m.NextRoleProposalId))
+ i--
+ dAtA[i] = 0x20
+ }
{
size, err := m.ReceivingState.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@@ -711,20 +796,20 @@ func (m *ReceivingState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
}
}
if len(m.PendingClaimSeqs) > 0 {
- dAtA5 := make([]byte, len(m.PendingClaimSeqs)*10)
- var j4 int
+ dAtA6 := make([]byte, len(m.PendingClaimSeqs)*10)
+ var j5 int
for _, num := range m.PendingClaimSeqs {
for num >= 1<<7 {
- dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80)
+ dAtA6[j5] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
- j4++
+ j5++
}
- dAtA5[j4] = uint8(num)
- j4++
+ dAtA6[j5] = uint8(num)
+ j5++
}
- i -= j4
- copy(dAtA[i:], dAtA5[:j4])
- i = encodeVarintGenesis(dAtA, i, uint64(j4))
+ i -= j5
+ copy(dAtA[i:], dAtA6[:j5])
+ i = encodeVarintGenesis(dAtA, i, uint64(j5))
i--
dAtA[i] = 0x22
}
@@ -953,6 +1038,23 @@ func (m *GenesisState) Size() (n int) {
n += 1 + l + sovGenesis(uint64(l))
l = m.ReceivingState.Size()
n += 1 + l + sovGenesis(uint64(l))
+ if m.NextRoleProposalId != 0 {
+ n += 1 + sovGenesis(uint64(m.NextRoleProposalId))
+ }
+ if len(m.RoleProposals) > 0 {
+ for _, e := range m.RoleProposals {
+ l = e.Size()
+ n += 1 + l + sovGenesis(uint64(l))
+ }
+ }
+ if len(m.Votes) > 0 {
+ for _, e := range m.Votes {
+ l = e.Size()
+ n += 1 + l + sovGenesis(uint64(l))
+ }
+ }
+ l = m.RoleMetadata.Size()
+ n += 1 + l + sovGenesis(uint64(l))
return n
}
@@ -1245,6 +1347,126 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
+ case 4:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field NextRoleProposalId", wireType)
+ }
+ m.NextRoleProposalId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.NextRoleProposalId |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 5:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field RoleProposals", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.RoleProposals = append(m.RoleProposals, RoleProposal{})
+ if err := m.RoleProposals[len(m.RoleProposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 6:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Votes = append(m.Votes, Vote{})
+ if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 7:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field RoleMetadata", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.RoleMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go
index 03179de065..09d8216e07 100644
--- a/x/fbridge/types/keys.go
+++ b/x/fbridge/types/keys.go
@@ -1,5 +1,12 @@
package types
+import (
+ "encoding/binary"
+ sdk "github.com/Finschia/finschia-sdk/types"
+ "github.com/Finschia/finschia-sdk/types/address"
+ "github.com/Finschia/finschia-sdk/types/kv"
+)
+
const (
// ModuleName is the module name constant used in many places
ModuleName = "fbridge"
@@ -8,7 +15,55 @@ const (
StoreKey = ModuleName
)
+// - 0x01: params
+// - 0x02: next sequence number for bridge send
+//
+// - 0x10: next proposal ID
+// 0x11: proposal
+// 0x12: vote
+// - 0x13: role
+
var (
KeyParams = []byte{0x01} // key for fbridge module params
KeyNextSeqSend = []byte{0x02} // key for the next bridge send sequence
+
+ KeyNextProposalID = []byte{0x10} // key for the next role proposal ID
+ KeyProposalPrefix = []byte{0x11} // key prefix for the role proposal
+ KeyProposalVotePrefix = []byte{0x12} // key prefix for the role proposal vote
+ KeyRolePrefix = []byte{0x13} // key prefix for the role of an address
+ KeyRoleMetadata = []byte{0x14}
)
+
+// GetProposalIDBytes returns the byte representation of the proposalID
+func GetProposalIDBytes(proposalID uint64) []byte {
+ bz := make([]byte, 8)
+ binary.BigEndian.PutUint64(bz, proposalID)
+ return bz
+}
+
+// ProposalKey key of a specific role proposal
+func ProposalKey(proposalID uint64) []byte {
+ return append(KeyProposalPrefix, GetProposalIDBytes(proposalID)...)
+}
+
+// SplitProposalKey split the proposal key and returns the proposal id
+func SplitProposalKey(key []byte) (proposalID uint64) {
+ kv.AssertKeyLength(key[1:], 8)
+
+ return binary.BigEndian.Uint64(key[1:])
+}
+
+// VotesKey gets the first part of the votes key based on the proposalID
+func VotesKey(proposalID uint64) []byte {
+ return append(KeyProposalVotePrefix, GetProposalIDBytes(proposalID)...)
+}
+
+// VoterVoteKey key of a specific vote from the store
+func VoterVoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte {
+ return append(VotesKey(proposalID), address.MustLengthPrefix(voterAddr.Bytes())...)
+}
+
+// RoleKey key of a specific role of the address from the store
+func RoleKey(target sdk.AccAddress) []byte {
+ return append(KeyRolePrefix, address.MustLengthPrefix(target.Bytes())...)
+}
diff --git a/x/fbridge/types/params.go b/x/fbridge/types/params.go
index ab1254f4c2..c4d8f2a5fc 100644
--- a/x/fbridge/types/params.go
+++ b/x/fbridge/types/params.go
@@ -1 +1,12 @@
package types
+
+import "time"
+
+func DefaultParams() Params {
+ return Params{
+ GuardianTrustLevel: Fraction{Numerator: 2, Denominator: 3},
+ OperatorTrustLevel: Fraction{Numerator: 2, Denominator: 3},
+ JudgeTrustLevel: Fraction{Numerator: 2, Denominator: 3},
+ ProposalPeriod: uint64(time.Minute * 60),
+ }
+}
diff --git a/x/fbridge/types/tx.pb.go b/x/fbridge/types/tx.pb.go
index 91346052d5..25c2abcd10 100644
--- a/x/fbridge/types/tx.pb.go
+++ b/x/fbridge/types/tx.pb.go
@@ -753,7 +753,7 @@ func (m *MsgSuggestRole) GetRole() Role {
if m != nil {
return m.Role
}
- return Role_UNSPECIFIED
+ return RoleEmpty
}
type MsgSuggestRoleResponse struct {
@@ -798,9 +798,7 @@ type MsgAddVoteForRole struct {
// the proposal ID
ProposalId uint64 `protobuf:"varint,2,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
// the vote option
- // - yes : true
- // - no : false
- Option bool `protobuf:"varint,3,opt,name=option,proto3" json:"option,omitempty"`
+ Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=lbm.fbridge.v1.VoteOption" json:"option,omitempty"`
}
func (m *MsgAddVoteForRole) Reset() { *m = MsgAddVoteForRole{} }
@@ -850,11 +848,11 @@ func (m *MsgAddVoteForRole) GetProposalId() uint64 {
return 0
}
-func (m *MsgAddVoteForRole) GetOption() bool {
+func (m *MsgAddVoteForRole) GetOption() VoteOption {
if m != nil {
return m.Option
}
- return false
+ return OptionEmpty
}
type MsgAddVoteForRoleResponse struct {
@@ -1085,55 +1083,55 @@ func init() {
func init() { proto.RegisterFile("lbm/fbridge/v1/tx.proto", fileDescriptor_54a336bc5ea063bb) }
var fileDescriptor_54a336bc5ea063bb = []byte{
- // 757 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x4e, 0xdb, 0x4a,
- 0x14, 0x4e, 0x6e, 0x42, 0x48, 0x0e, 0xdc, 0x00, 0x06, 0x92, 0x60, 0x20, 0x01, 0xdf, 0xcb, 0xbd,
- 0x14, 0xa9, 0x09, 0xd0, 0x45, 0xa5, 0xae, 0xda, 0x20, 0xa1, 0x82, 0x6a, 0xb5, 0x72, 0x7f, 0x54,
- 0x75, 0x51, 0x3a, 0x89, 0x27, 0x83, 0x55, 0xdb, 0x93, 0x7a, 0x26, 0x51, 0xfa, 0x10, 0x95, 0xfa,
- 0x04, 0x7d, 0x8a, 0x3e, 0x04, 0x4b, 0x96, 0x55, 0x17, 0xa8, 0x82, 0x17, 0xa9, 0xec, 0xd8, 0x83,
- 0x1d, 0xec, 0x04, 0xd4, 0xdd, 0x4c, 0xbe, 0x9f, 0x73, 0x8e, 0x67, 0xbe, 0xd8, 0x50, 0x36, 0x5b,
- 0x56, 0xa3, 0xd3, 0x72, 0x0c, 0x9d, 0xe0, 0x46, 0x7f, 0xaf, 0xc1, 0x07, 0xf5, 0xae, 0x43, 0x39,
- 0x95, 0x8a, 0x66, 0xcb, 0xaa, 0xfb, 0x40, 0xbd, 0xbf, 0x27, 0x2f, 0x11, 0x4a, 0xa8, 0x07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96, 0x37, 0x47, 0xc2, 0xc2, 0x73, 0x0f, 0x26, 0xfa, 0x51, 0x2f,
+ 0xc6, 0xf1, 0xe5, 0xf5, 0x38, 0x44, 0x98, 0xbc, 0x83, 0xe9, 0x60, 0xd2, 0x4b, 0x11, 0x82, 0x00,
+ 0x2e, 0x3f, 0x18, 0x8d, 0x0b, 0xdb, 0x4f, 0x90, 0x1b, 0x8a, 0xef, 0x46, 0x84, 0x32, 0x4c, 0x91,
+ 0x1f, 0x8d, 0xa5, 0x08, 0xff, 0xe7, 0x90, 0xf6, 0x32, 0x58, 0x88, 0x5a, 0x23, 0x64, 0x72, 0xb9,
+ 0x1c, 0x03, 0x08, 0x87, 0x7d, 0xc8, 0xf8, 0x59, 0x5c, 0x8e, 0x7c, 0x8e, 0x2e, 0x24, 0x6f, 0xc4,
+ 0x42, 0x03, 0x9f, 0xfa, 0xe1, 0xe9, 0x45, 0x29, 0x79, 0x76, 0x51, 0x4a, 0xfe, 0xbd, 0x28, 0x25,
+ 0x7f, 0x5c, 0x96, 0x12, 0x67, 0x97, 0xa5, 0xc4, 0xef, 0xcb, 0x52, 0xe2, 0xe3, 0xce, 0xd8, 0xd7,
+ 0x67, 0x4f, 0x7c, 0xa5, 0x78, 0x2f, 0xd2, 0x46, 0xc6, 0xfb, 0x42, 0x79, 0xf2, 0x2f, 0x00, 0x00,
+ 0xff, 0xff, 0x82, 0xfe, 0x50, 0x79, 0x00, 0x09, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -2129,13 +2127,8 @@ func (m *MsgAddVoteForRole) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
- if m.Option {
- i--
- if m.Option {
- dAtA[i] = 1
- } else {
- dAtA[i] = 0
- }
+ if m.Option != 0 {
+ i = encodeVarintTx(dAtA, i, uint64(m.Option))
i--
dAtA[i] = 0x18
}
@@ -2524,8 +2517,8 @@ func (m *MsgAddVoteForRole) Size() (n int) {
if m.ProposalId != 0 {
n += 1 + sovTx(uint64(m.ProposalId))
}
- if m.Option {
- n += 2
+ if m.Option != 0 {
+ n += 1 + sovTx(uint64(m.Option))
}
return n
}
@@ -4058,7 +4051,7 @@ func (m *MsgAddVoteForRole) Unmarshal(dAtA []byte) error {
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType)
}
- var v int
+ m.Option = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
@@ -4068,12 +4061,11 @@ func (m *MsgAddVoteForRole) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- v |= int(b&0x7F) << shift
+ m.Option |= VoteOption(b&0x7F) << shift
if b < 0x80 {
break
}
}
- m.Option = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
From 754496b342c7f27752d9a7a49ce0c94f29f38b43 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Thu, 2 May 2024 20:15:36 +0900
Subject: [PATCH 02/49] chore
---
proto/lbm/fbridge/v1/fbridge.proto | 3 +-
x/fbridge/types/fbridge.pb.go | 116 ++++++++++++++---------------
2 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto
index 6882232936..65d411b053 100644
--- a/proto/lbm/fbridge/v1/fbridge.proto
+++ b/proto/lbm/fbridge/v1/fbridge.proto
@@ -91,8 +91,7 @@ enum VoteOption {
// Vote defines a vote on a role proposal.
message Vote {
- option (gogoproto.goproto_stringer) = false;
- option (gogoproto.equal) = false;
+ option (gogoproto.equal) = false;
uint64 proposal_id = 1;
string voter = 2;
diff --git a/x/fbridge/types/fbridge.pb.go b/x/fbridge/types/fbridge.pb.go
index 45409b28fd..719aeaeee3 100644
--- a/x/fbridge/types/fbridge.pb.go
+++ b/x/fbridge/types/fbridge.pb.go
@@ -449,8 +449,9 @@ type Vote struct {
Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=lbm.fbridge.v1.VoteOption" json:"option,omitempty"`
}
-func (m *Vote) Reset() { *m = Vote{} }
-func (*Vote) ProtoMessage() {}
+func (m *Vote) Reset() { *m = Vote{} }
+func (m *Vote) String() string { return proto.CompactTextString(m) }
+func (*Vote) ProtoMessage() {}
func (*Vote) Descriptor() ([]byte, []int) {
return fileDescriptor_62374d75fc6aa1ba, []int{5}
}
@@ -581,62 +582,61 @@ func init() {
func init() { proto.RegisterFile("lbm/fbridge/v1/fbridge.proto", fileDescriptor_62374d75fc6aa1ba) }
var fileDescriptor_62374d75fc6aa1ba = []byte{
- // 865 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcf, 0x6f, 0x1b, 0x45,
- 0x14, 0xf6, 0x3a, 0x8e, 0x65, 0x3f, 0xc7, 0x3f, 0x18, 0x45, 0x10, 0xad, 0xca, 0xda, 0x58, 0x42,
- 0x44, 0x15, 0xac, 0xa9, 0xb9, 0x71, 0xcb, 0x0f, 0x27, 0xb2, 0x05, 0xb6, 0x35, 0x71, 0x2a, 0x15,
- 0x21, 0x59, 0x6b, 0xef, 0x64, 0x3b, 0x74, 0x77, 0x67, 0x99, 0x1d, 0x5b, 0x2d, 0xdc, 0x11, 0xca,
- 0xa9, 0x47, 0x2e, 0x91, 0x8a, 0xf8, 0x4b, 0xb8, 0x55, 0x9c, 0x7a, 0x44, 0x1c, 0x0a, 0x4a, 0x2e,
- 0xfc, 0x19, 0x68, 0x66, 0x76, 0x36, 0x4e, 0x2f, 0xe4, 0x36, 0xef, 0x9b, 0xef, 0xbd, 0xf7, 0xed,
- 0x37, 0xef, 0xd9, 0xf0, 0x20, 0x5c, 0x44, 0xbd, 0x8b, 0x05, 0xa7, 0x7e, 0x40, 0x7a, 0xeb, 0x47,
- 0xe6, 0xe8, 0x26, 0x9c, 0x09, 0x86, 0x1a, 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 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
From e30a99d8a7d5e29ea41738dc5e7ec1c0591a6d60 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Thu, 2 May 2024 21:12:38 +0900
Subject: [PATCH 03/49] feat: addVote
---
docs/core/proto-docs.md | 18 ++
proto/lbm/fbridge/v1/event.proto | 9 +
x/fbridge/keeper/auth.go | 47 ++++-
x/fbridge/keeper/genesis.go | 28 +++
x/fbridge/keeper/msg_server.go | 25 ++-
x/fbridge/types/errors.go | 9 +
x/fbridge/types/event.pb.go | 299 ++++++++++++++++++++++++++++---
x/fbridge/types/keys.go | 15 +-
8 files changed, 414 insertions(+), 36 deletions(-)
create mode 100644 x/fbridge/types/errors.go
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 66c8bc1cbd..2ed7c9cc1d 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -767,6 +767,7 @@
- [VoteOption](#lbm.fbridge.v1.VoteOption)
- [lbm/fbridge/v1/event.proto](#lbm/fbridge/v1/event.proto)
+ - [EventAddVoteForRole](#lbm.fbridge.v1.EventAddVoteForRole)
- [EventClaim](#lbm.fbridge.v1.EventClaim)
- [EventConfirmProvision](#lbm.fbridge.v1.EventConfirmProvision)
- [EventProvision](#lbm.fbridge.v1.EventProvision)
@@ -11560,6 +11561,23 @@ VoteOption enumerates the valid vote options for a given role proposal.
+
+
+### EventAddVoteForRole
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `voter` | [string](#string) | | the voter address |
+| `proposal_id` | [uint64](#uint64) | | the role proposal id |
+| `option` | [VoteOption](#lbm.fbridge.v1.VoteOption) | | the vote option |
+
+
+
+
+
+
### EventClaim
diff --git a/proto/lbm/fbridge/v1/event.proto b/proto/lbm/fbridge/v1/event.proto
index 2d505eaf1c..324a2db2a2 100644
--- a/proto/lbm/fbridge/v1/event.proto
+++ b/proto/lbm/fbridge/v1/event.proto
@@ -21,6 +21,15 @@ message EventSuggestRole {
RoleProposal proposal = 1 [(gogoproto.nullable) = false];
}
+message EventAddVoteForRole {
+ // the voter address
+ string voter = 1;
+ // the role proposal id
+ uint64 proposal_id = 2;
+ // the vote option
+ VoteOption option = 3;
+}
+
message EventProvision {
// the sequence number of the bridge request
uint64 seq = 1;
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index 66d3694131..9477084df0 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -36,6 +36,25 @@ func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAd
return proposal, nil
}
+func (k Keeper) addVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress, option types.VoteOption) error {
+ proposal, found := k.GetRoleProposal(ctx, proposalID)
+ if !found {
+ return types.ErrUnknownProposal.Wrapf("#%d not found", proposalID)
+ }
+
+ if ctx.BlockTime().After(proposal.ExpiredAt) {
+ return types.ErrInactiveProposal.Wrapf("#%d already expired", proposalID)
+ }
+
+ if err := k.IsValidVoteOption(option); err != nil {
+ return err
+ }
+
+ k.setVote(ctx, proposalID, voter, option)
+
+ return nil
+}
+
func (k Keeper) IsValidRole(role types.Role) error {
switch role {
case types.RoleGuardian, types.RoleOperator, types.RoleJudge:
@@ -45,6 +64,15 @@ func (k Keeper) IsValidRole(role types.Role) error {
return errors.New("unsupported role")
}
+func (k Keeper) IsValidVoteOption(option types.VoteOption) error {
+ switch option {
+ case types.OptionYes, types.OptionNo:
+ return nil
+ }
+
+ return errors.New("unsupported vote option")
+}
+
func (k Keeper) setNextProposalID(ctx sdk.Context, seq uint64) {
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 8)
@@ -112,9 +140,25 @@ func (k Keeper) GetProposals(ctx sdk.Context) (proposals []types.RoleProposal) {
return
}
-func (k Keeper) setRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) {
+func (k Keeper) setVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress, option types.VoteOption) {
store := ctx.KVStore(k.storeKey)
+ bz := make([]byte, 4)
+ binary.BigEndian.PutUint32(bz, uint32(option))
+ store.Set(types.VoterVoteKey(proposalID, voter), bz)
+}
+func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress) (types.VoteOption, error) {
+ store := ctx.KVStore(k.storeKey)
+ bz := store.Get(types.VoterVoteKey(proposalID, voter))
+ if bz == nil {
+ return types.OptionEmpty, types.ErrUnknownVote
+ }
+
+ return types.VoteOption(binary.BigEndian.Uint32(bz)), nil
+}
+
+func (k Keeper) setRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) {
+ store := ctx.KVStore(k.storeKey)
bz := make([]byte, 4)
binary.BigEndian.PutUint32(bz, uint32(role))
store.Set(types.RoleKey(addr), bz)
@@ -122,7 +166,6 @@ func (k Keeper) setRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) {
func (k Keeper) GetRole(ctx sdk.Context, addr sdk.AccAddress) types.Role {
store := ctx.KVStore(k.storeKey)
-
bz := store.Get(types.RoleKey(addr))
if bz == nil {
return types.RoleEmpty
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index e98a5aef5a..1a30f28c20 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -1,6 +1,7 @@
package keeper
import (
+ "encoding/binary"
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
@@ -28,5 +29,32 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
NextRoleProposalId: k.GetNextProposalID(ctx),
RoleMetadata: k.GetRoleMetadata(ctx),
RoleProposals: k.GetProposals(ctx),
+ Votes: k.GetAllVotes(ctx),
}
}
+
+// IterateVotes iterates over the all the votes for role proposals and performs a callback function
+func (k Keeper) IterateVotes(ctx sdk.Context, cb func(proposal types.Vote) (stop bool)) {
+ store := ctx.KVStore(k.storeKey)
+
+ iterator := sdk.KVStorePrefixIterator(store, types.KeyProposalPrefix)
+ defer iterator.Close()
+ for ; iterator.Valid(); iterator.Next() {
+ id, voter := types.SplitVoterVoteKey(iterator.Key())
+ opt := types.VoteOption(binary.BigEndian.Uint32(iterator.Value()))
+ v := types.Vote{ProposalId: id, Voter: voter.String(), Option: opt}
+ k.cdc.MustUnmarshal(iterator.Value(), &v)
+ if cb(v) {
+ break
+ }
+ }
+}
+
+// GetAllVotes returns all the votes from the store
+func (k Keeper) GetAllVotes(ctx sdk.Context) (votes []types.Vote) {
+ k.IterateVotes(ctx, func(vote types.Vote) bool {
+ votes = append(votes, vote)
+ return false
+ })
+ return
+}
diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go
index c4309f4eaf..f5f3ed0d28 100644
--- a/x/fbridge/keeper/msg_server.go
+++ b/x/fbridge/keeper/msg_server.go
@@ -103,7 +103,30 @@ func (m msgServer) SuggestRole(goCtx context.Context, msg *types.MsgSuggestRole)
}
func (m msgServer) AddVoteForRole(goCtx context.Context, msg *types.MsgAddVoteForRole) (*types.MsgAddVoteForRoleResponse, error) {
- panic("implement me")
+ ctx := sdk.UnwrapSDKContext(goCtx)
+
+ voter, err := sdk.AccAddressFromBech32(msg.From)
+ if err != nil {
+ return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid proposer address (%s)", err)
+ }
+
+ if err := m.IsValidVoteOption(msg.Option); err != nil {
+ return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
+ }
+
+ if err := m.addVote(ctx, msg.ProposalId, voter, msg.Option); err != nil {
+ return nil, err
+ }
+
+ if err := ctx.EventManager().EmitTypedEvent(&types.EventAddVoteForRole{
+ Voter: msg.From,
+ ProposalId: msg.ProposalId,
+ Option: msg.Option,
+ }); err != nil {
+ panic(err)
+ }
+
+ return &types.MsgAddVoteForRoleResponse{}, nil
}
func (m msgServer) Halt(ctx context.Context, msg *types.MsgHalt) (*types.MsgHaltResponse, error) {
diff --git a/x/fbridge/types/errors.go b/x/fbridge/types/errors.go
new file mode 100644
index 0000000000..bdbe596ca9
--- /dev/null
+++ b/x/fbridge/types/errors.go
@@ -0,0 +1,9 @@
+package types
+
+import sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
+
+var (
+ ErrUnknownProposal = sdkerrors.Register(ModuleName, 2, "unknown proposal")
+ ErrInactiveProposal = sdkerrors.Register(ModuleName, 3, "inactive proposal")
+ ErrUnknownVote = sdkerrors.Register(ModuleName, 4, "unknown vote")
+)
diff --git a/x/fbridge/types/event.pb.go b/x/fbridge/types/event.pb.go
index 044154a694..e82390f62a 100644
--- a/x/fbridge/types/event.pb.go
+++ b/x/fbridge/types/event.pb.go
@@ -139,6 +139,69 @@ func (m *EventSuggestRole) GetProposal() RoleProposal {
return RoleProposal{}
}
+type EventAddVoteForRole struct {
+ // the voter address
+ Voter string `protobuf:"bytes,1,opt,name=voter,proto3" json:"voter,omitempty"`
+ // the role proposal id
+ ProposalId uint64 `protobuf:"varint,2,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
+ // the vote option
+ Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=lbm.fbridge.v1.VoteOption" json:"option,omitempty"`
+}
+
+func (m *EventAddVoteForRole) Reset() { *m = EventAddVoteForRole{} }
+func (m *EventAddVoteForRole) String() string { return proto.CompactTextString(m) }
+func (*EventAddVoteForRole) ProtoMessage() {}
+func (*EventAddVoteForRole) Descriptor() ([]byte, []int) {
+ return fileDescriptor_a36aa6e56f2275b8, []int{2}
+}
+func (m *EventAddVoteForRole) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *EventAddVoteForRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_EventAddVoteForRole.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 *EventAddVoteForRole) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EventAddVoteForRole.Merge(m, src)
+}
+func (m *EventAddVoteForRole) XXX_Size() int {
+ return m.Size()
+}
+func (m *EventAddVoteForRole) XXX_DiscardUnknown() {
+ xxx_messageInfo_EventAddVoteForRole.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EventAddVoteForRole proto.InternalMessageInfo
+
+func (m *EventAddVoteForRole) GetVoter() string {
+ if m != nil {
+ return m.Voter
+ }
+ return ""
+}
+
+func (m *EventAddVoteForRole) GetProposalId() uint64 {
+ if m != nil {
+ return m.ProposalId
+ }
+ return 0
+}
+
+func (m *EventAddVoteForRole) GetOption() VoteOption {
+ if m != nil {
+ return m.Option
+ }
+ return OptionEmpty
+}
+
type EventProvision struct {
// the sequence number of the bridge request
Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"`
@@ -156,7 +219,7 @@ func (m *EventProvision) Reset() { *m = EventProvision{} }
func (m *EventProvision) String() string { return proto.CompactTextString(m) }
func (*EventProvision) ProtoMessage() {}
func (*EventProvision) Descriptor() ([]byte, []int) {
- return fileDescriptor_a36aa6e56f2275b8, []int{2}
+ return fileDescriptor_a36aa6e56f2275b8, []int{3}
}
func (m *EventProvision) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -229,7 +292,7 @@ func (m *EventConfirmProvision) Reset() { *m = EventConfirmProvision{} }
func (m *EventConfirmProvision) String() string { return proto.CompactTextString(m) }
func (*EventConfirmProvision) ProtoMessage() {}
func (*EventConfirmProvision) Descriptor() ([]byte, []int) {
- return fileDescriptor_a36aa6e56f2275b8, []int{3}
+ return fileDescriptor_a36aa6e56f2275b8, []int{4}
}
func (m *EventConfirmProvision) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -280,7 +343,7 @@ func (m *EventClaim) Reset() { *m = EventClaim{} }
func (m *EventClaim) String() string { return proto.CompactTextString(m) }
func (*EventClaim) ProtoMessage() {}
func (*EventClaim) Descriptor() ([]byte, []int) {
- return fileDescriptor_a36aa6e56f2275b8, []int{4}
+ return fileDescriptor_a36aa6e56f2275b8, []int{5}
}
func (m *EventClaim) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -340,6 +403,7 @@ func (m *EventClaim) GetAmount() string {
func init() {
proto.RegisterType((*EventTransfer)(nil), "lbm.fbridge.v1.EventTransfer")
proto.RegisterType((*EventSuggestRole)(nil), "lbm.fbridge.v1.EventSuggestRole")
+ proto.RegisterType((*EventAddVoteForRole)(nil), "lbm.fbridge.v1.EventAddVoteForRole")
proto.RegisterType((*EventProvision)(nil), "lbm.fbridge.v1.EventProvision")
proto.RegisterType((*EventConfirmProvision)(nil), "lbm.fbridge.v1.EventConfirmProvision")
proto.RegisterType((*EventClaim)(nil), "lbm.fbridge.v1.EventClaim")
@@ -348,29 +412,33 @@ func init() {
func init() { proto.RegisterFile("lbm/fbridge/v1/event.proto", fileDescriptor_a36aa6e56f2275b8) }
var fileDescriptor_a36aa6e56f2275b8 = []byte{
- // 343 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x92, 0xbd, 0x4e, 0xeb, 0x40,
- 0x10, 0x85, 0xed, 0x9b, 0xdc, 0x28, 0x77, 0xaf, 0x88, 0x22, 0x0b, 0x90, 0x65, 0x45, 0x26, 0x72,
- 0x15, 0x0a, 0x6c, 0x02, 0x3d, 0x45, 0x10, 0x14, 0x54, 0x91, 0xa1, 0xa2, 0xb3, 0x93, 0xb1, 0xb3,
- 0xe0, 0xdd, 0x31, 0xbb, 0x1b, 0x0b, 0x5e, 0x81, 0x8a, 0xc7, 0x4a, 0x99, 0x92, 0x0a, 0xa1, 0xe4,
- 0x45, 0x90, 0xd7, 0x4e, 0x24, 0x28, 0xe8, 0xd2, 0xcd, 0x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x91, 0x27, 0x54, 0xb0, 0x5f, 0x56, 0xf2, 0x1e, 0x08, 0xa9, 0xa2, 0x59, 0x44, 0xd9, 0x6e, 0x57,
- 0x1e, 0xdd, 0x2c, 0x56, 0xae, 0xb9, 0x5c, 0xb9, 0xe6, 0xe7, 0xca, 0x35, 0xdf, 0xd6, 0xae, 0xb1,
- 0x5c, 0xbb, 0xc6, 0xfb, 0xda, 0x35, 0xee, 0x4f, 0x53, 0xaa, 0x66, 0xf3, 0xd8, 0x9f, 0x20, 0x0b,
- 0xae, 0x29, 0x97, 0x93, 0x19, 0x8d, 0x82, 0xa4, 0x2e, 0x4e, 0xe4, 0xf4, 0x31, 0x78, 0xde, 0x7e,
- 0x8f, 0x7a, 0xc9, 0x41, 0xc6, 0x2d, 0xfd, 0x39, 0xe7, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x4b,
- 0xb9, 0x54, 0xa3, 0x9b, 0x02, 0x00, 0x00,
+ // 408 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x52, 0x3d, 0x6f, 0xd4, 0x40,
+ 0x10, 0xf5, 0x12, 0xe7, 0x94, 0x4c, 0xc4, 0x29, 0x32, 0x01, 0x59, 0x56, 0xe4, 0x44, 0xae, 0x42,
+ 0x81, 0x4d, 0x8e, 0x1e, 0x89, 0x20, 0x22, 0x41, 0x43, 0xb4, 0x20, 0x0a, 0x1a, 0x64, 0x9f, 0xc7,
+ 0xce, 0x82, 0xbd, 0x63, 0x76, 0xf7, 0x2c, 0xe8, 0xa8, 0xa9, 0xf8, 0x59, 0x29, 0x53, 0x52, 0x21,
+ 0x74, 0xf7, 0x47, 0x90, 0xd7, 0xf6, 0x49, 0x5c, 0x91, 0xee, 0xba, 0x79, 0x7e, 0x1f, 0xf3, 0xc6,
+ 0x5a, 0x08, 0xaa, 0xac, 0x4e, 0x8a, 0x4c, 0x89, 0xbc, 0xc4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, 0x9b, 0xc1, 0x84, 0x1a,
+ 0x23, 0x48, 0xda, 0xa3, 0xa6, 0xb3, 0x60, 0xb3, 0x4c, 0xb7, 0xe3, 0xad, 0x55, 0xf0, 0x41, 0x19,
+ 0xfd, 0x64, 0x30, 0xb5, 0x15, 0xae, 0x14, 0xb5, 0x42, 0x0b, 0x92, 0xdb, 0xfd, 0x8f, 0x9d, 0x87,
+ 0x1a, 0x54, 0xa9, 0x21, 0xe5, 0xef, 0xf6, 0x9e, 0x11, 0x47, 0x8f, 0xe1, 0xa1, 0xed, 0xf2, 0x92,
+ 0x64, 0x21, 0x54, 0x7d, 0x47, 0xa5, 0xe8, 0x33, 0x40, 0x2f, 0xad, 0x52, 0x51, 0x6f, 0xb7, 0xf2,
+ 0xc5, 0x9b, 0x9b, 0x65, 0xc8, 0x6e, 0x97, 0x21, 0xfb, 0xbb, 0x0c, 0xd9, 0xaf, 0x55, 0xe8, 0xdc,
+ 0xae, 0x42, 0xe7, 0xf7, 0x2a, 0x74, 0x3e, 0x3e, 0x2d, 0x85, 0xb9, 0x5e, 0x64, 0xf1, 0x9c, 0xea,
+ 0xe4, 0x52, 0x48, 0x3d, 0xbf, 0x16, 0x69, 0x52, 0x0c, 0xc3, 0x13, 0x9d, 0x7f, 0x49, 0xbe, 0xad,
+ 0x1f, 0xb0, 0xf9, 0xde, 0xa0, 0xce, 0x26, 0xf6, 0xf1, 0x3e, 0xfb, 0x17, 0x00, 0x00, 0xff, 0xff,
+ 0x96, 0x66, 0x6c, 0xc3, 0x1e, 0x03, 0x00, 0x00,
}
func (m *EventTransfer) Marshal() (dAtA []byte, err error) {
@@ -455,6 +523,46 @@ func (m *EventSuggestRole) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *EventAddVoteForRole) 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 *EventAddVoteForRole) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *EventAddVoteForRole) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Option != 0 {
+ i = encodeVarintEvent(dAtA, i, uint64(m.Option))
+ i--
+ dAtA[i] = 0x18
+ }
+ if m.ProposalId != 0 {
+ i = encodeVarintEvent(dAtA, i, uint64(m.ProposalId))
+ i--
+ dAtA[i] = 0x10
+ }
+ if len(m.Voter) > 0 {
+ i -= len(m.Voter)
+ copy(dAtA[i:], m.Voter)
+ i = encodeVarintEvent(dAtA, i, uint64(len(m.Voter)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
func (m *EventProvision) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -634,6 +742,25 @@ func (m *EventSuggestRole) Size() (n int) {
return n
}
+func (m *EventAddVoteForRole) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Voter)
+ if l > 0 {
+ n += 1 + l + sovEvent(uint64(l))
+ }
+ if m.ProposalId != 0 {
+ n += 1 + sovEvent(uint64(m.ProposalId))
+ }
+ if m.Option != 0 {
+ n += 1 + sovEvent(uint64(m.Option))
+ }
+ return n
+}
+
func (m *EventProvision) Size() (n int) {
if m == nil {
return 0
@@ -952,6 +1079,126 @@ func (m *EventSuggestRole) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *EventAddVoteForRole) 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 ErrIntOverflowEvent
+ }
+ 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: EventAddVoteForRole: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: EventAddVoteForRole: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEvent
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthEvent
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthEvent
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Voter = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType)
+ }
+ m.ProposalId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEvent
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ProposalId |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 3:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType)
+ }
+ m.Option = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEvent
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Option |= VoteOption(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipEvent(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthEvent
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *EventProvision) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go
index 09d8216e07..4d43b76208 100644
--- a/x/fbridge/types/keys.go
+++ b/x/fbridge/types/keys.go
@@ -46,13 +46,6 @@ func ProposalKey(proposalID uint64) []byte {
return append(KeyProposalPrefix, GetProposalIDBytes(proposalID)...)
}
-// SplitProposalKey split the proposal key and returns the proposal id
-func SplitProposalKey(key []byte) (proposalID uint64) {
- kv.AssertKeyLength(key[1:], 8)
-
- return binary.BigEndian.Uint64(key[1:])
-}
-
// VotesKey gets the first part of the votes key based on the proposalID
func VotesKey(proposalID uint64) []byte {
return append(KeyProposalVotePrefix, GetProposalIDBytes(proposalID)...)
@@ -63,6 +56,14 @@ func VoterVoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte {
return append(VotesKey(proposalID), address.MustLengthPrefix(voterAddr.Bytes())...)
}
+// SplitVoterVoteKey split the voter key and returns the proposal id and voter address
+func SplitVoterVoteKey(key []byte) (uint64, sdk.AccAddress) {
+ kv.AssertKeyAtLeastLength(key, 11)
+ proposalID := binary.BigEndian.Uint64(key[1:9])
+ voter := sdk.AccAddress(key[10:])
+ return proposalID, voter
+}
+
// RoleKey key of a specific role of the address from the store
func RoleKey(target sdk.AccAddress) []byte {
return append(KeyRolePrefix, address.MustLengthPrefix(target.Bytes())...)
From 1693f6084824320345f56f20121d2d8d37acfcce Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Thu, 2 May 2024 22:48:27 +0900
Subject: [PATCH 04/49] feat: role proposal confirmation logic
---
docs/core/proto-docs.md | 18 ++
proto/lbm/fbridge/v1/fbridge.proto | 7 +-
proto/lbm/fbridge/v1/genesis.proto | 2 +
x/fbridge/keeper/auth.go | 37 +++-
x/fbridge/keeper/genesis.go | 17 +-
x/fbridge/module/abci.go | 70 +++++++
x/fbridge/module/module.go | 14 +-
x/fbridge/types/fbridge.pb.go | 323 +++++++++++++++++++++++------
x/fbridge/types/genesis.pb.go | 162 ++++++++++-----
x/fbridge/types/keys.go | 6 +
x/fbridge/types/params.go | 31 ++-
11 files changed, 568 insertions(+), 119 deletions(-)
create mode 100644 x/fbridge/module/abci.go
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 2ed7c9cc1d..209143f2b6 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -760,6 +760,7 @@
- [ProvisionData](#lbm.fbridge.v1.ProvisionData)
- [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus)
- [RoleMetadata](#lbm.fbridge.v1.RoleMetadata)
+ - [RolePair](#lbm.fbridge.v1.RolePair)
- [RoleProposal](#lbm.fbridge.v1.RoleProposal)
- [Vote](#lbm.fbridge.v1.Vote)
@@ -11482,6 +11483,22 @@ RoleMetadata defines the metadata of the role.
+
+
+### RolePair
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `address` | [string](#string) | | |
+| `role` | [Role](#lbm.fbridge.v1.Role) | | |
+
+
+
+
+
+
### RoleProposal
@@ -11743,6 +11760,7 @@ GenesisState defines the fbridge module's genesis state.
| `role_proposals` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | repeated | role_proposals defines all the role proposals present at genesis. |
| `votes` | [Vote](#lbm.fbridge.v1.Vote) | repeated | votes defines all the votes present for role proposals at genesis. |
| `role_metadata` | [RoleMetadata](#lbm.fbridge.v1.RoleMetadata) | | role_metadata defines all the role metadata present at genesis. |
+| `roles` | [RolePair](#lbm.fbridge.v1.RolePair) | repeated | roles defines all addresses assigned roles at genesis. |
diff --git a/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto
index 65d411b053..c54d9a632e 100644
--- a/proto/lbm/fbridge/v1/fbridge.proto
+++ b/proto/lbm/fbridge/v1/fbridge.proto
@@ -60,6 +60,11 @@ enum Role {
JUDGE = 3 [(gogoproto.enumvalue_customname) = "RoleJudge"];
}
+message RolePair {
+ string address = 1;
+ Role role = 2;
+}
+
message RoleProposal {
uint64 id = 1;
// the proposer address
@@ -106,4 +111,4 @@ message RoleMetadata {
uint32 operator = 2;
// the number of the judges
uint32 judge = 3;
-}
\ No newline at end of file
+}
diff --git a/proto/lbm/fbridge/v1/genesis.proto b/proto/lbm/fbridge/v1/genesis.proto
index a2fadc6e4c..cda0f10e39 100644
--- a/proto/lbm/fbridge/v1/genesis.proto
+++ b/proto/lbm/fbridge/v1/genesis.proto
@@ -22,6 +22,8 @@ message GenesisState {
repeated Vote votes = 6 [(gogoproto.nullable) = false];
// role_metadata defines all the role metadata present at genesis.
RoleMetadata role_metadata = 7 [(gogoproto.nullable) = false];
+ // roles defines all addresses assigned roles at genesis.
+ repeated RolePair roles = 8 [(gogoproto.nullable) = false];
}
message SendingState {
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index 9477084df0..bd10693c2b 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -157,7 +157,21 @@ func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress
return types.VoteOption(binary.BigEndian.Uint32(bz)), nil
}
-func (k Keeper) setRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) {
+func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) []types.VoteOption {
+ store := ctx.KVStore(k.storeKey)
+
+ votes := make([]types.VoteOption, 0)
+ iterator := sdk.KVStorePrefixIterator(store, types.VotesKey(proposalID))
+ defer iterator.Close()
+ for ; iterator.Valid(); iterator.Next() {
+ v := types.VoteOption(binary.BigEndian.Uint32(iterator.Value()))
+ votes = append(votes, v)
+ }
+
+ return votes
+}
+
+func (k Keeper) SetRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) {
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 4)
binary.BigEndian.PutUint32(bz, uint32(role))
@@ -174,7 +188,26 @@ func (k Keeper) GetRole(ctx sdk.Context, addr sdk.AccAddress) types.Role {
return types.Role(binary.BigEndian.Uint32(bz))
}
-func (k Keeper) setRoleMetadata(ctx sdk.Context, data types.RoleMetadata) {
+func (k Keeper) GetRolePairs(ctx sdk.Context) []types.RolePair {
+ store := ctx.KVStore(k.storeKey)
+
+ pairs := make([]types.RolePair, 0)
+ iterator := sdk.KVStorePrefixIterator(store, types.KeyRolePrefix)
+ defer iterator.Close()
+ for ; iterator.Valid(); iterator.Next() {
+ assignee := types.SplitRoleKey(iterator.Key())
+ pairs = append(pairs, types.RolePair{Address: assignee.String(), Role: types.Role(binary.BigEndian.Uint32(iterator.Value()))})
+ }
+
+ return pairs
+}
+
+func (k Keeper) DeleteRole(ctx sdk.Context, addr sdk.AccAddress) {
+ store := ctx.KVStore(k.storeKey)
+ store.Delete(types.RoleKey(addr))
+}
+
+func (k Keeper) SetRoleMetadata(ctx sdk.Context, data types.RoleMetadata) {
store := ctx.KVStore(k.storeKey)
bz := k.cdc.MustMarshal(&data)
store.Set(types.KeyRoleMetadata, bz)
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index 1a30f28c20..5f31056776 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -9,12 +9,21 @@ import (
func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error {
k.SetParams(ctx, gs.Params)
k.setNextSequence(ctx, gs.SendingState.NextSeq)
- k.setNextProposalID(ctx, gs.NextRoleProposalId)
- k.setRoleMetadata(ctx, gs.RoleMetadata)
+ k.setNextProposalID(ctx, gs.NextRoleProposalId)
for _, proposal := range gs.RoleProposals {
k.setRoleProposal(ctx, proposal)
}
+
+ for _, vote := range gs.Votes {
+ k.setVote(ctx, vote.ProposalId, sdk.MustAccAddressFromBech32(vote.Voter), vote.Option)
+ }
+
+ k.SetRoleMetadata(ctx, gs.RoleMetadata)
+ for _, pair := range gs.Roles {
+ k.SetRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
+ }
+
// TODO: we initialize the appropriate genesis parameters whenever the feature is added
return nil
@@ -27,9 +36,10 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
NextSeq: k.GetNextSequence(ctx),
},
NextRoleProposalId: k.GetNextProposalID(ctx),
- RoleMetadata: k.GetRoleMetadata(ctx),
RoleProposals: k.GetProposals(ctx),
Votes: k.GetAllVotes(ctx),
+ RoleMetadata: k.GetRoleMetadata(ctx),
+ Roles: k.GetRolePairs(ctx),
}
}
@@ -43,7 +53,6 @@ func (k Keeper) IterateVotes(ctx sdk.Context, cb func(proposal types.Vote) (stop
id, voter := types.SplitVoterVoteKey(iterator.Key())
opt := types.VoteOption(binary.BigEndian.Uint32(iterator.Value()))
v := types.Vote{ProposalId: id, Voter: voter.String(), Option: opt}
- k.cdc.MustUnmarshal(iterator.Value(), &v)
if cb(v) {
break
}
diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go
new file mode 100644
index 0000000000..acb8d7874e
--- /dev/null
+++ b/x/fbridge/module/abci.go
@@ -0,0 +1,70 @@
+package module
+
+import (
+ "fmt"
+ sdk "github.com/Finschia/finschia-sdk/types"
+ "github.com/Finschia/finschia-sdk/x/fbridge/keeper"
+ "github.com/Finschia/finschia-sdk/x/fbridge/types"
+)
+
+func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
+ guardianTrustLevel := k.GetParams(ctx).GuardianTrustLevel
+ proposals := k.GetProposals(ctx)
+ for _, proposal := range proposals {
+ if ctx.BlockTime().After(proposal.ExpiredAt) {
+ k.DeleteRoleProposal(ctx, proposal.Id)
+ continue
+ }
+
+ votes := k.GetVotes(ctx, proposal.Id)
+
+ voteYes := 0
+ for _, vote := range votes {
+ if vote == types.OptionYes {
+ voteYes++
+ }
+ }
+
+ var total uint32 = 0
+ roleMeta := k.GetRoleMetadata(ctx)
+ previousRole := k.GetRole(ctx, sdk.MustAccAddressFromBech32(proposal.Target))
+ switch proposal.Role {
+ case types.RoleGuardian:
+ total = roleMeta.Guardian
+ case types.RoleOperator:
+ total = roleMeta.Operator
+ case types.RoleJudge:
+ total = roleMeta.Judge
+ default:
+ panic(fmt.Sprintf("invalid role: %s\n", proposal.Role))
+ }
+
+ if types.CheckTrustLevelThreshold(uint64(total), uint64(voteYes), guardianTrustLevel) {
+ if proposal.Role == types.RoleEmpty {
+ k.DeleteRole(ctx, sdk.MustAccAddressFromBech32(proposal.Target))
+ } else {
+ k.SetRole(ctx, proposal.Role, sdk.MustAccAddressFromBech32(proposal.Target))
+ }
+
+ switch proposal.Role {
+ case types.RoleGuardian:
+ roleMeta.Guardian++
+ case types.RoleOperator:
+ roleMeta.Operator++
+ case types.RoleJudge:
+ roleMeta.Judge++
+ }
+ switch previousRole {
+ case types.RoleGuardian:
+ roleMeta.Guardian--
+ case types.RoleOperator:
+ roleMeta.Operator--
+ case types.RoleJudge:
+ roleMeta.Judge--
+ }
+ k.SetRoleMetadata(ctx, roleMeta)
+
+ k.DeleteRoleProposal(ctx, proposal.Id)
+ }
+ }
+}
diff --git a/x/fbridge/module/module.go b/x/fbridge/module/module.go
index e7f7cfc28c..9c654c7ed5 100644
--- a/x/fbridge/module/module.go
+++ b/x/fbridge/module/module.go
@@ -24,9 +24,10 @@ const (
)
var (
- _ module.AppModuleBasic = AppModuleBasic{}
- _ module.AppModuleGenesis = AppModule{}
- _ module.AppModule = AppModule{}
+ _ module.AppModuleBasic = AppModuleBasic{}
+ _ module.AppModuleGenesis = AppModule{}
+ _ module.AppModule = AppModule{}
+ _ module.EndBlockAppModule = AppModule{}
)
// AppModuleBasic defines the basic application module used by the fbridge module.
@@ -121,6 +122,13 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return consensusVersion }
+// EndBlock returns the end blocker for the fbridge module.
+// It returns no validator updates.
+func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
+ EndBlocker(ctx, am.keeper)
+ return []abci.ValidatorUpdate{}
+}
+
// RegisterInvariants does nothing, there are no invariants to enforce
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
_ = ir
diff --git a/x/fbridge/types/fbridge.pb.go b/x/fbridge/types/fbridge.pb.go
index 719aeaeee3..8d9cb5aeec 100644
--- a/x/fbridge/types/fbridge.pb.go
+++ b/x/fbridge/types/fbridge.pb.go
@@ -358,6 +358,58 @@ func (m *Fraction) GetDenominator() uint64 {
return 0
}
+type RolePair struct {
+ Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
+ Role Role `protobuf:"varint,2,opt,name=role,proto3,enum=lbm.fbridge.v1.Role" json:"role,omitempty"`
+}
+
+func (m *RolePair) Reset() { *m = RolePair{} }
+func (m *RolePair) String() string { return proto.CompactTextString(m) }
+func (*RolePair) ProtoMessage() {}
+func (*RolePair) Descriptor() ([]byte, []int) {
+ return fileDescriptor_62374d75fc6aa1ba, []int{4}
+}
+func (m *RolePair) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *RolePair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_RolePair.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 *RolePair) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_RolePair.Merge(m, src)
+}
+func (m *RolePair) XXX_Size() int {
+ return m.Size()
+}
+func (m *RolePair) XXX_DiscardUnknown() {
+ xxx_messageInfo_RolePair.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_RolePair proto.InternalMessageInfo
+
+func (m *RolePair) GetAddress() string {
+ if m != nil {
+ return m.Address
+ }
+ return ""
+}
+
+func (m *RolePair) GetRole() Role {
+ if m != nil {
+ return m.Role
+ }
+ return RoleEmpty
+}
+
type RoleProposal struct {
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// the proposer address
@@ -378,7 +430,7 @@ func (m *RoleProposal) Reset() { *m = RoleProposal{} }
func (m *RoleProposal) String() string { return proto.CompactTextString(m) }
func (*RoleProposal) ProtoMessage() {}
func (*RoleProposal) Descriptor() ([]byte, []int) {
- return fileDescriptor_62374d75fc6aa1ba, []int{4}
+ return fileDescriptor_62374d75fc6aa1ba, []int{5}
}
func (m *RoleProposal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -453,7 +505,7 @@ func (m *Vote) Reset() { *m = Vote{} }
func (m *Vote) String() string { return proto.CompactTextString(m) }
func (*Vote) ProtoMessage() {}
func (*Vote) Descriptor() ([]byte, []int) {
- return fileDescriptor_62374d75fc6aa1ba, []int{5}
+ return fileDescriptor_62374d75fc6aa1ba, []int{6}
}
func (m *Vote) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -517,7 +569,7 @@ func (m *RoleMetadata) Reset() { *m = RoleMetadata{} }
func (m *RoleMetadata) String() string { return proto.CompactTextString(m) }
func (*RoleMetadata) ProtoMessage() {}
func (*RoleMetadata) Descriptor() ([]byte, []int) {
- return fileDescriptor_62374d75fc6aa1ba, []int{6}
+ return fileDescriptor_62374d75fc6aa1ba, []int{7}
}
func (m *RoleMetadata) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -574,6 +626,7 @@ func init() {
proto.RegisterType((*ProvisionData)(nil), "lbm.fbridge.v1.ProvisionData")
proto.RegisterType((*ProvisionStatus)(nil), "lbm.fbridge.v1.ProvisionStatus")
proto.RegisterType((*Fraction)(nil), "lbm.fbridge.v1.Fraction")
+ proto.RegisterType((*RolePair)(nil), "lbm.fbridge.v1.RolePair")
proto.RegisterType((*RoleProposal)(nil), "lbm.fbridge.v1.RoleProposal")
proto.RegisterType((*Vote)(nil), "lbm.fbridge.v1.Vote")
proto.RegisterType((*RoleMetadata)(nil), "lbm.fbridge.v1.RoleMetadata")
@@ -582,61 +635,63 @@ func init() {
func init() { proto.RegisterFile("lbm/fbridge/v1/fbridge.proto", fileDescriptor_62374d75fc6aa1ba) }
var fileDescriptor_62374d75fc6aa1ba = []byte{
- // 860 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcd, 0x6e, 0x23, 0x45,
- 0x10, 0xf6, 0x38, 0x93, 0xc8, 0x2e, 0xc7, 0x3f, 0xb4, 0x22, 0x88, 0x46, 0xcb, 0xd8, 0x58, 0x42,
- 0x44, 0x2b, 0x18, 0xb3, 0xe6, 0xc6, 0x2d, 0x3f, 0x4e, 0x64, 0x0b, 0x6c, 0xab, 0xe3, 0xac, 0xb4,
- 0x08, 0xc9, 0x1a, 0x7b, 0x3a, 0xb3, 0xcd, 0xce, 0x4c, 0x0f, 0x3d, 0x6d, 0xb3, 0xcb, 0x03, 0x20,
- 0x94, 0xd3, 0xbe, 0x40, 0x24, 0x10, 0x4f, 0xc2, 0x6d, 0xc5, 0x69, 0x8f, 0x88, 0xc3, 0x82, 0x92,
- 0x0b, 0x8f, 0x81, 0xba, 0x7b, 0x7a, 0xe2, 0xec, 0x85, 0xbd, 0x75, 0x7d, 0xfd, 0x55, 0xd5, 0x37,
- 0x5f, 0x57, 0xd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0xe3, 0xe7, 0x5e,
+ 0xdd, 0xf8, 0xb9, 0xbf, 0x6e, 0xfc, 0xdc, 0xb7, 0x5f, 0xbc, 0xf5, 0x33, 0xf2, 0x2c, 0xfb, 0xa7,
+ 0xe8, 0x0f, 0xca, 0xbc, 0xa0, 0xa7, 0xeb, 0xcb, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xe7,
+ 0x51, 0xc1, 0x6f, 0x06, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@@ -830,6 +885,41 @@ func (m *Fraction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *RolePair) 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 *RolePair) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *RolePair) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Role != 0 {
+ i = encodeVarintFbridge(dAtA, i, uint64(m.Role))
+ i--
+ dAtA[i] = 0x10
+ }
+ if len(m.Address) > 0 {
+ i -= len(m.Address)
+ copy(dAtA[i:], m.Address)
+ i = encodeVarintFbridge(dAtA, i, uint64(len(m.Address)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
func (m *RoleProposal) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -1050,6 +1140,22 @@ func (m *Fraction) Size() (n int) {
return n
}
+func (m *RolePair) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Address)
+ if l > 0 {
+ n += 1 + l + sovFbridge(uint64(l))
+ }
+ if m.Role != 0 {
+ n += 1 + sovFbridge(uint64(m.Role))
+ }
+ return n
+}
+
func (m *RoleProposal) Size() (n int) {
if m == nil {
return 0
@@ -1668,6 +1774,107 @@ func (m *Fraction) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *RolePair) 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 ErrIntOverflowFbridge
+ }
+ 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: RolePair: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: RolePair: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Address = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
+ }
+ m.Role = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Role |= Role(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipFbridge(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *RoleProposal) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
diff --git a/x/fbridge/types/genesis.pb.go b/x/fbridge/types/genesis.pb.go
index 4df591827b..de4f09477f 100644
--- a/x/fbridge/types/genesis.pb.go
+++ b/x/fbridge/types/genesis.pb.go
@@ -39,6 +39,8 @@ type GenesisState struct {
Votes []Vote `protobuf:"bytes,6,rep,name=votes,proto3" json:"votes"`
// role_metadata defines all the role metadata present at genesis.
RoleMetadata RoleMetadata `protobuf:"bytes,7,opt,name=role_metadata,json=roleMetadata,proto3" json:"role_metadata"`
+ // roles defines all addresses assigned roles at genesis.
+ Roles []RolePair `protobuf:"bytes,8,rep,name=roles,proto3" json:"roles"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
@@ -123,6 +125,13 @@ func (m *GenesisState) GetRoleMetadata() RoleMetadata {
return RoleMetadata{}
}
+func (m *GenesisState) GetRoles() []RolePair {
+ if m != nil {
+ return m.Roles
+ }
+ return nil
+}
+
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"`
@@ -511,55 +520,56 @@ func init() {
func init() { proto.RegisterFile("lbm/fbridge/v1/genesis.proto", fileDescriptor_0fc3cc4535a29f6d) }
var fileDescriptor_0fc3cc4535a29f6d = []byte{
- // 755 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xcd, 0x4e, 0xdb, 0x40,
- 0x10, 0xc7, 0xe3, 0xc4, 0x04, 0x18, 0x42, 0x40, 0x2b, 0x40, 0x26, 0xa5, 0x4e, 0x64, 0xf5, 0x90,
- 0x43, 0x9b, 0x90, 0xb6, 0x52, 0x3f, 0x84, 0x54, 0x29, 0x20, 0x10, 0x95, 0x50, 0x91, 0x5d, 0x55,
- 0x15, 0x17, 0xcb, 0x71, 0x36, 0xc1, 0x22, 0xf6, 0x3a, 0xde, 0x4d, 0x04, 0x6f, 0xd0, 0x63, 0x6f,
- 0xbd, 0xf6, 0xd2, 0x77, 0xe1, 0xc8, 0xa5, 0x52, 0x4f, 0x55, 0x05, 0x2f, 0x52, 0xed, 0x66, 0xed,
- 0x38, 0x26, 0x48, 0xed, 0xcd, 0x9e, 0xf9, 0xcf, 0x6f, 0x3e, 0x3c, 0xbb, 0x86, 0x9d, 0x41, 0xc7,
- 0x6f, 0xf6, 0x3a, 0x91, 0xd7, 0xed, 0xe3, 0xe6, 0xb8, 0xd5, 0xec, 0xe3, 0x00, 0x53, 0x8f, 0x36,
- 0xc2, 0x88, 0x30, 0x82, 0xca, 0x83, 0x8e, 0xdf, 0x90, 0xde, 0xc6, 0xb8, 0x55, 0xd9, 0xe8, 0x93,
- 0x3e, 0x11, 0xae, 0x26, 0x7f, 0x9a, 0xa8, 0x2a, 0x59, 0x46, 0x1c, 0x20, 0xbc, 0xc6, 0xcf, 0x02,
- 0x94, 0x8e, 0x26, 0x54, 0x8b, 0x39, 0x0c, 0xa3, 0x97, 0x50, 0x0c, 0x9d, 0xc8, 0xf1, 0xa9, 0xa6,
- 0xd4, 0x94, 0xfa, 0xca, 0xf3, 0xad, 0xc6, 0x6c, 0x96, 0xc6, 0xa9, 0xf0, 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a, 0xdf, 0xd3, 0xea, 0xa3, 0x45, 0x96, 0x80, 0x99, 0x12, 0x6e, 0x1c, 0x01, 0x7a, 0x38,
+ 0xec, 0x39, 0x57, 0x74, 0xb6, 0xe7, 0x7c, 0xb6, 0xe7, 0xf6, 0xbb, 0x9b, 0x3b, 0x5d, 0xb9, 0xbd,
+ 0xd3, 0x95, 0xdf, 0x77, 0xba, 0xf2, 0xf5, 0x5e, 0xcf, 0xdd, 0xde, 0xeb, 0xb9, 0x9f, 0xf7, 0x7a,
+ 0xee, 0x7c, 0xb7, 0xef, 0xb1, 0x8b, 0x51, 0xa7, 0xe1, 0x12, 0xbf, 0x79, 0xe4, 0x05, 0xd4, 0xbd,
+ 0xf0, 0x9c, 0x66, 0x4f, 0x2e, 0x9e, 0xd1, 0xee, 0x65, 0xf3, 0x2a, 0xf9, 0x81, 0xb1, 0xeb, 0x10,
+ 0xd3, 0x4e, 0x51, 0xfc, 0xbc, 0x5e, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x83, 0x3c, 0x4b, 0x92,
+ 0x20, 0x07, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -582,6 +592,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
+ if len(m.Roles) > 0 {
+ for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- {
+ {
+ size, err := m.Roles[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintGenesis(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x42
+ }
+ }
{
size, err := m.RoleMetadata.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@@ -1055,6 +1079,12 @@ func (m *GenesisState) Size() (n int) {
}
l = m.RoleMetadata.Size()
n += 1 + l + sovGenesis(uint64(l))
+ if len(m.Roles) > 0 {
+ for _, e := range m.Roles {
+ l = e.Size()
+ n += 1 + l + sovGenesis(uint64(l))
+ }
+ }
return n
}
@@ -1467,6 +1497,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
+ case 8:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Roles = append(m.Roles, RolePair{})
+ if err := m.Roles[len(m.Roles)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go
index 4d43b76208..110d6a8136 100644
--- a/x/fbridge/types/keys.go
+++ b/x/fbridge/types/keys.go
@@ -68,3 +68,9 @@ func SplitVoterVoteKey(key []byte) (uint64, sdk.AccAddress) {
func RoleKey(target sdk.AccAddress) []byte {
return append(KeyRolePrefix, address.MustLengthPrefix(target.Bytes())...)
}
+
+// SplitRoleKey split the role key and returns the address
+func SplitRoleKey(key []byte) sdk.AccAddress {
+ kv.AssertKeyAtLeastLength(key, 3)
+ return key[2:]
+}
diff --git a/x/fbridge/types/params.go b/x/fbridge/types/params.go
index c4d8f2a5fc..45fdbdc7d2 100644
--- a/x/fbridge/types/params.go
+++ b/x/fbridge/types/params.go
@@ -1,12 +1,39 @@
package types
-import "time"
+import (
+ sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
+ "time"
+)
func DefaultParams() Params {
return Params{
GuardianTrustLevel: Fraction{Numerator: 2, Denominator: 3},
OperatorTrustLevel: Fraction{Numerator: 2, Denominator: 3},
- JudgeTrustLevel: Fraction{Numerator: 2, Denominator: 3},
+ JudgeTrustLevel: Fraction{Numerator: 1, Denominator: 1},
ProposalPeriod: uint64(time.Minute * 60),
}
}
+
+func CheckTrustLevelThreshold(total, current uint64, trustLevel Fraction) bool {
+ if err := ValidateTrustLevel(trustLevel); err != nil {
+ panic(err)
+ }
+
+ if total*trustLevel.Numerator <= current*trustLevel.Denominator &&
+ total != 0 && current != 0 &&
+ current <= total {
+ return true
+ }
+
+ return false
+}
+
+func ValidateTrustLevel(trustLevel Fraction) error {
+ if trustLevel.Denominator < 1 || trustLevel.Numerator < 1 {
+ return sdkerrors.ErrInvalidRequest.Wrap("trust level must be positive")
+ } else if trustLevel.Denominator < trustLevel.Numerator {
+ return sdkerrors.ErrInvalidRequest.Wrap("trust level denominator must be greater than or equal to the numerator")
+ }
+
+ return nil
+}
From 90d7acadcefa207d4e95fa108ca67e917e37fbb7 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Thu, 2 May 2024 23:50:13 +0900
Subject: [PATCH 05/49] add gRPC for RBAC
---
client/docs/config.json | 4 +-
client/docs/swagger-ui/swagger.yaml | 444 +++++++---
docs/core/proto-docs.md | 74 +-
proto/lbm/fbridge/v1/query.proto | 48 +-
x/fbridge/keeper/auth.go | 15 +-
x/fbridge/keeper/genesis.go | 4 +-
x/fbridge/keeper/grpc_query.go | 124 ++-
x/fbridge/module/abci.go | 6 +-
x/fbridge/types/query.pb.go | 1164 +++++++++++++++++++++++----
x/fbridge/types/query.pb.gw.go | 226 +++++-
10 files changed, 1821 insertions(+), 288 deletions(-)
diff --git a/client/docs/config.json b/client/docs/config.json
index 4a1968c6ee..10c1f955fa 100644
--- a/client/docs/config.json
+++ b/client/docs/config.json
@@ -175,7 +175,9 @@
"Operators": "FBridgeOperators",
"Judges": "FBridgeJudges",
"Proposals": "FBridgeProposals",
- "Proposal": "FBridgeProposal"
+ "Proposal": "FBridgeProposal",
+ "Votes": "FBridgeVotes",
+ "Vote": "FBridgeVote"
}
}
}
diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml
index c56e21d150..1fc1847f2b 100644
--- a/client/docs/swagger-ui/swagger.yaml
+++ b/client/docs/swagger-ui/swagger.yaml
@@ -30313,90 +30313,7 @@ paths:
format: byte
tags:
- Query
- '/lbm/fbridge/v1/provision/{seq}':
- get:
- summary: ConfirmedProvision queries a particular sequence of confirmed provisions
- operationId: ConfirmedProvision
- responses:
- '200':
- description: A successful response.
- schema:
- type: object
- properties:
- data:
- type: object
- properties:
- seq:
- type: string
- format: uint64
- title: the sequence number of the bridge request
- amount:
- type: string
- title: the amount of token to be claimed
- sender:
- type: string
- title: the sender address on the source chain
- receiver:
- type: string
- title: the recipient address on the destination chain
- description: Provision is a struct that represents a provision internally.
- status:
- type: object
- properties:
- timelock_end:
- type: string
- format: uint64
- title: >-
- the unix timestamp the provision will be able to be
- claimed (unix timestamp)
- confirm_counts:
- type: integer
- format: int32
- title: >-
- a value that tells how many operators have submitted this
- provision
- is_claimed:
- type: boolean
- format: boolean
- title: whether the provision has been claimed
- description: >-
- ProvisionStatus is a struct that represents the status of a
- provision.
-
- To optimize computational cost, we have collected frequently
- changing values from provision.
- 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: seq
- description: the sequence number of the bridge request
- in: path
- required: true
- type: string
- format: uint64
- tags:
- - Query
- /lbm/fbridge/v1/role/proposals:
+ /lbm/fbridge/v1/proposals:
get:
summary: Proposals queries a list of SuggestRole Proposals
operationId: FBridgeProposals
@@ -30444,10 +30361,28 @@ paths:
judge.
expired_at:
type: string
- format: uint64
+ format: date-time
title: >-
the unix timestamp the proposal will be expired (unix
timestamp)
+ pagination:
+ description: pagination defines an pagination for the response.
+ type: object
+ properties:
+ next_key:
+ type: string
+ format: byte
+ title: |-
+ next_key is the key to be passed to PageRequest.key to
+ query the next page most efficiently
+ total:
+ type: string
+ format: uint64
+ title: >-
+ total is total number of results available if
+ PageRequest.count_total
+
+ was set, its value is undefined otherwise
default:
description: An unexpected error response
schema:
@@ -30531,7 +30466,7 @@ paths:
format: boolean
tags:
- Query
- '/lbm/fbridge/v1/role/proposals/{proposal_id}':
+ '/lbm/fbridge/v1/proposals/{proposal_id}':
get:
summary: Proposal queries a SuggestRole Proposal
operationId: FBridgeProposal
@@ -30572,7 +30507,7 @@ paths:
judge.
expired_at:
type: string
- format: uint64
+ format: date-time
title: >-
the unix timestamp the proposal will be expired (unix
timestamp)
@@ -30604,6 +30539,226 @@ paths:
in: path
required: true
type: string
+ format: uint64
+ tags:
+ - Query
+ '/lbm/fbridge/v1/proposals/{proposal_id}/votes':
+ get:
+ summary: Votes queries votes of a given proposal.
+ operationId: FBridgeVotes
+ responses:
+ '200':
+ description: A successful response.
+ schema:
+ type: object
+ properties:
+ votes:
+ type: array
+ items:
+ type: object
+ properties:
+ proposal_id:
+ type: string
+ format: uint64
+ voter:
+ type: string
+ option:
+ type: string
+ enum:
+ - VOTE_OPTION_UNSPECIFIED
+ - VOTE_OPTION_YES
+ - VOTE_OPTION_NO
+ default: VOTE_OPTION_UNSPECIFIED
+ description: >-
+ VoteOption enumerates the valid vote options for a given
+ role proposal.
+
+ - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
+ - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option.
+ - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.
+ description: Vote defines a vote on a role proposal.
+ description: votes defined the queried votes.
+ 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: proposal_id
+ description: proposal_id defines the unique id of the proposal.
+ in: path
+ required: true
+ type: string
+ format: uint64
+ tags:
+ - Query
+ '/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}':
+ get:
+ summary: 'Vote queries voted information based on proposalID, voterAddr.'
+ operationId: FBridgeVote
+ responses:
+ '200':
+ description: A successful response.
+ schema:
+ type: object
+ properties:
+ vote:
+ type: object
+ properties:
+ proposal_id:
+ type: string
+ format: uint64
+ voter:
+ type: string
+ option:
+ type: string
+ enum:
+ - VOTE_OPTION_UNSPECIFIED
+ - VOTE_OPTION_YES
+ - VOTE_OPTION_NO
+ default: VOTE_OPTION_UNSPECIFIED
+ description: >-
+ VoteOption enumerates the valid vote options for a given
+ role proposal.
+
+ - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
+ - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option.
+ - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.
+ description: Vote defines a vote on a role proposal.
+ 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: proposal_id
+ description: proposal_id defines the unique id of the proposal.
+ in: path
+ required: true
+ type: string
+ format: uint64
+ - name: voter
+ description: voter defines the oter address for the proposals.
+ in: path
+ required: true
+ type: string
+ tags:
+ - Query
+ '/lbm/fbridge/v1/provision/{seq}':
+ get:
+ summary: ConfirmedProvision queries a particular sequence of confirmed provisions
+ operationId: ConfirmedProvision
+ responses:
+ '200':
+ description: A successful response.
+ schema:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ seq:
+ type: string
+ format: uint64
+ title: the sequence number of the bridge request
+ amount:
+ type: string
+ title: the amount of token to be claimed
+ sender:
+ type: string
+ title: the sender address on the source chain
+ receiver:
+ type: string
+ title: the recipient address on the destination chain
+ description: Provision is a struct that represents a provision internally.
+ status:
+ type: object
+ properties:
+ timelock_end:
+ type: string
+ format: uint64
+ title: >-
+ the unix timestamp the provision will be able to be
+ claimed (unix timestamp)
+ confirm_counts:
+ type: integer
+ format: int32
+ title: >-
+ a value that tells how many operators have submitted this
+ provision
+ is_claimed:
+ type: boolean
+ format: boolean
+ title: whether the provision has been claimed
+ description: >-
+ ProvisionStatus is a struct that represents the status of a
+ provision.
+
+ To optimize computational cost, we have collected frequently
+ changing values from provision.
+ 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: seq
+ description: the sequence number of the bridge request
+ in: path
+ required: true
+ type: string
+ format: uint64
tags:
- Query
definitions:
@@ -50417,7 +50572,7 @@ definitions:
description: 'Role defines the role of the operator, guardian, and judge.'
expired_at:
type: string
- format: uint64
+ format: date-time
title: the unix timestamp the proposal will be expired (unix timestamp)
lbm.fbridge.v1.QueryProposalsResponse:
type: object
@@ -50453,8 +50608,26 @@ definitions:
description: 'Role defines the role of the operator, guardian, and judge.'
expired_at:
type: string
- format: uint64
+ format: date-time
title: the unix timestamp the proposal will be expired (unix timestamp)
+ pagination:
+ description: pagination defines an pagination for the response.
+ type: object
+ properties:
+ next_key:
+ type: string
+ format: byte
+ title: |-
+ next_key is the key to be passed to PageRequest.key to
+ query the next page most efficiently
+ total:
+ type: string
+ format: uint64
+ title: >-
+ total is total number of results available if
+ PageRequest.count_total
+
+ was set, its value is undefined otherwise
lbm.fbridge.v1.QuerySubmittedProvisionResponse:
type: object
properties:
@@ -50499,6 +50672,61 @@ definitions:
To optimize computational cost, we have collected frequently changing
values from provision.
+ lbm.fbridge.v1.QueryVoteResponse:
+ type: object
+ properties:
+ vote:
+ type: object
+ properties:
+ proposal_id:
+ type: string
+ format: uint64
+ voter:
+ type: string
+ option:
+ type: string
+ enum:
+ - VOTE_OPTION_UNSPECIFIED
+ - VOTE_OPTION_YES
+ - VOTE_OPTION_NO
+ default: VOTE_OPTION_UNSPECIFIED
+ description: >-
+ VoteOption enumerates the valid vote options for a given role
+ proposal.
+
+ - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
+ - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option.
+ - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.
+ description: Vote defines a vote on a role proposal.
+ lbm.fbridge.v1.QueryVotesResponse:
+ type: object
+ properties:
+ votes:
+ type: array
+ items:
+ type: object
+ properties:
+ proposal_id:
+ type: string
+ format: uint64
+ voter:
+ type: string
+ option:
+ type: string
+ enum:
+ - VOTE_OPTION_UNSPECIFIED
+ - VOTE_OPTION_YES
+ - VOTE_OPTION_NO
+ default: VOTE_OPTION_UNSPECIFIED
+ description: >-
+ VoteOption enumerates the valid vote options for a given role
+ proposal.
+
+ - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
+ - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option.
+ - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.
+ description: Vote defines a vote on a role proposal.
+ description: votes defined the queried votes.
lbm.fbridge.v1.Role:
type: string
enum:
@@ -50537,5 +50765,41 @@ definitions:
description: 'Role defines the role of the operator, guardian, and judge.'
expired_at:
type: string
- format: uint64
+ format: date-time
title: the unix timestamp the proposal will be expired (unix timestamp)
+ lbm.fbridge.v1.Vote:
+ type: object
+ properties:
+ proposal_id:
+ type: string
+ format: uint64
+ voter:
+ type: string
+ option:
+ type: string
+ enum:
+ - VOTE_OPTION_UNSPECIFIED
+ - VOTE_OPTION_YES
+ - VOTE_OPTION_NO
+ default: VOTE_OPTION_UNSPECIFIED
+ description: >-
+ VoteOption enumerates the valid vote options for a given role
+ proposal.
+
+ - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
+ - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option.
+ - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.
+ description: Vote defines a vote on a role proposal.
+ lbm.fbridge.v1.VoteOption:
+ type: string
+ enum:
+ - VOTE_OPTION_UNSPECIFIED
+ - VOTE_OPTION_YES
+ - VOTE_OPTION_NO
+ default: VOTE_OPTION_UNSPECIFIED
+ description: |-
+ VoteOption enumerates the valid vote options for a given role proposal.
+
+ - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
+ - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option.
+ - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 209143f2b6..9f6e4cca14 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -812,6 +812,10 @@
- [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse)
- [QuerySubmittedProvisionRequest](#lbm.fbridge.v1.QuerySubmittedProvisionRequest)
- [QuerySubmittedProvisionResponse](#lbm.fbridge.v1.QuerySubmittedProvisionResponse)
+ - [QueryVoteRequest](#lbm.fbridge.v1.QueryVoteRequest)
+ - [QueryVoteResponse](#lbm.fbridge.v1.QueryVoteResponse)
+ - [QueryVotesRequest](#lbm.fbridge.v1.QueryVotesRequest)
+ - [QueryVotesResponse](#lbm.fbridge.v1.QueryVotesResponse)
- [Query](#lbm.fbridge.v1.Query)
@@ -12133,7 +12137,7 @@ GenesisState defines the fbridge module's genesis state.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `proposal_id` | [string](#string) | | the proposal id |
+| `proposal_id` | [uint64](#uint64) | | the proposal id |
@@ -12179,6 +12183,7 @@ GenesisState defines the fbridge module's genesis state.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `proposals` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | repeated | |
+| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines an pagination for the response. |
@@ -12216,6 +12221,67 @@ GenesisState defines the fbridge module's genesis state.
+
+
+
+### QueryVoteRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `proposal_id` | [uint64](#uint64) | | proposal_id defines the unique id of the proposal. |
+| `voter` | [string](#string) | | voter defines the oter address for the proposals. |
+
+
+
+
+
+
+
+
+### QueryVoteResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `vote` | [Vote](#lbm.fbridge.v1.Vote) | | vote defined the queried vote. |
+
+
+
+
+
+
+
+
+### QueryVotesRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `proposal_id` | [uint64](#uint64) | | proposal_id defines the unique id of the proposal. |
+
+
+
+
+
+
+
+
+### QueryVotesResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `votes` | [Vote](#lbm.fbridge.v1.Vote) | repeated | votes defined the queried votes. |
+
+
+
+
+
@@ -12241,8 +12307,10 @@ GenesisState defines the fbridge module's genesis state.
| `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|
-| `Proposals` | [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) | Proposals queries a list of SuggestRole Proposals | GET|/lbm/fbridge/v1/role/proposals|
-| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/role/proposals/{proposal_id}|
+| `Proposals` | [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) | Proposals queries a list of SuggestRole Proposals | GET|/lbm/fbridge/v1/proposals|
+| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/proposals/{proposal_id}|
+| `Vote` | [QueryVoteRequest](#lbm.fbridge.v1.QueryVoteRequest) | [QueryVoteResponse](#lbm.fbridge.v1.QueryVoteResponse) | Vote queries voted information based on proposalID, voterAddr. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}|
+| `Votes` | [QueryVotesRequest](#lbm.fbridge.v1.QueryVotesRequest) | [QueryVotesResponse](#lbm.fbridge.v1.QueryVotesResponse) | Votes queries votes of a given proposal. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes|
diff --git a/proto/lbm/fbridge/v1/query.proto b/proto/lbm/fbridge/v1/query.proto
index 900aac4e8b..3114994e0f 100644
--- a/proto/lbm/fbridge/v1/query.proto
+++ b/proto/lbm/fbridge/v1/query.proto
@@ -70,12 +70,22 @@ service Query {
// Proposals queries a list of SuggestRole Proposals
rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) {
- option (google.api.http).get = "/lbm/fbridge/v1/role/proposals";
+ option (google.api.http).get = "/lbm/fbridge/v1/proposals";
}
// Proposal queries a SuggestRole Proposal
rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) {
- option (google.api.http).get = "/lbm/fbridge/v1/role/proposals/{proposal_id}";
+ option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}";
+ }
+
+ // Vote queries voted information based on proposalID, voterAddr.
+ rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) {
+ option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}";
+ }
+
+ // Votes queries votes of a given proposal.
+ rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) {
+ option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}/votes";
}
}
@@ -172,14 +182,40 @@ message QueryProposalsRequest {
}
message QueryProposalsResponse {
- repeated RoleProposal proposals = 1;
+ repeated RoleProposal proposals = 1 [(gogoproto.nullable) = false];
+
+ // pagination defines an pagination for the response.
+ cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
message QueryProposalRequest {
// the proposal id
- string proposal_id = 1;
+ uint64 proposal_id = 1;
}
message QueryProposalResponse {
- RoleProposal proposal = 1;
-}
\ No newline at end of file
+ RoleProposal proposal = 1 [(gogoproto.nullable) = false];
+}
+
+message QueryVoteRequest {
+ // proposal_id defines the unique id of the proposal.
+ uint64 proposal_id = 1;
+
+ // voter defines the oter address for the proposals.
+ string voter = 2;
+}
+
+message QueryVoteResponse {
+ // vote defined the queried vote.
+ Vote vote = 1 [(gogoproto.nullable) = false];
+}
+
+message QueryVotesRequest {
+ // proposal_id defines the unique id of the proposal.
+ uint64 proposal_id = 1;
+}
+
+message QueryVotesResponse {
+ // votes defined the queried votes.
+ repeated Vote votes = 1 [(gogoproto.nullable) = false];
+}
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index bd10693c2b..b5df808532 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -131,8 +131,8 @@ func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.RolePro
}
}
-// GetProposals returns all the role proposals from store
-func (k Keeper) GetProposals(ctx sdk.Context) (proposals []types.RoleProposal) {
+// GetRoleProposals returns all the role proposals from store
+func (k Keeper) GetRoleProposals(ctx sdk.Context) (proposals []types.RoleProposal) {
k.IterateProposals(ctx, func(proposal types.RoleProposal) bool {
proposals = append(proposals, proposal)
return false
@@ -157,14 +157,19 @@ func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress
return types.VoteOption(binary.BigEndian.Uint32(bz)), nil
}
-func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) []types.VoteOption {
+func (k Keeper) GetProposalVotes(ctx sdk.Context, proposalID uint64) []types.Vote {
store := ctx.KVStore(k.storeKey)
- votes := make([]types.VoteOption, 0)
+ votes := make([]types.Vote, 0)
iterator := sdk.KVStorePrefixIterator(store, types.VotesKey(proposalID))
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
- v := types.VoteOption(binary.BigEndian.Uint32(iterator.Value()))
+ _, voter := types.SplitVoterVoteKey(iterator.Key())
+ v := types.Vote{
+ ProposalId: proposalID,
+ Voter: voter.String(),
+ Option: types.VoteOption(binary.BigEndian.Uint32(iterator.Value())),
+ }
votes = append(votes, v)
}
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index 5f31056776..fa3b71f1a5 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -36,7 +36,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
NextSeq: k.GetNextSequence(ctx),
},
NextRoleProposalId: k.GetNextProposalID(ctx),
- RoleProposals: k.GetProposals(ctx),
+ RoleProposals: k.GetRoleProposals(ctx),
Votes: k.GetAllVotes(ctx),
RoleMetadata: k.GetRoleMetadata(ctx),
Roles: k.GetRolePairs(ctx),
@@ -47,7 +47,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
func (k Keeper) IterateVotes(ctx sdk.Context, cb func(proposal types.Vote) (stop bool)) {
store := ctx.KVStore(k.storeKey)
- iterator := sdk.KVStorePrefixIterator(store, types.KeyProposalPrefix)
+ iterator := sdk.KVStorePrefixIterator(store, types.KeyProposalVotePrefix)
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
id, voter := types.SplitVoterVoteKey(iterator.Key())
diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go
index 4953a0a5ef..34a8952668 100644
--- a/x/fbridge/keeper/grpc_query.go
+++ b/x/fbridge/keeper/grpc_query.go
@@ -2,18 +2,28 @@ package keeper
import (
"context"
+ "fmt"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "github.com/Finschia/finschia-sdk/store/prefix"
sdk "github.com/Finschia/finschia-sdk/types"
+ "github.com/Finschia/finschia-sdk/types/query"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
var _ types.QueryServer = Keeper{}
-func (k Keeper) Params(ctx context.Context, request *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
- panic("implement me")
+func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ params := k.GetParams(ctx)
+
+ return &types.QueryParamsResponse{Params: params}, nil
}
func (k Keeper) NextSeqSend(goCtx context.Context, req *types.QueryNextSeqSendRequest) (*types.QueryNextSeqSendResponse, error) {
@@ -51,22 +61,112 @@ func (k Keeper) Commitments(ctx context.Context, request *types.QueryCommitments
panic("implement me")
}
-func (k Keeper) Guardians(ctx context.Context, request *types.QueryGuardiansRequest) (*types.QueryGuardiansResponse, error) {
- panic("implement me")
+func (k Keeper) Guardians(goCtx context.Context, req *types.QueryGuardiansRequest) (*types.QueryGuardiansResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ guardians := make([]string, 0)
+ roles := k.GetRolePairs(ctx)
+ for _, pair := range roles {
+ if pair.Role == types.RoleGuardian {
+ guardians = append(guardians, pair.Address)
+ }
+ }
+
+ return &types.QueryGuardiansResponse{Guardians: guardians}, nil
}
-func (k Keeper) Operators(ctx context.Context, request *types.QueryOperatorsRequest) (*types.QueryOperatorsResponse, error) {
- panic("implement me")
+func (k Keeper) Operators(goCtx context.Context, req *types.QueryOperatorsRequest) (*types.QueryOperatorsResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ operators := make([]string, 0)
+ roles := k.GetRolePairs(ctx)
+ for _, pair := range roles {
+ if pair.Role == types.RoleOperator {
+ operators = append(operators, pair.Address)
+ }
+ }
+
+ return &types.QueryOperatorsResponse{Operators: operators}, nil
}
-func (k Keeper) Judges(ctx context.Context, request *types.QueryJudgesRequest) (*types.QueryJudgesResponse, error) {
- panic("implement me")
+func (k Keeper) Judges(goCtx context.Context, req *types.QueryJudgesRequest) (*types.QueryJudgesResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ judges := make([]string, 0)
+ roles := k.GetRolePairs(ctx)
+ for _, pair := range roles {
+ if pair.Role == types.RoleJudge {
+ judges = append(judges, pair.Address)
+ }
+ }
+
+ return &types.QueryJudgesResponse{Judges: judges}, nil
}
-func (k Keeper) Proposals(ctx context.Context, request *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) {
- panic("implement me")
+func (k Keeper) Proposals(goCtx context.Context, req *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyProposalPrefix)
+ proposals := make([]types.RoleProposal, 0)
+ pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error {
+ var proposal types.RoleProposal
+ k.cdc.MustUnmarshal(value, &proposal)
+ proposals = append(proposals, proposal)
+ return nil
+ })
+ if err != nil {
+ return nil, status.Error(codes.Internal, err.Error())
+ }
+
+ return &types.QueryProposalsResponse{Proposals: proposals, Pagination: pageRes}, nil
}
-func (k Keeper) Proposal(ctx context.Context, request *types.QueryProposalRequest) (*types.QueryProposalResponse, error) {
- panic("implement me")
+func (k Keeper) Proposal(goCtx context.Context, req *types.QueryProposalRequest) (*types.QueryProposalResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ proposal, found := k.GetRoleProposal(ctx, req.ProposalId)
+ if !found {
+ return nil, status.Error(codes.NotFound, fmt.Sprintf("role proposal %d", req.ProposalId))
+ }
+
+ return &types.QueryProposalResponse{Proposal: proposal}, nil
+}
+
+func (k Keeper) Votes(goCtx context.Context, req *types.QueryVotesRequest) (*types.QueryVotesResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ votes := k.GetProposalVotes(ctx, req.ProposalId)
+ return &types.QueryVotesResponse{Votes: votes}, nil
+}
+
+func (k Keeper) Vote(goCtx context.Context, req *types.QueryVoteRequest) (*types.QueryVoteResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ opt, err := k.GetVote(ctx, req.ProposalId, sdk.MustAccAddressFromBech32(req.Voter))
+ if err != nil {
+ return nil, status.Error(codes.NotFound, err.Error())
+ }
+
+ return &types.QueryVoteResponse{Vote: types.Vote{ProposalId: req.ProposalId, Voter: req.Voter, Option: opt}}, nil
}
diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go
index acb8d7874e..0eb1368348 100644
--- a/x/fbridge/module/abci.go
+++ b/x/fbridge/module/abci.go
@@ -9,18 +9,18 @@ import (
func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
guardianTrustLevel := k.GetParams(ctx).GuardianTrustLevel
- proposals := k.GetProposals(ctx)
+ proposals := k.GetRoleProposals(ctx)
for _, proposal := range proposals {
if ctx.BlockTime().After(proposal.ExpiredAt) {
k.DeleteRoleProposal(ctx, proposal.Id)
continue
}
- votes := k.GetVotes(ctx, proposal.Id)
+ votes := k.GetProposalVotes(ctx, proposal.Id)
voteYes := 0
for _, vote := range votes {
- if vote == types.OptionYes {
+ if vote.Option == types.OptionYes {
voteYes++
}
}
diff --git a/x/fbridge/types/query.pb.go b/x/fbridge/types/query.pb.go
index d43ba5168b..eace142a0c 100644
--- a/x/fbridge/types/query.pb.go
+++ b/x/fbridge/types/query.pb.go
@@ -1043,7 +1043,9 @@ func (m *QueryProposalsRequest) GetPagination() *query.PageRequest {
}
type QueryProposalsResponse struct {
- Proposals []*RoleProposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals,omitempty"`
+ Proposals []RoleProposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals"`
+ // pagination defines an pagination for the response.
+ Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
func (m *QueryProposalsResponse) Reset() { *m = QueryProposalsResponse{} }
@@ -1079,16 +1081,23 @@ func (m *QueryProposalsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryProposalsResponse proto.InternalMessageInfo
-func (m *QueryProposalsResponse) GetProposals() []*RoleProposal {
+func (m *QueryProposalsResponse) GetProposals() []RoleProposal {
if m != nil {
return m.Proposals
}
return nil
}
+func (m *QueryProposalsResponse) GetPagination() *query.PageResponse {
+ if m != nil {
+ return m.Pagination
+ }
+ return nil
+}
+
type QueryProposalRequest struct {
// the proposal id
- ProposalId string `protobuf:"bytes,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
+ ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
}
func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} }
@@ -1124,15 +1133,15 @@ func (m *QueryProposalRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryProposalRequest proto.InternalMessageInfo
-func (m *QueryProposalRequest) GetProposalId() string {
+func (m *QueryProposalRequest) GetProposalId() uint64 {
if m != nil {
return m.ProposalId
}
- return ""
+ return 0
}
type QueryProposalResponse struct {
- Proposal *RoleProposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"`
+ Proposal RoleProposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"`
}
func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} }
@@ -1168,10 +1177,199 @@ func (m *QueryProposalResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryProposalResponse proto.InternalMessageInfo
-func (m *QueryProposalResponse) GetProposal() *RoleProposal {
+func (m *QueryProposalResponse) GetProposal() RoleProposal {
if m != nil {
return m.Proposal
}
+ return RoleProposal{}
+}
+
+type QueryVoteRequest struct {
+ // proposal_id defines the unique id of the proposal.
+ ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
+ // voter defines the oter address for the proposals.
+ Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"`
+}
+
+func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} }
+func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryVoteRequest) ProtoMessage() {}
+func (*QueryVoteRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5e7780f9db9d346e, []int{26}
+}
+func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryVoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryVoteRequest.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 *QueryVoteRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryVoteRequest.Merge(m, src)
+}
+func (m *QueryVoteRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryVoteRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryVoteRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryVoteRequest proto.InternalMessageInfo
+
+func (m *QueryVoteRequest) GetProposalId() uint64 {
+ if m != nil {
+ return m.ProposalId
+ }
+ return 0
+}
+
+func (m *QueryVoteRequest) GetVoter() string {
+ if m != nil {
+ return m.Voter
+ }
+ return ""
+}
+
+type QueryVoteResponse struct {
+ // vote defined the queried vote.
+ Vote Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"`
+}
+
+func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} }
+func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryVoteResponse) ProtoMessage() {}
+func (*QueryVoteResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5e7780f9db9d346e, []int{27}
+}
+func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryVoteResponse.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 *QueryVoteResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryVoteResponse.Merge(m, src)
+}
+func (m *QueryVoteResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryVoteResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryVoteResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryVoteResponse proto.InternalMessageInfo
+
+func (m *QueryVoteResponse) GetVote() Vote {
+ if m != nil {
+ return m.Vote
+ }
+ return Vote{}
+}
+
+type QueryVotesRequest struct {
+ // proposal_id defines the unique id of the proposal.
+ ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
+}
+
+func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} }
+func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryVotesRequest) ProtoMessage() {}
+func (*QueryVotesRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5e7780f9db9d346e, []int{28}
+}
+func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryVotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryVotesRequest.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 *QueryVotesRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryVotesRequest.Merge(m, src)
+}
+func (m *QueryVotesRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryVotesRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryVotesRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryVotesRequest proto.InternalMessageInfo
+
+func (m *QueryVotesRequest) GetProposalId() uint64 {
+ if m != nil {
+ return m.ProposalId
+ }
+ return 0
+}
+
+type QueryVotesResponse struct {
+ // votes defined the queried votes.
+ Votes []Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes"`
+}
+
+func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} }
+func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryVotesResponse) ProtoMessage() {}
+func (*QueryVotesResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5e7780f9db9d346e, []int{29}
+}
+func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryVotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryVotesResponse.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 *QueryVotesResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryVotesResponse.Merge(m, src)
+}
+func (m *QueryVotesResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryVotesResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryVotesResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryVotesResponse proto.InternalMessageInfo
+
+func (m *QueryVotesResponse) GetVotes() []Vote {
+ if m != nil {
+ return m.Votes
+ }
return nil
}
@@ -1202,84 +1400,97 @@ func init() {
proto.RegisterType((*QueryProposalsResponse)(nil), "lbm.fbridge.v1.QueryProposalsResponse")
proto.RegisterType((*QueryProposalRequest)(nil), "lbm.fbridge.v1.QueryProposalRequest")
proto.RegisterType((*QueryProposalResponse)(nil), "lbm.fbridge.v1.QueryProposalResponse")
+ proto.RegisterType((*QueryVoteRequest)(nil), "lbm.fbridge.v1.QueryVoteRequest")
+ proto.RegisterType((*QueryVoteResponse)(nil), "lbm.fbridge.v1.QueryVoteResponse")
+ proto.RegisterType((*QueryVotesRequest)(nil), "lbm.fbridge.v1.QueryVotesRequest")
+ proto.RegisterType((*QueryVotesResponse)(nil), "lbm.fbridge.v1.QueryVotesResponse")
}
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, 0x36, 0x94, 0xda, 0xcd, 0x8e, 0x7d,
- 0xd8, 0x8c, 0x7c, 0xd7, 0xa3, 0xf6, 0x51, 0xd5, 0x0e, 0x7b, 0x34, 0x3a, 0xb1, 0xba, 0x11, 0x8b,
- 0x19, 0x79, 0xab, 0xdd, 0xec, 0x58, 0x38, 0x67, 0x1d, 0x55, 0x4b, 0x8b, 0x1e, 0x63, 0x5e, 0x9b,
- 0xda, 0x4e, 0xd7, 0xb7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4a, 0xf6, 0x5b, 0xa7, 0x44, 0x21, 0xb9, 0x25, 0xc8, 0xef, 0x90, 0x25, 0x25, 0xb9,
+ 0x75, 0x34, 0xe4, 0x01, 0xfa, 0xe4, 0x6b, 0x0d, 0x72, 0xd1, 0x03, 0x4e, 0x16, 0xc6, 0x12, 0x0c,
+ 0xf9, 0x19, 0x7d, 0x71, 0x42, 0x04, 0xd2, 0x6f, 0x08, 0xfa, 0x35, 0xf2, 0x70, 0x4a, 0x7a, 0x4b,
+ 0xf8, 0x05, 0xeb, 0x48, 0x38, 0x9f, 0x3e, 0xf9, 0x42, 0x83, 0x0b, 0xc2, 0x7b, 0x10, 0x35, 0x57,
+ 0xb2, 0x1e, 0xc6, 0xa4, 0x10, 0xd4, 0xf3, 0x50, 0xe8, 0xb1, 0xc8, 0xca, 0x99, 0xf4, 0x6c, 0x3e,
+ 0x7f, 0x75, 0x5c, 0xd2, 0x5e, 0x1f, 0x97, 0xb4, 0xbf, 0x8e, 0x4b, 0xda, 0xb7, 0x27, 0xa5, 0x99,
+ 0xd7, 0x27, 0xa5, 0x99, 0x3f, 0x4e, 0x4a, 0x33, 0x9f, 0xac, 0xba, 0x5e, 0xf8, 0xb2, 0xdb, 0x30,
+ 0x9b, 0xac, 0x65, 0x6d, 0x7b, 0x3e, 0x6f, 0xbe, 0xf4, 0x6c, 0x6b, 0x0f, 0x3f, 0x56, 0xb8, 0xf3,
+ 0x99, 0x75, 0x90, 0xd0, 0x84, 0x87, 0x6d, 0xca, 0x1b, 0xb3, 0xe2, 0xcf, 0x8e, 0xb7, 0xfe, 0x09,
+ 0x00, 0x00, 0xff, 0xff, 0x2a, 0x3b, 0xaf, 0xda, 0x98, 0x11, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1323,6 +1534,10 @@ type QueryClient interface {
Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error)
// Proposal queries a SuggestRole Proposal
Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error)
+ // Vote queries voted information based on proposalID, voterAddr.
+ Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error)
+ // Votes queries votes of a given proposal.
+ Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error)
}
type queryClient struct {
@@ -1450,6 +1665,24 @@ func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, op
return out, nil
}
+func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) {
+ out := new(QueryVoteResponse)
+ err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Vote", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) {
+ out := new(QueryVotesResponse)
+ err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Votes", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// QueryServer is the server API for Query service.
type QueryServer interface {
// Params queries the parameters of x/fbridge module.
@@ -1481,6 +1714,10 @@ type QueryServer interface {
Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error)
// Proposal queries a SuggestRole Proposal
Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error)
+ // Vote queries voted information based on proposalID, voterAddr.
+ Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error)
+ // Votes queries votes of a given proposal.
+ Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@@ -1526,6 +1763,12 @@ func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryPropos
func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented")
}
+func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented")
+}
+func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented")
+}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@@ -1765,6 +2008,42 @@ func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
+func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryVoteRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).Vote(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/lbm.fbridge.v1.Query/Vote",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryVotesRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).Votes(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/lbm.fbridge.v1.Query/Votes",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "lbm.fbridge.v1.Query",
HandlerType: (*QueryServer)(nil),
@@ -1821,6 +2100,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Proposal",
Handler: _Query_Proposal_Handler,
},
+ {
+ MethodName: "Vote",
+ Handler: _Query_Vote_Handler,
+ },
+ {
+ MethodName: "Votes",
+ Handler: _Query_Votes_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "lbm/fbridge/v1/query.proto",
@@ -2547,6 +2834,18 @@ func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
_ = i
var l int
_ = l
+ if m.Pagination != nil {
+ {
+ size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x12
+ }
if len(m.Proposals) > 0 {
for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- {
{
@@ -2584,12 +2883,10 @@ func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
- if len(m.ProposalId) > 0 {
- i -= len(m.ProposalId)
- copy(dAtA[i:], m.ProposalId)
- i = encodeVarintQuery(dAtA, i, uint64(len(m.ProposalId)))
+ if m.ProposalId != 0 {
+ i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId))
i--
- dAtA[i] = 0xa
+ dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
@@ -2614,76 +2911,207 @@ func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
- if m.Proposal != nil {
- {
- size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i])
- if err != nil {
- return 0, err
- }
- i -= size
- i = encodeVarintQuery(dAtA, i, uint64(size))
+ {
+ size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
}
- i--
- dAtA[i] = 0xa
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
}
+ i--
+ dAtA[i] = 0xa
return len(dAtA) - i, nil
}
-func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
- offset -= sovQuery(v)
- base := offset
- for v >= 1<<7 {
- dAtA[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
+func (m *QueryVoteRequest) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
}
- dAtA[offset] = uint8(v)
- return base
+ return dAtA[:n], nil
}
-func (m *QueryParamsRequest) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- return n
+
+func (m *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *QueryParamsResponse) Size() (n int) {
- if m == nil {
- return 0
- }
+func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
var l int
_ = l
- l = m.Params.Size()
- n += 1 + l + sovQuery(uint64(l))
- return n
+ if len(m.Voter) > 0 {
+ i -= len(m.Voter)
+ copy(dAtA[i:], m.Voter)
+ i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if m.ProposalId != 0 {
+ i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
}
-func (m *QueryNextSeqSendRequest) Size() (n int) {
- if m == nil {
- return 0
+func (m *QueryVoteResponse) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
}
- var l int
- _ = l
- return n
+ return dAtA[:n], nil
}
-func (m *QueryNextSeqSendResponse) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- if m.Seq != 0 {
- n += 1 + sovQuery(uint64(m.Seq))
- }
- return n
+func (m *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *QueryGreatestSeqByOperatorRequest) Size() (n int) {
- if m == nil {
- return 0
+func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ {
+ size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
+ return len(dAtA) - i, nil
+}
+
+func (m *QueryVotesRequest) 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 *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.ProposalId != 0 {
+ i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *QueryVotesResponse) 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 *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Votes) > 0 {
+ for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- {
+ {
+ size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
+ }
+ }
+ return len(dAtA) - i, nil
+}
+
+func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
+ offset -= sovQuery(v)
+ base := offset
+ for v >= 1<<7 {
+ dAtA[offset] = uint8(v&0x7f | 0x80)
+ v >>= 7
+ offset++
+ }
+ dAtA[offset] = uint8(v)
+ return base
+}
+func (m *QueryParamsRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ return n
+}
+
+func (m *QueryParamsResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = m.Params.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ return n
+}
+
+func (m *QueryNextSeqSendRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ return n
+}
+
+func (m *QueryNextSeqSendResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Seq != 0 {
+ n += 1 + sovQuery(uint64(m.Seq))
+ }
+ return n
+}
+
+func (m *QueryGreatestSeqByOperatorRequest) Size() (n int) {
+ if m == nil {
+ return 0
}
var l int
_ = l
@@ -2937,6 +3365,10 @@ func (m *QueryProposalsResponse) Size() (n int) {
n += 1 + l + sovQuery(uint64(l))
}
}
+ if m.Pagination != nil {
+ l = m.Pagination.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
return n
}
@@ -2946,9 +3378,8 @@ func (m *QueryProposalRequest) Size() (n int) {
}
var l int
_ = l
- l = len(m.ProposalId)
- if l > 0 {
- n += 1 + l + sovQuery(uint64(l))
+ if m.ProposalId != 0 {
+ n += 1 + sovQuery(uint64(m.ProposalId))
}
return n
}
@@ -2959,13 +3390,65 @@ func (m *QueryProposalResponse) Size() (n int) {
}
var l int
_ = l
- if m.Proposal != nil {
- l = m.Proposal.Size()
+ l = m.Proposal.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ return n
+}
+
+func (m *QueryVoteRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.ProposalId != 0 {
+ n += 1 + sovQuery(uint64(m.ProposalId))
+ }
+ l = len(m.Voter)
+ if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
+func (m *QueryVoteResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = m.Vote.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ return n
+}
+
+func (m *QueryVotesRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.ProposalId != 0 {
+ n += 1 + sovQuery(uint64(m.ProposalId))
+ }
+ return n
+}
+
+func (m *QueryVotesResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if len(m.Votes) > 0 {
+ for _, e := range m.Votes {
+ l = e.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ }
+ return n
+}
+
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -4814,11 +5297,47 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.Proposals = append(m.Proposals, &RoleProposal{})
+ m.Proposals = append(m.Proposals, RoleProposal{})
if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.Pagination == nil {
+ m.Pagination = &query.PageResponse{}
+ }
+ if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -4870,10 +5389,10 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error {
}
switch fieldNum {
case 1:
- if wireType != 2 {
+ if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType)
}
- var stringLen uint64
+ m.ProposalId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@@ -4883,24 +5402,11 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- stringLen |= uint64(b&0x7F) << shift
+ m.ProposalId |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthQuery
- }
- postIndex := iNdEx + intStringLen
- if postIndex < 0 {
- return ErrInvalidLengthQuery
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.ProposalId = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -4980,9 +5486,6 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if m.Proposal == nil {
- m.Proposal = &RoleProposal{}
- }
if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -5008,6 +5511,343 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *QueryVoteRequest) 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: QueryVoteRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType)
+ }
+ m.ProposalId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ProposalId |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Voter = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *QueryVoteResponse) 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: QueryVoteResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *QueryVotesRequest) 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: QueryVotesRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType)
+ }
+ m.ProposalId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ProposalId |= uint64(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 *QueryVotesResponse) 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: QueryVotesResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Votes = append(m.Votes, Vote{})
+ if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
diff --git a/x/fbridge/types/query.pb.gw.go b/x/fbridge/types/query.pb.gw.go
index 8de3ab8ffe..470bb7bc34 100644
--- a/x/fbridge/types/query.pb.gw.go
+++ b/x/fbridge/types/query.pb.gw.go
@@ -501,7 +501,7 @@ func request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler,
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id")
}
- protoReq.ProposalId, err = runtime.String(val)
+ protoReq.ProposalId, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err)
@@ -528,7 +528,7 @@ func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marsh
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id")
}
- protoReq.ProposalId, err = runtime.String(val)
+ protoReq.ProposalId, err = runtime.Uint64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err)
@@ -539,6 +539,136 @@ func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marsh
}
+func request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryVoteRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["proposal_id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id")
+ }
+
+ protoReq.ProposalId, err = runtime.Uint64(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err)
+ }
+
+ val, ok = pathParams["voter"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter")
+ }
+
+ protoReq.Voter, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err)
+ }
+
+ msg, err := client.Vote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryVoteRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["proposal_id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id")
+ }
+
+ protoReq.ProposalId, err = runtime.Uint64(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err)
+ }
+
+ val, ok = pathParams["voter"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter")
+ }
+
+ protoReq.Voter, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err)
+ }
+
+ msg, err := server.Vote(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
+func request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryVotesRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["proposal_id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id")
+ }
+
+ protoReq.ProposalId, err = runtime.Uint64(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err)
+ }
+
+ msg, err := client.Votes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryVotesRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["proposal_id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id")
+ }
+
+ protoReq.ProposalId, err = runtime.Uint64(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err)
+ }
+
+ msg, err := server.Votes(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.
@@ -805,6 +935,46 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
+ mux.Handle("GET", pattern_Query_Vote_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_Vote_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_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("GET", pattern_Query_Votes_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_Votes_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_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -1106,6 +1276,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
+ mux.Handle("GET", pattern_Query_Vote_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_Vote_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_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("GET", pattern_Query_Votes_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_Votes_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_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -1132,9 +1342,13 @@ var (
pattern_Query_Judges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "judges"}, "", runtime.AssumeColonVerbOpt(false)))
- pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"lbm", "fbridge", "v1", "role", "proposals"}, "", runtime.AssumeColonVerbOpt(false)))
+ pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "proposals"}, "", runtime.AssumeColonVerbOpt(false)))
+
+ pattern_Query_Proposal_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", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false)))
+
+ pattern_Query_Vote_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", "proposals", "proposal_id", "votes", "voter"}, "", runtime.AssumeColonVerbOpt(false)))
- pattern_Query_Proposal_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", "role", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false)))
+ pattern_Query_Votes_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", "proposals", "proposal_id", "votes"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
@@ -1163,4 +1377,8 @@ var (
forward_Query_Proposals_0 = runtime.ForwardResponseMessage
forward_Query_Proposal_0 = runtime.ForwardResponseMessage
+
+ forward_Query_Vote_0 = runtime.ForwardResponseMessage
+
+ forward_Query_Votes_0 = runtime.ForwardResponseMessage
)
From 38d0969d2c942e8501f1fadf5a1c30f24246390f Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 00:43:27 +0900
Subject: [PATCH 06/49] fix checking trustLevel condition
---
x/fbridge/types/params.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x/fbridge/types/params.go b/x/fbridge/types/params.go
index 45fdbdc7d2..fbcab0ae6f 100644
--- a/x/fbridge/types/params.go
+++ b/x/fbridge/types/params.go
@@ -20,7 +20,7 @@ func CheckTrustLevelThreshold(total, current uint64, trustLevel Fraction) bool {
}
if total*trustLevel.Numerator <= current*trustLevel.Denominator &&
- total != 0 && current != 0 &&
+ total > 0 && current >= 0 &&
current <= total {
return true
}
From f21efb6a749693c1737eaed8850a7793a80fb6b9 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 01:40:23 +0900
Subject: [PATCH 07/49] validate role metadata during initialization
---
x/fbridge/keeper/auth.go | 38 +++++++++++++++++++++++++++++++++++++
x/fbridge/keeper/genesis.go | 17 ++++++++++++++++-
2 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index b5df808532..47080a89d7 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -218,6 +218,44 @@ func (k Keeper) SetRoleMetadata(ctx sdk.Context, data types.RoleMetadata) {
store.Set(types.KeyRoleMetadata, bz)
}
+func (k Keeper) UpdateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) error {
+ previousRole := k.GetRole(ctx, addr)
+ if previousRole == role {
+ return sdkerrors.ErrUnauthorized.Wrap("target already has same role")
+ }
+
+ metadata := k.GetRoleMetadata(ctx)
+
+ switch previousRole {
+ case types.RoleGuardian:
+ metadata.Guardian--
+ case types.RoleOperator:
+ metadata.Operator--
+ case types.RoleJudge:
+ metadata.Judge--
+ }
+
+ if role == types.RoleEmpty {
+ k.DeleteRole(ctx, addr)
+ return nil
+ } else {
+ k.SetRole(ctx, role, addr)
+ }
+
+ switch role {
+ case types.RoleGuardian:
+ metadata.Guardian++
+ case types.RoleOperator:
+ metadata.Operator++
+ case types.RoleJudge:
+ metadata.Judge++
+ }
+
+ k.SetRoleMetadata(ctx, metadata)
+
+ return nil
+}
+
func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata {
store := ctx.KVStore(k.storeKey)
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index fa3b71f1a5..5e93b1bf83 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -19,11 +19,26 @@ func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error {
k.setVote(ctx, vote.ProposalId, sdk.MustAccAddressFromBech32(vote.Voter), vote.Option)
}
- k.SetRoleMetadata(ctx, gs.RoleMetadata)
+ expectedRoleMeta := types.RoleMetadata{}
for _, pair := range gs.Roles {
k.SetRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
+ switch pair.Role {
+ case types.RoleGuardian:
+ expectedRoleMeta.Guardian++
+ case types.RoleOperator:
+ expectedRoleMeta.Operator++
+ case types.RoleJudge:
+ expectedRoleMeta.Judge++
+ }
}
+ if expectedRoleMeta.Guardian != gs.RoleMetadata.Guardian ||
+ expectedRoleMeta.Operator != gs.RoleMetadata.Operator ||
+ expectedRoleMeta.Judge != gs.RoleMetadata.Judge {
+ panic("role metadata does not match the number of roles")
+ }
+ k.SetRoleMetadata(ctx, gs.RoleMetadata)
+
// TODO: we initialize the appropriate genesis parameters whenever the feature is added
return nil
From 25f27224e77dd4fb99596fe2443f711a3bdb7a9a Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 10:47:56 +0900
Subject: [PATCH 08/49] add invariants for metadata
---
x/fbridge/keeper/genesis.go | 15 -----------
x/fbridge/module/abci.go | 51 ++++++++++++++++++++++---------------
x/fbridge/module/module.go | 2 +-
3 files changed, 32 insertions(+), 36 deletions(-)
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index 5e93b1bf83..e3ed8445b2 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -19,23 +19,8 @@ func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error {
k.setVote(ctx, vote.ProposalId, sdk.MustAccAddressFromBech32(vote.Voter), vote.Option)
}
- expectedRoleMeta := types.RoleMetadata{}
for _, pair := range gs.Roles {
k.SetRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
- switch pair.Role {
- case types.RoleGuardian:
- expectedRoleMeta.Guardian++
- case types.RoleOperator:
- expectedRoleMeta.Operator++
- case types.RoleJudge:
- expectedRoleMeta.Judge++
- }
- }
-
- if expectedRoleMeta.Guardian != gs.RoleMetadata.Guardian ||
- expectedRoleMeta.Operator != gs.RoleMetadata.Operator ||
- expectedRoleMeta.Judge != gs.RoleMetadata.Judge {
- panic("role metadata does not match the number of roles")
}
k.SetRoleMetadata(ctx, gs.RoleMetadata)
diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go
index 0eb1368348..e5e8c37bb4 100644
--- a/x/fbridge/module/abci.go
+++ b/x/fbridge/module/abci.go
@@ -27,7 +27,6 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
var total uint32 = 0
roleMeta := k.GetRoleMetadata(ctx)
- previousRole := k.GetRole(ctx, sdk.MustAccAddressFromBech32(proposal.Target))
switch proposal.Role {
case types.RoleGuardian:
total = roleMeta.Guardian
@@ -40,31 +39,43 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
}
if types.CheckTrustLevelThreshold(uint64(total), uint64(voteYes), guardianTrustLevel) {
- if proposal.Role == types.RoleEmpty {
- k.DeleteRole(ctx, sdk.MustAccAddressFromBech32(proposal.Target))
- } else {
- k.SetRole(ctx, proposal.Role, sdk.MustAccAddressFromBech32(proposal.Target))
+ if err := k.UpdateRole(ctx, proposal.Role, sdk.MustAccAddressFromBech32(proposal.Target)); err != nil {
+ panic(err)
}
- switch proposal.Role {
- case types.RoleGuardian:
- roleMeta.Guardian++
- case types.RoleOperator:
- roleMeta.Operator++
- case types.RoleJudge:
- roleMeta.Judge++
- }
- switch previousRole {
+ k.DeleteRoleProposal(ctx, proposal.Id)
+ }
+ }
+}
+
+// RegisterInvariants registers all staking invariants
+func RegisterInvariants(ir sdk.InvariantRegistry, k keeper.Keeper) {
+ ir.RegisterRoute(types.ModuleName, "role-metadata", RoleMeatadataInvariant(k))
+}
+
+func RoleMeatadataInvariant(k keeper.Keeper) sdk.Invariant {
+ return func(ctx sdk.Context) (string, bool) {
+ actualRoleMeta := k.GetRoleMetadata(ctx)
+ expectedRoleMeta := types.RoleMetadata{}
+ for _, pair := range k.GetRolePairs(ctx) {
+ k.SetRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
+ switch pair.Role {
case types.RoleGuardian:
- roleMeta.Guardian--
+ expectedRoleMeta.Guardian++
case types.RoleOperator:
- roleMeta.Operator--
+ expectedRoleMeta.Operator++
case types.RoleJudge:
- roleMeta.Judge--
+ expectedRoleMeta.Judge++
}
- k.SetRoleMetadata(ctx, roleMeta)
-
- k.DeleteRoleProposal(ctx, proposal.Id)
}
+
+ broken := expectedRoleMeta.Guardian != actualRoleMeta.Guardian ||
+ expectedRoleMeta.Operator != actualRoleMeta.Operator ||
+ expectedRoleMeta.Judge != actualRoleMeta.Judge
+
+ return sdk.FormatInvariant(types.ModuleName, "registered members and role metadata", fmt.Sprintf(
+ "Saved Role Metadata: %+v"+
+ "Calculated Role Metadata: %+v",
+ actualRoleMeta, expectedRoleMeta)), broken
}
}
diff --git a/x/fbridge/module/module.go b/x/fbridge/module/module.go
index 9c654c7ed5..03bede71d9 100644
--- a/x/fbridge/module/module.go
+++ b/x/fbridge/module/module.go
@@ -131,7 +131,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
// RegisterInvariants does nothing, there are no invariants to enforce
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
- _ = ir
+ RegisterInvariants(ir, am.keeper)
}
// Deprecated: Route does nothing.
From b6dedb92a63e1387659d3d42b5b3b868121e7e2b Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 11:09:53 +0900
Subject: [PATCH 09/49] chore
---
x/fbridge/keeper/auth.go | 80 ++++++++++++++++++-------------------
x/fbridge/keeper/genesis.go | 2 +-
2 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index 47080a89d7..0281c3b08c 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -55,6 +55,44 @@ func (k Keeper) addVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress
return nil
}
+func (k Keeper) UpdateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) error {
+ previousRole := k.GetRole(ctx, addr)
+ if previousRole == role {
+ return sdkerrors.ErrInvalidRequest.Wrap("target already has same role")
+ }
+
+ metadata := k.GetRoleMetadata(ctx)
+
+ switch previousRole {
+ case types.RoleGuardian:
+ metadata.Guardian--
+ case types.RoleOperator:
+ metadata.Operator--
+ case types.RoleJudge:
+ metadata.Judge--
+ }
+
+ if role == types.RoleEmpty {
+ k.deleteRole(ctx, addr)
+ return nil
+ } else {
+ k.setRole(ctx, role, addr)
+ }
+
+ switch role {
+ case types.RoleGuardian:
+ metadata.Guardian++
+ case types.RoleOperator:
+ metadata.Operator++
+ case types.RoleJudge:
+ metadata.Judge++
+ }
+
+ k.SetRoleMetadata(ctx, metadata)
+
+ return nil
+}
+
func (k Keeper) IsValidRole(role types.Role) error {
switch role {
case types.RoleGuardian, types.RoleOperator, types.RoleJudge:
@@ -176,7 +214,7 @@ func (k Keeper) GetProposalVotes(ctx sdk.Context, proposalID uint64) []types.Vot
return votes
}
-func (k Keeper) SetRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) {
+func (k Keeper) setRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) {
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 4)
binary.BigEndian.PutUint32(bz, uint32(role))
@@ -207,7 +245,7 @@ func (k Keeper) GetRolePairs(ctx sdk.Context) []types.RolePair {
return pairs
}
-func (k Keeper) DeleteRole(ctx sdk.Context, addr sdk.AccAddress) {
+func (k Keeper) deleteRole(ctx sdk.Context, addr sdk.AccAddress) {
store := ctx.KVStore(k.storeKey)
store.Delete(types.RoleKey(addr))
}
@@ -218,44 +256,6 @@ func (k Keeper) SetRoleMetadata(ctx sdk.Context, data types.RoleMetadata) {
store.Set(types.KeyRoleMetadata, bz)
}
-func (k Keeper) UpdateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) error {
- previousRole := k.GetRole(ctx, addr)
- if previousRole == role {
- return sdkerrors.ErrUnauthorized.Wrap("target already has same role")
- }
-
- metadata := k.GetRoleMetadata(ctx)
-
- switch previousRole {
- case types.RoleGuardian:
- metadata.Guardian--
- case types.RoleOperator:
- metadata.Operator--
- case types.RoleJudge:
- metadata.Judge--
- }
-
- if role == types.RoleEmpty {
- k.DeleteRole(ctx, addr)
- return nil
- } else {
- k.SetRole(ctx, role, addr)
- }
-
- switch role {
- case types.RoleGuardian:
- metadata.Guardian++
- case types.RoleOperator:
- metadata.Operator++
- case types.RoleJudge:
- metadata.Judge++
- }
-
- k.SetRoleMetadata(ctx, metadata)
-
- return nil
-}
-
func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata {
store := ctx.KVStore(k.storeKey)
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index e3ed8445b2..8d6e76dc01 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -20,7 +20,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error {
}
for _, pair := range gs.Roles {
- k.SetRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
+ k.setRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
}
k.SetRoleMetadata(ctx, gs.RoleMetadata)
From f902e6736e0a5f853a527e04b1b68904c08820b9 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 11:32:18 +0900
Subject: [PATCH 10/49] delete expired proposal at begin blocker
---
x/fbridge/module/abci.go | 11 +++++++----
x/fbridge/module/module.go | 14 ++++++++++----
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go
index e5e8c37bb4..9dc570a265 100644
--- a/x/fbridge/module/abci.go
+++ b/x/fbridge/module/abci.go
@@ -7,15 +7,19 @@ import (
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
-func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
- guardianTrustLevel := k.GetParams(ctx).GuardianTrustLevel
+func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
proposals := k.GetRoleProposals(ctx)
for _, proposal := range proposals {
if ctx.BlockTime().After(proposal.ExpiredAt) {
k.DeleteRoleProposal(ctx, proposal.Id)
- continue
}
+ }
+}
+func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
+ guardianTrustLevel := k.GetParams(ctx).GuardianTrustLevel
+ proposals := k.GetRoleProposals(ctx)
+ for _, proposal := range proposals {
votes := k.GetProposalVotes(ctx, proposal.Id)
voteYes := 0
@@ -58,7 +62,6 @@ func RoleMeatadataInvariant(k keeper.Keeper) sdk.Invariant {
actualRoleMeta := k.GetRoleMetadata(ctx)
expectedRoleMeta := types.RoleMetadata{}
for _, pair := range k.GetRolePairs(ctx) {
- k.SetRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
switch pair.Role {
case types.RoleGuardian:
expectedRoleMeta.Guardian++
diff --git a/x/fbridge/module/module.go b/x/fbridge/module/module.go
index 03bede71d9..2f5464557e 100644
--- a/x/fbridge/module/module.go
+++ b/x/fbridge/module/module.go
@@ -24,10 +24,11 @@ const (
)
var (
- _ module.AppModuleBasic = AppModuleBasic{}
- _ module.AppModuleGenesis = AppModule{}
- _ module.AppModule = AppModule{}
- _ module.EndBlockAppModule = AppModule{}
+ _ module.AppModuleBasic = AppModuleBasic{}
+ _ module.AppModuleGenesis = AppModule{}
+ _ module.AppModule = AppModule{}
+ _ module.BeginBlockAppModule = AppModule{}
+ _ module.EndBlockAppModule = AppModule{}
)
// AppModuleBasic defines the basic application module used by the fbridge module.
@@ -122,6 +123,11 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return consensusVersion }
+// BeginBlock returns the begin blocker for the fbridge module.
+func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
+ BeginBlocker(ctx, am.keeper)
+}
+
// EndBlock returns the end blocker for the fbridge module.
// It returns no validator updates.
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
From 2cb61cd8d6ee8f859203e12e85058334714b1c6b Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 11:48:38 +0900
Subject: [PATCH 11/49] chore
---
x/fbridge/keeper/msg_server.go | 8 ++++----
x/fbridge/types/fbridge.go | 23 +++++++++++++++++++++++
2 files changed, 27 insertions(+), 4 deletions(-)
create mode 100644 x/fbridge/types/fbridge.go
diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go
index f5f3ed0d28..130b6d15d3 100644
--- a/x/fbridge/keeper/msg_server.go
+++ b/x/fbridge/keeper/msg_server.go
@@ -84,7 +84,7 @@ func (m msgServer) SuggestRole(goCtx context.Context, msg *types.MsgSuggestRole)
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid target address (%s)", err)
}
- if err := m.IsValidRole(msg.Role); err != nil {
+ if err := types.IsValidRole(msg.Role); err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}
@@ -110,7 +110,7 @@ func (m msgServer) AddVoteForRole(goCtx context.Context, msg *types.MsgAddVoteFo
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid proposer address (%s)", err)
}
- if err := m.IsValidVoteOption(msg.Option); err != nil {
+ if err := types.IsValidVoteOption(msg.Option); err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}
@@ -129,10 +129,10 @@ func (m msgServer) AddVoteForRole(goCtx context.Context, msg *types.MsgAddVoteFo
return &types.MsgAddVoteForRoleResponse{}, nil
}
-func (m msgServer) Halt(ctx context.Context, msg *types.MsgHalt) (*types.MsgHaltResponse, error) {
+func (m msgServer) Halt(goCtx context.Context, msg *types.MsgHalt) (*types.MsgHaltResponse, error) {
panic("implement me")
}
-func (m msgServer) Resume(ctx context.Context, resume *types.MsgResume) (*types.MsgResumeResponse, error) {
+func (m msgServer) Resume(goCtx context.Context, resume *types.MsgResume) (*types.MsgResumeResponse, error) {
panic("implement me")
}
diff --git a/x/fbridge/types/fbridge.go b/x/fbridge/types/fbridge.go
new file mode 100644
index 0000000000..167ce50caf
--- /dev/null
+++ b/x/fbridge/types/fbridge.go
@@ -0,0 +1,23 @@
+package types
+
+import (
+ "errors"
+)
+
+func IsValidRole(role Role) error {
+ switch role {
+ case RoleGuardian, RoleOperator, RoleJudge:
+ return nil
+ }
+
+ return errors.New("unsupported role")
+}
+
+func IsValidVoteOption(option VoteOption) error {
+ switch option {
+ case OptionYes, OptionNo:
+ return nil
+ }
+
+ return errors.New("unsupported vote option")
+}
From 4460ca34943c03cbbe8a105e72473bdfb6eae0fe Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 15:59:57 +0900
Subject: [PATCH 12/49] add memStore and halting feature
---
docs/core/proto-docs.md | 58 ++++-
proto/lbm/fbridge/v1/fbridge.proto | 25 +-
proto/lbm/fbridge/v1/genesis.proto | 12 +-
proto/lbm/fbridge/v1/tx.proto | 2 +-
simapp/app.go | 4 +-
x/fbridge/keeper/auth.go | 105 ++++----
x/fbridge/keeper/genesis.go | 19 +-
x/fbridge/keeper/keeper.go | 112 +++++++--
x/fbridge/keeper/msg_server.go | 32 ++-
x/fbridge/keeper/transfer_test.go | 4 +-
x/fbridge/module/abci.go | 10 +-
x/fbridge/testutil/setup.go | 5 +-
x/fbridge/types/errors.go | 6 +-
x/fbridge/types/fbridge.pb.go | 361 ++++++++++++++++++++++-----
x/fbridge/types/genesis.go | 17 +-
x/fbridge/types/genesis.pb.go | 387 ++++++++++++++++++++++-------
x/fbridge/types/keys.go | 25 +-
x/fbridge/types/msgs.go | 2 +-
x/fbridge/types/tx.pb.go | 118 ++++-----
19 files changed, 982 insertions(+), 322 deletions(-)
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 9f6e4cca14..f28da7d89a 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -755,6 +755,7 @@
- [Msg](#lbm.collection.v1.Msg)
- [lbm/fbridge/v1/fbridge.proto](#lbm/fbridge/v1/fbridge.proto)
+ - [BridgeStatusMetadata](#lbm.fbridge.v1.BridgeStatusMetadata)
- [Fraction](#lbm.fbridge.v1.Fraction)
- [Params](#lbm.fbridge.v1.Params)
- [ProvisionData](#lbm.fbridge.v1.ProvisionData)
@@ -764,6 +765,7 @@
- [RoleProposal](#lbm.fbridge.v1.RoleProposal)
- [Vote](#lbm.fbridge.v1.Vote)
+ - [BridgeStatus](#lbm.fbridge.v1.BridgeStatus)
- [Role](#lbm.fbridge.v1.Role)
- [VoteOption](#lbm.fbridge.v1.VoteOption)
@@ -777,6 +779,7 @@
- [lbm/fbridge/v1/genesis.proto](#lbm/fbridge/v1/genesis.proto)
- [BlockSeqInfo](#lbm.fbridge.v1.BlockSeqInfo)
+ - [BridgeSwitch](#lbm.fbridge.v1.BridgeSwitch)
- [Commitment](#lbm.fbridge.v1.Commitment)
- [ConfirmedProvision](#lbm.fbridge.v1.ConfirmedProvision)
- [GenesisState](#lbm.fbridge.v1.GenesisState)
@@ -11398,6 +11401,22 @@ Msg defines the collection Msg service.
+
+
+### BridgeStatusMetadata
+BridgeStatusMetadata defines the metadata of the bridge status.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `inactive` | [uint64](#uint64) | | the number of inactived bridge switch |
+| `active` | [uint64](#uint64) | | the number of activated bridge switch |
+
+
+
+
+
+
### Fraction
@@ -11478,9 +11497,9 @@ RoleMetadata defines the metadata of the role.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `guardian` | [uint32](#uint32) | | the number of registered guardians |
-| `operator` | [uint32](#uint32) | | the number of the operators |
-| `judge` | [uint32](#uint32) | | the number of the judges |
+| `guardian` | [uint64](#uint64) | | the number of registered guardians |
+| `operator` | [uint64](#uint64) | | the number of the operators |
+| `judge` | [uint64](#uint64) | | the number of the judges |
@@ -11541,6 +11560,19 @@ Vote defines a vote on a role proposal.
+
+
+### BridgeStatus
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| BRIDGE_STATUS_UNSPECIFIED | 0 | BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status. |
+| BRIDGE_STATUS_ACTIVE | 1 | BRIDGE_STATUS_ACTIVE defines an active bridge status. |
+| BRIDGE_STATUS_INACTIVE | 2 | BRIDGE_STATUS_INACTIVE defines an inactive bridge status. |
+
+
+
### Role
@@ -11716,6 +11748,22 @@ VoteOption enumerates the valid vote options for a given role proposal.
+
+
+### BridgeSwitch
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `guardian` | [string](#string) | | the guardian address |
+| `status` | [BridgeStatus](#lbm.fbridge.v1.BridgeStatus) | | |
+
+
+
+
+
+
### Commitment
@@ -11763,8 +11811,8 @@ GenesisState defines the fbridge module's genesis state.
| `next_role_proposal_id` | [uint64](#uint64) | | next_role_proposal_id is the next role proposal ID to be used. |
| `role_proposals` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | repeated | role_proposals defines all the role proposals present at genesis. |
| `votes` | [Vote](#lbm.fbridge.v1.Vote) | repeated | votes defines all the votes present for role proposals at genesis. |
-| `role_metadata` | [RoleMetadata](#lbm.fbridge.v1.RoleMetadata) | | role_metadata defines all the role metadata present at genesis. |
| `roles` | [RolePair](#lbm.fbridge.v1.RolePair) | repeated | roles defines all addresses assigned roles at genesis. |
+| `bridge_switches` | [BridgeSwitch](#lbm.fbridge.v1.BridgeSwitch) | repeated | bridge_switches defines the status of whether each guardian has allowed the bridge to operate. |
@@ -12542,7 +12590,7 @@ MsgResume is input values required for resuming the bridge module
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `from` | [string](#string) | | the guardian address |
+| `guardian` | [string](#string) | | the guardian address |
diff --git a/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto
index c54d9a632e..509557c7d9 100644
--- a/proto/lbm/fbridge/v1/fbridge.proto
+++ b/proto/lbm/fbridge/v1/fbridge.proto
@@ -106,9 +106,28 @@ message Vote {
// RoleMetadata defines the metadata of the role.
message RoleMetadata {
// the number of registered guardians
- uint32 guardian = 1;
+ uint64 guardian = 1;
// the number of the operators
- uint32 operator = 2;
+ uint64 operator = 2;
// the number of the judges
- uint32 judge = 3;
+ uint64 judge = 3;
+}
+
+enum BridgeStatus {
+ option (gogoproto.goproto_enum_prefix) = false;
+
+ // BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status.
+ BRIDGE_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "StatusEmpty"];
+ // BRIDGE_STATUS_ACTIVE defines an active bridge status.
+ BRIDGE_STATUS_ACTIVE = 1 [(gogoproto.enumvalue_customname) = "StatusActive"];
+ // BRIDGE_STATUS_INACTIVE defines an inactive bridge status.
+ BRIDGE_STATUS_INACTIVE = 2 [(gogoproto.enumvalue_customname) = "StatusInactive"];
+}
+
+// BridgeStatusMetadata defines the metadata of the bridge status.
+message BridgeStatusMetadata {
+ // the number of inactived bridge switch
+ uint64 inactive = 1;
+ // the number of activated bridge switch
+ uint64 active = 2;
}
diff --git a/proto/lbm/fbridge/v1/genesis.proto b/proto/lbm/fbridge/v1/genesis.proto
index cda0f10e39..e37fbdd321 100644
--- a/proto/lbm/fbridge/v1/genesis.proto
+++ b/proto/lbm/fbridge/v1/genesis.proto
@@ -20,10 +20,10 @@ message GenesisState {
repeated RoleProposal role_proposals = 5 [(gogoproto.nullable) = false];
// votes defines all the votes present for role proposals at genesis.
repeated Vote votes = 6 [(gogoproto.nullable) = false];
- // role_metadata defines all the role metadata present at genesis.
- RoleMetadata role_metadata = 7 [(gogoproto.nullable) = false];
// roles defines all addresses assigned roles at genesis.
- repeated RolePair roles = 8 [(gogoproto.nullable) = false];
+ repeated RolePair roles = 7 [(gogoproto.nullable) = false];
+ // bridge_switches defines the status of whether each guardian has allowed the bridge to operate.
+ repeated BridgeSwitch bridge_switches = 8 [(gogoproto.nullable) = false];
}
message SendingState {
@@ -89,3 +89,9 @@ message ConfirmedProvision {
// commitment is the hash value of a provision
string commitment = 2;
}
+
+message BridgeSwitch {
+ // the guardian address
+ string guardian = 1;
+ BridgeStatus status = 2;
+}
diff --git a/proto/lbm/fbridge/v1/tx.proto b/proto/lbm/fbridge/v1/tx.proto
index c8c8d197af..364a773ff6 100644
--- a/proto/lbm/fbridge/v1/tx.proto
+++ b/proto/lbm/fbridge/v1/tx.proto
@@ -161,7 +161,7 @@ message MsgHaltResponse {}
// MsgResume is input values required for resuming the bridge module
message MsgResume {
// the guardian address
- string from = 1;
+ string guardian = 1;
}
message MsgResumeResponse {}
diff --git a/simapp/app.go b/simapp/app.go
index f6ce763cdd..ab00332ada 100644
--- a/simapp/app.go
+++ b/simapp/app.go
@@ -268,7 +268,7 @@ func NewSimApp(
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
// NOTE: The testingkey is just mounted for testing purposes. Actual applications should
// not include this key.
- memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, "testingkey")
+ memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, fbridgetypes.MemStoreKey, "testingkey")
// configure state listening capabilities using AppOptions
// we are doing nothing with the returned streamingServices and waitGroup in this case
@@ -370,7 +370,7 @@ func NewSimApp(
fswapConfig := fswaptypes.DefaultConfig()
app.FswapKeeper = fswapkeeper.NewKeeper(appCodec, keys[fswaptypes.StoreKey], app.AccountKeeper, app.BankKeeper, fswapConfig)
- app.FbridgeKeeper = fbridgekeeper.NewKeeper(appCodec, keys[fbridgetypes.StoreKey], app.AccountKeeper, app.BankKeeper, "stake", authtypes.NewModuleAddress(govtypes.ModuleName).String())
+ app.FbridgeKeeper = fbridgekeeper.NewKeeper(appCodec, keys[fbridgetypes.StoreKey], memKeys[fbridgetypes.MemStoreKey], app.AccountKeeper, app.BankKeeper, "stake")
/**** Module Options ****/
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index 0281c3b08c..b70d303507 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -2,7 +2,6 @@ package keeper
import (
"encoding/binary"
- "errors"
"fmt"
sdk "github.com/Finschia/finschia-sdk/types"
sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
@@ -11,9 +10,7 @@ import (
)
func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAddress, role types.Role) (types.RoleProposal, error) {
- if k.GetRoleMetadata(ctx).Guardian < 1 && k.authority != proposer.String() {
- return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrapf("only %s can submit a role proposal if there are no guardians", k.authority)
- } else if k.GetRole(ctx, proposer) != types.RoleGuardian {
+ if k.GetRole(ctx, proposer) != types.RoleGuardian {
return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrap("only guardian can submit a role proposal")
}
@@ -37,16 +34,12 @@ func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAd
}
func (k Keeper) addVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress, option types.VoteOption) error {
- proposal, found := k.GetRoleProposal(ctx, proposalID)
+ _, found := k.GetRoleProposal(ctx, proposalID)
if !found {
return types.ErrUnknownProposal.Wrapf("#%d not found", proposalID)
}
- if ctx.BlockTime().After(proposal.ExpiredAt) {
- return types.ErrInactiveProposal.Wrapf("#%d already expired", proposalID)
- }
-
- if err := k.IsValidVoteOption(option); err != nil {
+ if err := types.IsValidVoteOption(option); err != nil {
return err
}
@@ -61,15 +54,28 @@ func (k Keeper) UpdateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
return sdkerrors.ErrInvalidRequest.Wrap("target already has same role")
}
- metadata := k.GetRoleMetadata(ctx)
+ roleMeta := k.GetRoleMetadata(ctx)
+ bsMeta := k.GetBridgeStatusMetadata(ctx)
switch previousRole {
case types.RoleGuardian:
- metadata.Guardian--
+ roleMeta.Guardian--
+
+ sw, err := k.GetBridgeSwitch(ctx, addr)
+ if err != nil {
+ panic(err)
+ }
+
+ if sw.Status == types.StatusActive {
+ bsMeta.Active--
+ } else {
+ bsMeta.Inactive--
+ }
+
case types.RoleOperator:
- metadata.Operator--
+ roleMeta.Operator--
case types.RoleJudge:
- metadata.Judge--
+ roleMeta.Judge--
}
if role == types.RoleEmpty {
@@ -81,36 +87,20 @@ func (k Keeper) UpdateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
switch role {
case types.RoleGuardian:
- metadata.Guardian++
+ roleMeta.Guardian++
+ bsMeta.Active++
case types.RoleOperator:
- metadata.Operator++
+ roleMeta.Operator++
case types.RoleJudge:
- metadata.Judge++
+ roleMeta.Judge++
}
- k.SetRoleMetadata(ctx, metadata)
+ k.setRoleMetadata(ctx, roleMeta)
+ k.setBridgeStatusMetadata(ctx, bsMeta)
return nil
}
-func (k Keeper) IsValidRole(role types.Role) error {
- switch role {
- case types.RoleGuardian, types.RoleOperator, types.RoleJudge:
- return nil
- }
-
- return errors.New("unsupported role")
-}
-
-func (k Keeper) IsValidVoteOption(option types.VoteOption) error {
- switch option {
- case types.OptionYes, types.OptionNo:
- return nil
- }
-
- return errors.New("unsupported vote option")
-}
-
func (k Keeper) setNextProposalID(ctx sdk.Context, seq uint64) {
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 8)
@@ -250,20 +240,43 @@ func (k Keeper) deleteRole(ctx sdk.Context, addr sdk.AccAddress) {
store.Delete(types.RoleKey(addr))
}
-func (k Keeper) SetRoleMetadata(ctx sdk.Context, data types.RoleMetadata) {
+func (k Keeper) setBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
+ if k.GetRole(ctx, guardian) != types.RoleGuardian {
+ return sdkerrors.ErrUnauthorized.Wrap("only guardian can set bridge switch")
+ }
+
store := ctx.KVStore(k.storeKey)
- bz := k.cdc.MustMarshal(&data)
- store.Set(types.KeyRoleMetadata, bz)
+ bz := make([]byte, 4)
+ binary.BigEndian.PutUint32(bz, uint32(status))
+ store.Set(types.BridgeSwitchKey(guardian), bz)
+
+ return nil
}
-func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata {
- store := ctx.KVStore(k.storeKey)
+func (k Keeper) GetBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress) (types.BridgeSwitch, error) {
+ if k.GetRole(ctx, guardian) != types.RoleGuardian {
+ return types.BridgeSwitch{}, sdkerrors.ErrUnauthorized.Wrap("only guardian can set bridge switch")
+ }
- data := types.RoleMetadata{}
- bz := store.Get(types.KeyRoleMetadata)
+ store := ctx.KVStore(k.storeKey)
+ bz := store.Get(types.BridgeSwitchKey(guardian))
if bz == nil {
- panic("role metadata must be set at genesis")
+ panic("bridge switch must be set at genesis")
}
- k.cdc.MustUnmarshal(bz, &data)
- return data
+
+ return types.BridgeSwitch{Guardian: guardian.String(), Status: types.BridgeStatus(binary.BigEndian.Uint32(bz))}, nil
+}
+
+func (k Keeper) GetBridgeSwitches(ctx sdk.Context) []types.BridgeSwitch {
+ store := ctx.KVStore(k.storeKey)
+
+ bws := make([]types.BridgeSwitch, 0)
+ iterator := sdk.KVStorePrefixIterator(store, types.KeyBridgeSwitch)
+ defer iterator.Close()
+ for ; iterator.Valid(); iterator.Next() {
+ addr := types.SplitBridgeSwitchKey(iterator.Key())
+ bws = append(bws, types.BridgeSwitch{Guardian: addr.String(), Status: types.BridgeStatus(binary.BigEndian.Uint32(iterator.Value()))})
+ }
+
+ return bws
}
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index 8d6e76dc01..770d5ca802 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -7,9 +7,20 @@ import (
)
func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error {
+
k.SetParams(ctx, gs.Params)
k.setNextSequence(ctx, gs.SendingState.NextSeq)
+ for _, pair := range gs.Roles {
+ k.setRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
+ }
+
+ for _, sw := range gs.BridgeSwitches {
+ if err := k.setBridgeSwitch(ctx, sdk.MustAccAddressFromBech32(sw.Guardian), sw.Status); err != nil {
+ panic(err)
+ }
+ }
+
k.setNextProposalID(ctx, gs.NextRoleProposalId)
for _, proposal := range gs.RoleProposals {
k.setRoleProposal(ctx, proposal)
@@ -19,13 +30,10 @@ func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error {
k.setVote(ctx, vote.ProposalId, sdk.MustAccAddressFromBech32(vote.Voter), vote.Option)
}
- for _, pair := range gs.Roles {
- k.setRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
- }
- k.SetRoleMetadata(ctx, gs.RoleMetadata)
-
// TODO: we initialize the appropriate genesis parameters whenever the feature is added
+ k.InitMemStore(ctx)
+
return nil
}
@@ -38,7 +46,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
NextRoleProposalId: k.GetNextProposalID(ctx),
RoleProposals: k.GetRoleProposals(ctx),
Votes: k.GetAllVotes(ctx),
- RoleMetadata: k.GetRoleMetadata(ctx),
Roles: k.GetRolePairs(ctx),
}
}
diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go
index 6059da88bc..33cc2ed914 100644
--- a/x/fbridge/keeper/keeper.go
+++ b/x/fbridge/keeper/keeper.go
@@ -2,6 +2,7 @@ package keeper
import (
"errors"
+ "fmt"
"github.com/tendermint/tendermint/libs/log"
@@ -12,42 +13,33 @@ import (
type Keeper struct {
storeKey sdk.StoreKey
+ memKey sdk.StoreKey
cdc codec.BinaryCodec
authKeeper types.AccountKeeper
bankKeeper types.BankKeeper
// the target denom for the bridge
targetDenom string
-
- // the authority address that can execute privileged operations only if the guardian group is not set
- // - UpdateParams
- // - SuggestRole
- authority string
}
func NewKeeper(
cdc codec.BinaryCodec,
- key sdk.StoreKey,
+ key, memKey sdk.StoreKey,
authKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
targetDenom string,
- authority string,
) Keeper {
if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil {
panic(errors.New("fbridge module account has not been set"))
}
- if authority != types.DefaultAuthority().String() {
- panic(errors.New("authority must be gov module"))
- }
-
return Keeper{
storeKey: key,
+ memKey: memKey,
cdc: cdc,
authKeeper: authKeeper,
bankKeeper: bankKeeper,
targetDenom: targetDenom,
- authority: authority,
}
}
@@ -55,6 +47,98 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", "x/"+types.ModuleName)
}
-func (k Keeper) GetAuthority() string {
- return k.authority
+func (k Keeper) InitMemStore(ctx sdk.Context) {
+ memStore := ctx.KVStore(k.memKey)
+ memStoreType := memStore.GetStoreType()
+ if memStoreType != sdk.StoreTypeMemory {
+ panic(fmt.Sprintf("invalid memory store type; got %s, expected: %s", memStoreType, sdk.StoreTypeMemory))
+ }
+
+ // create context with no block gas meter to ensure we do not consume gas during local initialization logic.
+ noGasCtx := ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter())
+
+ roleMetadata := types.RoleMetadata{}
+ if !k.IsInitialized(noGasCtx) {
+ memStore := noGasCtx.KVStore(k.memKey)
+
+ for _, pair := range k.GetRolePairs(noGasCtx) {
+ switch pair.Role {
+ case types.RoleGuardian:
+ roleMetadata.Guardian++
+ case types.RoleOperator:
+ roleMetadata.Operator++
+ case types.RoleJudge:
+ roleMetadata.Judge++
+ }
+ }
+ memStore.Set(types.KeyMemRoleMetadata, k.cdc.MustMarshal(&roleMetadata))
+
+ bsMeta := types.BridgeStatusMetadata{Inactive: 0, Active: 0}
+ for _, bs := range k.GetBridgeSwitches(noGasCtx) {
+ switch bs.Status {
+ case types.StatusInactive:
+ bsMeta.Inactive++
+ case types.StatusActive:
+ bsMeta.Active++
+ default:
+ panic("invalid bridge switch status")
+ }
+ }
+ k.setBridgeStatusMetadata(noGasCtx, types.BridgeStatusMetadata{})
+
+ memStore.Set(types.KeyMemInitialized, []byte{1})
+ }
+}
+
+// IsInitialized returns true if the keeper is properly initialized, and false otherwise.
+func (k Keeper) IsInitialized(ctx sdk.Context) bool {
+ memStore := ctx.KVStore(k.memKey)
+ return memStore.Get(types.KeyMemInitialized) != nil
+}
+
+func (k Keeper) IsBridgeHalted(ctx sdk.Context) bool {
+ return k.GetBridgeStatus(ctx) == types.StatusInactive
+}
+
+func (k Keeper) setRoleMetadata(ctx sdk.Context, data types.RoleMetadata) {
+ memStore := ctx.KVStore(k.memKey)
+ bz := k.cdc.MustMarshal(&data)
+ memStore.Set(types.KeyMemRoleMetadata, bz)
+}
+
+func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata {
+ memStore := ctx.KVStore(k.memKey)
+ data := types.RoleMetadata{}
+ bz := memStore.Get(types.KeyMemRoleMetadata)
+ if bz == nil {
+ panic("role metadata must be set at genesis")
+ }
+ k.cdc.MustUnmarshal(bz, &data)
+ return data
+}
+
+func (k Keeper) GetBridgeStatus(ctx sdk.Context) types.BridgeStatus {
+ memStore := ctx.KVStore(k.memKey)
+ bsMeta := types.BridgeStatusMetadata{}
+ bz := memStore.Get(types.KeyMemBridgeStatus)
+ k.cdc.MustUnmarshal(bz, &bsMeta)
+
+ if types.CheckTrustLevelThreshold(bsMeta.Active+bsMeta.Inactive, bsMeta.Active, k.GetParams(ctx).GuardianTrustLevel) {
+ return types.StatusActive
+ }
+
+ return types.StatusInactive
+}
+
+func (k Keeper) setBridgeStatusMetadata(ctx sdk.Context, status types.BridgeStatusMetadata) {
+ memStore := ctx.KVStore(k.memKey)
+ memStore.Set(types.KeyMemBridgeStatus, k.cdc.MustMarshal(&status))
+}
+
+func (k Keeper) GetBridgeStatusMetadata(ctx sdk.Context) types.BridgeStatusMetadata {
+ memStore := ctx.KVStore(k.memKey)
+ bsMeta := types.BridgeStatusMetadata{}
+ bz := memStore.Get(types.KeyMemBridgeStatus)
+ k.cdc.MustUnmarshal(bz, &bsMeta)
+ return bsMeta
}
diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go
index 130b6d15d3..13a127246b 100644
--- a/x/fbridge/keeper/msg_server.go
+++ b/x/fbridge/keeper/msg_server.go
@@ -21,6 +21,10 @@ func NewMsgServer(k Keeper) types.MsgServer {
func (m msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
+ if m.IsBridgeHalted(ctx) {
+ return nil, types.ErrInactiveBridge
+ }
+
from, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err)
@@ -130,9 +134,31 @@ func (m msgServer) AddVoteForRole(goCtx context.Context, msg *types.MsgAddVoteFo
}
func (m msgServer) Halt(goCtx context.Context, msg *types.MsgHalt) (*types.MsgHaltResponse, error) {
- panic("implement me")
+ ctx := sdk.UnwrapSDKContext(goCtx)
+
+ addr, err := sdk.AccAddressFromBech32(msg.Guardian)
+ if err != nil {
+ return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid guardian address (%s)", err)
+ }
+
+ if err := m.setBridgeSwitch(ctx, addr, types.StatusInactive); err != nil {
+ return nil, err
+ }
+
+ return &types.MsgHaltResponse{}, nil
}
-func (m msgServer) Resume(goCtx context.Context, resume *types.MsgResume) (*types.MsgResumeResponse, error) {
- panic("implement me")
+func (m msgServer) Resume(goCtx context.Context, msg *types.MsgResume) (*types.MsgResumeResponse, error) {
+ ctx := sdk.UnwrapSDKContext(goCtx)
+
+ addr, err := sdk.AccAddressFromBech32(msg.Guardian)
+ if err != nil {
+ return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid guardian address (%s)", err)
+ }
+
+ if err := m.setBridgeSwitch(ctx, addr, types.StatusActive); err != nil {
+ return nil, err
+ }
+
+ return &types.MsgResumeResponse{}, nil
}
diff --git a/x/fbridge/keeper/transfer_test.go b/x/fbridge/keeper/transfer_test.go
index b0bdc05849..6dcf8199c8 100644
--- a/x/fbridge/keeper/transfer_test.go
+++ b/x/fbridge/keeper/transfer_test.go
@@ -13,7 +13,7 @@ import (
)
func TestHandleBridgeTransfer(t *testing.T) {
- key, ctx, encCfg, authKeeper, bankKeeper := testutil.PrepareFbridgeTest(t)
+ key, memKey, ctx, encCfg, authKeeper, bankKeeper := testutil.PrepareFbridgeTest(t)
sender := sdk.AccAddress("test")
amt := sdk.NewInt(1000000)
@@ -26,7 +26,7 @@ func TestHandleBridgeTransfer(t *testing.T) {
bankKeeper.EXPECT().SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, token).Return(nil)
bankKeeper.EXPECT().BurnCoins(ctx, types.ModuleName, token).Return(nil)
- k := NewKeeper(encCfg.Codec, key, authKeeper, bankKeeper, denom, authtypes.NewModuleAddress("gov").String())
+ k := NewKeeper(encCfg.Codec, key, memKey, authKeeper, bankKeeper, denom)
targetSeq := uint64(2)
bz := make([]byte, 8)
binary.BigEndian.PutUint64(bz, targetSeq)
diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go
index 9dc570a265..c61e97652c 100644
--- a/x/fbridge/module/abci.go
+++ b/x/fbridge/module/abci.go
@@ -8,6 +8,8 @@ import (
)
func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
+ k.InitMemStore(ctx)
+
proposals := k.GetRoleProposals(ctx)
for _, proposal := range proposals {
if ctx.BlockTime().After(proposal.ExpiredAt) {
@@ -22,14 +24,14 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
for _, proposal := range proposals {
votes := k.GetProposalVotes(ctx, proposal.Id)
- voteYes := 0
+ var voteYes uint64 = 0
for _, vote := range votes {
if vote.Option == types.OptionYes {
voteYes++
}
}
- var total uint32 = 0
+ var total uint64 = 0
roleMeta := k.GetRoleMetadata(ctx)
switch proposal.Role {
case types.RoleGuardian:
@@ -42,7 +44,7 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
panic(fmt.Sprintf("invalid role: %s\n", proposal.Role))
}
- if types.CheckTrustLevelThreshold(uint64(total), uint64(voteYes), guardianTrustLevel) {
+ if types.CheckTrustLevelThreshold(total, voteYes, guardianTrustLevel) {
if err := k.UpdateRole(ctx, proposal.Role, sdk.MustAccAddressFromBech32(proposal.Target)); err != nil {
panic(err)
}
@@ -52,7 +54,7 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
}
}
-// RegisterInvariants registers all staking invariants
+// RegisterInvariants registers all fbridge invariants
func RegisterInvariants(ir sdk.InvariantRegistry, k keeper.Keeper) {
ir.RegisterRoute(types.ModuleName, "role-metadata", RoleMeatadataInvariant(k))
}
diff --git a/x/fbridge/testutil/setup.go b/x/fbridge/testutil/setup.go
index 029772fac0..78205b2737 100644
--- a/x/fbridge/testutil/setup.go
+++ b/x/fbridge/testutil/setup.go
@@ -60,16 +60,17 @@ func MakeTestEncodingConfig() TestEncodingConfig {
return encCfg
}
-func PrepareFbridgeTest(tb testing.TB) (*sdk.KVStoreKey, sdk.Context, TestEncodingConfig, *MockAccountKeeper, *MockBankKeeper) {
+func PrepareFbridgeTest(tb testing.TB) (*sdk.KVStoreKey, *sdk.MemoryStoreKey, sdk.Context, TestEncodingConfig, *MockAccountKeeper, *MockBankKeeper) {
tb.Helper()
ctrl := gomock.NewController(tb)
key := storetypes.NewKVStoreKey(types.StoreKey)
+ memKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)
ctx := DefaultContextWithDB(tb, key, sdk.NewTransientStoreKey("transient_test"))
encCfg := MakeTestEncodingConfig()
authKeeper := NewMockAccountKeeper(ctrl)
bankKeeper := NewMockBankKeeper(ctrl)
- return key, ctx, encCfg, authKeeper, bankKeeper
+ return key, memKey, ctx, encCfg, authKeeper, bankKeeper
}
diff --git a/x/fbridge/types/errors.go b/x/fbridge/types/errors.go
index bdbe596ca9..9a8b1e2db0 100644
--- a/x/fbridge/types/errors.go
+++ b/x/fbridge/types/errors.go
@@ -3,7 +3,7 @@ package types
import sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
var (
- ErrUnknownProposal = sdkerrors.Register(ModuleName, 2, "unknown proposal")
- ErrInactiveProposal = sdkerrors.Register(ModuleName, 3, "inactive proposal")
- ErrUnknownVote = sdkerrors.Register(ModuleName, 4, "unknown vote")
+ ErrUnknownProposal = sdkerrors.Register(ModuleName, 2, "unknown proposal")
+ ErrUnknownVote = sdkerrors.Register(ModuleName, 3, "unknown vote")
+ ErrInactiveBridge = sdkerrors.Register(ModuleName, 4, "the bridge has halted")
)
diff --git a/x/fbridge/types/fbridge.pb.go b/x/fbridge/types/fbridge.pb.go
index 8d9cb5aeec..e81d70a81b 100644
--- a/x/fbridge/types/fbridge.pb.go
+++ b/x/fbridge/types/fbridge.pb.go
@@ -92,6 +92,37 @@ func (VoteOption) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_62374d75fc6aa1ba, []int{1}
}
+type BridgeStatus int32
+
+const (
+ // BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status.
+ StatusEmpty BridgeStatus = 0
+ // BRIDGE_STATUS_ACTIVE defines an active bridge status.
+ StatusActive BridgeStatus = 1
+ // BRIDGE_STATUS_INACTIVE defines an inactive bridge status.
+ StatusInactive BridgeStatus = 2
+)
+
+var BridgeStatus_name = map[int32]string{
+ 0: "BRIDGE_STATUS_UNSPECIFIED",
+ 1: "BRIDGE_STATUS_ACTIVE",
+ 2: "BRIDGE_STATUS_INACTIVE",
+}
+
+var BridgeStatus_value = map[string]int32{
+ "BRIDGE_STATUS_UNSPECIFIED": 0,
+ "BRIDGE_STATUS_ACTIVE": 1,
+ "BRIDGE_STATUS_INACTIVE": 2,
+}
+
+func (x BridgeStatus) String() string {
+ return proto.EnumName(BridgeStatus_name, int32(x))
+}
+
+func (BridgeStatus) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_62374d75fc6aa1ba, []int{2}
+}
+
type Params struct {
// ratio of how many operators' confirmations are needed to be valid.
OperatorTrustLevel Fraction `protobuf:"bytes,1,opt,name=operator_trust_level,json=operatorTrustLevel,proto3" json:"operator_trust_level"`
@@ -558,11 +589,11 @@ func (m *Vote) GetOption() VoteOption {
// RoleMetadata defines the metadata of the role.
type RoleMetadata struct {
// the number of registered guardians
- Guardian uint32 `protobuf:"varint,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
+ Guardian uint64 `protobuf:"varint,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
// the number of the operators
- Operator uint32 `protobuf:"varint,2,opt,name=operator,proto3" json:"operator,omitempty"`
+ Operator uint64 `protobuf:"varint,2,opt,name=operator,proto3" json:"operator,omitempty"`
// the number of the judges
- Judge uint32 `protobuf:"varint,3,opt,name=judge,proto3" json:"judge,omitempty"`
+ Judge uint64 `protobuf:"varint,3,opt,name=judge,proto3" json:"judge,omitempty"`
}
func (m *RoleMetadata) Reset() { *m = RoleMetadata{} }
@@ -598,30 +629,86 @@ func (m *RoleMetadata) XXX_DiscardUnknown() {
var xxx_messageInfo_RoleMetadata proto.InternalMessageInfo
-func (m *RoleMetadata) GetGuardian() uint32 {
+func (m *RoleMetadata) GetGuardian() uint64 {
if m != nil {
return m.Guardian
}
return 0
}
-func (m *RoleMetadata) GetOperator() uint32 {
+func (m *RoleMetadata) GetOperator() uint64 {
if m != nil {
return m.Operator
}
return 0
}
-func (m *RoleMetadata) GetJudge() uint32 {
+func (m *RoleMetadata) GetJudge() uint64 {
if m != nil {
return m.Judge
}
return 0
}
+// BridgeStatusMetadata defines the metadata of the bridge status.
+type BridgeStatusMetadata struct {
+ // the number of inactived bridge switch
+ Inactive uint64 `protobuf:"varint,1,opt,name=inactive,proto3" json:"inactive,omitempty"`
+ // the number of activated bridge switch
+ Active uint64 `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"`
+}
+
+func (m *BridgeStatusMetadata) Reset() { *m = BridgeStatusMetadata{} }
+func (m *BridgeStatusMetadata) String() string { return proto.CompactTextString(m) }
+func (*BridgeStatusMetadata) ProtoMessage() {}
+func (*BridgeStatusMetadata) Descriptor() ([]byte, []int) {
+ return fileDescriptor_62374d75fc6aa1ba, []int{8}
+}
+func (m *BridgeStatusMetadata) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *BridgeStatusMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_BridgeStatusMetadata.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 *BridgeStatusMetadata) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_BridgeStatusMetadata.Merge(m, src)
+}
+func (m *BridgeStatusMetadata) XXX_Size() int {
+ return m.Size()
+}
+func (m *BridgeStatusMetadata) XXX_DiscardUnknown() {
+ xxx_messageInfo_BridgeStatusMetadata.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_BridgeStatusMetadata proto.InternalMessageInfo
+
+func (m *BridgeStatusMetadata) GetInactive() uint64 {
+ if m != nil {
+ return m.Inactive
+ }
+ return 0
+}
+
+func (m *BridgeStatusMetadata) GetActive() uint64 {
+ if m != nil {
+ return m.Active
+ }
+ return 0
+}
+
func init() {
proto.RegisterEnum("lbm.fbridge.v1.Role", Role_name, Role_value)
proto.RegisterEnum("lbm.fbridge.v1.VoteOption", VoteOption_name, VoteOption_value)
+ proto.RegisterEnum("lbm.fbridge.v1.BridgeStatus", BridgeStatus_name, BridgeStatus_value)
proto.RegisterType((*Params)(nil), "lbm.fbridge.v1.Params")
proto.RegisterType((*ProvisionData)(nil), "lbm.fbridge.v1.ProvisionData")
proto.RegisterType((*ProvisionStatus)(nil), "lbm.fbridge.v1.ProvisionStatus")
@@ -630,68 +717,74 @@ func init() {
proto.RegisterType((*RoleProposal)(nil), "lbm.fbridge.v1.RoleProposal")
proto.RegisterType((*Vote)(nil), "lbm.fbridge.v1.Vote")
proto.RegisterType((*RoleMetadata)(nil), "lbm.fbridge.v1.RoleMetadata")
+ proto.RegisterType((*BridgeStatusMetadata)(nil), "lbm.fbridge.v1.BridgeStatusMetadata")
}
func init() { proto.RegisterFile("lbm/fbridge/v1/fbridge.proto", fileDescriptor_62374d75fc6aa1ba) }
var fileDescriptor_62374d75fc6aa1ba = []byte{
- // 886 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4f, 0x8f, 0x1b, 0x35,
- 0x14, 0xcf, 0xa4, 0xb3, 0x21, 0x79, 0xd9, 0xfc, 0xc1, 0x5a, 0x41, 0x34, 0x2a, 0x93, 0x10, 0x09,
- 0xb1, 0xaa, 0x20, 0xa1, 0xe1, 0xc6, 0x6d, 0xff, 0x64, 0x57, 0x89, 0x20, 0x89, 0xbc, 0xd9, 0x4a,
- 0x45, 0x48, 0x91, 0x93, 0xf1, 0xa6, 0xa6, 0x33, 0xe3, 0xc1, 0xe3, 0x84, 0x96, 0x0f, 0x80, 0xd0,
- 0x9e, 0xfa, 0x05, 0x56, 0x02, 0xf1, 0x49, 0xb8, 0x55, 0x9c, 0x7a, 0x44, 0x1c, 0x0a, 0xda, 0xbd,
- 0xf0, 0x31, 0x90, 0xed, 0x78, 0x36, 0xdb, 0x4b, 0x7b, 0xf3, 0xfb, 0xf9, 0xf7, 0x7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0xab, 0xa2, 0x80, 0x4a, 0x5c, 0x1b, 0xf6, 0xd6, 0xd1, 0x8f, 0x9c, 0xb3, 0x9a, 0xa1, 0xd2,
+ 0x28, 0xd4, 0x23, 0x9c, 0xa2, 0x16, 0x54, 0xd7, 0x31, 0xc3, 0x51, 0xad, 0x68, 0xed, 0x5c, 0x5d,
+ 0xb7, 0x4a, 0x0a, 0x32, 0xa4, 0x99, 0x90, 0x17, 0x06, 0xec, 0xac, 0xb7, 0x17, 0xd9, 0xf0, 0x61,
+ 0xdf, 0x73, 0x8f, 0x4f, 0x9d, 0xe9, 0xd9, 0xa4, 0x37, 0x39, 0x3f, 0xfb, 0x3f, 0x31, 0x0a, 0xaa,
+ 0xc4, 0x1c, 0x42, 0x7d, 0x13, 0xdf, 0x3b, 0x9a, 0xb8, 0x17, 0x8e, 0xee, 0x9a, 0x82, 0xf6, 0xd4,
+ 0x58, 0x6c, 0xb8, 0xbf, 0x89, 0x75, 0x87, 0x19, 0xba, 0x68, 0xa1, 0xab, 0xeb, 0x56, 0x55, 0xa1,
+ 0xdd, 0x6c, 0x8c, 0x4a, 0x62, 0x7f, 0xf0, 0xf2, 0xa6, 0x61, 0xbc, 0xba, 0x69, 0x18, 0xff, 0xdc,
+ 0x34, 0x8c, 0xe7, 0xb7, 0x8d, 0xc2, 0xab, 0xdb, 0x46, 0xe1, 0xcf, 0xdb, 0x46, 0xe1, 0xdb, 0x2f,
+ 0xde, 0xfa, 0xd5, 0x7c, 0x9a, 0xff, 0x42, 0xe5, 0xf7, 0x73, 0xb6, 0x2d, 0x1f, 0xd3, 0x97, 0xff,
+ 0x05, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x2c, 0x09, 0x1f, 0x5e, 0x07, 0x00, 0x00,
}
func (m *Params) Marshal() (dAtA []byte, err error) {
@@ -1053,6 +1146,39 @@ func (m *RoleMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *BridgeStatusMetadata) 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 *BridgeStatusMetadata) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *BridgeStatusMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Active != 0 {
+ i = encodeVarintFbridge(dAtA, i, uint64(m.Active))
+ i--
+ dAtA[i] = 0x10
+ }
+ if m.Inactive != 0 {
+ i = encodeVarintFbridge(dAtA, i, uint64(m.Inactive))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintFbridge(dAtA []byte, offset int, v uint64) int {
offset -= sovFbridge(v)
base := offset
@@ -1218,6 +1344,21 @@ func (m *RoleMetadata) Size() (n int) {
return n
}
+func (m *BridgeStatusMetadata) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Inactive != 0 {
+ n += 1 + sovFbridge(uint64(m.Inactive))
+ }
+ if m.Active != 0 {
+ n += 1 + sovFbridge(uint64(m.Active))
+ }
+ return n
+}
+
func sovFbridge(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -2223,7 +2364,7 @@ func (m *RoleMetadata) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- m.Guardian |= uint32(b&0x7F) << shift
+ m.Guardian |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -2242,7 +2383,7 @@ func (m *RoleMetadata) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- m.Operator |= uint32(b&0x7F) << shift
+ m.Operator |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
@@ -2261,7 +2402,95 @@ func (m *RoleMetadata) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- m.Judge |= uint32(b&0x7F) << shift
+ m.Judge |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipFbridge(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthFbridge
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *BridgeStatusMetadata) 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 ErrIntOverflowFbridge
+ }
+ 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: BridgeStatusMetadata: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: BridgeStatusMetadata: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Inactive", wireType)
+ }
+ m.Inactive = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Inactive |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType)
+ }
+ m.Active = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowFbridge
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Active |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index c07db74618..f7f91dbe83 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -1,11 +1,5 @@
package types
-import (
- sdk "github.com/Finschia/finschia-sdk/types"
- authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
- govtypes "github.com/Finschia/finschia-sdk/x/gov/types"
-)
-
func DefaultGenesisState() *GenesisState {
return &GenesisState{
SendingState: SendingState{
@@ -13,7 +7,8 @@ func DefaultGenesisState() *GenesisState {
},
ReceivingState: ReceivingState{},
NextRoleProposalId: 1,
- RoleMetadata: RoleMetadata{Guardian: 0, Operator: 0, Judge: 0},
+ Roles: []RolePair{{Role: RoleGuardian, Address: ""}},
+ BridgeSwitches: []BridgeSwitch{{Guardian: "", Status: StatusActive}},
}
}
@@ -26,13 +21,5 @@ func ValidateGenesis(data GenesisState) error {
panic("next role proposal ID must be positive")
}
- if data.RoleMetadata.Guardian < 0 || data.RoleMetadata.Operator < 0 || data.RoleMetadata.Judge < 0 {
- panic("length of each group must be positive")
- }
-
return nil
}
-
-func DefaultAuthority() sdk.AccAddress {
- return authtypes.NewModuleAddress(govtypes.ModuleName)
-}
diff --git a/x/fbridge/types/genesis.pb.go b/x/fbridge/types/genesis.pb.go
index de4f09477f..1290daf11e 100644
--- a/x/fbridge/types/genesis.pb.go
+++ b/x/fbridge/types/genesis.pb.go
@@ -37,10 +37,10 @@ type GenesisState struct {
RoleProposals []RoleProposal `protobuf:"bytes,5,rep,name=role_proposals,json=roleProposals,proto3" json:"role_proposals"`
// votes defines all the votes present for role proposals at genesis.
Votes []Vote `protobuf:"bytes,6,rep,name=votes,proto3" json:"votes"`
- // role_metadata defines all the role metadata present at genesis.
- RoleMetadata RoleMetadata `protobuf:"bytes,7,opt,name=role_metadata,json=roleMetadata,proto3" json:"role_metadata"`
// roles defines all addresses assigned roles at genesis.
- Roles []RolePair `protobuf:"bytes,8,rep,name=roles,proto3" json:"roles"`
+ Roles []RolePair `protobuf:"bytes,7,rep,name=roles,proto3" json:"roles"`
+ // bridge_switches defines the status of whether each guardian has allowed the bridge to operate.
+ BridgeSwitches []BridgeSwitch `protobuf:"bytes,8,rep,name=bridge_switches,json=bridgeSwitches,proto3" json:"bridge_switches"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
@@ -118,16 +118,16 @@ func (m *GenesisState) GetVotes() []Vote {
return nil
}
-func (m *GenesisState) GetRoleMetadata() RoleMetadata {
+func (m *GenesisState) GetRoles() []RolePair {
if m != nil {
- return m.RoleMetadata
+ return m.Roles
}
- return RoleMetadata{}
+ return nil
}
-func (m *GenesisState) GetRoles() []RolePair {
+func (m *GenesisState) GetBridgeSwitches() []BridgeSwitch {
if m != nil {
- return m.Roles
+ return m.BridgeSwitches
}
return nil
}
@@ -506,6 +506,59 @@ func (m *ConfirmedProvision) GetCommitment() string {
return ""
}
+type BridgeSwitch struct {
+ // the guardian address
+ Guardian string `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
+ Status BridgeStatus `protobuf:"varint,2,opt,name=status,proto3,enum=lbm.fbridge.v1.BridgeStatus" json:"status,omitempty"`
+}
+
+func (m *BridgeSwitch) Reset() { *m = BridgeSwitch{} }
+func (m *BridgeSwitch) String() string { return proto.CompactTextString(m) }
+func (*BridgeSwitch) ProtoMessage() {}
+func (*BridgeSwitch) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0fc3cc4535a29f6d, []int{8}
+}
+func (m *BridgeSwitch) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *BridgeSwitch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_BridgeSwitch.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 *BridgeSwitch) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_BridgeSwitch.Merge(m, src)
+}
+func (m *BridgeSwitch) XXX_Size() int {
+ return m.Size()
+}
+func (m *BridgeSwitch) XXX_DiscardUnknown() {
+ xxx_messageInfo_BridgeSwitch.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_BridgeSwitch proto.InternalMessageInfo
+
+func (m *BridgeSwitch) GetGuardian() string {
+ if m != nil {
+ return m.Guardian
+ }
+ return ""
+}
+
+func (m *BridgeSwitch) GetStatus() BridgeStatus {
+ if m != nil {
+ return m.Status
+ }
+ return StatusEmpty
+}
+
func init() {
proto.RegisterType((*GenesisState)(nil), "lbm.fbridge.v1.GenesisState")
proto.RegisterType((*SendingState)(nil), "lbm.fbridge.v1.SendingState")
@@ -515,61 +568,64 @@ func init() {
proto.RegisterType((*Commitment)(nil), "lbm.fbridge.v1.Commitment")
proto.RegisterType((*Provision)(nil), "lbm.fbridge.v1.Provision")
proto.RegisterType((*ConfirmedProvision)(nil), "lbm.fbridge.v1.ConfirmedProvision")
+ proto.RegisterType((*BridgeSwitch)(nil), "lbm.fbridge.v1.BridgeSwitch")
}
func init() { proto.RegisterFile("lbm/fbridge/v1/genesis.proto", fileDescriptor_0fc3cc4535a29f6d) }
var fileDescriptor_0fc3cc4535a29f6d = []byte{
- // 772 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x4f, 0x4f, 0xdb, 0x4e,
- 0x10, 0x8d, 0x13, 0x13, 0x60, 0x08, 0x01, 0xad, 0x00, 0x99, 0xfc, 0xf8, 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,
- 0xd3, 0x4e, 0x51, 0xfc, 0xbc, 0x5e, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x83, 0x3c, 0x4b, 0x92,
- 0x20, 0x07, 0x00, 0x00,
+ // 806 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcf, 0x8f, 0xdb, 0x44,
+ 0x14, 0x8e, 0x13, 0x6f, 0xba, 0x7d, 0xcd, 0x26, 0xd5, 0xa8, 0xad, 0xdc, 0x50, 0x9c, 0xc8, 0xe2,
+ 0x90, 0x03, 0x24, 0x0d, 0x54, 0xe2, 0x87, 0x2a, 0x21, 0x65, 0xab, 0x56, 0x0b, 0x42, 0x54, 0x36,
+ 0x42, 0xa8, 0x17, 0x33, 0xb6, 0x27, 0xde, 0x51, 0x63, 0x8f, 0xe3, 0x99, 0x84, 0xee, 0x7f, 0xc0,
+ 0x0d, 0x6e, 0x5c, 0xb9, 0xf0, 0xbf, 0xf4, 0xd8, 0x23, 0x27, 0x84, 0x76, 0xff, 0x11, 0x34, 0x93,
+ 0xb1, 0xe3, 0x38, 0x89, 0x44, 0x6f, 0x33, 0xf3, 0xbe, 0xf7, 0xbd, 0x6f, 0x9e, 0x3f, 0xbf, 0x81,
+ 0x47, 0x8b, 0x20, 0x99, 0xcc, 0x83, 0x9c, 0x46, 0x31, 0x99, 0xac, 0xa7, 0x93, 0x98, 0xa4, 0x84,
+ 0x53, 0x3e, 0xce, 0x72, 0x26, 0x18, 0xea, 0x2e, 0x82, 0x64, 0xac, 0xa3, 0xe3, 0xf5, 0xb4, 0x7f,
+ 0x2f, 0x66, 0x31, 0x53, 0xa1, 0x89, 0x5c, 0x6d, 0x50, 0xfd, 0x3a, 0x47, 0x91, 0xa0, 0xa2, 0xce,
+ 0x6f, 0x26, 0x74, 0x5e, 0x6c, 0x58, 0x3d, 0x81, 0x05, 0x41, 0x4f, 0xa0, 0x9d,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 0x1f, 0xf8, 0x45, 0x77, 0x35, 0x37, 0xf7, 0x6e, 0xf8, 0x33, 0x74,
+ 0xaa, 0x13, 0x48, 0xf6, 0x2f, 0x5e, 0xe1, 0x3c, 0xa2, 0x38, 0x2d, 0xfa, 0x57, 0xec, 0xe5, 0x43,
+ 0xa4, 0xc5, 0x4a, 0x9e, 0xee, 0xd1, 0x59, 0xb6, 0xa3, 0x74, 0xf6, 0xcd, 0xdb, 0x6b, 0xdb, 0x78,
+ 0x77, 0x6d, 0x1b, 0xff, 0x5e, 0xdb, 0xc6, 0xef, 0x37, 0x76, 0xe3, 0xdd, 0x8d, 0xdd, 0xf8, 0xfb,
+ 0xc6, 0x6e, 0xbc, 0x7a, 0x1c, 0x53, 0x71, 0xb9, 0x0a, 0xc6, 0x21, 0x4b, 0x26, 0xcf, 0x69, 0xca,
+ 0xc3, 0x4b, 0x8a, 0x27, 0x73, 0xbd, 0xf8, 0x84, 0x47, 0xaf, 0x27, 0x6f, 0xca, 0x67, 0x52, 0x5c,
+ 0x65, 0x84, 0x07, 0x6d, 0xf5, 0x44, 0x7e, 0xf6, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x93, 0xaf,
+ 0x65, 0xdd, 0x86, 0x07, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -592,10 +648,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
- if len(m.Roles) > 0 {
- for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- {
+ if len(m.BridgeSwitches) > 0 {
+ for iNdEx := len(m.BridgeSwitches) - 1; iNdEx >= 0; iNdEx-- {
{
- size, err := m.Roles[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ size, err := m.BridgeSwitches[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
@@ -606,16 +662,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0x42
}
}
- {
- size, err := m.RoleMetadata.MarshalToSizedBuffer(dAtA[:i])
- if err != nil {
- return 0, err
+ if len(m.Roles) > 0 {
+ for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- {
+ {
+ size, err := m.Roles[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintGenesis(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x3a
}
- i -= size
- i = encodeVarintGenesis(dAtA, i, uint64(size))
}
- i--
- dAtA[i] = 0x3a
if len(m.Votes) > 0 {
for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- {
{
@@ -820,20 +880,20 @@ func (m *ReceivingState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
}
}
if len(m.PendingClaimSeqs) > 0 {
- dAtA6 := make([]byte, len(m.PendingClaimSeqs)*10)
- var j5 int
+ dAtA5 := make([]byte, len(m.PendingClaimSeqs)*10)
+ var j4 int
for _, num := range m.PendingClaimSeqs {
for num >= 1<<7 {
- dAtA6[j5] = uint8(uint64(num)&0x7f | 0x80)
+ dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
- j5++
+ j4++
}
- dAtA6[j5] = uint8(num)
- j5++
+ dAtA5[j4] = uint8(num)
+ j4++
}
- i -= j5
- copy(dAtA[i:], dAtA6[:j5])
- i = encodeVarintGenesis(dAtA, i, uint64(j5))
+ i -= j4
+ copy(dAtA[i:], dAtA5[:j4])
+ i = encodeVarintGenesis(dAtA, i, uint64(j4))
i--
dAtA[i] = 0x22
}
@@ -1039,6 +1099,41 @@ func (m *ConfirmedProvision) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *BridgeSwitch) 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 *BridgeSwitch) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *BridgeSwitch) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Status != 0 {
+ i = encodeVarintGenesis(dAtA, i, uint64(m.Status))
+ i--
+ dAtA[i] = 0x10
+ }
+ if len(m.Guardian) > 0 {
+ i -= len(m.Guardian)
+ copy(dAtA[i:], m.Guardian)
+ i = encodeVarintGenesis(dAtA, i, uint64(len(m.Guardian)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
offset -= sovGenesis(v)
base := offset
@@ -1077,14 +1172,18 @@ func (m *GenesisState) Size() (n int) {
n += 1 + l + sovGenesis(uint64(l))
}
}
- l = m.RoleMetadata.Size()
- n += 1 + l + sovGenesis(uint64(l))
if len(m.Roles) > 0 {
for _, e := range m.Roles {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
+ if len(m.BridgeSwitches) > 0 {
+ for _, e := range m.BridgeSwitches {
+ l = e.Size()
+ n += 1 + l + sovGenesis(uint64(l))
+ }
+ }
return n
}
@@ -1243,6 +1342,22 @@ func (m *ConfirmedProvision) Size() (n int) {
return n
}
+func (m *BridgeSwitch) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Guardian)
+ if l > 0 {
+ n += 1 + l + sovGenesis(uint64(l))
+ }
+ if m.Status != 0 {
+ n += 1 + sovGenesis(uint64(m.Status))
+ }
+ return n
+}
+
func sovGenesis(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -1466,7 +1581,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 7:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field RoleMetadata", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -1493,13 +1608,14 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if err := m.RoleMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ m.Roles = append(m.Roles, RolePair{})
+ if err := m.Roles[len(m.Roles)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 8:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Roles", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field BridgeSwitches", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -1526,8 +1642,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.Roles = append(m.Roles, RolePair{})
- if err := m.Roles[len(m.Roles)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ m.BridgeSwitches = append(m.BridgeSwitches, BridgeSwitch{})
+ if err := m.BridgeSwitches[len(m.BridgeSwitches)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -2547,6 +2663,107 @@ func (m *ConfirmedProvision) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *BridgeSwitch) 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 ErrIntOverflowGenesis
+ }
+ 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: BridgeSwitch: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: BridgeSwitch: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Guardian", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Guardian = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
+ }
+ m.Status = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Status |= BridgeStatus(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipGenesis(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipGenesis(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go
index 110d6a8136..21cc2277c7 100644
--- a/x/fbridge/types/keys.go
+++ b/x/fbridge/types/keys.go
@@ -11,8 +11,11 @@ const (
// ModuleName is the module name constant used in many places
ModuleName = "fbridge"
- // StoreKey is the store key string for distribution
+ // StoreKey is the store key string for fbridge
StoreKey = ModuleName
+
+ // MemStoreKey is the in-memory store key string for fbridge
+ MemStoreKey = "mem_" + StoreKey
)
// - 0x01: params
@@ -22,6 +25,10 @@ const (
// 0x11: proposal
// 0x12: vote
// - 0x13: role
+// - 0x14: bridge switch
+//
+// - 0xF0: memstore initialized
+// - 0xF1: role metadata
var (
KeyParams = []byte{0x01} // key for fbridge module params
@@ -31,7 +38,11 @@ var (
KeyProposalPrefix = []byte{0x11} // key prefix for the role proposal
KeyProposalVotePrefix = []byte{0x12} // key prefix for the role proposal vote
KeyRolePrefix = []byte{0x13} // key prefix for the role of an address
- KeyRoleMetadata = []byte{0x14}
+ KeyBridgeSwitch = []byte{0x14} // key for the switch to halt
+
+ KeyMemInitialized = []byte{0xF0}
+ KeyMemRoleMetadata = []byte{0xF1} // key for the role metadata
+ KeyMemBridgeStatus = []byte{0xF2} // key for the bridge status
)
// GetProposalIDBytes returns the byte representation of the proposalID
@@ -74,3 +85,13 @@ func SplitRoleKey(key []byte) sdk.AccAddress {
kv.AssertKeyAtLeastLength(key, 3)
return key[2:]
}
+
+func BridgeSwitchKey(guardian sdk.AccAddress) []byte {
+ return append(KeyBridgeSwitch, address.MustLengthPrefix(guardian.Bytes())...)
+}
+
+// SplitBridgeSwitchKey split the bridge switch key and returns the guardian address
+func SplitBridgeSwitchKey(key []byte) sdk.AccAddress {
+ kv.AssertKeyAtLeastLength(key, 3)
+ return key[2:]
+}
diff --git a/x/fbridge/types/msgs.go b/x/fbridge/types/msgs.go
index fce2320548..b43bb32c9e 100644
--- a/x/fbridge/types/msgs.go
+++ b/x/fbridge/types/msgs.go
@@ -119,7 +119,7 @@ func (m MsgHalt) GetSignBytes() []byte {
func (m MsgResume) ValidateBasic() error { return nil }
func (m MsgResume) GetSigners() []sdk.AccAddress {
- return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)}
+ return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Guardian)}
}
func (m MsgResume) GetSignBytes() []byte {
diff --git a/x/fbridge/types/tx.pb.go b/x/fbridge/types/tx.pb.go
index 25c2abcd10..384afaef10 100644
--- a/x/fbridge/types/tx.pb.go
+++ b/x/fbridge/types/tx.pb.go
@@ -976,7 +976,7 @@ var xxx_messageInfo_MsgHaltResponse proto.InternalMessageInfo
// MsgResume is input values required for resuming the bridge module
type MsgResume struct {
// the guardian address
- From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
+ Guardian string `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
}
func (m *MsgResume) Reset() { *m = MsgResume{} }
@@ -1012,9 +1012,9 @@ func (m *MsgResume) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgResume proto.InternalMessageInfo
-func (m *MsgResume) GetFrom() string {
+func (m *MsgResume) GetGuardian() string {
if m != nil {
- return m.From
+ return m.Guardian
}
return ""
}
@@ -1083,55 +1083,55 @@ func init() {
func init() { proto.RegisterFile("lbm/fbridge/v1/tx.proto", fileDescriptor_54a336bc5ea063bb) }
var fileDescriptor_54a336bc5ea063bb = []byte{
- // 762 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdf, 0x4e, 0xd3, 0x50,
- 0x18, 0xdf, 0xdc, 0x18, 0xec, 0x03, 0x07, 0x14, 0xd8, 0x46, 0x81, 0x0d, 0xaa, 0x28, 0x92, 0xb8,
- 0xc1, 0xbc, 0x30, 0xf1, 0x4a, 0x47, 0x42, 0x84, 0xd8, 0x60, 0xea, 0x9f, 0x18, 0x2f, 0x24, 0x67,
- 0xeb, 0xd9, 0xa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c2, 0x19, 0xc1, 0xec, 0x70, 0xc2, 0x95, 0x08, 0xed, 0x10, 0x47, 0xde, 0x1e, 0xcf, 0x09,
- 0x97, 0x08, 0x47, 0x3d, 0xba, 0x44, 0x88, 0x13, 0x53, 0x22, 0x32, 0xf6, 0x92, 0x06, 0x10, 0xc8,
- 0xfc, 0x5a, 0x84, 0xf2, 0x0a, 0x96, 0x37, 0x47, 0xc2, 0xc2, 0x73, 0x0f, 0x26, 0xfa, 0x51, 0x2f,
- 0xc6, 0xf1, 0xe5, 0xf5, 0x38, 0x44, 0x98, 0xbc, 0x83, 0xe9, 0x60, 0xd2, 0x4b, 0x11, 0x82, 0x00,
- 0x2e, 0x3f, 0x18, 0x8d, 0x0b, 0xdb, 0x4f, 0x90, 0x1b, 0x8a, 0xef, 0x46, 0x84, 0x32, 0x4c, 0x91,
- 0x1f, 0x8d, 0xa5, 0x08, 0xff, 0xe7, 0x90, 0xf6, 0x32, 0x58, 0x88, 0x5a, 0x23, 0x64, 0x72, 0xb9,
- 0x1c, 0x03, 0x08, 0x87, 0x7d, 0xc8, 0xf8, 0x59, 0x5c, 0x8e, 0x7c, 0x8e, 0x2e, 0x24, 0x6f, 0xc4,
- 0x42, 0x03, 0x9f, 0xfa, 0xe1, 0xe9, 0x45, 0x29, 0x79, 0x76, 0x51, 0x4a, 0xfe, 0xbd, 0x28, 0x25,
- 0x7f, 0x5c, 0x96, 0x12, 0x67, 0x97, 0xa5, 0xc4, 0xef, 0xcb, 0x52, 0xe2, 0xe3, 0xce, 0xd8, 0xd7,
- 0x67, 0x4f, 0x7c, 0xa5, 0x78, 0x2f, 0xd2, 0x46, 0xc6, 0xfb, 0x42, 0x79, 0xf2, 0x2f, 0x00, 0x00,
- 0xff, 0xff, 0x82, 0xfe, 0x50, 0x79, 0x00, 0x09, 0x00, 0x00,
+ // 764 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa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0x5f, 0x95, 0x12, 0xbf, 0xae, 0x4a, 0x89, 0x0f, 0xbb, 0x63,
+ 0x5f, 0xa3, 0x3d, 0xf1, 0xb5, 0xe2, 0xbd, 0x50, 0x1b, 0x19, 0xef, 0x4b, 0xe5, 0xf1, 0xdf, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0xad, 0xb2, 0x7b, 0x66, 0x08, 0x09, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -2243,10 +2243,10 @@ func (m *MsgResume) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
- if len(m.From) > 0 {
- i -= len(m.From)
- copy(dAtA[i:], m.From)
- i = encodeVarintTx(dAtA, i, uint64(len(m.From)))
+ if len(m.Guardian) > 0 {
+ i -= len(m.Guardian)
+ copy(dAtA[i:], m.Guardian)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.Guardian)))
i--
dAtA[i] = 0xa
}
@@ -2560,7 +2560,7 @@ func (m *MsgResume) Size() (n int) {
}
var l int
_ = l
- l = len(m.From)
+ l = len(m.Guardian)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
@@ -4300,7 +4300,7 @@ func (m *MsgResume) Unmarshal(dAtA []byte) error {
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field From", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Guardian", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -4328,7 +4328,7 @@ func (m *MsgResume) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.From = string(dAtA[iNdEx:postIndex])
+ m.Guardian = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
From 59962c27383acc9302e2a43cd98bdf678f350877 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 16:12:07 +0900
Subject: [PATCH 13/49] chore
---
x/fbridge/keeper/keeper.go | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go
index 33cc2ed914..5c86fafd3c 100644
--- a/x/fbridge/keeper/keeper.go
+++ b/x/fbridge/keeper/keeper.go
@@ -59,8 +59,6 @@ func (k Keeper) InitMemStore(ctx sdk.Context) {
roleMetadata := types.RoleMetadata{}
if !k.IsInitialized(noGasCtx) {
- memStore := noGasCtx.KVStore(k.memKey)
-
for _, pair := range k.GetRolePairs(noGasCtx) {
switch pair.Role {
case types.RoleGuardian:
@@ -71,7 +69,7 @@ func (k Keeper) InitMemStore(ctx sdk.Context) {
roleMetadata.Judge++
}
}
- memStore.Set(types.KeyMemRoleMetadata, k.cdc.MustMarshal(&roleMetadata))
+ k.setRoleMetadata(noGasCtx, roleMetadata)
bsMeta := types.BridgeStatusMetadata{Inactive: 0, Active: 0}
for _, bs := range k.GetBridgeSwitches(noGasCtx) {
@@ -86,6 +84,7 @@ func (k Keeper) InitMemStore(ctx sdk.Context) {
}
k.setBridgeStatusMetadata(noGasCtx, types.BridgeStatusMetadata{})
+ memStore := noGasCtx.KVStore(k.memKey)
memStore.Set(types.KeyMemInitialized, []byte{1})
}
}
@@ -111,7 +110,7 @@ func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata {
data := types.RoleMetadata{}
bz := memStore.Get(types.KeyMemRoleMetadata)
if bz == nil {
- panic("role metadata must be set at genesis")
+ return types.RoleMetadata{}
}
k.cdc.MustUnmarshal(bz, &data)
return data
From e4727c207a5935e6144ad0201c108fed16126807 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 16:26:02 +0900
Subject: [PATCH 14/49] remove redundant gRPC queries
---
client/docs/config.json | 4 +-
client/docs/swagger-ui/swagger.yaml | 108 +---
docs/core/proto-docs.md | 69 +-
proto/lbm/fbridge/v1/query.proto | 35 +-
x/fbridge/keeper/grpc_query.go | 45 +-
x/fbridge/types/fbridge.go | 6 +
x/fbridge/types/query.pb.go | 964 +++++-----------------------
x/fbridge/types/query.pb.gw.go | 164 +----
8 files changed, 248 insertions(+), 1147 deletions(-)
diff --git a/client/docs/config.json b/client/docs/config.json
index 10c1f955fa..c1e0bb7c12 100644
--- a/client/docs/config.json
+++ b/client/docs/config.json
@@ -171,9 +171,7 @@
"rename": {
"Params": "FBridgeParams",
"Commitments": "FBridgeCommitments",
- "Guardians": "FBridgeGuardians",
- "Operators": "FBridgeOperators",
- "Judges": "FBridgeJudges",
+ "Members": "FBridgeMembers",
"Proposals": "FBridgeProposals",
"Proposal": "FBridgeProposal",
"Votes": "FBridgeVotes",
diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml
index 1fc1847f2b..fb9fcf1c8f 100644
--- a/client/docs/swagger-ui/swagger.yaml
+++ b/client/docs/swagger-ui/swagger.yaml
@@ -29883,55 +29883,17 @@ paths:
format: byte
tags:
- Query
- /lbm/fbridge/v1/guardians:
+ /lbm/fbridge/v1/members:
get:
- summary: Guardians queries a list of Guardians registered on the bridge
- operationId: FBridgeGuardians
+ summary: Members queries the members of spcific group registered on the bridge
+ operationId: FBridgeMembers
responses:
'200':
description: A successful response.
schema:
type: object
properties:
- guardians:
- type: array
- items:
- type: string
- 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/judges:
- get:
- summary: Judges queries a list of Judges registered on the bridge
- operationId: FBridgeJudges
- responses:
- '200':
- description: A successful response.
- schema:
- type: object
- properties:
- judges:
+ members:
type: array
items:
type: string
@@ -29957,6 +29919,12 @@ paths:
value:
type: string
format: byte
+ parameters:
+ - name: role
+ description: 'the role name (guardian, operator, judge).'
+ in: query
+ required: false
+ type: string
tags:
- Query
/lbm/fbridge/v1/nextseq_send:
@@ -29996,44 +29964,6 @@ paths:
format: byte
tags:
- Query
- /lbm/fbridge/v1/operators:
- get:
- summary: Operators queries a list of Operators registered on the bridge
- operationId: FBridgeOperators
- responses:
- '200':
- description: A successful response.
- schema:
- type: object
- properties:
- operators:
- type: array
- items:
- type: string
- 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/operators/{operator}/needed_submission_seqs':
get:
summary: >-
@@ -50461,17 +50391,10 @@ definitions:
seq:
type: string
format: uint64
- lbm.fbridge.v1.QueryGuardiansResponse:
+ lbm.fbridge.v1.QueryMembersResponse:
type: object
properties:
- guardians:
- type: array
- items:
- type: string
- lbm.fbridge.v1.QueryJudgesResponse:
- type: object
- properties:
- judges:
+ members:
type: array
items:
type: string
@@ -50489,13 +50412,6 @@ definitions:
seq:
type: string
format: uint64
- lbm.fbridge.v1.QueryOperatorsResponse:
- type: object
- properties:
- operators:
- type: array
- items:
- type: string
lbm.fbridge.v1.QueryParamsResponse:
type: object
properties:
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index f28da7d89a..2fe4fd6932 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -797,16 +797,12 @@
- [QueryGreatestConsecutiveConfirmedSeqResponse](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqResponse)
- [QueryGreatestSeqByOperatorRequest](#lbm.fbridge.v1.QueryGreatestSeqByOperatorRequest)
- [QueryGreatestSeqByOperatorResponse](#lbm.fbridge.v1.QueryGreatestSeqByOperatorResponse)
- - [QueryGuardiansRequest](#lbm.fbridge.v1.QueryGuardiansRequest)
- - [QueryGuardiansResponse](#lbm.fbridge.v1.QueryGuardiansResponse)
- - [QueryJudgesRequest](#lbm.fbridge.v1.QueryJudgesRequest)
- - [QueryJudgesResponse](#lbm.fbridge.v1.QueryJudgesResponse)
+ - [QueryMembersRequest](#lbm.fbridge.v1.QueryMembersRequest)
+ - [QueryMembersResponse](#lbm.fbridge.v1.QueryMembersResponse)
- [QueryNeededSubmissionSeqsRequest](#lbm.fbridge.v1.QueryNeededSubmissionSeqsRequest)
- [QueryNeededSubmissionSeqsResponse](#lbm.fbridge.v1.QueryNeededSubmissionSeqsResponse)
- [QueryNextSeqSendRequest](#lbm.fbridge.v1.QueryNextSeqSendRequest)
- [QueryNextSeqSendResponse](#lbm.fbridge.v1.QueryNextSeqSendResponse)
- - [QueryOperatorsRequest](#lbm.fbridge.v1.QueryOperatorsRequest)
- - [QueryOperatorsResponse](#lbm.fbridge.v1.QueryOperatorsResponse)
- [QueryParamsRequest](#lbm.fbridge.v1.QueryParamsRequest)
- [QueryParamsResponse](#lbm.fbridge.v1.QueryParamsResponse)
- [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest)
@@ -12021,50 +12017,30 @@ GenesisState defines the fbridge module's genesis state.
-
+
-### QueryGuardiansRequest
-
-
-
-
-
-
-
-
-
-### QueryGuardiansResponse
+### QueryMembersRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `guardians` | [string](#string) | repeated | |
-
+| `role` | [string](#string) | | the role name (guardian, operator, judge) |
-
-### QueryJudgesRequest
+
-
-
-
-
-
-
-
-
-### QueryJudgesResponse
+### QueryMembersResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `judges` | [string](#string) | repeated | |
+| `members` | [string](#string) | repeated | |
@@ -12127,31 +12103,6 @@ GenesisState defines the fbridge module's genesis state.
-
-
-### QueryOperatorsRequest
-
-
-
-
-
-
-
-
-
-### QueryOperatorsResponse
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| `operators` | [string](#string) | repeated | |
-
-
-
-
-
-
### QueryParamsRequest
@@ -12352,9 +12303,7 @@ GenesisState defines the fbridge module's genesis state.
| `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}|
-| `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|
+| `Members` | [QueryMembersRequest](#lbm.fbridge.v1.QueryMembersRequest) | [QueryMembersResponse](#lbm.fbridge.v1.QueryMembersResponse) | Members queries the members of spcific group registered on the bridge | GET|/lbm/fbridge/v1/members|
| `Proposals` | [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) | Proposals queries a list of SuggestRole Proposals | GET|/lbm/fbridge/v1/proposals|
| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/proposals/{proposal_id}|
| `Vote` | [QueryVoteRequest](#lbm.fbridge.v1.QueryVoteRequest) | [QueryVoteResponse](#lbm.fbridge.v1.QueryVoteResponse) | Vote queries voted information based on proposalID, voterAddr. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}|
diff --git a/proto/lbm/fbridge/v1/query.proto b/proto/lbm/fbridge/v1/query.proto
index 3114994e0f..c477980a37 100644
--- a/proto/lbm/fbridge/v1/query.proto
+++ b/proto/lbm/fbridge/v1/query.proto
@@ -53,19 +53,9 @@ service Query {
option (google.api.http).get = "/lbm/fbridge/v1/commitments/{seq}";
}
- // Guardians queries a list of Guardians registered on the bridge
- rpc Guardians(QueryGuardiansRequest) returns (QueryGuardiansResponse) {
- option (google.api.http).get = "/lbm/fbridge/v1/guardians";
- }
-
- // Operators queries a list of Operators registered on the bridge
- rpc Operators(QueryOperatorsRequest) returns (QueryOperatorsResponse) {
- option (google.api.http).get = "/lbm/fbridge/v1/operators";
- }
-
- // Judges queries a list of Judges registered on the bridge
- rpc Judges(QueryJudgesRequest) returns (QueryJudgesResponse) {
- option (google.api.http).get = "/lbm/fbridge/v1/judges";
+ // Members queries the members of spcific group registered on the bridge
+ rpc Members(QueryMembersRequest) returns (QueryMembersResponse) {
+ option (google.api.http).get = "/lbm/fbridge/v1/members";
}
// Proposals queries a list of SuggestRole Proposals
@@ -158,22 +148,13 @@ message QueryCommitmentsResponse {
repeated string commitments = 1;
}
-message QueryGuardiansRequest {}
-
-message QueryGuardiansResponse {
- repeated string guardians = 1;
+message QueryMembersRequest {
+ // the role name (guardian, operator, judge)
+ string role = 1;
}
-message QueryOperatorsRequest {}
-
-message QueryOperatorsResponse {
- repeated string operators = 1;
-}
-
-message QueryJudgesRequest {}
-
-message QueryJudgesResponse {
- repeated string judges = 1;
+message QueryMembersResponse {
+ repeated string members = 1;
}
message QueryProposalsRequest {
diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go
index 34a8952668..93ad7742c4 100644
--- a/x/fbridge/keeper/grpc_query.go
+++ b/x/fbridge/keeper/grpc_query.go
@@ -61,55 +61,26 @@ func (k Keeper) Commitments(ctx context.Context, request *types.QueryCommitments
panic("implement me")
}
-func (k Keeper) Guardians(goCtx context.Context, req *types.QueryGuardiansRequest) (*types.QueryGuardiansResponse, error) {
+func (k Keeper) Members(goCtx context.Context, req *types.QueryMembersRequest) (*types.QueryMembersResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
- guardians := make([]string, 0)
- roles := k.GetRolePairs(ctx)
- for _, pair := range roles {
- if pair.Role == types.RoleGuardian {
- guardians = append(guardians, pair.Address)
- }
- }
-
- return &types.QueryGuardiansResponse{Guardians: guardians}, nil
-}
-
-func (k Keeper) Operators(goCtx context.Context, req *types.QueryOperatorsRequest) (*types.QueryOperatorsResponse, error) {
- if req == nil {
- return nil, status.Error(codes.InvalidArgument, "empty request")
- }
-
- ctx := sdk.UnwrapSDKContext(goCtx)
- operators := make([]string, 0)
- roles := k.GetRolePairs(ctx)
- for _, pair := range roles {
- if pair.Role == types.RoleOperator {
- operators = append(operators, pair.Address)
- }
+ role := types.QueryParamToRole[req.Role]
+ if role == 0 {
+ return nil, status.Error(codes.InvalidArgument, "invalid role")
}
- return &types.QueryOperatorsResponse{Operators: operators}, nil
-}
-
-func (k Keeper) Judges(goCtx context.Context, req *types.QueryJudgesRequest) (*types.QueryJudgesResponse, error) {
- if req == nil {
- return nil, status.Error(codes.InvalidArgument, "empty request")
- }
-
- ctx := sdk.UnwrapSDKContext(goCtx)
- judges := make([]string, 0)
+ members := make([]string, 0)
roles := k.GetRolePairs(ctx)
for _, pair := range roles {
- if pair.Role == types.RoleJudge {
- judges = append(judges, pair.Address)
+ if pair.Role == role {
+ members = append(members, pair.Address)
}
}
- return &types.QueryJudgesResponse{Judges: judges}, nil
+ return &types.QueryMembersResponse{Members: members}, nil
}
func (k Keeper) Proposals(goCtx context.Context, req *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) {
diff --git a/x/fbridge/types/fbridge.go b/x/fbridge/types/fbridge.go
index 167ce50caf..85116dd0fd 100644
--- a/x/fbridge/types/fbridge.go
+++ b/x/fbridge/types/fbridge.go
@@ -4,6 +4,12 @@ import (
"errors"
)
+var QueryParamToRole = map[string]Role{
+ "guardian": 1,
+ "operator": 2,
+ "judge": 3,
+}
+
func IsValidRole(role Role) error {
switch role {
case RoleGuardian, RoleOperator, RoleJudge:
diff --git a/x/fbridge/types/query.pb.go b/x/fbridge/types/query.pb.go
index eace142a0c..d73b1fb895 100644
--- a/x/fbridge/types/query.pb.go
+++ b/x/fbridge/types/query.pb.go
@@ -757,21 +757,23 @@ func (m *QueryCommitmentsResponse) GetCommitments() []string {
return nil
}
-type QueryGuardiansRequest struct {
+type QueryMembersRequest struct {
+ // the role name (guardian, operator, judge)
+ Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
}
-func (m *QueryGuardiansRequest) Reset() { *m = QueryGuardiansRequest{} }
-func (m *QueryGuardiansRequest) String() string { return proto.CompactTextString(m) }
-func (*QueryGuardiansRequest) ProtoMessage() {}
-func (*QueryGuardiansRequest) Descriptor() ([]byte, []int) {
+func (m *QueryMembersRequest) Reset() { *m = QueryMembersRequest{} }
+func (m *QueryMembersRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryMembersRequest) ProtoMessage() {}
+func (*QueryMembersRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_5e7780f9db9d346e, []int{16}
}
-func (m *QueryGuardiansRequest) XXX_Unmarshal(b []byte) error {
+func (m *QueryMembersRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-func (m *QueryGuardiansRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *QueryMembersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
- return xxx_messageInfo_QueryGuardiansRequest.Marshal(b, m, deterministic)
+ return xxx_messageInfo_QueryMembersRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -781,194 +783,41 @@ func (m *QueryGuardiansRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt
return b[:n], nil
}
}
-func (m *QueryGuardiansRequest) XXX_Merge(src proto.Message) {
- xxx_messageInfo_QueryGuardiansRequest.Merge(m, src)
+func (m *QueryMembersRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryMembersRequest.Merge(m, src)
}
-func (m *QueryGuardiansRequest) XXX_Size() int {
+func (m *QueryMembersRequest) XXX_Size() int {
return m.Size()
}
-func (m *QueryGuardiansRequest) XXX_DiscardUnknown() {
- xxx_messageInfo_QueryGuardiansRequest.DiscardUnknown(m)
+func (m *QueryMembersRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryMembersRequest.DiscardUnknown(m)
}
-var xxx_messageInfo_QueryGuardiansRequest proto.InternalMessageInfo
+var xxx_messageInfo_QueryMembersRequest proto.InternalMessageInfo
-type QueryGuardiansResponse struct {
- Guardians []string `protobuf:"bytes,1,rep,name=guardians,proto3" json:"guardians,omitempty"`
-}
-
-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}
-}
-func (m *QueryGuardiansResponse) XXX_Unmarshal(b []byte) error {
- return m.Unmarshal(b)
-}
-func (m *QueryGuardiansResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- if deterministic {
- return xxx_messageInfo_QueryGuardiansResponse.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 *QueryGuardiansResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_QueryGuardiansResponse.Merge(m, src)
-}
-func (m *QueryGuardiansResponse) XXX_Size() int {
- return m.Size()
-}
-func (m *QueryGuardiansResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_QueryGuardiansResponse.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_QueryGuardiansResponse proto.InternalMessageInfo
-
-func (m *QueryGuardiansResponse) GetGuardians() []string {
- if m != nil {
- return m.Guardians
- }
- return nil
-}
-
-type QueryOperatorsRequest struct {
-}
-
-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}
-}
-func (m *QueryOperatorsRequest) XXX_Unmarshal(b []byte) error {
- return m.Unmarshal(b)
-}
-func (m *QueryOperatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- if deterministic {
- return xxx_messageInfo_QueryOperatorsRequest.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 *QueryOperatorsRequest) XXX_Merge(src proto.Message) {
- xxx_messageInfo_QueryOperatorsRequest.Merge(m, src)
-}
-func (m *QueryOperatorsRequest) XXX_Size() int {
- return m.Size()
-}
-func (m *QueryOperatorsRequest) XXX_DiscardUnknown() {
- xxx_messageInfo_QueryOperatorsRequest.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_QueryOperatorsRequest proto.InternalMessageInfo
-
-type QueryOperatorsResponse struct {
- Operators []string `protobuf:"bytes,1,rep,name=operators,proto3" json:"operators,omitempty"`
-}
-
-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}
-}
-func (m *QueryOperatorsResponse) XXX_Unmarshal(b []byte) error {
- return m.Unmarshal(b)
-}
-func (m *QueryOperatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- if deterministic {
- return xxx_messageInfo_QueryOperatorsResponse.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 *QueryOperatorsResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_QueryOperatorsResponse.Merge(m, src)
-}
-func (m *QueryOperatorsResponse) XXX_Size() int {
- return m.Size()
-}
-func (m *QueryOperatorsResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_QueryOperatorsResponse.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_QueryOperatorsResponse proto.InternalMessageInfo
-
-func (m *QueryOperatorsResponse) GetOperators() []string {
+func (m *QueryMembersRequest) GetRole() string {
if m != nil {
- return m.Operators
- }
- return nil
-}
-
-type QueryJudgesRequest struct {
-}
-
-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}
-}
-func (m *QueryJudgesRequest) XXX_Unmarshal(b []byte) error {
- return m.Unmarshal(b)
-}
-func (m *QueryJudgesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- if deterministic {
- return xxx_messageInfo_QueryJudgesRequest.Marshal(b, m, deterministic)
- } else {
- b = b[:cap(b)]
- n, err := m.MarshalToSizedBuffer(b)
- if err != nil {
- return nil, err
- }
- return b[:n], nil
+ return m.Role
}
+ return ""
}
-func (m *QueryJudgesRequest) XXX_Merge(src proto.Message) {
- xxx_messageInfo_QueryJudgesRequest.Merge(m, src)
-}
-func (m *QueryJudgesRequest) XXX_Size() int {
- return m.Size()
-}
-func (m *QueryJudgesRequest) XXX_DiscardUnknown() {
- xxx_messageInfo_QueryJudgesRequest.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_QueryJudgesRequest proto.InternalMessageInfo
-type QueryJudgesResponse struct {
- Judges []string `protobuf:"bytes,1,rep,name=judges,proto3" json:"judges,omitempty"`
+type QueryMembersResponse struct {
+ Members []string `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"`
}
-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}
+func (m *QueryMembersResponse) Reset() { *m = QueryMembersResponse{} }
+func (m *QueryMembersResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryMembersResponse) ProtoMessage() {}
+func (*QueryMembersResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5e7780f9db9d346e, []int{17}
}
-func (m *QueryJudgesResponse) XXX_Unmarshal(b []byte) error {
+func (m *QueryMembersResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-func (m *QueryJudgesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *QueryMembersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
- return xxx_messageInfo_QueryJudgesResponse.Marshal(b, m, deterministic)
+ return xxx_messageInfo_QueryMembersResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -978,21 +827,21 @@ func (m *QueryJudgesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return b[:n], nil
}
}
-func (m *QueryJudgesResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_QueryJudgesResponse.Merge(m, src)
+func (m *QueryMembersResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryMembersResponse.Merge(m, src)
}
-func (m *QueryJudgesResponse) XXX_Size() int {
+func (m *QueryMembersResponse) XXX_Size() int {
return m.Size()
}
-func (m *QueryJudgesResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_QueryJudgesResponse.DiscardUnknown(m)
+func (m *QueryMembersResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryMembersResponse.DiscardUnknown(m)
}
-var xxx_messageInfo_QueryJudgesResponse proto.InternalMessageInfo
+var xxx_messageInfo_QueryMembersResponse proto.InternalMessageInfo
-func (m *QueryJudgesResponse) GetJudges() []string {
+func (m *QueryMembersResponse) GetMembers() []string {
if m != nil {
- return m.Judges
+ return m.Members
}
return nil
}
@@ -1006,7 +855,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{18}
}
func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1052,7 +901,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{19}
}
func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1104,7 +953,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{20}
}
func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1148,7 +997,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{21}
}
func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1195,7 +1044,7 @@ func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} }
func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) }
func (*QueryVoteRequest) ProtoMessage() {}
func (*QueryVoteRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_5e7780f9db9d346e, []int{26}
+ return fileDescriptor_5e7780f9db9d346e, []int{22}
}
func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1247,7 +1096,7 @@ func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} }
func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) }
func (*QueryVoteResponse) ProtoMessage() {}
func (*QueryVoteResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_5e7780f9db9d346e, []int{27}
+ return fileDescriptor_5e7780f9db9d346e, []int{23}
}
func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1292,7 +1141,7 @@ func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} }
func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryVotesRequest) ProtoMessage() {}
func (*QueryVotesRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_5e7780f9db9d346e, []int{28}
+ return fileDescriptor_5e7780f9db9d346e, []int{24}
}
func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1337,7 +1186,7 @@ func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} }
func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryVotesResponse) ProtoMessage() {}
func (*QueryVotesResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_5e7780f9db9d346e, []int{29}
+ return fileDescriptor_5e7780f9db9d346e, []int{25}
}
func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1390,12 +1239,8 @@ func init() {
proto.RegisterType((*QueryConfirmedProvisionResponse)(nil), "lbm.fbridge.v1.QueryConfirmedProvisionResponse")
proto.RegisterType((*QueryCommitmentsRequest)(nil), "lbm.fbridge.v1.QueryCommitmentsRequest")
proto.RegisterType((*QueryCommitmentsResponse)(nil), "lbm.fbridge.v1.QueryCommitmentsResponse")
- proto.RegisterType((*QueryGuardiansRequest)(nil), "lbm.fbridge.v1.QueryGuardiansRequest")
- proto.RegisterType((*QueryGuardiansResponse)(nil), "lbm.fbridge.v1.QueryGuardiansResponse")
- proto.RegisterType((*QueryOperatorsRequest)(nil), "lbm.fbridge.v1.QueryOperatorsRequest")
- proto.RegisterType((*QueryOperatorsResponse)(nil), "lbm.fbridge.v1.QueryOperatorsResponse")
- proto.RegisterType((*QueryJudgesRequest)(nil), "lbm.fbridge.v1.QueryJudgesRequest")
- proto.RegisterType((*QueryJudgesResponse)(nil), "lbm.fbridge.v1.QueryJudgesResponse")
+ proto.RegisterType((*QueryMembersRequest)(nil), "lbm.fbridge.v1.QueryMembersRequest")
+ proto.RegisterType((*QueryMembersResponse)(nil), "lbm.fbridge.v1.QueryMembersResponse")
proto.RegisterType((*QueryProposalsRequest)(nil), "lbm.fbridge.v1.QueryProposalsRequest")
proto.RegisterType((*QueryProposalsResponse)(nil), "lbm.fbridge.v1.QueryProposalsResponse")
proto.RegisterType((*QueryProposalRequest)(nil), "lbm.fbridge.v1.QueryProposalRequest")
@@ -1409,88 +1254,84 @@ func init() {
func init() { proto.RegisterFile("lbm/fbridge/v1/query.proto", fileDescriptor_5e7780f9db9d346e) }
var fileDescriptor_5e7780f9db9d346e = []byte{
- // 1292 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcd, 0x6f, 0x1b, 0xc5,
- 0x1b, 0xce, 0xb6, 0x6e, 0x54, 0xbf, 0x96, 0x7e, 0x6a, 0xe7, 0xe7, 0xa6, 0xed, 0x12, 0xec, 0x64,
- 0xfb, 0x91, 0xf4, 0x23, 0xbb, 0xb1, 0x69, 0x9b, 0x43, 0x13, 0xa8, 0x12, 0x94, 0xaa, 0x45, 0x2a,
- 0xc1, 0x41, 0x20, 0x71, 0xb1, 0xd6, 0xde, 0xc9, 0x76, 0x21, 0xde, 0xb1, 0x77, 0xd6, 0x56, 0xa2,
- 0xc8, 0x17, 0x24, 0x10, 0x82, 0x0b, 0x12, 0x27, 0x2e, 0x5c, 0xf8, 0x07, 0x90, 0x38, 0x23, 0x71,
- 0xec, 0x81, 0x43, 0x25, 0x2e, 0x9c, 0x10, 0x4a, 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c6, 0x12, 0x0c,
- 0xf9, 0x19, 0x7d, 0x71, 0x42, 0x04, 0xd2, 0x6f, 0x08, 0xfa, 0x35, 0xf2, 0x70, 0x4a, 0x7a, 0x4b,
- 0xf8, 0x05, 0xeb, 0x48, 0x38, 0x9f, 0x3e, 0xf9, 0x42, 0x83, 0x0b, 0xc2, 0x7b, 0x10, 0x35, 0x57,
- 0xb2, 0x1e, 0xc6, 0xa4, 0x10, 0xd4, 0xf3, 0x50, 0xe8, 0xb1, 0xc8, 0xca, 0x99, 0xf4, 0x6c, 0x3e,
- 0x7f, 0x75, 0x5c, 0xd2, 0x5e, 0x1f, 0x97, 0xb4, 0xbf, 0x8e, 0x4b, 0xda, 0xb7, 0x27, 0xa5, 0x99,
- 0xd7, 0x27, 0xa5, 0x99, 0x3f, 0x4e, 0x4a, 0x33, 0x9f, 0xac, 0xba, 0x5e, 0xf8, 0xb2, 0xdb, 0x30,
- 0x9b, 0xac, 0x65, 0x6d, 0x7b, 0x3e, 0x6f, 0xbe, 0xf4, 0x6c, 0x6b, 0x0f, 0x3f, 0x56, 0xb8, 0xf3,
- 0x99, 0x75, 0x90, 0xd0, 0x84, 0x87, 0x6d, 0xca, 0x1b, 0xb3, 0xe2, 0xcf, 0x8e, 0xb7, 0xfe, 0x09,
- 0x00, 0x00, 0xff, 0xff, 0x2a, 0x3b, 0xaf, 0xda, 0x98, 0x11, 0x00, 0x00,
+ // 1227 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x1b, 0x45,
+ 0x14, 0xce, 0xb6, 0x6e, 0x9a, 0x3c, 0x4b, 0x50, 0x06, 0x37, 0x4d, 0x96, 0x60, 0x27, 0xdb, 0x34,
+ 0x3f, 0xda, 0x66, 0x37, 0x36, 0x69, 0x73, 0x68, 0x02, 0x55, 0x82, 0x52, 0x15, 0x44, 0x09, 0x0e,
+ 0x02, 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d2, 0x5b, 0xd2,
+ 0x35, 0xad, 0x63, 0xe9, 0xff, 0x27, 0xe4, 0x4b, 0x0d, 0xae, 0x49, 0x07, 0x26, 0xe9, 0x5c, 0xd1,
+ 0x3c, 0x8c, 0x61, 0x10, 0xd4, 0xf3, 0x40, 0xea, 0xb1, 0xc8, 0xea, 0xa5, 0xf4, 0x6c, 0xbf, 0xf7,
+ 0xe2, 0x34, 0xaf, 0xbd, 0x3c, 0xcd, 0x6b, 0x7f, 0x9f, 0xe6, 0xb5, 0xef, 0xce, 0xf2, 0x63, 0x2f,
+ 0xcf, 0xf2, 0x63, 0x7f, 0x9e, 0xe5, 0xc7, 0x3e, 0x5b, 0x6b, 0x38, 0xe2, 0x79, 0xa7, 0x6a, 0xd6,
+ 0x98, 0x6b, 0xed, 0x3a, 0x1e, 0xaf, 0x3d, 0x77, 0x6c, 0xeb, 0x00, 0x17, 0xab, 0xbc, 0xfe, 0xb9,
+ 0x75, 0x18, 0xd1, 0x88, 0xa3, 0x16, 0xe5, 0xd5, 0x71, 0xf9, 0x47, 0xfb, 0xad, 0x7f, 0x03, 0x00,
+ 0x00, 0xff, 0xff, 0xb9, 0x77, 0x01, 0xfe, 0x14, 0x10, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1524,12 +1365,8 @@ type QueryClient interface {
NeededSubmissionSeqs(ctx context.Context, in *QueryNeededSubmissionSeqsRequest, opts ...grpc.CallOption) (*QueryNeededSubmissionSeqsResponse, error)
// Commitments queries commitments of a specific sequence number
Commitments(ctx context.Context, in *QueryCommitmentsRequest, opts ...grpc.CallOption) (*QueryCommitmentsResponse, error)
- // Guardians queries a list of Guardians registered on the bridge
- Guardians(ctx context.Context, in *QueryGuardiansRequest, opts ...grpc.CallOption) (*QueryGuardiansResponse, error)
- // Operators queries a list of Operators registered on the bridge
- Operators(ctx context.Context, in *QueryOperatorsRequest, opts ...grpc.CallOption) (*QueryOperatorsResponse, error)
- // Judges queries a list of Judges registered on the bridge
- Judges(ctx context.Context, in *QueryJudgesRequest, opts ...grpc.CallOption) (*QueryJudgesResponse, error)
+ // Members queries the members of spcific group registered on the bridge
+ Members(ctx context.Context, in *QueryMembersRequest, opts ...grpc.CallOption) (*QueryMembersResponse, error)
// Proposals queries a list of SuggestRole Proposals
Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error)
// Proposal queries a SuggestRole Proposal
@@ -1620,27 +1457,9 @@ func (c *queryClient) Commitments(ctx context.Context, in *QueryCommitmentsReque
return out, nil
}
-func (c *queryClient) Guardians(ctx context.Context, in *QueryGuardiansRequest, opts ...grpc.CallOption) (*QueryGuardiansResponse, error) {
- out := new(QueryGuardiansResponse)
- err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Guardians", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *queryClient) Operators(ctx context.Context, in *QueryOperatorsRequest, opts ...grpc.CallOption) (*QueryOperatorsResponse, error) {
- out := new(QueryOperatorsResponse)
- err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Operators", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *queryClient) Judges(ctx context.Context, in *QueryJudgesRequest, opts ...grpc.CallOption) (*QueryJudgesResponse, error) {
- out := new(QueryJudgesResponse)
- err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Judges", in, out, opts...)
+func (c *queryClient) Members(ctx context.Context, in *QueryMembersRequest, opts ...grpc.CallOption) (*QueryMembersResponse, error) {
+ out := new(QueryMembersResponse)
+ err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Members", in, out, opts...)
if err != nil {
return nil, err
}
@@ -1704,12 +1523,8 @@ type QueryServer interface {
NeededSubmissionSeqs(context.Context, *QueryNeededSubmissionSeqsRequest) (*QueryNeededSubmissionSeqsResponse, error)
// Commitments queries commitments of a specific sequence number
Commitments(context.Context, *QueryCommitmentsRequest) (*QueryCommitmentsResponse, error)
- // Guardians queries a list of Guardians registered on the bridge
- Guardians(context.Context, *QueryGuardiansRequest) (*QueryGuardiansResponse, error)
- // Operators queries a list of Operators registered on the bridge
- Operators(context.Context, *QueryOperatorsRequest) (*QueryOperatorsResponse, error)
- // Judges queries a list of Judges registered on the bridge
- Judges(context.Context, *QueryJudgesRequest) (*QueryJudgesResponse, error)
+ // Members queries the members of spcific group registered on the bridge
+ Members(context.Context, *QueryMembersRequest) (*QueryMembersResponse, error)
// Proposals queries a list of SuggestRole Proposals
Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error)
// Proposal queries a SuggestRole Proposal
@@ -1748,14 +1563,8 @@ func (*UnimplementedQueryServer) NeededSubmissionSeqs(ctx context.Context, req *
func (*UnimplementedQueryServer) Commitments(ctx context.Context, req *QueryCommitmentsRequest) (*QueryCommitmentsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Commitments not implemented")
}
-func (*UnimplementedQueryServer) Guardians(ctx context.Context, req *QueryGuardiansRequest) (*QueryGuardiansResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Guardians not implemented")
-}
-func (*UnimplementedQueryServer) Operators(ctx context.Context, req *QueryOperatorsRequest) (*QueryOperatorsResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Operators not implemented")
-}
-func (*UnimplementedQueryServer) Judges(ctx context.Context, req *QueryJudgesRequest) (*QueryJudgesResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Judges not implemented")
+func (*UnimplementedQueryServer) Members(ctx context.Context, req *QueryMembersRequest) (*QueryMembersResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Members not implemented")
}
func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented")
@@ -1918,56 +1727,20 @@ func _Query_Commitments_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
-func _Query_Guardians_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(QueryGuardiansRequest)
+func _Query_Members_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryMembersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(QueryServer).Guardians(ctx, in)
+ return srv.(QueryServer).Members(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/lbm.fbridge.v1.Query/Guardians",
+ FullMethod: "/lbm.fbridge.v1.Query/Members",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(QueryServer).Guardians(ctx, req.(*QueryGuardiansRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Query_Operators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(QueryOperatorsRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(QueryServer).Operators(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/lbm.fbridge.v1.Query/Operators",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(QueryServer).Operators(ctx, req.(*QueryOperatorsRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Query_Judges_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(QueryJudgesRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(QueryServer).Judges(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/lbm.fbridge.v1.Query/Judges",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(QueryServer).Judges(ctx, req.(*QueryJudgesRequest))
+ return srv.(QueryServer).Members(ctx, req.(*QueryMembersRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -2081,16 +1854,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{
Handler: _Query_Commitments_Handler,
},
{
- MethodName: "Guardians",
- Handler: _Query_Guardians_Handler,
- },
- {
- MethodName: "Operators",
- Handler: _Query_Operators_Handler,
- },
- {
- MethodName: "Judges",
- Handler: _Query_Judges_Handler,
+ MethodName: "Members",
+ Handler: _Query_Members_Handler,
},
{
MethodName: "Proposals",
@@ -2614,7 +2379,7 @@ func (m *QueryCommitmentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error
return len(dAtA) - i, nil
}
-func (m *QueryGuardiansRequest) Marshal() (dAtA []byte, err error) {
+func (m *QueryMembersRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -2624,107 +2389,27 @@ func (m *QueryGuardiansRequest) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
-func (m *QueryGuardiansRequest) MarshalTo(dAtA []byte) (int, error) {
+func (m *QueryMembersRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *QueryGuardiansRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *QueryMembersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
- return len(dAtA) - i, nil
-}
-
-func (m *QueryGuardiansResponse) 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 *QueryGuardiansResponse) MarshalTo(dAtA []byte) (int, error) {
- size := m.Size()
- return m.MarshalToSizedBuffer(dAtA[:size])
-}
-
-func (m *QueryGuardiansResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
- i := len(dAtA)
- _ = i
- var l int
- _ = l
- if len(m.Guardians) > 0 {
- for iNdEx := len(m.Guardians) - 1; iNdEx >= 0; iNdEx-- {
- i -= len(m.Guardians[iNdEx])
- copy(dAtA[i:], m.Guardians[iNdEx])
- i = encodeVarintQuery(dAtA, i, uint64(len(m.Guardians[iNdEx])))
- i--
- dAtA[i] = 0xa
- }
- }
- return len(dAtA) - i, nil
-}
-
-func (m *QueryOperatorsRequest) 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 *QueryOperatorsRequest) MarshalTo(dAtA []byte) (int, error) {
- size := m.Size()
- return m.MarshalToSizedBuffer(dAtA[:size])
-}
-
-func (m *QueryOperatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
- i := len(dAtA)
- _ = i
- var l int
- _ = l
- return len(dAtA) - i, nil
-}
-
-func (m *QueryOperatorsResponse) 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 *QueryOperatorsResponse) MarshalTo(dAtA []byte) (int, error) {
- size := m.Size()
- return m.MarshalToSizedBuffer(dAtA[:size])
-}
-
-func (m *QueryOperatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
- i := len(dAtA)
- _ = i
- var l int
- _ = l
- if len(m.Operators) > 0 {
- for iNdEx := len(m.Operators) - 1; iNdEx >= 0; iNdEx-- {
- i -= len(m.Operators[iNdEx])
- copy(dAtA[i:], m.Operators[iNdEx])
- i = encodeVarintQuery(dAtA, i, uint64(len(m.Operators[iNdEx])))
- i--
- dAtA[i] = 0xa
- }
+ if len(m.Role) > 0 {
+ i -= len(m.Role)
+ copy(dAtA[i:], m.Role)
+ i = encodeVarintQuery(dAtA, i, uint64(len(m.Role)))
+ i--
+ dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
-func (m *QueryJudgesRequest) Marshal() (dAtA []byte, err error) {
+func (m *QueryMembersResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -2734,44 +2419,21 @@ func (m *QueryJudgesRequest) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
-func (m *QueryJudgesRequest) MarshalTo(dAtA []byte) (int, error) {
+func (m *QueryMembersResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *QueryJudgesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *QueryMembersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
- return len(dAtA) - i, nil
-}
-
-func (m *QueryJudgesResponse) 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 *QueryJudgesResponse) MarshalTo(dAtA []byte) (int, error) {
- size := m.Size()
- return m.MarshalToSizedBuffer(dAtA[:size])
-}
-
-func (m *QueryJudgesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
- i := len(dAtA)
- _ = i
- var l int
- _ = l
- if len(m.Judges) > 0 {
- for iNdEx := len(m.Judges) - 1; iNdEx >= 0; iNdEx-- {
- i -= len(m.Judges[iNdEx])
- copy(dAtA[i:], m.Judges[iNdEx])
- i = encodeVarintQuery(dAtA, i, uint64(len(m.Judges[iNdEx])))
+ if len(m.Members) > 0 {
+ for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- {
+ i -= len(m.Members[iNdEx])
+ copy(dAtA[i:], m.Members[iNdEx])
+ i = encodeVarintQuery(dAtA, i, uint64(len(m.Members[iNdEx])))
i--
dAtA[i] = 0xa
}
@@ -3268,71 +2930,27 @@ func (m *QueryCommitmentsResponse) Size() (n int) {
return n
}
-func (m *QueryGuardiansRequest) Size() (n int) {
+func (m *QueryMembersRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
- return n
-}
-
-func (m *QueryGuardiansResponse) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- if len(m.Guardians) > 0 {
- for _, s := range m.Guardians {
- l = len(s)
- n += 1 + l + sovQuery(uint64(l))
- }
- }
- return n
-}
-
-func (m *QueryOperatorsRequest) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- return n
-}
-
-func (m *QueryOperatorsResponse) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- if len(m.Operators) > 0 {
- for _, s := range m.Operators {
- l = len(s)
- n += 1 + l + sovQuery(uint64(l))
- }
- }
- return n
-}
-
-func (m *QueryJudgesRequest) Size() (n int) {
- if m == nil {
- return 0
+ l = len(m.Role)
+ if l > 0 {
+ n += 1 + l + sovQuery(uint64(l))
}
- var l int
- _ = l
return n
}
-func (m *QueryJudgesResponse) Size() (n int) {
+func (m *QueryMembersResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
- if len(m.Judges) > 0 {
- for _, s := range m.Judges {
+ if len(m.Members) > 0 {
+ for _, s := range m.Members {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
@@ -4757,139 +4375,7 @@ func (m *QueryCommitmentsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGuardiansRequest) 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: QueryGuardiansRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGuardiansRequest: 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 *QueryGuardiansResponse) 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: QueryGuardiansResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGuardiansResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Guardians", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLen |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthQuery
- }
- postIndex := iNdEx + intStringLen
- if postIndex < 0 {
- return ErrInvalidLengthQuery
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Guardians = append(m.Guardians, string(dAtA[iNdEx:postIndex]))
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipQuery(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if (skippy < 0) || (iNdEx+skippy) < 0 {
- return ErrInvalidLengthQuery
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *QueryOperatorsRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryMembersRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4912,65 +4398,15 @@ func (m *QueryOperatorsRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryOperatorsRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryMembersRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryOperatorsRequest: 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 *QueryOperatorsResponse) 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: QueryOperatorsResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryOperatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryMembersRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Operators", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -4998,7 +4434,7 @@ func (m *QueryOperatorsResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.Operators = append(m.Operators, string(dAtA[iNdEx:postIndex]))
+ m.Role = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -5021,57 +4457,7 @@ func (m *QueryOperatorsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryJudgesRequest) 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: QueryJudgesRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryJudgesRequest: 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 *QueryJudgesResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryMembersResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -5094,15 +4480,15 @@ func (m *QueryJudgesResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryJudgesResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryMembersResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryJudgesResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryMembersResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Judges", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -5130,7 +4516,7 @@ func (m *QueryJudgesResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.Judges = append(m.Judges, string(dAtA[iNdEx:postIndex]))
+ m.Members = append(m.Members, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
diff --git a/x/fbridge/types/query.pb.gw.go b/x/fbridge/types/query.pb.gw.go
index 470bb7bc34..086984e485 100644
--- a/x/fbridge/types/query.pb.gw.go
+++ b/x/fbridge/types/query.pb.gw.go
@@ -395,56 +395,38 @@ func local_request_Query_Commitments_0(ctx context.Context, marshaler runtime.Ma
}
-func request_Query_Guardians_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq QueryGuardiansRequest
- var metadata runtime.ServerMetadata
-
- msg, err := client.Guardians(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_Query_Guardians_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq QueryGuardiansRequest
- var metadata runtime.ServerMetadata
-
- msg, err := server.Guardians(ctx, &protoReq)
- return msg, metadata, err
-
-}
+var (
+ filter_Query_Members_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
+)
-func request_Query_Operators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq QueryOperatorsRequest
+func request_Query_Members_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryMembersRequest
var metadata runtime.ServerMetadata
- msg, err := client.Operators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_Query_Operators_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq QueryOperatorsRequest
- 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_Members_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
- msg, err := server.Operators(ctx, &protoReq)
+ msg, err := client.Members(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
-func request_Query_Judges_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq QueryJudgesRequest
+func local_request_Query_Members_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryMembersRequest
var metadata runtime.ServerMetadata
- msg, err := client.Judges(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_Query_Judges_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq QueryJudgesRequest
- 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_Members_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
- msg, err := server.Judges(ctx, &protoReq)
+ msg, err := server.Members(ctx, &protoReq)
return msg, metadata, err
}
@@ -835,27 +817,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
- mux.Handle("GET", pattern_Query_Guardians_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_Guardians_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_Guardians_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_Query_Operators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle("GET", pattern_Query_Members_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)
@@ -864,34 +826,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := local_request_Query_Operators_0(rctx, inboundMarshaler, server, req, pathParams)
+ resp, md, err := local_request_Query_Members_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_Operators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_Query_Judges_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_Judges_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_Judges_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_Query_Members_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
@@ -1176,47 +1118,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
- mux.Handle("GET", pattern_Query_Guardians_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_Guardians_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_Guardians_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_Query_Operators_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_Operators_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_Operators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- mux.Handle("GET", pattern_Query_Judges_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle("GET", pattern_Query_Members_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)
@@ -1225,14 +1127,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := request_Query_Judges_0(rctx, inboundMarshaler, client, req, pathParams)
+ resp, md, err := request_Query_Members_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_Judges_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_Query_Members_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
@@ -1336,11 +1238,7 @@ var (
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_Guardians_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "guardians"}, "", runtime.AssumeColonVerbOpt(false)))
-
- pattern_Query_Operators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "operators"}, "", runtime.AssumeColonVerbOpt(false)))
-
- pattern_Query_Judges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "judges"}, "", runtime.AssumeColonVerbOpt(false)))
+ pattern_Query_Members_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "members"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "proposals"}, "", runtime.AssumeColonVerbOpt(false)))
@@ -1368,11 +1266,7 @@ var (
forward_Query_Commitments_0 = runtime.ForwardResponseMessage
- forward_Query_Guardians_0 = runtime.ForwardResponseMessage
-
- forward_Query_Operators_0 = runtime.ForwardResponseMessage
-
- forward_Query_Judges_0 = runtime.ForwardResponseMessage
+ forward_Query_Members_0 = runtime.ForwardResponseMessage
forward_Query_Proposals_0 = runtime.ForwardResponseMessage
From cb2f2b9334d4b45bc2ea69d2a87e5f4e06edea4d Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 16:35:50 +0900
Subject: [PATCH 15/49] fix endblock logic
---
x/fbridge/keeper/auth.go | 5 ++++-
x/fbridge/module/abci.go | 15 +--------------
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index b70d303507..090f49861c 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -34,6 +34,10 @@ func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAd
}
func (k Keeper) addVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress, option types.VoteOption) error {
+ if k.GetRole(ctx, voter) != types.RoleGuardian {
+ return sdkerrors.ErrUnauthorized.Wrap("only guardian can vote for a role proposal")
+ }
+
_, found := k.GetRoleProposal(ctx, proposalID)
if !found {
return types.ErrUnknownProposal.Wrapf("#%d not found", proposalID)
@@ -223,7 +227,6 @@ func (k Keeper) GetRole(ctx sdk.Context, addr sdk.AccAddress) types.Role {
func (k Keeper) GetRolePairs(ctx sdk.Context) []types.RolePair {
store := ctx.KVStore(k.storeKey)
-
pairs := make([]types.RolePair, 0)
iterator := sdk.KVStorePrefixIterator(store, types.KeyRolePrefix)
defer iterator.Close()
diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go
index c61e97652c..6201c9b89e 100644
--- a/x/fbridge/module/abci.go
+++ b/x/fbridge/module/abci.go
@@ -31,20 +31,7 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
}
}
- var total uint64 = 0
- roleMeta := k.GetRoleMetadata(ctx)
- switch proposal.Role {
- case types.RoleGuardian:
- total = roleMeta.Guardian
- case types.RoleOperator:
- total = roleMeta.Operator
- case types.RoleJudge:
- total = roleMeta.Judge
- default:
- panic(fmt.Sprintf("invalid role: %s\n", proposal.Role))
- }
-
- if types.CheckTrustLevelThreshold(total, voteYes, guardianTrustLevel) {
+ if types.CheckTrustLevelThreshold(k.GetRoleMetadata(ctx).Guardian, voteYes, guardianTrustLevel) {
if err := k.UpdateRole(ctx, proposal.Role, sdk.MustAccAddressFromBech32(proposal.Target)); err != nil {
panic(err)
}
From 79fe41260205f5a75b4298ff789d314443545bb8 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 16:40:08 +0900
Subject: [PATCH 16/49] chore
---
x/fbridge/types/genesis.go | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index f7f91dbe83..8da15560e5 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -1,14 +1,23 @@
package types
+import (
+ "github.com/Finschia/finschia-sdk/crypto/keys/secp256k1"
+ sdk "github.com/Finschia/finschia-sdk/types"
+)
+
func DefaultGenesisState() *GenesisState {
+ dummyGuardian := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().String())
+
return &GenesisState{
SendingState: SendingState{
NextSeq: 1,
},
ReceivingState: ReceivingState{},
NextRoleProposalId: 1,
- Roles: []RolePair{{Role: RoleGuardian, Address: ""}},
- BridgeSwitches: []BridgeSwitch{{Guardian: "", Status: StatusActive}},
+ // WARN: you must set your own guardian address in production
+ Roles: []RolePair{{Role: RoleGuardian, Address: dummyGuardian.String()}},
+ // WARN: you must set your own guardian address in production
+ BridgeSwitches: []BridgeSwitch{{Guardian: dummyGuardian.String(), Status: StatusActive}},
}
}
From 200c366ad4fa923c702054194393a93e70e30f52 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 16:57:00 +0900
Subject: [PATCH 17/49] add Params test
---
x/fbridge/types/genesis.go | 1 +
x/fbridge/types/params_test.go | 61 ++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
create mode 100644 x/fbridge/types/params_test.go
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 8da15560e5..105c967a84 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -9,6 +9,7 @@ func DefaultGenesisState() *GenesisState {
dummyGuardian := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().String())
return &GenesisState{
+ Params: DefaultParams(),
SendingState: SendingState{
NextSeq: 1,
},
diff --git a/x/fbridge/types/params_test.go b/x/fbridge/types/params_test.go
new file mode 100644
index 0000000000..22157462bf
--- /dev/null
+++ b/x/fbridge/types/params_test.go
@@ -0,0 +1,61 @@
+package types_test
+
+import (
+ "github.com/stretchr/testify/require"
+ "testing"
+
+ "github.com/Finschia/finschia-sdk/x/fbridge/types"
+)
+
+func TestCheckTrustLevelThreshold(t *testing.T) {
+ tcs := map[string]struct {
+ total uint64
+ current uint64
+ trustLevel types.Fraction
+ isPanic bool
+ isValid bool
+ }{
+ "meet the trust level": {
+ current: 3,
+ total: 4,
+ trustLevel: types.Fraction{Numerator: 2, Denominator: 3},
+ isValid: true,
+ },
+ "not meet the trust level": {
+ current: 1,
+ total: 2,
+ trustLevel: types.Fraction{Numerator: 2, Denominator: 3},
+ isValid: false,
+ },
+ "total is 0": {
+ total: 0,
+ current: 3,
+ trustLevel: types.Fraction{Numerator: 2, Denominator: 3},
+ isValid: false,
+ },
+ "invalid trust level - 1": {
+ total: 10,
+ current: 8,
+ trustLevel: types.Fraction{Numerator: 3, Denominator: 2},
+ isPanic: true,
+ },
+ "invalid trust level - 2": {
+ total: 10,
+ current: 8,
+ trustLevel: types.Fraction{Numerator: 3, Denominator: 0},
+ isPanic: true,
+ },
+ }
+
+ for name, tc := range tcs {
+ t.Run(name, func(t *testing.T) {
+ if tc.isPanic {
+ require.Panics(t, func() { types.CheckTrustLevelThreshold(tc.total, tc.current, tc.trustLevel) })
+ } else if tc.isValid {
+ require.True(t, types.CheckTrustLevelThreshold(tc.total, tc.current, tc.trustLevel))
+ } else {
+ require.False(t, types.CheckTrustLevelThreshold(tc.total, tc.current, tc.trustLevel))
+ }
+ })
+ }
+}
From 83b042e9c8818dc32fce4af262606e20275a2f73 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 17:00:49 +0900
Subject: [PATCH 18/49] add dummy guardian for testing
---
x/fbridge/types/genesis.go | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 105c967a84..70bddccfe8 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -1,13 +1,9 @@
package types
-import (
- "github.com/Finschia/finschia-sdk/crypto/keys/secp256k1"
- sdk "github.com/Finschia/finschia-sdk/types"
-)
+// For testing purposes, you must not use the DummyGuardian address in production
+const DummyGuardian = "link1zmm9v8wucqecl75q22hddz0qypdgyvdpgg9a6d"
func DefaultGenesisState() *GenesisState {
- dummyGuardian := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().String())
-
return &GenesisState{
Params: DefaultParams(),
SendingState: SendingState{
@@ -16,9 +12,9 @@ func DefaultGenesisState() *GenesisState {
ReceivingState: ReceivingState{},
NextRoleProposalId: 1,
// WARN: you must set your own guardian address in production
- Roles: []RolePair{{Role: RoleGuardian, Address: dummyGuardian.String()}},
+ Roles: []RolePair{{Role: RoleGuardian, Address: DummyGuardian}},
// WARN: you must set your own guardian address in production
- BridgeSwitches: []BridgeSwitch{{Guardian: dummyGuardian.String(), Status: StatusActive}},
+ BridgeSwitches: []BridgeSwitch{{Guardian: DummyGuardian, Status: StatusActive}},
}
}
From dae3f099839a75e49358075de26fdd4331239295 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 17:19:49 +0900
Subject: [PATCH 19/49] remove redundant invariants
---
x/fbridge/module/abci.go | 32 --------------------------------
x/fbridge/module/module.go | 4 +---
2 files changed, 1 insertion(+), 35 deletions(-)
diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go
index 6201c9b89e..bdfec0f0fe 100644
--- a/x/fbridge/module/abci.go
+++ b/x/fbridge/module/abci.go
@@ -1,7 +1,6 @@
package module
import (
- "fmt"
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/x/fbridge/keeper"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
@@ -40,34 +39,3 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
}
}
}
-
-// RegisterInvariants registers all fbridge invariants
-func RegisterInvariants(ir sdk.InvariantRegistry, k keeper.Keeper) {
- ir.RegisterRoute(types.ModuleName, "role-metadata", RoleMeatadataInvariant(k))
-}
-
-func RoleMeatadataInvariant(k keeper.Keeper) sdk.Invariant {
- return func(ctx sdk.Context) (string, bool) {
- actualRoleMeta := k.GetRoleMetadata(ctx)
- expectedRoleMeta := types.RoleMetadata{}
- for _, pair := range k.GetRolePairs(ctx) {
- switch pair.Role {
- case types.RoleGuardian:
- expectedRoleMeta.Guardian++
- case types.RoleOperator:
- expectedRoleMeta.Operator++
- case types.RoleJudge:
- expectedRoleMeta.Judge++
- }
- }
-
- broken := expectedRoleMeta.Guardian != actualRoleMeta.Guardian ||
- expectedRoleMeta.Operator != actualRoleMeta.Operator ||
- expectedRoleMeta.Judge != actualRoleMeta.Judge
-
- return sdk.FormatInvariant(types.ModuleName, "registered members and role metadata", fmt.Sprintf(
- "Saved Role Metadata: %+v"+
- "Calculated Role Metadata: %+v",
- actualRoleMeta, expectedRoleMeta)), broken
- }
-}
diff --git a/x/fbridge/module/module.go b/x/fbridge/module/module.go
index 2f5464557e..0aa135ca74 100644
--- a/x/fbridge/module/module.go
+++ b/x/fbridge/module/module.go
@@ -136,9 +136,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
}
// RegisterInvariants does nothing, there are no invariants to enforce
-func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
- RegisterInvariants(ir, am.keeper)
-}
+func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
// Deprecated: Route does nothing.
func (am AppModule) Route() sdk.Route { return sdk.NewRoute("", nil) }
From 72b4a68fb708c7ff2bebcc526509f8554a5142e5 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 20:48:25 +0900
Subject: [PATCH 20/49] set bridge switch at missing parts
---
docs/core/proto-docs.md | 15 ++++++++-------
x/fbridge/keeper/auth.go | 10 ++++++++++
x/fbridge/keeper/genesis.go | 1 +
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 8d80f2bb5a..c4928036ce 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -12328,13 +12328,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}|
| `Members` | [QueryMembersRequest](#lbm.fbridge.v1.QueryMembersRequest) | [QueryMembersResponse](#lbm.fbridge.v1.QueryMembersResponse) | Members queries the members of spcific group registered on the bridge | GET|/lbm/fbridge/v1/members|
| `Proposals` | [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) | Proposals queries a list of SuggestRole Proposals | GET|/lbm/fbridge/v1/proposals|
| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/proposals/{proposal_id}|
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index fd4f0c86fc..e3ae1fadc7 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -76,6 +76,8 @@ func (k Keeper) UpdateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
bsMeta.Inactive--
}
+ k.deleteBridgeSwitch(ctx, addr)
+
case types.RoleOperator:
roleMeta.Operator--
case types.RoleJudge:
@@ -92,6 +94,9 @@ func (k Keeper) UpdateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
switch role {
case types.RoleGuardian:
roleMeta.Guardian++
+ if err := k.setBridgeSwitch(ctx, addr, types.StatusActive); err != nil {
+ panic(err)
+ }
bsMeta.Active++
case types.RoleOperator:
roleMeta.Operator++
@@ -256,6 +261,11 @@ func (k Keeper) setBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status
return nil
}
+func (k Keeper) deleteBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress) {
+ store := ctx.KVStore(k.storeKey)
+ store.Delete(types.BridgeSwitchKey(guardian))
+}
+
func (k Keeper) GetBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress) (types.BridgeSwitch, error) {
if k.GetRole(ctx, guardian) != types.RoleGuardian {
return types.BridgeSwitch{}, sdkerrors.ErrUnauthorized.Wrap("only guardian can set bridge switch")
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index f317487341..70903cd0e9 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -52,6 +52,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
RoleProposals: k.GetRoleProposals(ctx),
Votes: k.GetAllVotes(ctx),
Roles: k.GetRolePairs(ctx),
+ BridgeSwitches: k.GetBridgeSwitches(ctx),
}
}
From c6ea9b84b44f2cb2d6dc0fa2304c4cab3d63dce8 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 21:15:20 +0900
Subject: [PATCH 21/49] fix typo
---
x/fbridge/client/cli/query.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x/fbridge/client/cli/query.go b/x/fbridge/client/cli/query.go
index 4878af22e7..6a1396c84d 100644
--- a/x/fbridge/client/cli/query.go
+++ b/x/fbridge/client/cli/query.go
@@ -59,7 +59,7 @@ func NewQuerySeqToBlocknumsCmd() *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),
+ Example: fmt.Sprintf("%s query %s 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 {
From 77959dd917cf66d57c13350a2f0e01a2cc5c00c7 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 22:33:28 +0900
Subject: [PATCH 22/49] add gov authority
---
simapp/app.go | 2 +-
x/fbridge/keeper/auth.go | 10 +++++-----
x/fbridge/keeper/keeper.go | 18 ++++++++++++++++--
x/fbridge/module/abci.go | 2 +-
x/fbridge/types/genesis.go | 24 ++++++++++++++++--------
x/fbridge/types/params.go | 26 ++++++++++++++++++++++++++
6 files changed, 65 insertions(+), 17 deletions(-)
diff --git a/simapp/app.go b/simapp/app.go
index ab00332ada..45372bcbe5 100644
--- a/simapp/app.go
+++ b/simapp/app.go
@@ -370,7 +370,7 @@ func NewSimApp(
fswapConfig := fswaptypes.DefaultConfig()
app.FswapKeeper = fswapkeeper.NewKeeper(appCodec, keys[fswaptypes.StoreKey], app.AccountKeeper, app.BankKeeper, fswapConfig)
- app.FbridgeKeeper = fbridgekeeper.NewKeeper(appCodec, keys[fbridgetypes.StoreKey], memKeys[fbridgetypes.MemStoreKey], app.AccountKeeper, app.BankKeeper, "stake")
+ app.FbridgeKeeper = fbridgekeeper.NewKeeper(appCodec, keys[fbridgetypes.StoreKey], memKeys[fbridgetypes.MemStoreKey], app.AccountKeeper, app.BankKeeper, "stake", fbridgetypes.DefaultAuthority().String())
/**** Module Options ****/
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index e3ae1fadc7..1e1e7882a7 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -10,8 +10,8 @@ import (
)
func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAddress, role types.Role) (types.RoleProposal, error) {
- if k.GetRole(ctx, proposer) != types.RoleGuardian {
- return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrap("only guardian can submit a role proposal")
+ if k.GetRole(ctx, proposer) != types.RoleGuardian || proposer.String() != k.authority {
+ return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrapf("only guardian or %s can execute this action", k.authority)
}
if k.GetRole(ctx, target) == role {
@@ -35,7 +35,7 @@ func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAd
func (k Keeper) addVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress, option types.VoteOption) error {
if k.GetRole(ctx, voter) != types.RoleGuardian {
- return sdkerrors.ErrUnauthorized.Wrap("only guardian can vote for a role proposal")
+ return sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action")
}
_, found := k.GetRoleProposal(ctx, proposalID)
@@ -250,7 +250,7 @@ func (k Keeper) deleteRole(ctx sdk.Context, addr sdk.AccAddress) {
func (k Keeper) setBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
if k.GetRole(ctx, guardian) != types.RoleGuardian {
- return sdkerrors.ErrUnauthorized.Wrap("only guardian can set bridge switch")
+ return sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action")
}
store := ctx.KVStore(k.storeKey)
@@ -268,7 +268,7 @@ func (k Keeper) deleteBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress) {
func (k Keeper) GetBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress) (types.BridgeSwitch, error) {
if k.GetRole(ctx, guardian) != types.RoleGuardian {
- return types.BridgeSwitch{}, sdkerrors.ErrUnauthorized.Wrap("only guardian can set bridge switch")
+ return types.BridgeSwitch{}, sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action")
}
store := ctx.KVStore(k.storeKey)
diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go
index 5c86fafd3c..668508838a 100644
--- a/x/fbridge/keeper/keeper.go
+++ b/x/fbridge/keeper/keeper.go
@@ -3,7 +3,6 @@ package keeper
import (
"errors"
"fmt"
-
"github.com/tendermint/tendermint/libs/log"
"github.com/Finschia/finschia-sdk/codec"
@@ -20,6 +19,9 @@ type Keeper struct {
// the target denom for the bridge
targetDenom string
+
+ // address that can have the same rights as a Guardian when the guardian is not registered yet
+ authority string
}
func NewKeeper(
@@ -27,12 +29,16 @@ func NewKeeper(
key, memKey sdk.StoreKey,
authKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
- targetDenom string,
+ targetDenom, authority string,
) Keeper {
if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil {
panic(errors.New("fbridge module account has not been set"))
}
+ if authority != types.DefaultAuthority().String() {
+ panic("x/bridge authority must be the gov module account")
+ }
+
return Keeper{
storeKey: key,
memKey: memKey,
@@ -40,6 +46,7 @@ func NewKeeper(
authKeeper: authKeeper,
bankKeeper: bankKeeper,
targetDenom: targetDenom,
+ authority: authority,
}
}
@@ -95,6 +102,10 @@ func (k Keeper) IsInitialized(ctx sdk.Context) bool {
return memStore.Get(types.KeyMemInitialized) != nil
}
+func (k Keeper) GetAuthority() string {
+ return k.authority
+}
+
func (k Keeper) IsBridgeHalted(ctx sdk.Context) bool {
return k.GetBridgeStatus(ctx) == types.StatusInactive
}
@@ -138,6 +149,9 @@ func (k Keeper) GetBridgeStatusMetadata(ctx sdk.Context) types.BridgeStatusMetad
memStore := ctx.KVStore(k.memKey)
bsMeta := types.BridgeStatusMetadata{}
bz := memStore.Get(types.KeyMemBridgeStatus)
+ if bz == nil {
+ return types.BridgeStatusMetadata{}
+ }
k.cdc.MustUnmarshal(bz, &bsMeta)
return bsMeta
}
diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go
index bdfec0f0fe..ed98b5d579 100644
--- a/x/fbridge/module/abci.go
+++ b/x/fbridge/module/abci.go
@@ -30,7 +30,7 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
}
}
- if types.CheckTrustLevelThreshold(k.GetRoleMetadata(ctx).Guardian, voteYes, guardianTrustLevel) {
+ if types.CheckTrustLevelThreshold(k.GetRoleMetadata(ctx).Guardian, voteYes, guardianTrustLevel) || proposal.Proposer == k.GetAuthority() {
if err := k.UpdateRole(ctx, proposal.Role, sdk.MustAccAddressFromBech32(proposal.Target)); err != nil {
panic(err)
}
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 70bddccfe8..6029df94b7 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -1,7 +1,11 @@
package types
-// For testing purposes, you must not use the DummyGuardian address in production
-const DummyGuardian = "link1zmm9v8wucqecl75q22hddz0qypdgyvdpgg9a6d"
+import (
+ "errors"
+ sdk "github.com/Finschia/finschia-sdk/types"
+ authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
+ govtypes "github.com/Finschia/finschia-sdk/x/gov/types"
+)
func DefaultGenesisState() *GenesisState {
return &GenesisState{
@@ -11,20 +15,24 @@ func DefaultGenesisState() *GenesisState {
},
ReceivingState: ReceivingState{},
NextRoleProposalId: 1,
- // WARN: you must set your own guardian address in production
- Roles: []RolePair{{Role: RoleGuardian, Address: DummyGuardian}},
- // WARN: you must set your own guardian address in production
- BridgeSwitches: []BridgeSwitch{{Guardian: DummyGuardian, Status: StatusActive}},
}
}
+func DefaultAuthority() sdk.AccAddress {
+ return authtypes.NewModuleAddress(govtypes.ModuleName)
+}
+
func ValidateGenesis(data GenesisState) error {
+ if err := ValidateParams(data.Params); err != nil {
+ return err
+ }
+
if data.SendingState.NextSeq < 1 {
- panic("next sequence must be positive")
+ return errors.New("next sequence must be positive")
}
if data.NextRoleProposalId < 1 {
- panic("next role proposal ID must be positive")
+ return errors.New("next role proposal ID must be positive")
}
return nil
diff --git a/x/fbridge/types/params.go b/x/fbridge/types/params.go
index fbcab0ae6f..e1071aeace 100644
--- a/x/fbridge/types/params.go
+++ b/x/fbridge/types/params.go
@@ -11,9 +11,35 @@ func DefaultParams() Params {
OperatorTrustLevel: Fraction{Numerator: 2, Denominator: 3},
JudgeTrustLevel: Fraction{Numerator: 1, Denominator: 1},
ProposalPeriod: uint64(time.Minute * 60),
+ TimelockPeriod: uint64(time.Hour * 24),
}
}
+func ValidateParams(params Params) error {
+ if err := ValidateTrustLevel(params.GuardianTrustLevel); err != nil {
+ return sdkerrors.ErrInvalidRequest.Wrap("guardian trust level: " + err.Error())
+ }
+
+ if err := ValidateTrustLevel(params.OperatorTrustLevel); err != nil {
+ return sdkerrors.ErrInvalidRequest.Wrap("operator trust level: " + err.Error())
+ }
+
+ if err := ValidateTrustLevel(params.JudgeTrustLevel); err != nil {
+ return sdkerrors.ErrInvalidRequest.Wrap("judge trust level: " + err.Error())
+ }
+
+ if params.ProposalPeriod == 0 {
+ return sdkerrors.ErrInvalidRequest.Wrap("proposal period cannot be 0")
+ }
+
+ if params.TimelockPeriod == 0 {
+ return sdkerrors.ErrInvalidRequest.Wrap("timelock period cannot be 0")
+ }
+
+ return nil
+
+}
+
func CheckTrustLevelThreshold(total, current uint64, trustLevel Fraction) bool {
if err := ValidateTrustLevel(trustLevel); err != nil {
panic(err)
From d0d5dfbd4f59f14bdd9dce4c3223487589a9b672 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 22:55:07 +0900
Subject: [PATCH 23/49] add guardian invariant
---
x/fbridge/module/abci.go | 27 +++++++++++++++++++++++++++
x/fbridge/module/module.go | 4 +++-
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go
index ed98b5d579..8af018af32 100644
--- a/x/fbridge/module/abci.go
+++ b/x/fbridge/module/abci.go
@@ -1,6 +1,7 @@
package module
import (
+ "fmt"
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/x/fbridge/keeper"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
@@ -39,3 +40,29 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
}
}
}
+
+// RegisterInvariants registers the fbridge module invariants
+func RegisterInvariants(ir sdk.InvariantRegistry, k keeper.Keeper) {
+ ir.RegisterRoute(types.ModuleName, "guardian-invariant", GuardianInvariant(k))
+}
+
+func GuardianInvariant(k keeper.Keeper) sdk.Invariant {
+ return func(ctx sdk.Context) (string, bool) {
+
+ numGuardian := 0
+ for _, p := range k.GetRolePairs(ctx) {
+ if p.Role == types.RoleGuardian {
+ numGuardian++
+ }
+ }
+
+ numBridgeSw := len(k.GetBridgeSwitches(ctx))
+
+ broken := numGuardian != numBridgeSw
+
+ return sdk.FormatInvariant(
+ types.ModuleName, "guardian-invariant",
+ fmt.Sprintf("number of guardians(%d) != number of bridge switches(%d)", numGuardian, numBridgeSw),
+ ), broken
+ }
+}
diff --git a/x/fbridge/module/module.go b/x/fbridge/module/module.go
index 0aa135ca74..2f5464557e 100644
--- a/x/fbridge/module/module.go
+++ b/x/fbridge/module/module.go
@@ -136,7 +136,9 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
}
// RegisterInvariants does nothing, there are no invariants to enforce
-func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
+func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
+ RegisterInvariants(ir, am.keeper)
+}
// Deprecated: Route does nothing.
func (am AppModule) Route() sdk.Route { return sdk.NewRoute("", nil) }
From 5ceb48bb64fe7617c6ef76155dc64ae25830fb69 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 22:55:16 +0900
Subject: [PATCH 24/49] chore
---
x/fbridge/keeper/keeper.go | 2 +-
x/fbridge/keeper/transfer_test.go | 2 +-
x/fbridge/types/keys.go | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go
index 668508838a..1ebc9957df 100644
--- a/x/fbridge/keeper/keeper.go
+++ b/x/fbridge/keeper/keeper.go
@@ -20,7 +20,7 @@ type Keeper struct {
// the target denom for the bridge
targetDenom string
- // address that can have the same rights as a Guardian when the guardian is not registered yet
+ // authority can give a role to a specific address like guardian
authority string
}
diff --git a/x/fbridge/keeper/transfer_test.go b/x/fbridge/keeper/transfer_test.go
index 755d6fdd71..81f19b56e1 100644
--- a/x/fbridge/keeper/transfer_test.go
+++ b/x/fbridge/keeper/transfer_test.go
@@ -26,7 +26,7 @@ func TestHandleBridgeTransfer(t *testing.T) {
bankKeeper.EXPECT().SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, token).Return(nil)
bankKeeper.EXPECT().BurnCoins(ctx, types.ModuleName, token).Return(nil)
- k := NewKeeper(encCfg.Codec, key, memKey, authKeeper, bankKeeper, denom)
+ k := NewKeeper(encCfg.Codec, key, memKey, authKeeper, bankKeeper, denom, types.DefaultAuthority().String())
targetSeq := uint64(2)
bz := make([]byte, 8)
binary.BigEndian.PutUint64(bz, targetSeq)
diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go
index a50724e0f0..f34472803b 100644
--- a/x/fbridge/types/keys.go
+++ b/x/fbridge/types/keys.go
@@ -30,6 +30,7 @@ const (
//
// - 0xF0: memstore initialized
// - 0xF1: role metadata
+// - 0xF2: bridge status
var (
KeyParams = []byte{0x01} // key for fbridge module params
From 1a6e281531da2a696f34c2d971ecfefb473c4209 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Fri, 3 May 2024 23:38:58 +0900
Subject: [PATCH 25/49] add single member query
---
client/docs/config.json | 1 +
client/docs/swagger-ui/swagger.yaml | 46 +++
docs/core/proto-docs.md | 33 ++
proto/lbm/fbridge/v1/query.proto | 13 +
x/fbridge/keeper/grpc_query.go | 11 +
x/fbridge/types/query.pb.go | 561 +++++++++++++++++++++++-----
x/fbridge/types/query.pb.gw.go | 98 +++++
7 files changed, 673 insertions(+), 90 deletions(-)
diff --git a/client/docs/config.json b/client/docs/config.json
index c1e0bb7c12..6670e56370 100644
--- a/client/docs/config.json
+++ b/client/docs/config.json
@@ -172,6 +172,7 @@
"Params": "FBridgeParams",
"Commitments": "FBridgeCommitments",
"Members": "FBridgeMembers",
+ "Member": "FBridgeMember",
"Proposals": "FBridgeProposals",
"Proposal": "FBridgeProposal",
"Votes": "FBridgeVotes",
diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml
index a1d2c93314..62f62be964 100644
--- a/client/docs/swagger-ui/swagger.yaml
+++ b/client/docs/swagger-ui/swagger.yaml
@@ -29843,6 +29843,47 @@ paths:
type: string
tags:
- Query
+ '/lbm/fbridge/v1/members/{address}':
+ get:
+ summary: Member queries the role of a specific member
+ operationId: FBridgeMember
+ responses:
+ '200':
+ description: A successful response.
+ schema:
+ type: object
+ properties:
+ role:
+ type: string
+ 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: address
+ in: path
+ required: true
+ type: string
+ tags:
+ - Query
/lbm/fbridge/v1/params:
get:
summary: Params queries the parameters of x/fbridge module.
@@ -50442,6 +50483,11 @@ definitions:
seq:
type: string
format: uint64
+ lbm.fbridge.v1.QueryMemberResponse:
+ type: object
+ properties:
+ role:
+ type: string
lbm.fbridge.v1.QueryMembersResponse:
type: object
properties:
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index e2c722fd64..9d9ce0e03c 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -797,6 +797,8 @@
- [QueryGreatestConsecutiveConfirmedSeqResponse](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqResponse)
- [QueryGreatestSeqByOperatorRequest](#lbm.fbridge.v1.QueryGreatestSeqByOperatorRequest)
- [QueryGreatestSeqByOperatorResponse](#lbm.fbridge.v1.QueryGreatestSeqByOperatorResponse)
+ - [QueryMemberRequest](#lbm.fbridge.v1.QueryMemberRequest)
+ - [QueryMemberResponse](#lbm.fbridge.v1.QueryMemberResponse)
- [QueryMembersRequest](#lbm.fbridge.v1.QueryMembersRequest)
- [QueryMembersResponse](#lbm.fbridge.v1.QueryMembersResponse)
- [QueryNeededSubmissionSeqsRequest](#lbm.fbridge.v1.QueryNeededSubmissionSeqsRequest)
@@ -12021,6 +12023,36 @@ GenesisState defines the fbridge module's genesis state.
+
+
+### QueryMemberRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `address` | [string](#string) | | |
+
+
+
+
+
+
+
+
+### QueryMemberResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `role` | [string](#string) | | |
+
+
+
+
+
+
### QueryMembersRequest
@@ -12339,6 +12371,7 @@ GenesisState defines the fbridge module's genesis state.
| `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}|
| `Members` | [QueryMembersRequest](#lbm.fbridge.v1.QueryMembersRequest) | [QueryMembersResponse](#lbm.fbridge.v1.QueryMembersResponse) | Members queries the members of spcific group registered on the bridge | GET|/lbm/fbridge/v1/members|
+| `Member` | [QueryMemberRequest](#lbm.fbridge.v1.QueryMemberRequest) | [QueryMemberResponse](#lbm.fbridge.v1.QueryMemberResponse) | Member queries the role of a specific member | GET|/lbm/fbridge/v1/members/{address}|
| `Proposals` | [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) | Proposals queries a list of SuggestRole Proposals | GET|/lbm/fbridge/v1/proposals|
| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/proposals/{proposal_id}|
| `Vote` | [QueryVoteRequest](#lbm.fbridge.v1.QueryVoteRequest) | [QueryVoteResponse](#lbm.fbridge.v1.QueryVoteResponse) | Vote queries voted information based on proposalID, voterAddr. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}|
diff --git a/proto/lbm/fbridge/v1/query.proto b/proto/lbm/fbridge/v1/query.proto
index 5f7992ef76..bc79974847 100644
--- a/proto/lbm/fbridge/v1/query.proto
+++ b/proto/lbm/fbridge/v1/query.proto
@@ -63,6 +63,11 @@ service Query {
option (google.api.http).get = "/lbm/fbridge/v1/members";
}
+ // Member queries the role of a specific member
+ rpc Member(QueryMemberRequest) returns (QueryMemberResponse) {
+ option (google.api.http).get = "/lbm/fbridge/v1/members/{address}";
+ }
+
// Proposals queries a list of SuggestRole Proposals
rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) {
option (google.api.http).get = "/lbm/fbridge/v1/proposals";
@@ -171,6 +176,14 @@ message QueryMembersResponse {
repeated string members = 1;
}
+message QueryMemberRequest {
+ string address = 1;
+}
+
+message QueryMemberResponse {
+ string role = 1;
+}
+
message QueryProposalsRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go
index 2b810b12e0..0f251cfeb8 100644
--- a/x/fbridge/keeper/grpc_query.go
+++ b/x/fbridge/keeper/grpc_query.go
@@ -107,6 +107,17 @@ func (k Keeper) Members(goCtx context.Context, req *types.QueryMembersRequest) (
return &types.QueryMembersResponse{Members: members}, nil
}
+func (k Keeper) Member(goCtx context.Context, req *types.QueryMemberRequest) (*types.QueryMemberResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ r := k.GetRole(ctx, sdk.MustAccAddressFromBech32(req.Address))
+
+ return &types.QueryMemberResponse{Role: types.Role_name[int32(r)]}, nil
+}
+
func (k Keeper) Proposals(goCtx context.Context, req *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
diff --git a/x/fbridge/types/query.pb.go b/x/fbridge/types/query.pb.go
index 7859c52455..10eb5c6310 100644
--- a/x/fbridge/types/query.pb.go
+++ b/x/fbridge/types/query.pb.go
@@ -935,6 +935,94 @@ func (m *QueryMembersResponse) GetMembers() []string {
return nil
}
+type QueryMemberRequest struct {
+ Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
+}
+
+func (m *QueryMemberRequest) Reset() { *m = QueryMemberRequest{} }
+func (m *QueryMemberRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryMemberRequest) ProtoMessage() {}
+func (*QueryMemberRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5e7780f9db9d346e, []int{20}
+}
+func (m *QueryMemberRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryMemberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryMemberRequest.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 *QueryMemberRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryMemberRequest.Merge(m, src)
+}
+func (m *QueryMemberRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryMemberRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryMemberRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryMemberRequest proto.InternalMessageInfo
+
+func (m *QueryMemberRequest) GetAddress() string {
+ if m != nil {
+ return m.Address
+ }
+ return ""
+}
+
+type QueryMemberResponse struct {
+ Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
+}
+
+func (m *QueryMemberResponse) Reset() { *m = QueryMemberResponse{} }
+func (m *QueryMemberResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryMemberResponse) ProtoMessage() {}
+func (*QueryMemberResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5e7780f9db9d346e, []int{21}
+}
+func (m *QueryMemberResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryMemberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryMemberResponse.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 *QueryMemberResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryMemberResponse.Merge(m, src)
+}
+func (m *QueryMemberResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryMemberResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryMemberResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryMemberResponse proto.InternalMessageInfo
+
+func (m *QueryMemberResponse) GetRole() string {
+ if m != nil {
+ return m.Role
+ }
+ return ""
+}
+
type QueryProposalsRequest struct {
// pagination defines an optional pagination for the request.
Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
@@ -944,7 +1032,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{20}
+ return fileDescriptor_5e7780f9db9d346e, []int{22}
}
func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -990,7 +1078,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{21}
+ return fileDescriptor_5e7780f9db9d346e, []int{23}
}
func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1042,7 +1130,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{22}
+ return fileDescriptor_5e7780f9db9d346e, []int{24}
}
func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1086,7 +1174,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{23}
+ return fileDescriptor_5e7780f9db9d346e, []int{25}
}
func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1133,7 +1221,7 @@ func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} }
func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) }
func (*QueryVoteRequest) ProtoMessage() {}
func (*QueryVoteRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_5e7780f9db9d346e, []int{24}
+ return fileDescriptor_5e7780f9db9d346e, []int{26}
}
func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1185,7 +1273,7 @@ func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} }
func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) }
func (*QueryVoteResponse) ProtoMessage() {}
func (*QueryVoteResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_5e7780f9db9d346e, []int{25}
+ return fileDescriptor_5e7780f9db9d346e, []int{27}
}
func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1230,7 +1318,7 @@ func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} }
func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) }
func (*QueryVotesRequest) ProtoMessage() {}
func (*QueryVotesRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_5e7780f9db9d346e, []int{26}
+ return fileDescriptor_5e7780f9db9d346e, []int{28}
}
func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1275,7 +1363,7 @@ func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} }
func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) }
func (*QueryVotesResponse) ProtoMessage() {}
func (*QueryVotesResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_5e7780f9db9d346e, []int{27}
+ return fileDescriptor_5e7780f9db9d346e, []int{29}
}
func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1332,6 +1420,8 @@ func init() {
proto.RegisterType((*QueryCommitmentsResponse)(nil), "lbm.fbridge.v1.QueryCommitmentsResponse")
proto.RegisterType((*QueryMembersRequest)(nil), "lbm.fbridge.v1.QueryMembersRequest")
proto.RegisterType((*QueryMembersResponse)(nil), "lbm.fbridge.v1.QueryMembersResponse")
+ proto.RegisterType((*QueryMemberRequest)(nil), "lbm.fbridge.v1.QueryMemberRequest")
+ proto.RegisterType((*QueryMemberResponse)(nil), "lbm.fbridge.v1.QueryMemberResponse")
proto.RegisterType((*QueryProposalsRequest)(nil), "lbm.fbridge.v1.QueryProposalsRequest")
proto.RegisterType((*QueryProposalsResponse)(nil), "lbm.fbridge.v1.QueryProposalsResponse")
proto.RegisterType((*QueryProposalRequest)(nil), "lbm.fbridge.v1.QueryProposalRequest")
@@ -1345,89 +1435,92 @@ func init() {
func init() { proto.RegisterFile("lbm/fbridge/v1/query.proto", fileDescriptor_5e7780f9db9d346e) }
var fileDescriptor_5e7780f9db9d346e = []byte{
- // 1300 bytes of a gzipped FileDescriptorProto
+ // 1347 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0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, 0x92,
+ 0xf4, 0xeb, 0xe4, 0xfa, 0x94, 0xf4, 0x54, 0x3a, 0x11, 0xba, 0x2b, 0x3d, 0x55, 0x9f, 0x7c, 0xa1,
+ 0xc1, 0x11, 0xe9, 0x6a, 0x48, 0x36, 0x57, 0x7c, 0x1e, 0xc6, 0x38, 0x08, 0xea, 0xb9, 0x2e, 0xf5,
+ 0x50, 0xb2, 0x76, 0x20, 0x3d, 0x1b, 0xef, 0xbf, 0x78, 0x55, 0xd4, 0x5e, 0xbe, 0x2a, 0x6a, 0x7f,
+ 0xbf, 0x2a, 0x6a, 0xdf, 0xec, 0x15, 0x67, 0x5e, 0xee, 0x15, 0x67, 0xfe, 0xdc, 0x2b, 0xce, 0x7c,
+ 0x5a, 0x6e, 0x3a, 0xc1, 0x93, 0x6e, 0xdd, 0x6c, 0x70, 0x97, 0x6e, 0x39, 0x9e, 0x68, 0x3c, 0x71,
+ 0x2c, 0xfa, 0x18, 0x17, 0x6b, 0xc2, 0x7e, 0x4a, 0x9f, 0xc5, 0x34, 0xc1, 0xf3, 0x36, 0x13, 0xf5,
+ 0x59, 0xf9, 0x37, 0xcc, 0xd5, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x8b, 0x6b, 0x76, 0x32,
+ 0x12, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1465,6 +1558,8 @@ type QueryClient interface {
Commitments(ctx context.Context, in *QueryCommitmentsRequest, opts ...grpc.CallOption) (*QueryCommitmentsResponse, error)
// Members queries the members of spcific group registered on the bridge
Members(ctx context.Context, in *QueryMembersRequest, opts ...grpc.CallOption) (*QueryMembersResponse, error)
+ // Member queries the role of a specific member
+ Member(ctx context.Context, in *QueryMemberRequest, opts ...grpc.CallOption) (*QueryMemberResponse, error)
// Proposals queries a list of SuggestRole Proposals
Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error)
// Proposal queries a SuggestRole Proposal
@@ -1573,6 +1668,15 @@ func (c *queryClient) Members(ctx context.Context, in *QueryMembersRequest, opts
return out, nil
}
+func (c *queryClient) Member(ctx context.Context, in *QueryMemberRequest, opts ...grpc.CallOption) (*QueryMemberResponse, error) {
+ out := new(QueryMemberResponse)
+ err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Member", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) {
out := new(QueryProposalsResponse)
err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Proposals", in, out, opts...)
@@ -1634,6 +1738,8 @@ type QueryServer interface {
Commitments(context.Context, *QueryCommitmentsRequest) (*QueryCommitmentsResponse, error)
// Members queries the members of spcific group registered on the bridge
Members(context.Context, *QueryMembersRequest) (*QueryMembersResponse, error)
+ // Member queries the role of a specific member
+ Member(context.Context, *QueryMemberRequest) (*QueryMemberResponse, error)
// Proposals queries a list of SuggestRole Proposals
Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error)
// Proposal queries a SuggestRole Proposal
@@ -1678,6 +1784,9 @@ func (*UnimplementedQueryServer) Commitments(ctx context.Context, req *QueryComm
func (*UnimplementedQueryServer) Members(ctx context.Context, req *QueryMembersRequest) (*QueryMembersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Members not implemented")
}
+func (*UnimplementedQueryServer) Member(ctx context.Context, req *QueryMemberRequest) (*QueryMemberResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Member not implemented")
+}
func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented")
}
@@ -1875,6 +1984,24 @@ func _Query_Members_Handler(srv interface{}, ctx context.Context, dec func(inter
return interceptor(ctx, in, info, handler)
}
+func _Query_Member_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryMemberRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).Member(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/lbm.fbridge.v1.Query/Member",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).Member(ctx, req.(*QueryMemberRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryProposalsRequest)
if err := dec(in); err != nil {
@@ -1991,6 +2118,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Members",
Handler: _Query_Members_Handler,
},
+ {
+ MethodName: "Member",
+ Handler: _Query_Member_Handler,
+ },
{
MethodName: "Proposals",
Handler: _Query_Proposals_Handler,
@@ -2657,6 +2788,66 @@ func (m *QueryMembersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *QueryMemberRequest) 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 *QueryMemberRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryMemberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Address) > 0 {
+ i -= len(m.Address)
+ copy(dAtA[i:], m.Address)
+ i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *QueryMemberResponse) 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 *QueryMemberResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryMemberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Role) > 0 {
+ i -= len(m.Role)
+ copy(dAtA[i:], m.Role)
+ i = encodeVarintQuery(dAtA, i, uint64(len(m.Role)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
func (m *QueryProposalsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -3206,6 +3397,32 @@ func (m *QueryMembersResponse) Size() (n int) {
return n
}
+func (m *QueryMemberRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Address)
+ if l > 0 {
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ return n
+}
+
+func (m *QueryMemberResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Role)
+ if l > 0 {
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ return n
+}
+
func (m *QueryProposalsRequest) Size() (n int) {
if m == nil {
return 0
@@ -5039,6 +5256,170 @@ func (m *QueryMembersResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *QueryMemberRequest) 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: QueryMemberRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryMemberRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Address = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *QueryMemberResponse) 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: QueryMemberResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryMemberResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Role = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *QueryProposalsRequest) 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 357e2c1f2c..1176aeecf0 100644
--- a/x/fbridge/types/query.pb.gw.go
+++ b/x/fbridge/types/query.pb.gw.go
@@ -467,6 +467,60 @@ func local_request_Query_Members_0(ctx context.Context, marshaler runtime.Marsha
}
+func request_Query_Member_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryMemberRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["address"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
+ }
+
+ protoReq.Address, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
+ }
+
+ msg, err := client.Member(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Query_Member_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryMemberRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["address"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address")
+ }
+
+ protoReq.Address, err = runtime.String(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err)
+ }
+
+ msg, err := server.Member(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
var (
filter_Query_Proposals_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
@@ -893,6 +947,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
+ mux.Handle("GET", pattern_Query_Member_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_Member_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_Member_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("GET", pattern_Query_Proposals_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -1214,6 +1288,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
+ mux.Handle("GET", pattern_Query_Member_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_Member_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_Member_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("GET", pattern_Query_Proposals_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -1318,6 +1412,8 @@ var (
pattern_Query_Members_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "members"}, "", runtime.AssumeColonVerbOpt(false)))
+ pattern_Query_Member_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", "members", "address"}, "", runtime.AssumeColonVerbOpt(false)))
+
pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "proposals"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Proposal_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", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false)))
@@ -1348,6 +1444,8 @@ var (
forward_Query_Members_0 = runtime.ForwardResponseMessage
+ forward_Query_Member_0 = runtime.ForwardResponseMessage
+
forward_Query_Proposals_0 = runtime.ForwardResponseMessage
forward_Query_Proposal_0 = runtime.ForwardResponseMessage
From e41f7ef1045fed7810ed14681c9dc06bc9479f56 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Sat, 4 May 2024 00:03:50 +0900
Subject: [PATCH 26/49] return error if the address has no role
---
x/fbridge/keeper/grpc_query.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go
index 0f251cfeb8..3e06ca1d87 100644
--- a/x/fbridge/keeper/grpc_query.go
+++ b/x/fbridge/keeper/grpc_query.go
@@ -114,6 +114,9 @@ func (k Keeper) Member(goCtx context.Context, req *types.QueryMemberRequest) (*t
ctx := sdk.UnwrapSDKContext(goCtx)
r := k.GetRole(ctx, sdk.MustAccAddressFromBech32(req.Address))
+ if r == types.RoleEmpty {
+ return nil, status.Error(codes.NotFound, "role not found")
+ }
return &types.QueryMemberResponse{Role: types.Role_name[int32(r)]}, nil
}
From cdebadd6f870aa9e039be28462176a304e66f4bd Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Sat, 4 May 2024 00:06:46 +0900
Subject: [PATCH 27/49] append genesis validation
---
x/fbridge/keeper/genesis.go | 2 +-
x/fbridge/types/genesis.go | 50 +++++++++++++++++++++++++++++++++++--
2 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index 70903cd0e9..2ebf18aacd 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -8,7 +8,6 @@ import (
)
func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error {
-
k.SetParams(ctx, gs.Params)
k.setNextSequence(ctx, gs.SendingState.NextSeq)
for _, info := range gs.SendingState.SeqToBlocknum {
@@ -48,6 +47,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
NextSeq: k.GetNextSequence(ctx),
SeqToBlocknum: k.getAllSeqToBlocknums(ctx),
},
+ ReceivingState: types.ReceivingState{},
NextRoleProposalId: k.GetNextProposalID(ctx),
RoleProposals: k.GetRoleProposals(ctx),
Votes: k.GetAllVotes(ctx),
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 6029df94b7..9835232e9e 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -27,13 +27,59 @@ func ValidateGenesis(data GenesisState) error {
return err
}
- if data.SendingState.NextSeq < 1 {
- return errors.New("next sequence must be positive")
+ if err := validateSendingState(data.SendingState); err != nil {
+ return err
}
if data.NextRoleProposalId < 1 {
return errors.New("next role proposal ID must be positive")
}
+ for _, v := range data.RoleProposals {
+ if v.Id < 1 {
+ return errors.New("role proposal ID must be positive")
+ }
+ sdk.MustAccAddressFromBech32(v.Proposer)
+ sdk.MustAccAddressFromBech32(v.Target)
+ }
+
+ for _, v := range data.Votes {
+ if v.ProposalId < 1 {
+ return errors.New("role proposal ID must be positive")
+ }
+ sdk.MustAccAddressFromBech32(v.Voter)
+ if v.Option == OptionEmpty {
+ return errors.New("invalid voting option")
+ }
+ }
+
+ for _, v := range data.Roles {
+ sdk.MustAccAddressFromBech32(v.Address)
+ if v.Role == RoleEmpty {
+ return errors.New("invalid role")
+ }
+ }
+
+ for _, v := range data.BridgeSwitches {
+ sdk.MustAccAddressFromBech32(v.Guardian)
+ if v.Status == StatusEmpty {
+ return errors.New("invalid bridge switch status")
+ }
+ }
+
+ return nil
+}
+
+func validateSendingState(state SendingState) error {
+ if state.NextSeq < 1 {
+ return errors.New("next sequence must be positive")
+ }
+
+ for _, v := range state.SeqToBlocknum {
+ if v.Blocknum < 1 || v.Seq < 1 {
+ return errors.New("blocknum and seq must be positive")
+ }
+ }
+
return nil
}
From b50267389a9618c90ea7d93b269528477d80ca58 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Sat, 4 May 2024 00:14:06 +0900
Subject: [PATCH 28/49] chore
---
x/fbridge/keeper/keeper.go | 7 +++++--
x/fbridge/types/genesis.go | 8 ++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go
index 1ebc9957df..4e65ca3d2f 100644
--- a/x/fbridge/keeper/keeper.go
+++ b/x/fbridge/keeper/keeper.go
@@ -35,8 +35,11 @@ func NewKeeper(
panic(errors.New("fbridge module account has not been set"))
}
- if authority != types.DefaultAuthority().String() {
- panic("x/bridge authority must be the gov module account")
+ for _, addr := range types.AuthorityCandiates() {
+ if authority == addr.String() {
+ break
+ }
+ panic("x/bridge authority must be the gov or foundation module account")
}
return Keeper{
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 9835232e9e..6d45c501c1 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -4,6 +4,7 @@ import (
"errors"
sdk "github.com/Finschia/finschia-sdk/types"
authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
+ foundationtypes "github.com/Finschia/finschia-sdk/x/foundation"
govtypes "github.com/Finschia/finschia-sdk/x/gov/types"
)
@@ -22,6 +23,13 @@ func DefaultAuthority() sdk.AccAddress {
return authtypes.NewModuleAddress(govtypes.ModuleName)
}
+func AuthorityCandiates() []sdk.AccAddress {
+ return []sdk.AccAddress{
+ authtypes.NewModuleAddress(govtypes.ModuleName),
+ authtypes.NewModuleAddress(foundationtypes.ModuleName),
+ }
+}
+
func ValidateGenesis(data GenesisState) error {
if err := ValidateParams(data.Params); err != nil {
return err
From 1ad07828437d888273fa26cc80acbee93add8758 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Sat, 4 May 2024 03:36:46 +0900
Subject: [PATCH 29/49] add CLI
---
x/fbridge/client/cli/query.go | 208 +++++++++++++++++++++++++++++++++
x/fbridge/client/cli/tx.go | 152 +++++++++++++++++++++++-
x/fbridge/keeper/grpc_query.go | 4 +-
x/fbridge/types/fbridge.go | 7 +-
4 files changed, 363 insertions(+), 8 deletions(-)
diff --git a/x/fbridge/client/cli/query.go b/x/fbridge/client/cli/query.go
index 6a1396c84d..866d4cca21 100644
--- a/x/fbridge/client/cli/query.go
+++ b/x/fbridge/client/cli/query.go
@@ -2,6 +2,7 @@ package cli
import (
"fmt"
+ "strconv"
"github.com/spf13/cobra"
@@ -23,13 +24,44 @@ func NewQueryCmd() *cobra.Command {
}
cmd.AddCommand(
+ NewQueryParamsCmd(),
NewQueryNextSeqSendCmd(),
NewQuerySeqToBlocknumsCmd(),
+ NewQueryMembersCmd(),
+ NewQueryMemberCmd(),
+ NewProposalsCmd(),
+ NewProposalCmd(),
+ NewVotesCmd(),
+ NewVoteCmd(),
)
return cmd
}
+func NewQueryParamsCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "params",
+ Short: "Query the current fbridge module parameters",
+ Args: cobra.NoArgs,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientQueryContext(cmd)
+ if err != nil {
+ return err
+ }
+ qc := types.NewQueryClient(clientCtx)
+ res, err := qc.Params(cmd.Context(), &types.QueryParamsRequest{})
+ if err != nil {
+ return err
+ }
+
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+ return cmd
+}
+
func NewQueryNextSeqSendCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "sending-next-seq",
@@ -90,3 +122,179 @@ func NewQuerySeqToBlocknumsCmd() *cobra.Command {
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
+
+func NewQueryMembersCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "members [role]",
+ Short: "Query the members of spcific group registered on the bridge (guardian|operator|judge)",
+ Args: cobra.ExactArgs(1),
+ Example: fmt.Sprintf("%s query %s members guardian", 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)
+
+ res, err := qc.Members(cmd.Context(), &types.QueryMembersRequest{Role: args[0]})
+ if err != nil {
+ return err
+ }
+
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+ return cmd
+}
+
+func NewQueryMemberCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "member [address]",
+ Short: "Query the roles of a specific member registered on the bridge",
+ Args: cobra.ExactArgs(1),
+ Example: fmt.Sprintf("%s query %s member link1...", 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)
+
+ res, err := qc.Member(cmd.Context(), &types.QueryMemberRequest{Address: args[0]})
+ if err != nil {
+ return err
+ }
+
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+ return cmd
+}
+
+func NewProposalsCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "proposals",
+ Short: "Query all role proposals",
+ Args: cobra.NoArgs,
+ Example: fmt.Sprintf("%s query %s proposals", 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)
+ pageReq, err := client.ReadPageRequest(cmd.Flags())
+ if err != nil {
+ return err
+ }
+
+ res, err := qc.Proposals(cmd.Context(), &types.QueryProposalsRequest{Pagination: pageReq})
+ if err != nil {
+ return err
+ }
+
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+ flags.AddPaginationFlagsToCmd(cmd, "all proposals")
+ return cmd
+}
+
+func NewProposalCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "proposal [proposal_id]",
+ Short: "Query a specific role proposal",
+ Args: cobra.ExactArgs(1),
+ Example: fmt.Sprintf("%s query %s proposal 1", 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)
+
+ id, err := strconv.ParseUint(args[0], 10, 64)
+ if err != nil {
+ return err
+ }
+
+ res, err := qc.Proposal(cmd.Context(), &types.QueryProposalRequest{ProposalId: id})
+ if err != nil {
+ return err
+ }
+
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+ return cmd
+}
+
+func NewVotesCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "votes [proposal_id]",
+ Short: "Query all votes for a specific role proposal",
+ Args: cobra.ExactArgs(1),
+ Example: fmt.Sprintf("%s query %s votes 1", 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)
+
+ id, err := strconv.ParseUint(args[0], 10, 64)
+ if err != nil {
+ return err
+ }
+
+ res, err := qc.Votes(cmd.Context(), &types.QueryVotesRequest{ProposalId: id})
+ if err != nil {
+ return err
+ }
+
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+ return cmd
+}
+
+func NewVoteCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "vote [proposal_id] [voter]",
+ Short: "Query a specific vote for a role proposal",
+ Args: cobra.ExactArgs(2),
+ Example: fmt.Sprintf("%s query %s vote 1 link1...", 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)
+
+ id, err := strconv.ParseUint(args[0], 10, 64)
+ if err != nil {
+ return err
+ }
+
+ res, err := qc.Vote(cmd.Context(), &types.QueryVoteRequest{ProposalId: id, Voter: args[1]})
+ if err != nil {
+ return err
+ }
+
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+ return cmd
+}
diff --git a/x/fbridge/client/cli/tx.go b/x/fbridge/client/cli/tx.go
index 8aa3b892bb..a76cfac125 100644
--- a/x/fbridge/client/cli/tx.go
+++ b/x/fbridge/client/cli/tx.go
@@ -1,7 +1,10 @@
package cli
import (
+ "fmt"
+ "github.com/Finschia/finschia-sdk/version"
"github.com/spf13/cobra"
+ "strconv"
"github.com/Finschia/finschia-sdk/client"
"github.com/Finschia/finschia-sdk/client/flags"
@@ -23,6 +26,10 @@ func NewTxCmd() *cobra.Command {
TxCmd.AddCommand(
NewTransferTxCmd(),
+ NewSuggestRoleTxCmd(),
+ NewAddVoteForRoleTxCmd(),
+ NewHaltTxCmd(),
+ NewResumeTxCmd(),
)
return TxCmd
@@ -30,9 +37,10 @@ func NewTxCmd() *cobra.Command {
func NewTransferTxCmd() *cobra.Command {
cmd := &cobra.Command{
- Use: "transfer [to_address] [amount]",
- Short: `Transfer token from current chain to counterparty chain`,
- Args: cobra.ExactArgs(2),
+ Use: "transfer [to_address] [amount]",
+ Short: `Transfer token from current chain to counterparty chain`,
+ Example: fmt.Sprintf("%s tx %s transfer link1... 1000cony --from mykey", version.AppName, types.ModuleName),
+ Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
@@ -65,3 +73,141 @@ func NewTransferTxCmd() *cobra.Command {
return cmd
}
+
+func NewSuggestRoleTxCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "suggest-role [target_address] [role]",
+ Short: `Suggest a role to a specific address (unspecified|guardian|operator|judge)`,
+ Args: cobra.ExactArgs(2),
+ Example: fmt.Sprintf("%s tx %s suggest-role link1... guardian --from guardiankey", version.AppName, types.ModuleName),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientTxContext(cmd)
+ if err != nil {
+ return err
+ }
+ from := clientCtx.GetFromAddress().String()
+ if _, err := sdk.AccAddressFromBech32(from); err != nil {
+ return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", from)
+ }
+ target := args[0]
+ role, found := types.QueryParamToRole[args[1]]
+ if !found {
+ return sdkerrors.ErrInvalidRequest.Wrapf("invalid role: %s", args[1])
+ }
+
+ msg := types.MsgSuggestRole{
+ From: from,
+ Target: target,
+ Role: role,
+ }
+
+ return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
+ },
+ }
+
+ flags.AddTxFlagsToCmd(cmd)
+
+ return cmd
+}
+
+func NewAddVoteForRoleTxCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "add-vote-for-role [proposal_id] [option]",
+ Short: `Vote for a role proposal (yes|no)`,
+ Args: cobra.ExactArgs(2),
+ Example: fmt.Sprintf("%s tx %s add-vote-for-role 1 yes --from guardiankey", version.AppName, types.ModuleName),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientTxContext(cmd)
+ if err != nil {
+ return err
+ }
+ from := clientCtx.GetFromAddress().String()
+ if _, err := sdk.AccAddressFromBech32(from); err != nil {
+ return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", from)
+ }
+ proposalID, err := strconv.ParseUint(args[0], 10, 64)
+ if err != nil {
+ return sdkerrors.ErrInvalidRequest.Wrapf("invalid proposal ID: %s", args[0])
+ }
+
+ voteOpts := map[string]types.VoteOption{
+ "yes": types.OptionYes,
+ "no": types.OptionNo,
+ }
+ option, found := voteOpts[args[1]]
+ if !found {
+ return sdkerrors.ErrInvalidRequest.Wrapf("invalid vote option: %s", args[1])
+ }
+
+ msg := types.MsgAddVoteForRole{
+ From: from,
+ ProposalId: proposalID,
+ Option: option,
+ }
+
+ return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
+ },
+ }
+
+ flags.AddTxFlagsToCmd(cmd)
+
+ return cmd
+}
+
+func NewHaltTxCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "halt",
+ Short: `Activate sender's halting switch for the bridge module`,
+ Args: cobra.NoArgs,
+ Example: fmt.Sprintf("%s tx %s halt --from guardiankey", version.AppName, types.ModuleName),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientTxContext(cmd)
+ if err != nil {
+ return err
+ }
+ from := clientCtx.GetFromAddress().String()
+ if _, err := sdk.AccAddressFromBech32(from); err != nil {
+ return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", from)
+ }
+
+ msg := types.MsgHalt{
+ Guardian: from,
+ }
+
+ return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
+ },
+ }
+
+ flags.AddTxFlagsToCmd(cmd)
+
+ return cmd
+}
+
+func NewResumeTxCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "resume",
+ Short: `Activate sender's resuming switch for the bridge module`,
+ Args: cobra.NoArgs,
+ Example: fmt.Sprintf("%s tx %s resume --from guardiankey", version.AppName, types.ModuleName),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientTxContext(cmd)
+ if err != nil {
+ return err
+ }
+ from := clientCtx.GetFromAddress().String()
+ if _, err := sdk.AccAddressFromBech32(from); err != nil {
+ return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", from)
+ }
+
+ msg := types.MsgResume{
+ Guardian: from,
+ }
+
+ return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
+ },
+ }
+
+ flags.AddTxFlagsToCmd(cmd)
+
+ return cmd
+}
diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go
index 3e06ca1d87..2bf4248427 100644
--- a/x/fbridge/keeper/grpc_query.go
+++ b/x/fbridge/keeper/grpc_query.go
@@ -91,8 +91,8 @@ func (k Keeper) Members(goCtx context.Context, req *types.QueryMembersRequest) (
}
ctx := sdk.UnwrapSDKContext(goCtx)
- role := types.QueryParamToRole[req.Role]
- if role == 0 {
+ role, found := types.QueryParamToRole[req.Role]
+ if !found {
return nil, status.Error(codes.InvalidArgument, "invalid role")
}
diff --git a/x/fbridge/types/fbridge.go b/x/fbridge/types/fbridge.go
index 85116dd0fd..c13aff38ff 100644
--- a/x/fbridge/types/fbridge.go
+++ b/x/fbridge/types/fbridge.go
@@ -5,9 +5,10 @@ import (
)
var QueryParamToRole = map[string]Role{
- "guardian": 1,
- "operator": 2,
- "judge": 3,
+ "unspecified": 0,
+ "guardian": 1,
+ "operator": 2,
+ "judge": 3,
}
func IsValidRole(role Role) error {
From b4f3b6cdaa8fa6cc8035d67c843764ea24b1e785 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Sat, 4 May 2024 13:40:10 +0900
Subject: [PATCH 30/49] return all registered members if there is no query
string
---
x/fbridge/keeper/grpc_query.go | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go
index 2bf4248427..e0785ddc28 100644
--- a/x/fbridge/keeper/grpc_query.go
+++ b/x/fbridge/keeper/grpc_query.go
@@ -91,17 +91,24 @@ func (k Keeper) Members(goCtx context.Context, req *types.QueryMembersRequest) (
}
ctx := sdk.UnwrapSDKContext(goCtx)
- role, found := types.QueryParamToRole[req.Role]
- if !found {
- return nil, status.Error(codes.InvalidArgument, "invalid role")
- }
-
- members := make([]string, 0)
roles := k.GetRolePairs(ctx)
- for _, pair := range roles {
- if pair.Role == role {
+ members := make([]string, 0)
+
+ if req.Role == "" {
+ for _, pair := range roles {
members = append(members, pair.Address)
}
+ } else {
+ role, found := types.QueryParamToRole[req.Role]
+ if !found {
+ return nil, status.Error(codes.InvalidArgument, "invalid role")
+ }
+
+ for _, pair := range roles {
+ if pair.Role == role {
+ members = append(members, pair.Address)
+ }
+ }
}
return &types.QueryMembersResponse{Members: members}, nil
From f1dba4ffcc86c69e6bb653926b45c55e39bbbfa0 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 02:56:12 +0900
Subject: [PATCH 31/49] add unit tests for RBAC
---
x/fbridge/{module => keeper}/abci.go | 17 ++++---
x/fbridge/keeper/auth.go | 30 +++++++++---
x/fbridge/keeper/auth_test.go | 70 ++++++++++++++++++++++++++++
x/fbridge/keeper/msg_server.go | 4 +-
x/fbridge/keeper/transfer_test.go | 5 +-
x/fbridge/module/module.go | 8 ++--
x/fbridge/testutil/setup.go | 17 +++++--
7 files changed, 122 insertions(+), 29 deletions(-)
rename x/fbridge/{module => keeper}/abci.go (75%)
diff --git a/x/fbridge/module/abci.go b/x/fbridge/keeper/abci.go
similarity index 75%
rename from x/fbridge/module/abci.go
rename to x/fbridge/keeper/abci.go
index 8af018af32..e8976cc702 100644
--- a/x/fbridge/module/abci.go
+++ b/x/fbridge/keeper/abci.go
@@ -1,24 +1,23 @@
-package module
+package keeper
import (
"fmt"
sdk "github.com/Finschia/finschia-sdk/types"
- "github.com/Finschia/finschia-sdk/x/fbridge/keeper"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
-func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
+func (k Keeper) BeginBlocker(ctx sdk.Context) {
k.InitMemStore(ctx)
proposals := k.GetRoleProposals(ctx)
for _, proposal := range proposals {
if ctx.BlockTime().After(proposal.ExpiredAt) {
- k.DeleteRoleProposal(ctx, proposal.Id)
+ k.deleteRoleProposal(ctx, proposal.Id)
}
}
}
-func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
+func (k Keeper) EndBlocker(ctx sdk.Context) {
guardianTrustLevel := k.GetParams(ctx).GuardianTrustLevel
proposals := k.GetRoleProposals(ctx)
for _, proposal := range proposals {
@@ -32,21 +31,21 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
}
if types.CheckTrustLevelThreshold(k.GetRoleMetadata(ctx).Guardian, voteYes, guardianTrustLevel) || proposal.Proposer == k.GetAuthority() {
- if err := k.UpdateRole(ctx, proposal.Role, sdk.MustAccAddressFromBech32(proposal.Target)); err != nil {
+ if err := k.updateRole(ctx, proposal.Role, sdk.MustAccAddressFromBech32(proposal.Target)); err != nil {
panic(err)
}
- k.DeleteRoleProposal(ctx, proposal.Id)
+ k.deleteRoleProposal(ctx, proposal.Id)
}
}
}
// RegisterInvariants registers the fbridge module invariants
-func RegisterInvariants(ir sdk.InvariantRegistry, k keeper.Keeper) {
+func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) {
ir.RegisterRoute(types.ModuleName, "guardian-invariant", GuardianInvariant(k))
}
-func GuardianInvariant(k keeper.Keeper) sdk.Invariant {
+func GuardianInvariant(k Keeper) sdk.Invariant {
return func(ctx sdk.Context) (string, bool) {
numGuardian := 0
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index 1e1e7882a7..2a5dafebdb 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -10,7 +10,7 @@ import (
)
func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAddress, role types.Role) (types.RoleProposal, error) {
- if k.GetRole(ctx, proposer) != types.RoleGuardian || proposer.String() != k.authority {
+ if k.GetRole(ctx, proposer) != types.RoleGuardian && proposer.String() != k.authority {
return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrapf("only guardian or %s can execute this action", k.authority)
}
@@ -52,7 +52,7 @@ func (k Keeper) addVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress
return nil
}
-func (k Keeper) UpdateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) error {
+func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) error {
previousRole := k.GetRole(ctx, addr)
if previousRole == role {
return sdkerrors.ErrInvalidRequest.Wrap("target already has same role")
@@ -144,7 +144,7 @@ func (k Keeper) GetRoleProposal(ctx sdk.Context, id uint64) (proposal types.Role
return proposal, true
}
-func (k Keeper) DeleteRoleProposal(ctx sdk.Context, id uint64) {
+func (k Keeper) deleteRoleProposal(ctx sdk.Context, id uint64) {
store := ctx.KVStore(k.storeKey)
if _, found := k.GetRoleProposal(ctx, id); !found {
panic(fmt.Sprintf("role proposal #%d not found", id))
@@ -248,16 +248,34 @@ func (k Keeper) deleteRole(ctx sdk.Context, addr sdk.AccAddress) {
store.Delete(types.RoleKey(addr))
}
-func (k Keeper) setBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
+func (k Keeper) UpdateBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
if k.GetRole(ctx, guardian) != types.RoleGuardian {
return sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action")
}
+ bsMeta := k.GetBridgeStatusMetadata(ctx)
+ switch status {
+ case types.StatusActive:
+ bsMeta.Active++
+ case types.StatusInactive:
+ bsMeta.Inactive++
+ default:
+ return sdkerrors.ErrInvalidRequest.Wrap("invalid bridge switch status")
+ }
+ k.setBridgeStatusMetadata(ctx, bsMeta)
+
+ if err := k.setBridgeSwitch(ctx, guardian, status); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (k Keeper) setBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 4)
binary.BigEndian.PutUint32(bz, uint32(status))
store.Set(types.BridgeSwitchKey(guardian), bz)
-
return nil
}
@@ -268,7 +286,7 @@ func (k Keeper) deleteBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress) {
func (k Keeper) GetBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress) (types.BridgeSwitch, error) {
if k.GetRole(ctx, guardian) != types.RoleGuardian {
- return types.BridgeSwitch{}, sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action")
+ return types.BridgeSwitch{}, sdkerrors.ErrUnauthorized.Wrap("only guardian has bridge switch")
}
store := ctx.KVStore(k.storeKey)
diff --git a/x/fbridge/keeper/auth_test.go b/x/fbridge/keeper/auth_test.go
index b55569d4a4..5506e612a2 100644
--- a/x/fbridge/keeper/auth_test.go
+++ b/x/fbridge/keeper/auth_test.go
@@ -1 +1,71 @@
package keeper
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/Finschia/finschia-sdk/x/fbridge/testutil"
+ "github.com/Finschia/finschia-sdk/x/fbridge/types"
+)
+
+func TestAssignRole(t *testing.T) {
+ key, memKey, ctx, encCfg, authKeeper, bankKeeper, addrs := testutil.PrepareFbridgeTest(t, 3)
+ auth := types.DefaultAuthority()
+ k := NewKeeper(encCfg.Codec, key, memKey, authKeeper, bankKeeper, "stake", auth.String())
+ err := k.InitGenesis(ctx, types.DefaultGenesisState())
+ require.NoError(t, err)
+
+ // 1. Bridge authority assigns an address to a guardian role
+ p, err := k.RegisterRoleProposal(ctx, addrs[0], addrs[1], types.RoleGuardian)
+ require.Error(t, err, "role proposal must not be passed without authority")
+ p, err = k.RegisterRoleProposal(ctx, auth, addrs[0], types.RoleGuardian)
+ require.NoError(t, err)
+ require.EqualValues(t, 1, p.Id)
+ err = k.updateRole(ctx, types.RoleGuardian, addrs[0])
+ require.NoError(t, err)
+ require.Equal(t, types.RoleGuardian, k.GetRole(ctx, addrs[0]))
+
+ // 2. Guardian assigns an address to a guardian role
+ p, err = k.RegisterRoleProposal(ctx, addrs[0], addrs[1], types.RoleGuardian)
+ require.NoError(t, err, "role proposal must be passed with guardian role")
+ require.EqualValues(t, 2, p.Id)
+ err = k.addVote(ctx, p.Id, addrs[0], types.OptionYes)
+ require.NoError(t, err)
+ opt, err := k.GetVote(ctx, p.Id, addrs[0])
+ require.NoError(t, err)
+ require.Equal(t, types.OptionYes, opt)
+ err = k.updateRole(ctx, types.RoleGuardian, addrs[1])
+
+ require.Equal(t, types.RoleMetadata{Guardian: 2, Operator: 0, Judge: 0}, k.GetRoleMetadata(ctx))
+ sws := k.GetBridgeSwitches(ctx)
+ require.Len(t, sws, 2)
+ for _, sw := range sws {
+ require.Equal(t, types.StatusActive, sw.Status)
+ }
+}
+
+func TestBridgeHaltAndResume(t *testing.T) {
+ key, memKey, ctx, encCfg, authKeeper, bankKeeper, addrs := testutil.PrepareFbridgeTest(t, 3)
+ auth := types.DefaultAuthority()
+ k := NewKeeper(encCfg.Codec, key, memKey, authKeeper, bankKeeper, "stake", auth.String())
+ err := k.InitGenesis(ctx, types.DefaultGenesisState())
+ require.NoError(t, err)
+ for _, addr := range addrs {
+ err = k.updateRole(ctx, types.RoleGuardian, addr)
+ require.NoError(t, err)
+ }
+
+ require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (3/3)")
+ err = k.UpdateBridgeSwitch(ctx, addrs[0], types.StatusInactive)
+ require.NoError(t, err)
+ require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (2/3)")
+
+ err = k.UpdateBridgeSwitch(ctx, addrs[1], types.StatusInactive)
+ require.NoError(t, err)
+ require.Equal(t, types.StatusInactive, k.GetBridgeStatus(ctx), "bridge status must be inactive (1/3)")
+
+ err = k.UpdateBridgeSwitch(ctx, addrs[0], types.StatusActive)
+ require.NoError(t, err)
+ require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (2/3)")
+}
diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go
index 13a127246b..c17bfbbe23 100644
--- a/x/fbridge/keeper/msg_server.go
+++ b/x/fbridge/keeper/msg_server.go
@@ -141,7 +141,7 @@ func (m msgServer) Halt(goCtx context.Context, msg *types.MsgHalt) (*types.MsgHa
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid guardian address (%s)", err)
}
- if err := m.setBridgeSwitch(ctx, addr, types.StatusInactive); err != nil {
+ if err := m.UpdateBridgeSwitch(ctx, addr, types.StatusInactive); err != nil {
return nil, err
}
@@ -156,7 +156,7 @@ func (m msgServer) Resume(goCtx context.Context, msg *types.MsgResume) (*types.M
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid guardian address (%s)", err)
}
- if err := m.setBridgeSwitch(ctx, addr, types.StatusActive); err != nil {
+ if err := m.UpdateBridgeSwitch(ctx, addr, types.StatusActive); err != nil {
return nil, err
}
diff --git a/x/fbridge/keeper/transfer_test.go b/x/fbridge/keeper/transfer_test.go
index 81f19b56e1..4466e3d06c 100644
--- a/x/fbridge/keeper/transfer_test.go
+++ b/x/fbridge/keeper/transfer_test.go
@@ -7,21 +7,18 @@ import (
"github.com/stretchr/testify/require"
sdk "github.com/Finschia/finschia-sdk/types"
- authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
"github.com/Finschia/finschia-sdk/x/fbridge/testutil"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
func TestHandleBridgeTransfer(t *testing.T) {
- key, memKey, ctx, encCfg, authKeeper, bankKeeper := testutil.PrepareFbridgeTest(t)
+ key, memKey, ctx, encCfg, authKeeper, bankKeeper, _ := testutil.PrepareFbridgeTest(t, 0)
sender := sdk.AccAddress("test")
amt := sdk.NewInt(1000000)
denom := "stake"
token := sdk.Coins{sdk.Coin{Denom: denom, Amount: amt}}
- bridge := authtypes.NewEmptyModuleAccount("fbridge")
- authKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(bridge.GetAddress()).AnyTimes()
bankKeeper.EXPECT().IsSendEnabledCoins(ctx, token).Return(nil)
bankKeeper.EXPECT().SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, token).Return(nil)
bankKeeper.EXPECT().BurnCoins(ctx, types.ModuleName, token).Return(nil)
diff --git a/x/fbridge/module/module.go b/x/fbridge/module/module.go
index 2f5464557e..72d43c88f3 100644
--- a/x/fbridge/module/module.go
+++ b/x/fbridge/module/module.go
@@ -89,7 +89,7 @@ type AppModule struct {
}
// NewAppModule creates a new AppModule object
-func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule {
+func NewAppModule(_ codec.Codec, keeper keeper.Keeper) AppModule {
return AppModule{
keeper: keeper,
}
@@ -125,19 +125,19 @@ func (AppModule) ConsensusVersion() uint64 { return consensusVersion }
// BeginBlock returns the begin blocker for the fbridge module.
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
- BeginBlocker(ctx, am.keeper)
+ am.keeper.BeginBlocker(ctx)
}
// EndBlock returns the end blocker for the fbridge module.
// It returns no validator updates.
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
- EndBlocker(ctx, am.keeper)
+ am.keeper.EndBlocker(ctx)
return []abci.ValidatorUpdate{}
}
// RegisterInvariants does nothing, there are no invariants to enforce
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
- RegisterInvariants(ir, am.keeper)
+ keeper.RegisterInvariants(ir, am.keeper)
}
// Deprecated: Route does nothing.
diff --git a/x/fbridge/testutil/setup.go b/x/fbridge/testutil/setup.go
index 78205b2737..6b4ef7dc22 100644
--- a/x/fbridge/testutil/setup.go
+++ b/x/fbridge/testutil/setup.go
@@ -1,6 +1,8 @@
package testutil
import (
+ "github.com/Finschia/finschia-sdk/crypto/keys/secp256k1"
+ authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
"testing"
"github.com/golang/mock/gomock"
@@ -20,11 +22,12 @@ import (
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
-func DefaultContextWithDB(tb testing.TB, key, tkey storetypes.StoreKey) sdk.Context {
+func DefaultContextWithDB(tb testing.TB, key, mkey, tkey storetypes.StoreKey) sdk.Context {
tb.Helper()
db := dbm.NewMemDB()
cms := store.NewCommitMultiStore(db)
cms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db)
+ cms.MountStoreWithDB(mkey, storetypes.StoreTypeMemory, db)
cms.MountStoreWithDB(tkey, storetypes.StoreTypeTransient, db)
err := cms.LoadLatestVersion()
assert.NoError(tb, err)
@@ -60,17 +63,23 @@ func MakeTestEncodingConfig() TestEncodingConfig {
return encCfg
}
-func PrepareFbridgeTest(tb testing.TB) (*sdk.KVStoreKey, *sdk.MemoryStoreKey, sdk.Context, TestEncodingConfig, *MockAccountKeeper, *MockBankKeeper) {
+func PrepareFbridgeTest(tb testing.TB, n int) (*sdk.KVStoreKey, *sdk.MemoryStoreKey, sdk.Context, TestEncodingConfig, *MockAccountKeeper, *MockBankKeeper, []sdk.AccAddress) {
tb.Helper()
ctrl := gomock.NewController(tb)
key := storetypes.NewKVStoreKey(types.StoreKey)
memKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)
- ctx := DefaultContextWithDB(tb, key, sdk.NewTransientStoreKey("transient_test"))
+ ctx := DefaultContextWithDB(tb, key, memKey, sdk.NewTransientStoreKey("transient_test"))
encCfg := MakeTestEncodingConfig()
authKeeper := NewMockAccountKeeper(ctrl)
+ authKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(authtypes.NewEmptyModuleAccount("fbridge").GetAddress()).AnyTimes()
bankKeeper := NewMockBankKeeper(ctrl)
- return key, memKey, ctx, encCfg, authKeeper, bankKeeper
+ addrs := make([]sdk.AccAddress, n)
+ for i := 0; i < n; i++ {
+ addrs[i] = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address())
+ }
+
+ return key, memKey, ctx, encCfg, authKeeper, bankKeeper, addrs
}
From 7cb04696b26d38fa91f39e9288a453b1b53f864f Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 04:00:51 +0900
Subject: [PATCH 32/49] merge `halt` with `resume` as `set-bridge-status`
---
client/docs/swagger-ui/swagger.yaml | 108 ++++++
docs/core/proto-docs.md | 74 ++--
proto/lbm/fbridge/v1/query.proto | 12 +
proto/lbm/fbridge/v1/tx.proto | 22 +-
x/fbridge/client/cli/query.go | 40 +-
x/fbridge/client/cli/tx.go | 47 +--
x/fbridge/keeper/auth.go | 6 +
x/fbridge/keeper/grpc_query.go | 9 +
x/fbridge/keeper/msg_server.go | 21 +-
x/fbridge/types/codec.go | 6 +-
x/fbridge/types/msgs.go | 19 +-
x/fbridge/types/query.pb.go | 538 ++++++++++++++++++++++-----
x/fbridge/types/query.pb.gw.go | 62 ++++
x/fbridge/types/tx.pb.go | 549 +++++++---------------------
14 files changed, 876 insertions(+), 637 deletions(-)
diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml
index 62f62be964..de9fab3eff 100644
--- a/client/docs/swagger-ui/swagger.yaml
+++ b/client/docs/swagger-ui/swagger.yaml
@@ -30783,6 +30783,65 @@ paths:
format: byte
tags:
- Query
+ /lbm/fbridge/v1/status:
+ get:
+ summary: BridgeStatus queries the status of the bridge
+ operationId: BridgeStatus
+ responses:
+ '200':
+ description: A successful response.
+ schema:
+ type: object
+ properties:
+ status:
+ type: string
+ enum:
+ - BRIDGE_STATUS_UNSPECIFIED
+ - BRIDGE_STATUS_ACTIVE
+ - BRIDGE_STATUS_INACTIVE
+ default: BRIDGE_STATUS_UNSPECIFIED
+ description: |2-
+ - BRIDGE_STATUS_UNSPECIFIED: BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status.
+ - BRIDGE_STATUS_ACTIVE: BRIDGE_STATUS_ACTIVE defines an active bridge status.
+ - BRIDGE_STATUS_INACTIVE: BRIDGE_STATUS_INACTIVE defines an inactive bridge status.
+ metadata:
+ type: object
+ properties:
+ inactive:
+ type: string
+ format: uint64
+ title: the number of inactived bridge switch
+ active:
+ type: string
+ format: uint64
+ title: the number of activated bridge switch
+ description: >-
+ BridgeStatusMetadata defines the metadata of the bridge
+ status.
+ 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
@@ -50328,6 +50387,29 @@ definitions:
minimum_gas_price:
type: string
description: ConfigResponse defines the response structure for the Config gRPC query.
+ lbm.fbridge.v1.BridgeStatus:
+ type: string
+ enum:
+ - BRIDGE_STATUS_UNSPECIFIED
+ - BRIDGE_STATUS_ACTIVE
+ - BRIDGE_STATUS_INACTIVE
+ default: BRIDGE_STATUS_UNSPECIFIED
+ description: |2-
+ - BRIDGE_STATUS_UNSPECIFIED: BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status.
+ - BRIDGE_STATUS_ACTIVE: BRIDGE_STATUS_ACTIVE defines an active bridge status.
+ - BRIDGE_STATUS_INACTIVE: BRIDGE_STATUS_INACTIVE defines an inactive bridge status.
+ lbm.fbridge.v1.BridgeStatusMetadata:
+ type: object
+ properties:
+ inactive:
+ type: string
+ format: uint64
+ title: the number of inactived bridge switch
+ active:
+ type: string
+ format: uint64
+ title: the number of activated bridge switch
+ description: BridgeStatusMetadata defines the metadata of the bridge status.
lbm.fbridge.v1.Fraction:
type: object
properties:
@@ -50420,6 +50502,32 @@ definitions:
To optimize computational cost, we have collected frequently changing
values from provision.
+ lbm.fbridge.v1.QueryBridgeStatusResponse:
+ type: object
+ properties:
+ status:
+ type: string
+ enum:
+ - BRIDGE_STATUS_UNSPECIFIED
+ - BRIDGE_STATUS_ACTIVE
+ - BRIDGE_STATUS_INACTIVE
+ default: BRIDGE_STATUS_UNSPECIFIED
+ description: |2-
+ - BRIDGE_STATUS_UNSPECIFIED: BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status.
+ - BRIDGE_STATUS_ACTIVE: BRIDGE_STATUS_ACTIVE defines an active bridge status.
+ - BRIDGE_STATUS_INACTIVE: BRIDGE_STATUS_INACTIVE defines an inactive bridge status.
+ metadata:
+ type: object
+ properties:
+ inactive:
+ type: string
+ format: uint64
+ title: the number of inactived bridge switch
+ active:
+ type: string
+ format: uint64
+ title: the number of activated bridge switch
+ description: BridgeStatusMetadata defines the metadata of the bridge status.
lbm.fbridge.v1.QueryCommitmentsResponse:
type: object
properties:
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 9d9ce0e03c..5a8121cdf8 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -789,6 +789,8 @@
- [SendingState](#lbm.fbridge.v1.SendingState)
- [lbm/fbridge/v1/query.proto](#lbm/fbridge/v1/query.proto)
+ - [QueryBridgeStatusRequest](#lbm.fbridge.v1.QueryBridgeStatusRequest)
+ - [QueryBridgeStatusResponse](#lbm.fbridge.v1.QueryBridgeStatusResponse)
- [QueryCommitmentsRequest](#lbm.fbridge.v1.QueryCommitmentsRequest)
- [QueryCommitmentsResponse](#lbm.fbridge.v1.QueryCommitmentsResponse)
- [QueryConfirmedProvisionRequest](#lbm.fbridge.v1.QueryConfirmedProvisionRequest)
@@ -829,8 +831,6 @@
- [MsgClaimBatch](#lbm.fbridge.v1.MsgClaimBatch)
- [MsgClaimBatchResponse](#lbm.fbridge.v1.MsgClaimBatchResponse)
- [MsgClaimResponse](#lbm.fbridge.v1.MsgClaimResponse)
- - [MsgHalt](#lbm.fbridge.v1.MsgHalt)
- - [MsgHaltResponse](#lbm.fbridge.v1.MsgHaltResponse)
- [MsgHoldTransfer](#lbm.fbridge.v1.MsgHoldTransfer)
- [MsgHoldTransferResponse](#lbm.fbridge.v1.MsgHoldTransferResponse)
- [MsgProvision](#lbm.fbridge.v1.MsgProvision)
@@ -839,8 +839,8 @@
- [MsgReleaseTransferResponse](#lbm.fbridge.v1.MsgReleaseTransferResponse)
- [MsgRemoveProvision](#lbm.fbridge.v1.MsgRemoveProvision)
- [MsgRemoveProvisionResponse](#lbm.fbridge.v1.MsgRemoveProvisionResponse)
- - [MsgResume](#lbm.fbridge.v1.MsgResume)
- - [MsgResumeResponse](#lbm.fbridge.v1.MsgResumeResponse)
+ - [MsgSetBridgeStatus](#lbm.fbridge.v1.MsgSetBridgeStatus)
+ - [MsgSetBridgeStatusResponse](#lbm.fbridge.v1.MsgSetBridgeStatusResponse)
- [MsgSuggestRole](#lbm.fbridge.v1.MsgSuggestRole)
- [MsgSuggestRoleResponse](#lbm.fbridge.v1.MsgSuggestRoleResponse)
- [MsgTransfer](#lbm.fbridge.v1.MsgTransfer)
@@ -11907,6 +11907,32 @@ GenesisState defines the fbridge module's genesis state.
+
+
+### QueryBridgeStatusRequest
+
+
+
+
+
+
+
+
+
+### QueryBridgeStatusResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `status` | [BridgeStatus](#lbm.fbridge.v1.BridgeStatus) | | |
+| `metadata` | [BridgeStatusMetadata](#lbm.fbridge.v1.BridgeStatusMetadata) | | |
+
+
+
+
+
+
### QueryCommitmentsRequest
@@ -12376,6 +12402,7 @@ GenesisState defines the fbridge module's genesis state.
| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/proposals/{proposal_id}|
| `Vote` | [QueryVoteRequest](#lbm.fbridge.v1.QueryVoteRequest) | [QueryVoteResponse](#lbm.fbridge.v1.QueryVoteResponse) | Vote queries voted information based on proposalID, voterAddr. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}|
| `Votes` | [QueryVotesRequest](#lbm.fbridge.v1.QueryVotesRequest) | [QueryVotesResponse](#lbm.fbridge.v1.QueryVotesResponse) | Votes queries votes of a given proposal. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes|
+| `BridgeStatus` | [QueryBridgeStatusRequest](#lbm.fbridge.v1.QueryBridgeStatusRequest) | [QueryBridgeStatusResponse](#lbm.fbridge.v1.QueryBridgeStatusResponse) | BridgeStatus queries the status of the bridge | GET|/lbm/fbridge/v1/status|
@@ -12467,31 +12494,6 @@ MsgClaimBatch is input values required for claiming multiple claimable provision
-
-
-### MsgHalt
-MsgHalt is input values required for halting the bridge module
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| `guardian` | [string](#string) | | the guardian address |
-
-
-
-
-
-
-
-
-### MsgHaltResponse
-
-
-
-
-
-
-
### MsgHoldTransfer
@@ -12599,24 +12601,25 @@ MsgRemoveProvision is input values required for removing a specific confirmed pr
-
+
-### MsgResume
-MsgResume is input values required for resuming the bridge module
+### MsgSetBridgeStatus
+MsgSetBridgeStatus is input values required for setting the status of the bridge module
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `guardian` | [string](#string) | | the guardian address |
+| `status` | [BridgeStatus](#lbm.fbridge.v1.BridgeStatus) | | |
-
+
-### MsgResumeResponse
+### MsgSetBridgeStatusResponse
@@ -12700,8 +12703,7 @@ MsgTransfer is input values required for bridge transfer
| `Claim` | [MsgClaim](#lbm.fbridge.v1.MsgClaim) | [MsgClaimResponse](#lbm.fbridge.v1.MsgClaimResponse) | Claim processes the claiming of a provision with a specific sequence number | |
| `SuggestRole` | [MsgSuggestRole](#lbm.fbridge.v1.MsgSuggestRole) | [MsgSuggestRoleResponse](#lbm.fbridge.v1.MsgSuggestRoleResponse) | SuggestRole suggests updating the role of an address in the bridge module. The role can be one of the following: guardian, operator, judge. The proposal will be passed only with the consent of +2/3 Guardian members. | |
| `AddVoteForRole` | [MsgAddVoteForRole](#lbm.fbridge.v1.MsgAddVoteForRole) | [MsgAddVoteForRoleResponse](#lbm.fbridge.v1.MsgAddVoteForRoleResponse) | AddVoteForRole adds a vote for a role change proposal. | |
-| `Halt` | [MsgHalt](#lbm.fbridge.v1.MsgHalt) | [MsgHaltResponse](#lbm.fbridge.v1.MsgHaltResponse) | Halt the bridge module. | |
-| `Resume` | [MsgResume](#lbm.fbridge.v1.MsgResume) | [MsgResumeResponse](#lbm.fbridge.v1.MsgResumeResponse) | Resume the bridge module. | |
+| `SetBridgeStatus` | [MsgSetBridgeStatus](#lbm.fbridge.v1.MsgSetBridgeStatus) | [MsgSetBridgeStatusResponse](#lbm.fbridge.v1.MsgSetBridgeStatusResponse) | SetBridgeStatus operates a switch to halt/resume the bridge module. If the ratio of active bridge switches does not exceed TrustLevel, the bridge module halts. | |
diff --git a/proto/lbm/fbridge/v1/query.proto b/proto/lbm/fbridge/v1/query.proto
index bc79974847..b59d513956 100644
--- a/proto/lbm/fbridge/v1/query.proto
+++ b/proto/lbm/fbridge/v1/query.proto
@@ -87,6 +87,11 @@ service Query {
rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) {
option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}/votes";
}
+
+ // BridgeStatus queries the status of the bridge
+ rpc BridgeStatus(QueryBridgeStatusRequest) returns (QueryBridgeStatusResponse) {
+ option (google.api.http).get = "/lbm/fbridge/v1/status";
+ }
}
message QueryParamsRequest {}
@@ -227,3 +232,10 @@ message QueryVotesResponse {
// votes defined the queried votes.
repeated Vote votes = 1 [(gogoproto.nullable) = false];
}
+
+message QueryBridgeStatusRequest {}
+
+message QueryBridgeStatusResponse {
+ BridgeStatus status = 1;
+ BridgeStatusMetadata metadata = 2 [(gogoproto.nullable) = false];
+}
diff --git a/proto/lbm/fbridge/v1/tx.proto b/proto/lbm/fbridge/v1/tx.proto
index 364a773ff6..3bf8234a5e 100644
--- a/proto/lbm/fbridge/v1/tx.proto
+++ b/proto/lbm/fbridge/v1/tx.proto
@@ -36,11 +36,9 @@ service Msg {
// AddVoteForRole adds a vote for a role change proposal.
rpc AddVoteForRole(MsgAddVoteForRole) returns (MsgAddVoteForRoleResponse);
- // Halt the bridge module.
- rpc Halt(MsgHalt) returns (MsgHaltResponse);
-
- // Resume the bridge module.
- rpc Resume(MsgResume) returns (MsgResumeResponse);
+ // SetBridgeStatus operates a switch to halt/resume the bridge module.
+ // If the ratio of active bridge switches does not exceed TrustLevel, the bridge module halts.
+ rpc SetBridgeStatus(MsgSetBridgeStatus) returns (MsgSetBridgeStatusResponse);
}
// MsgTransfer is input values required for bridge transfer
@@ -150,18 +148,12 @@ message MsgAddVoteForRole {
message MsgAddVoteForRoleResponse {}
-// MsgHalt is input values required for halting the bridge module
-message MsgHalt {
+// MsgSetBridgeStatus is input values required for setting the status of the bridge module
+message MsgSetBridgeStatus {
// the guardian address
string guardian = 1;
-}
-
-message MsgHaltResponse {}
-// MsgResume is input values required for resuming the bridge module
-message MsgResume {
- // the guardian address
- string guardian = 1;
+ BridgeStatus status = 2;
}
-message MsgResumeResponse {}
+message MsgSetBridgeStatusResponse {}
diff --git a/x/fbridge/client/cli/query.go b/x/fbridge/client/cli/query.go
index 866d4cca21..19708afb6e 100644
--- a/x/fbridge/client/cli/query.go
+++ b/x/fbridge/client/cli/query.go
@@ -29,10 +29,11 @@ func NewQueryCmd() *cobra.Command {
NewQuerySeqToBlocknumsCmd(),
NewQueryMembersCmd(),
NewQueryMemberCmd(),
- NewProposalsCmd(),
- NewProposalCmd(),
- NewVotesCmd(),
- NewVoteCmd(),
+ NewQueryProposalsCmd(),
+ NewQueryProposalCmd(),
+ NewQueryVotesCmd(),
+ NewQueryVoteCmd(),
+ NewQueryBridgeStatusCmd(),
)
return cmd
@@ -175,7 +176,7 @@ func NewQueryMemberCmd() *cobra.Command {
return cmd
}
-func NewProposalsCmd() *cobra.Command {
+func NewQueryProposalsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "proposals",
Short: "Query all role proposals",
@@ -206,7 +207,7 @@ func NewProposalsCmd() *cobra.Command {
return cmd
}
-func NewProposalCmd() *cobra.Command {
+func NewQueryProposalCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "proposal [proposal_id]",
Short: "Query a specific role proposal",
@@ -237,7 +238,7 @@ func NewProposalCmd() *cobra.Command {
return cmd
}
-func NewVotesCmd() *cobra.Command {
+func NewQueryVotesCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "votes [proposal_id]",
Short: "Query all votes for a specific role proposal",
@@ -268,7 +269,7 @@ func NewVotesCmd() *cobra.Command {
return cmd
}
-func NewVoteCmd() *cobra.Command {
+func NewQueryVoteCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "vote [proposal_id] [voter]",
Short: "Query a specific vote for a role proposal",
@@ -298,3 +299,26 @@ func NewVoteCmd() *cobra.Command {
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
+
+func NewQueryBridgeStatusCmd() *cobra.Command {
+ cmd := &cobra.Command{
+ Use: "status",
+ Short: "Query the current status of the bridge",
+ Args: cobra.NoArgs,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, err := client.GetClientQueryContext(cmd)
+ if err != nil {
+ return err
+ }
+ qc := types.NewQueryClient(clientCtx)
+ res, err := qc.BridgeStatus(cmd.Context(), &types.QueryBridgeStatusRequest{})
+ if err != nil {
+ return err
+ }
+ return clientCtx.PrintProto(res)
+ },
+ }
+
+ flags.AddQueryFlagsToCmd(cmd)
+ return cmd
+}
diff --git a/x/fbridge/client/cli/tx.go b/x/fbridge/client/cli/tx.go
index a76cfac125..fef1a3dda8 100644
--- a/x/fbridge/client/cli/tx.go
+++ b/x/fbridge/client/cli/tx.go
@@ -28,8 +28,7 @@ func NewTxCmd() *cobra.Command {
NewTransferTxCmd(),
NewSuggestRoleTxCmd(),
NewAddVoteForRoleTxCmd(),
- NewHaltTxCmd(),
- NewResumeTxCmd(),
+ NewSetBridgeStatusTxCmd(),
)
return TxCmd
@@ -154,12 +153,13 @@ func NewAddVoteForRoleTxCmd() *cobra.Command {
return cmd
}
-func NewHaltTxCmd() *cobra.Command {
+func NewSetBridgeStatusTxCmd() *cobra.Command {
cmd := &cobra.Command{
- Use: "halt",
- Short: `Activate sender's halting switch for the bridge module`,
- Args: cobra.NoArgs,
- Example: fmt.Sprintf("%s tx %s halt --from guardiankey", version.AppName, types.ModuleName),
+ Use: "set-bridge-status [status]",
+ Short: `Set sender's bridge switch for halting/resuming the bridge module. Each guardian has their own switch. (halt|resume)`,
+ Args: cobra.ExactArgs(1),
+ Example: fmt.Sprintf("%s tx %s set-bridge-status halt --from guardiankey\n"+
+ "%s tx %s set-bridge-status resume --from guardiankey\n", version.AppName, types.ModuleName, version.AppName, types.ModuleName),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
@@ -170,37 +170,14 @@ func NewHaltTxCmd() *cobra.Command {
return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", from)
}
- msg := types.MsgHalt{
- Guardian: from,
- }
-
- return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
- },
- }
-
- flags.AddTxFlagsToCmd(cmd)
-
- return cmd
-}
-
-func NewResumeTxCmd() *cobra.Command {
- cmd := &cobra.Command{
- Use: "resume",
- Short: `Activate sender's resuming switch for the bridge module`,
- Args: cobra.NoArgs,
- Example: fmt.Sprintf("%s tx %s resume --from guardiankey", version.AppName, types.ModuleName),
- RunE: func(cmd *cobra.Command, args []string) error {
- clientCtx, err := client.GetClientTxContext(cmd)
- if err != nil {
- return err
- }
- from := clientCtx.GetFromAddress().String()
- if _, err := sdk.AccAddressFromBech32(from); err != nil {
- return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", from)
+ conv := map[string]types.BridgeStatus{
+ "halt": types.StatusInactive,
+ "resume": types.StatusActive,
}
- msg := types.MsgResume{
+ msg := types.MsgSetBridgeStatus{
Guardian: from,
+ Status: conv[args[0]],
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index 2a5dafebdb..fddfed7879 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -253,6 +253,12 @@ func (k Keeper) UpdateBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, sta
return sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action")
}
+ if sw, err := k.GetBridgeSwitch(ctx, guardian); err == nil && sw.Status == status {
+ return sdkerrors.ErrInvalidRequest.Wrapf("%s already set %s", guardian, status)
+ } else if err != nil {
+ return err
+ }
+
bsMeta := k.GetBridgeStatusMetadata(ctx)
switch status {
case types.StatusActive:
diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go
index e0785ddc28..176663ef06 100644
--- a/x/fbridge/keeper/grpc_query.go
+++ b/x/fbridge/keeper/grpc_query.go
@@ -186,3 +186,12 @@ func (k Keeper) Vote(goCtx context.Context, req *types.QueryVoteRequest) (*types
return &types.QueryVoteResponse{Vote: types.Vote{ProposalId: req.ProposalId, Voter: req.Voter, Option: opt}}, nil
}
+
+func (k Keeper) BridgeStatus(goCtx context.Context, req *types.QueryBridgeStatusRequest) (*types.QueryBridgeStatusResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "empty request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ return &types.QueryBridgeStatusResponse{Status: k.GetBridgeStatus(ctx), Metadata: k.GetBridgeStatusMetadata(ctx)}, nil
+}
diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go
index c17bfbbe23..1c6b6327f6 100644
--- a/x/fbridge/keeper/msg_server.go
+++ b/x/fbridge/keeper/msg_server.go
@@ -133,7 +133,7 @@ func (m msgServer) AddVoteForRole(goCtx context.Context, msg *types.MsgAddVoteFo
return &types.MsgAddVoteForRoleResponse{}, nil
}
-func (m msgServer) Halt(goCtx context.Context, msg *types.MsgHalt) (*types.MsgHaltResponse, error) {
+func (m msgServer) SetBridgeStatus(goCtx context.Context, msg *types.MsgSetBridgeStatus) (*types.MsgSetBridgeStatusResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
addr, err := sdk.AccAddressFromBech32(msg.Guardian)
@@ -141,24 +141,9 @@ func (m msgServer) Halt(goCtx context.Context, msg *types.MsgHalt) (*types.MsgHa
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid guardian address (%s)", err)
}
- if err := m.UpdateBridgeSwitch(ctx, addr, types.StatusInactive); err != nil {
+ if err := m.UpdateBridgeSwitch(ctx, addr, msg.Status); err != nil {
return nil, err
}
- return &types.MsgHaltResponse{}, nil
-}
-
-func (m msgServer) Resume(goCtx context.Context, msg *types.MsgResume) (*types.MsgResumeResponse, error) {
- ctx := sdk.UnwrapSDKContext(goCtx)
-
- addr, err := sdk.AccAddressFromBech32(msg.Guardian)
- if err != nil {
- return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid guardian address (%s)", err)
- }
-
- if err := m.UpdateBridgeSwitch(ctx, addr, types.StatusActive); err != nil {
- return nil, err
- }
-
- return &types.MsgResumeResponse{}, nil
+ return &types.MsgSetBridgeStatusResponse{}, nil
}
diff --git a/x/fbridge/types/codec.go b/x/fbridge/types/codec.go
index c2edd215be..745a212112 100644
--- a/x/fbridge/types/codec.go
+++ b/x/fbridge/types/codec.go
@@ -22,8 +22,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
legacy.RegisterAminoMsg(cdc, &MsgClaim{}, "lbm-sdk/MsgClaim")
legacy.RegisterAminoMsg(cdc, &MsgSuggestRole{}, "lbm-sdk/MsgSuggestRole")
legacy.RegisterAminoMsg(cdc, &MsgAddVoteForRole{}, "lbm-sdk/MsgAddVoteForRole")
- legacy.RegisterAminoMsg(cdc, &MsgHalt{}, "lbm-sdk/MsgHalt")
- legacy.RegisterAminoMsg(cdc, &MsgResume{}, "lbm-sdk/MsgResume")
+ legacy.RegisterAminoMsg(cdc, &MsgSetBridgeStatus{}, "lbm-sdk/MsgSetBridgeStatus")
}
func RegisterInterfaces(registrar types.InterfaceRegistry) {
@@ -38,8 +37,7 @@ func RegisterInterfaces(registrar types.InterfaceRegistry) {
&MsgClaim{},
&MsgSuggestRole{},
&MsgAddVoteForRole{},
- &MsgHalt{},
- &MsgResume{},
+ &MsgSetBridgeStatus{},
)
msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc)
diff --git a/x/fbridge/types/msgs.go b/x/fbridge/types/msgs.go
index b43bb32c9e..979176c073 100644
--- a/x/fbridge/types/msgs.go
+++ b/x/fbridge/types/msgs.go
@@ -12,8 +12,7 @@ var (
_ sdk.Msg = &MsgClaim{}
_ sdk.Msg = &MsgSuggestRole{}
_ sdk.Msg = &MsgAddVoteForRole{}
- _ sdk.Msg = &MsgHalt{}
- _ sdk.Msg = &MsgResume{}
+ _ sdk.Msg = &MsgSetBridgeStatus{}
)
func (m MsgTransfer) ValidateBasic() error { return nil }
@@ -106,22 +105,12 @@ func (m MsgAddVoteForRole) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}
-func (m MsgHalt) ValidateBasic() error { return nil }
+func (m MsgSetBridgeStatus) ValidateBasic() error { return nil }
-func (m MsgHalt) GetSigners() []sdk.AccAddress {
+func (m MsgSetBridgeStatus) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Guardian)}
}
-func (m MsgHalt) GetSignBytes() []byte {
- return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
-}
-
-func (m MsgResume) ValidateBasic() error { return nil }
-
-func (m MsgResume) GetSigners() []sdk.AccAddress {
- return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Guardian)}
-}
-
-func (m MsgResume) GetSignBytes() []byte {
+func (m MsgSetBridgeStatus) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}
diff --git a/x/fbridge/types/query.pb.go b/x/fbridge/types/query.pb.go
index 10eb5c6310..e0aa3d380a 100644
--- a/x/fbridge/types/query.pb.go
+++ b/x/fbridge/types/query.pb.go
@@ -1399,6 +1399,94 @@ func (m *QueryVotesResponse) GetVotes() []Vote {
return nil
}
+type QueryBridgeStatusRequest struct {
+}
+
+func (m *QueryBridgeStatusRequest) Reset() { *m = QueryBridgeStatusRequest{} }
+func (m *QueryBridgeStatusRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryBridgeStatusRequest) ProtoMessage() {}
+func (*QueryBridgeStatusRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5e7780f9db9d346e, []int{30}
+}
+func (m *QueryBridgeStatusRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryBridgeStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryBridgeStatusRequest.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 *QueryBridgeStatusRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryBridgeStatusRequest.Merge(m, src)
+}
+func (m *QueryBridgeStatusRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryBridgeStatusRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryBridgeStatusRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryBridgeStatusRequest proto.InternalMessageInfo
+
+type QueryBridgeStatusResponse struct {
+ Status BridgeStatus `protobuf:"varint,1,opt,name=status,proto3,enum=lbm.fbridge.v1.BridgeStatus" json:"status,omitempty"`
+ Metadata BridgeStatusMetadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata"`
+}
+
+func (m *QueryBridgeStatusResponse) Reset() { *m = QueryBridgeStatusResponse{} }
+func (m *QueryBridgeStatusResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryBridgeStatusResponse) ProtoMessage() {}
+func (*QueryBridgeStatusResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_5e7780f9db9d346e, []int{31}
+}
+func (m *QueryBridgeStatusResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryBridgeStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryBridgeStatusResponse.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 *QueryBridgeStatusResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryBridgeStatusResponse.Merge(m, src)
+}
+func (m *QueryBridgeStatusResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryBridgeStatusResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryBridgeStatusResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryBridgeStatusResponse proto.InternalMessageInfo
+
+func (m *QueryBridgeStatusResponse) GetStatus() BridgeStatus {
+ if m != nil {
+ return m.Status
+ }
+ return StatusEmpty
+}
+
+func (m *QueryBridgeStatusResponse) GetMetadata() BridgeStatusMetadata {
+ if m != nil {
+ return m.Metadata
+ }
+ return BridgeStatusMetadata{}
+}
+
func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "lbm.fbridge.v1.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "lbm.fbridge.v1.QueryParamsResponse")
@@ -1430,97 +1518,103 @@ func init() {
proto.RegisterType((*QueryVoteResponse)(nil), "lbm.fbridge.v1.QueryVoteResponse")
proto.RegisterType((*QueryVotesRequest)(nil), "lbm.fbridge.v1.QueryVotesRequest")
proto.RegisterType((*QueryVotesResponse)(nil), "lbm.fbridge.v1.QueryVotesResponse")
+ proto.RegisterType((*QueryBridgeStatusRequest)(nil), "lbm.fbridge.v1.QueryBridgeStatusRequest")
+ proto.RegisterType((*QueryBridgeStatusResponse)(nil), "lbm.fbridge.v1.QueryBridgeStatusResponse")
}
func init() { proto.RegisterFile("lbm/fbridge/v1/query.proto", fileDescriptor_5e7780f9db9d346e) }
var fileDescriptor_5e7780f9db9d346e = []byte{
- // 1347 bytes of a gzipped FileDescriptorProto
+ // 1422 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcf, 0x6f, 0x1b, 0x45,
- 0x14, 0xce, 0xb6, 0x6e, 0xda, 0x3c, 0x4b, 0x55, 0x19, 0xdc, 0x36, 0xdd, 0x06, 0x3b, 0xd9, 0xfe,
- 0x48, 0xd3, 0x34, 0x3b, 0xb6, 0xdb, 0x12, 0x44, 0x7f, 0x50, 0x25, 0x90, 0xaa, 0xa0, 0x96, 0xe2,
- 0x54, 0x20, 0x71, 0x89, 0xd6, 0xde, 0xa9, 0xbb, 0xaa, 0x77, 0xc7, 0xde, 0x59, 0x5b, 0xad, 0x82,
- 0x2f, 0x48, 0x48, 0xc0, 0x09, 0x09, 0x10, 0xe2, 0xcc, 0x85, 0xbf, 0x01, 0x89, 0x7b, 0xc5, 0xa9,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0x93, 0x9c, 0xee, 0xf6, 0xb8, 0xa2,
+ 0x3d, 0xf2, 0x8d, 0x06, 0xb9, 0xd0, 0xd2, 0x90, 0x85, 0x54, 0x82, 0x1e, 0x87, 0xa7, 0x2f, 0x0e,
+ 0x41, 0x20, 0xfd, 0x4d, 0x49, 0xbf, 0x4e, 0xae, 0x8d, 0x49, 0x4f, 0xa5, 0x83, 0xa2, 0xbb, 0xd2,
+ 0x0b, 0xee, 0x91, 0x2f, 0x35, 0x38, 0x22, 0xdd, 0x18, 0xc9, 0xe6, 0x8a, 0xcf, 0xc3, 0x18, 0x06,
+ 0x41, 0x3d, 0xd7, 0xa4, 0x1e, 0x4a, 0x56, 0x0f, 0xa4, 0x87, 0x7c, 0xa1, 0xc1, 0x6b, 0xbd, 0x16,
+ 0x8a, 0xa4, 0xbf, 0x83, 0x29, 0x86, 0x4f, 0x5f, 0x1e, 0x03, 0x39, 0xca, 0x22, 0x45, 0x3e, 0x6f,
+ 0xe3, 0xfd, 0x17, 0xaf, 0x0a, 0xda, 0xcb, 0x57, 0x05, 0xed, 0xef, 0x57, 0x05, 0xed, 0xdb, 0xfd,
+ 0xc2, 0xc4, 0xcb, 0xfd, 0xc2, 0xc4, 0x9f, 0xfb, 0x85, 0x89, 0x4f, 0xd7, 0xea, 0x4e, 0xf0, 0xb8,
+ 0x5d, 0x35, 0x6b, 0xdc, 0xa5, 0x5b, 0x8e, 0x27, 0x6a, 0x8f, 0x1d, 0x8b, 0x3e, 0xc2, 0xc5, 0xaa,
+ 0xb0, 0x9f, 0xd0, 0xa7, 0x71, 0xbe, 0xe0, 0x59, 0x93, 0x89, 0xea, 0xa4, 0xfc, 0x13, 0xeb, 0xca,
+ 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb3, 0xe6, 0xb2, 0x67, 0x70, 0x13, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1568,6 +1662,8 @@ type QueryClient interface {
Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error)
// Votes queries votes of a given proposal.
Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error)
+ // BridgeStatus queries the status of the bridge
+ BridgeStatus(ctx context.Context, in *QueryBridgeStatusRequest, opts ...grpc.CallOption) (*QueryBridgeStatusResponse, error)
}
type queryClient struct {
@@ -1713,6 +1809,15 @@ func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...
return out, nil
}
+func (c *queryClient) BridgeStatus(ctx context.Context, in *QueryBridgeStatusRequest, opts ...grpc.CallOption) (*QueryBridgeStatusResponse, error) {
+ out := new(QueryBridgeStatusResponse)
+ err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/BridgeStatus", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// QueryServer is the server API for Query service.
type QueryServer interface {
// Params queries the parameters of x/fbridge module.
@@ -1748,6 +1853,8 @@ type QueryServer interface {
Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error)
// Votes queries votes of a given proposal.
Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error)
+ // BridgeStatus queries the status of the bridge
+ BridgeStatus(context.Context, *QueryBridgeStatusRequest) (*QueryBridgeStatusResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@@ -1799,6 +1906,9 @@ func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest
func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented")
}
+func (*UnimplementedQueryServer) BridgeStatus(ctx context.Context, req *QueryBridgeStatusRequest) (*QueryBridgeStatusResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method BridgeStatus not implemented")
+}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@@ -2074,6 +2184,24 @@ func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interfa
return interceptor(ctx, in, info, handler)
}
+func _Query_BridgeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryBridgeStatusRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).BridgeStatus(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/lbm.fbridge.v1.Query/BridgeStatus",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).BridgeStatus(ctx, req.(*QueryBridgeStatusRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "lbm.fbridge.v1.Query",
HandlerType: (*QueryServer)(nil),
@@ -2138,6 +2266,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Votes",
Handler: _Query_Votes_Handler,
},
+ {
+ MethodName: "BridgeStatus",
+ Handler: _Query_BridgeStatus_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "lbm/fbridge/v1/query.proto",
@@ -3126,6 +3258,67 @@ func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *QueryBridgeStatusRequest) 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 *QueryBridgeStatusRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryBridgeStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ return len(dAtA) - i, nil
+}
+
+func (m *QueryBridgeStatusResponse) 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 *QueryBridgeStatusResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryBridgeStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ {
+ size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x12
+ if m.Status != 0 {
+ i = encodeVarintQuery(dAtA, i, uint64(m.Status))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
@@ -3532,6 +3725,29 @@ func (m *QueryVotesResponse) Size() (n int) {
return n
}
+func (m *QueryBridgeStatusRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ return n
+}
+
+func (m *QueryBridgeStatusResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Status != 0 {
+ n += 1 + sovQuery(uint64(m.Status))
+ }
+ l = m.Metadata.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ return n
+}
+
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -6115,6 +6331,158 @@ func (m *QueryVotesResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *QueryBridgeStatusRequest) 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: QueryBridgeStatusRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryBridgeStatusRequest: 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 *QueryBridgeStatusResponse) 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: QueryBridgeStatusResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryBridgeStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
+ }
+ m.Status = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Status |= BridgeStatus(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
diff --git a/x/fbridge/types/query.pb.gw.go b/x/fbridge/types/query.pb.gw.go
index 1176aeecf0..30afc929bb 100644
--- a/x/fbridge/types/query.pb.gw.go
+++ b/x/fbridge/types/query.pb.gw.go
@@ -741,6 +741,24 @@ func local_request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshale
}
+func request_Query_BridgeStatus_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryBridgeStatusRequest
+ var metadata runtime.ServerMetadata
+
+ msg, err := client.BridgeStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Query_BridgeStatus_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryBridgeStatusRequest
+ var metadata runtime.ServerMetadata
+
+ msg, err := server.BridgeStatus(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.
@@ -1047,6 +1065,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
+ mux.Handle("GET", pattern_Query_BridgeStatus_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_BridgeStatus_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_BridgeStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -1388,6 +1426,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
+ mux.Handle("GET", pattern_Query_BridgeStatus_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_BridgeStatus_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_BridgeStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -1421,6 +1479,8 @@ var (
pattern_Query_Vote_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", "proposals", "proposal_id", "votes", "voter"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Votes_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", "proposals", "proposal_id", "votes"}, "", runtime.AssumeColonVerbOpt(false)))
+
+ pattern_Query_BridgeStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "status"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
@@ -1453,4 +1513,6 @@ var (
forward_Query_Vote_0 = runtime.ForwardResponseMessage
forward_Query_Votes_0 = runtime.ForwardResponseMessage
+
+ forward_Query_BridgeStatus_0 = runtime.ForwardResponseMessage
)
diff --git a/x/fbridge/types/tx.pb.go b/x/fbridge/types/tx.pb.go
index 384afaef10..8cc462afb1 100644
--- a/x/fbridge/types/tx.pb.go
+++ b/x/fbridge/types/tx.pb.go
@@ -891,24 +891,25 @@ func (m *MsgAddVoteForRoleResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgAddVoteForRoleResponse proto.InternalMessageInfo
-// MsgHalt is input values required for halting the bridge module
-type MsgHalt struct {
+// MsgSetBridgeStatus is input values required for setting the status of the bridge module
+type MsgSetBridgeStatus struct {
// the guardian address
- Guardian string `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
+ Guardian string `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
+ Status BridgeStatus `protobuf:"varint,2,opt,name=status,proto3,enum=lbm.fbridge.v1.BridgeStatus" json:"status,omitempty"`
}
-func (m *MsgHalt) Reset() { *m = MsgHalt{} }
-func (m *MsgHalt) String() string { return proto.CompactTextString(m) }
-func (*MsgHalt) ProtoMessage() {}
-func (*MsgHalt) Descriptor() ([]byte, []int) {
+func (m *MsgSetBridgeStatus) Reset() { *m = MsgSetBridgeStatus{} }
+func (m *MsgSetBridgeStatus) String() string { return proto.CompactTextString(m) }
+func (*MsgSetBridgeStatus) ProtoMessage() {}
+func (*MsgSetBridgeStatus) Descriptor() ([]byte, []int) {
return fileDescriptor_54a336bc5ea063bb, []int{18}
}
-func (m *MsgHalt) XXX_Unmarshal(b []byte) error {
+func (m *MsgSetBridgeStatus) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-func (m *MsgHalt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *MsgSetBridgeStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
- return xxx_messageInfo_MsgHalt.Marshal(b, m, deterministic)
+ return xxx_messageInfo_MsgSetBridgeStatus.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -918,122 +919,47 @@ func (m *MsgHalt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
-func (m *MsgHalt) XXX_Merge(src proto.Message) {
- xxx_messageInfo_MsgHalt.Merge(m, src)
+func (m *MsgSetBridgeStatus) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgSetBridgeStatus.Merge(m, src)
}
-func (m *MsgHalt) XXX_Size() int {
+func (m *MsgSetBridgeStatus) XXX_Size() int {
return m.Size()
}
-func (m *MsgHalt) XXX_DiscardUnknown() {
- xxx_messageInfo_MsgHalt.DiscardUnknown(m)
+func (m *MsgSetBridgeStatus) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgSetBridgeStatus.DiscardUnknown(m)
}
-var xxx_messageInfo_MsgHalt proto.InternalMessageInfo
+var xxx_messageInfo_MsgSetBridgeStatus proto.InternalMessageInfo
-func (m *MsgHalt) GetGuardian() string {
+func (m *MsgSetBridgeStatus) GetGuardian() string {
if m != nil {
return m.Guardian
}
return ""
}
-type MsgHaltResponse struct {
-}
-
-func (m *MsgHaltResponse) Reset() { *m = MsgHaltResponse{} }
-func (m *MsgHaltResponse) String() string { return proto.CompactTextString(m) }
-func (*MsgHaltResponse) ProtoMessage() {}
-func (*MsgHaltResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_54a336bc5ea063bb, []int{19}
-}
-func (m *MsgHaltResponse) XXX_Unmarshal(b []byte) error {
- return m.Unmarshal(b)
-}
-func (m *MsgHaltResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- if deterministic {
- return xxx_messageInfo_MsgHaltResponse.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 *MsgHaltResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_MsgHaltResponse.Merge(m, src)
-}
-func (m *MsgHaltResponse) XXX_Size() int {
- return m.Size()
-}
-func (m *MsgHaltResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_MsgHaltResponse.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_MsgHaltResponse proto.InternalMessageInfo
-
-// MsgResume is input values required for resuming the bridge module
-type MsgResume struct {
- // the guardian address
- Guardian string `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"`
-}
-
-func (m *MsgResume) Reset() { *m = MsgResume{} }
-func (m *MsgResume) String() string { return proto.CompactTextString(m) }
-func (*MsgResume) ProtoMessage() {}
-func (*MsgResume) Descriptor() ([]byte, []int) {
- return fileDescriptor_54a336bc5ea063bb, []int{20}
-}
-func (m *MsgResume) XXX_Unmarshal(b []byte) error {
- return m.Unmarshal(b)
-}
-func (m *MsgResume) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- if deterministic {
- return xxx_messageInfo_MsgResume.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 *MsgResume) XXX_Merge(src proto.Message) {
- xxx_messageInfo_MsgResume.Merge(m, src)
-}
-func (m *MsgResume) XXX_Size() int {
- return m.Size()
-}
-func (m *MsgResume) XXX_DiscardUnknown() {
- xxx_messageInfo_MsgResume.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_MsgResume proto.InternalMessageInfo
-
-func (m *MsgResume) GetGuardian() string {
+func (m *MsgSetBridgeStatus) GetStatus() BridgeStatus {
if m != nil {
- return m.Guardian
+ return m.Status
}
- return ""
+ return StatusEmpty
}
-type MsgResumeResponse struct {
+type MsgSetBridgeStatusResponse struct {
}
-func (m *MsgResumeResponse) Reset() { *m = MsgResumeResponse{} }
-func (m *MsgResumeResponse) String() string { return proto.CompactTextString(m) }
-func (*MsgResumeResponse) ProtoMessage() {}
-func (*MsgResumeResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_54a336bc5ea063bb, []int{21}
+func (m *MsgSetBridgeStatusResponse) Reset() { *m = MsgSetBridgeStatusResponse{} }
+func (m *MsgSetBridgeStatusResponse) String() string { return proto.CompactTextString(m) }
+func (*MsgSetBridgeStatusResponse) ProtoMessage() {}
+func (*MsgSetBridgeStatusResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_54a336bc5ea063bb, []int{19}
}
-func (m *MsgResumeResponse) XXX_Unmarshal(b []byte) error {
+func (m *MsgSetBridgeStatusResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-func (m *MsgResumeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *MsgSetBridgeStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
- return xxx_messageInfo_MsgResumeResponse.Marshal(b, m, deterministic)
+ return xxx_messageInfo_MsgSetBridgeStatusResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -1043,17 +969,17 @@ func (m *MsgResumeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e
return b[:n], nil
}
}
-func (m *MsgResumeResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_MsgResumeResponse.Merge(m, src)
+func (m *MsgSetBridgeStatusResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgSetBridgeStatusResponse.Merge(m, src)
}
-func (m *MsgResumeResponse) XXX_Size() int {
+func (m *MsgSetBridgeStatusResponse) XXX_Size() int {
return m.Size()
}
-func (m *MsgResumeResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_MsgResumeResponse.DiscardUnknown(m)
+func (m *MsgSetBridgeStatusResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgSetBridgeStatusResponse.DiscardUnknown(m)
}
-var xxx_messageInfo_MsgResumeResponse proto.InternalMessageInfo
+var xxx_messageInfo_MsgSetBridgeStatusResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgTransfer)(nil), "lbm.fbridge.v1.MsgTransfer")
@@ -1074,64 +1000,61 @@ func init() {
proto.RegisterType((*MsgSuggestRoleResponse)(nil), "lbm.fbridge.v1.MsgSuggestRoleResponse")
proto.RegisterType((*MsgAddVoteForRole)(nil), "lbm.fbridge.v1.MsgAddVoteForRole")
proto.RegisterType((*MsgAddVoteForRoleResponse)(nil), "lbm.fbridge.v1.MsgAddVoteForRoleResponse")
- proto.RegisterType((*MsgHalt)(nil), "lbm.fbridge.v1.MsgHalt")
- proto.RegisterType((*MsgHaltResponse)(nil), "lbm.fbridge.v1.MsgHaltResponse")
- proto.RegisterType((*MsgResume)(nil), "lbm.fbridge.v1.MsgResume")
- proto.RegisterType((*MsgResumeResponse)(nil), "lbm.fbridge.v1.MsgResumeResponse")
+ proto.RegisterType((*MsgSetBridgeStatus)(nil), "lbm.fbridge.v1.MsgSetBridgeStatus")
+ proto.RegisterType((*MsgSetBridgeStatusResponse)(nil), "lbm.fbridge.v1.MsgSetBridgeStatusResponse")
}
func init() { proto.RegisterFile("lbm/fbridge/v1/tx.proto", fileDescriptor_54a336bc5ea063bb) }
var fileDescriptor_54a336bc5ea063bb = []byte{
- // 764 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcb, 0x4e, 0xdb, 0x4c,
- 0x14, 0x4e, 0xfe, 0x84, 0x40, 0x0e, 0xfc, 0x01, 0x0c, 0x24, 0xc1, 0x40, 0x02, 0x6e, 0x29, 0x14,
- 0xa9, 0x09, 0xa4, 0x8b, 0x4a, 0x5d, 0xb5, 0x41, 0x42, 0x05, 0xd5, 0xa2, 0x72, 0x2f, 0xaa, 0xba,
- 0x28, 0x9a, 0xc4, 0x93, 0xc1, 0xaa, 0xed, 0x49, 0x3d, 0x93, 0x28, 0x95, 0xfa, 0x0a, 0x95, 0xfa,
- 0x04, 0x7d, 0x8a, 0x3e, 0x04, 0x4b, 0x96, 0x55, 0x17, 0xa8, 0x82, 0x17, 0xa9, 0xec, 0x38, 0x83,
- 0x1d, 0xec, 0x04, 0xd4, 0xdd, 0x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 0x11, 0xca, 0x6b, 0x58, 0xde, 0x1c, 0x09, 0x0b, 0xcf, 0x7d, 0x98, 0xe8, 0x47,
- 0xbe, 0x18, 0xc7, 0x97, 0xd7, 0xe3, 0x10, 0x61, 0xf2, 0x16, 0xa6, 0x83, 0x89, 0x2f, 0x45, 0x08,
- 0x02, 0xb8, 0xfc, 0x60, 0x34, 0x2e, 0x6c, 0x3f, 0x42, 0x6e, 0x28, 0xc6, 0x1b, 0x11, 0xca, 0x30,
- 0x45, 0x7e, 0x38, 0x96, 0x22, 0xfc, 0x9f, 0x41, 0xda, 0xcb, 0x62, 0x21, 0x6a, 0x8d, 0x90, 0xc9,
- 0xe5, 0x72, 0x0c, 0x20, 0x1c, 0x0e, 0x20, 0xe3, 0x67, 0x72, 0x39, 0xf2, 0x39, 0xba, 0x90, 0xbc,
- 0x11, 0x0b, 0x0d, 0x7c, 0xea, 0x47, 0x67, 0x97, 0xa5, 0xe4, 0xf9, 0x65, 0x29, 0xf9, 0xe7, 0xb2,
- 0x94, 0xfc, 0x7e, 0x55, 0x4a, 0x9c, 0x5f, 0x95, 0x12, 0xbf, 0xae, 0x4a, 0x89, 0x0f, 0xbb, 0x63,
- 0x5f, 0xa3, 0x3d, 0xf1, 0xb5, 0xe2, 0xbd, 0x50, 0x1b, 0x19, 0xef, 0x4b, 0xe5, 0xf1, 0xdf, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0xad, 0xb2, 0x7b, 0x66, 0x08, 0x09, 0x00, 0x00,
+ // 752 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x4e, 0xdb, 0x4a,
+ 0x14, 0x4e, 0x6e, 0x42, 0x04, 0x07, 0x6e, 0xe0, 0xce, 0x85, 0x10, 0x4c, 0x48, 0xb8, 0xbe, 0xfd,
+ 0xa1, 0x48, 0x4d, 0x20, 0xad, 0x54, 0xa9, 0xbb, 0x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x54, 0xb9, 0x33, 0x0e, 0x95, 0x86, 0x6f, 0x61, 0x2e, 0x32, 0xf1, 0xb5, 0x04, 0x55,
+ 0x98, 0xa0, 0xdc, 0x9f, 0x40, 0x90, 0xce, 0x06, 0xcc, 0xc7, 0xe7, 0x5e, 0x4d, 0xd0, 0xc6, 0x38,
+ 0xca, 0xe6, 0x64, 0x4e, 0xb4, 0x44, 0xf4, 0x01, 0x48, 0x2e, 0x11, 0xe1, 0xa4, 0x94, 0x48, 0x7c,
+ 0x0c, 0x90, 0x0e, 0x10, 0x7a, 0x09, 0xd6, 0x12, 0x94, 0x57, 0xb0, 0x72, 0x77, 0x2c, 0x2c, 0x3d,
+ 0x77, 0x60, 0xea, 0xf2, 0x01, 0x28, 0xa7, 0xf1, 0x95, 0xf5, 0x34, 0x44, 0x9a, 0xbc, 0x86, 0xd9,
+ 0xf0, 0xfc, 0x57, 0x13, 0x04, 0x21, 0x5c, 0xb9, 0x37, 0x1e, 0x97, 0xb6, 0xef, 0xa1, 0x18, 0x1b,
+ 0xea, 0xff, 0x12, 0x94, 0x51, 0x8a, 0xf2, 0x60, 0x22, 0x25, 0x7c, 0x64, 0xf1, 0xc9, 0x4c, 0x3a,
+ 0xb2, 0x18, 0x27, 0xf1, 0xc8, 0x52, 0x26, 0xaf, 0xb5, 0x7f, 0x72, 0x5e, 0xcd, 0x9e, 0x9e, 0x57,
+ 0xb3, 0x3f, 0xcf, 0xab, 0xd9, 0xaf, 0x17, 0xd5, 0xcc, 0xe9, 0x45, 0x35, 0xf3, 0xfd, 0xa2, 0x9a,
+ 0x79, 0xb7, 0x35, 0xf1, 0xd7, 0x72, 0x28, 0xff, 0x94, 0x04, 0xbf, 0x9b, 0xed, 0x42, 0xf0, 0x87,
+ 0xe4, 0xd1, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xb2, 0x5f, 0xea, 0xef, 0x08, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1166,10 +1089,9 @@ type MsgClient interface {
SuggestRole(ctx context.Context, in *MsgSuggestRole, opts ...grpc.CallOption) (*MsgSuggestRoleResponse, error)
// AddVoteForRole adds a vote for a role change proposal.
AddVoteForRole(ctx context.Context, in *MsgAddVoteForRole, opts ...grpc.CallOption) (*MsgAddVoteForRoleResponse, error)
- // Halt the bridge module.
- Halt(ctx context.Context, in *MsgHalt, opts ...grpc.CallOption) (*MsgHaltResponse, error)
- // Resume the bridge module.
- Resume(ctx context.Context, in *MsgResume, opts ...grpc.CallOption) (*MsgResumeResponse, error)
+ // SetBridgeStatus operates a switch to halt/resume the bridge module.
+ // If the ratio of active bridge switches does not exceed TrustLevel, the bridge module halts.
+ SetBridgeStatus(ctx context.Context, in *MsgSetBridgeStatus, opts ...grpc.CallOption) (*MsgSetBridgeStatusResponse, error)
}
type msgClient struct {
@@ -1261,18 +1183,9 @@ func (c *msgClient) AddVoteForRole(ctx context.Context, in *MsgAddVoteForRole, o
return out, nil
}
-func (c *msgClient) Halt(ctx context.Context, in *MsgHalt, opts ...grpc.CallOption) (*MsgHaltResponse, error) {
- out := new(MsgHaltResponse)
- err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/Halt", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *msgClient) Resume(ctx context.Context, in *MsgResume, opts ...grpc.CallOption) (*MsgResumeResponse, error) {
- out := new(MsgResumeResponse)
- err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/Resume", in, out, opts...)
+func (c *msgClient) SetBridgeStatus(ctx context.Context, in *MsgSetBridgeStatus, opts ...grpc.CallOption) (*MsgSetBridgeStatusResponse, error) {
+ out := new(MsgSetBridgeStatusResponse)
+ err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/SetBridgeStatus", in, out, opts...)
if err != nil {
return nil, err
}
@@ -1301,10 +1214,9 @@ type MsgServer interface {
SuggestRole(context.Context, *MsgSuggestRole) (*MsgSuggestRoleResponse, error)
// AddVoteForRole adds a vote for a role change proposal.
AddVoteForRole(context.Context, *MsgAddVoteForRole) (*MsgAddVoteForRoleResponse, error)
- // Halt the bridge module.
- Halt(context.Context, *MsgHalt) (*MsgHaltResponse, error)
- // Resume the bridge module.
- Resume(context.Context, *MsgResume) (*MsgResumeResponse, error)
+ // SetBridgeStatus operates a switch to halt/resume the bridge module.
+ // If the ratio of active bridge switches does not exceed TrustLevel, the bridge module halts.
+ SetBridgeStatus(context.Context, *MsgSetBridgeStatus) (*MsgSetBridgeStatusResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@@ -1338,11 +1250,8 @@ func (*UnimplementedMsgServer) SuggestRole(ctx context.Context, req *MsgSuggestR
func (*UnimplementedMsgServer) AddVoteForRole(ctx context.Context, req *MsgAddVoteForRole) (*MsgAddVoteForRoleResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddVoteForRole not implemented")
}
-func (*UnimplementedMsgServer) Halt(ctx context.Context, req *MsgHalt) (*MsgHaltResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Halt not implemented")
-}
-func (*UnimplementedMsgServer) Resume(ctx context.Context, req *MsgResume) (*MsgResumeResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Resume not implemented")
+func (*UnimplementedMsgServer) SetBridgeStatus(ctx context.Context, req *MsgSetBridgeStatus) (*MsgSetBridgeStatusResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SetBridgeStatus not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
@@ -1511,38 +1420,20 @@ func _Msg_AddVoteForRole_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler)
}
-func _Msg_Halt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(MsgHalt)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(MsgServer).Halt(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/lbm.fbridge.v1.Msg/Halt",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(MsgServer).Halt(ctx, req.(*MsgHalt))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Msg_Resume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(MsgResume)
+func _Msg_SetBridgeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(MsgSetBridgeStatus)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(MsgServer).Resume(ctx, in)
+ return srv.(MsgServer).SetBridgeStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/lbm.fbridge.v1.Msg/Resume",
+ FullMethod: "/lbm.fbridge.v1.Msg/SetBridgeStatus",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(MsgServer).Resume(ctx, req.(*MsgResume))
+ return srv.(MsgServer).SetBridgeStatus(ctx, req.(*MsgSetBridgeStatus))
}
return interceptor(ctx, in, info, handler)
}
@@ -1588,12 +1479,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
Handler: _Msg_AddVoteForRole_Handler,
},
{
- MethodName: "Halt",
- Handler: _Msg_Halt_Handler,
- },
- {
- MethodName: "Resume",
- Handler: _Msg_Resume_Handler,
+ MethodName: "SetBridgeStatus",
+ Handler: _Msg_SetBridgeStatus_Handler,
},
},
Streams: []grpc.StreamDesc{},
@@ -2170,7 +2057,7 @@ func (m *MsgAddVoteForRoleResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro
return len(dAtA) - i, nil
}
-func (m *MsgHalt) Marshal() (dAtA []byte, err error) {
+func (m *MsgSetBridgeStatus) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -2180,69 +2067,21 @@ func (m *MsgHalt) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
-func (m *MsgHalt) MarshalTo(dAtA []byte) (int, error) {
+func (m *MsgSetBridgeStatus) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *MsgHalt) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *MsgSetBridgeStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
- if len(m.Guardian) > 0 {
- i -= len(m.Guardian)
- copy(dAtA[i:], m.Guardian)
- i = encodeVarintTx(dAtA, i, uint64(len(m.Guardian)))
+ if m.Status != 0 {
+ i = encodeVarintTx(dAtA, i, uint64(m.Status))
i--
- dAtA[i] = 0xa
- }
- return len(dAtA) - i, nil
-}
-
-func (m *MsgHaltResponse) 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 *MsgHaltResponse) MarshalTo(dAtA []byte) (int, error) {
- size := m.Size()
- return m.MarshalToSizedBuffer(dAtA[:size])
-}
-
-func (m *MsgHaltResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
- i := len(dAtA)
- _ = i
- var l int
- _ = l
- return len(dAtA) - i, nil
-}
-
-func (m *MsgResume) Marshal() (dAtA []byte, err error) {
- size := m.Size()
- dAtA = make([]byte, size)
- n, err := m.MarshalToSizedBuffer(dAtA[:size])
- if err != nil {
- return nil, err
+ dAtA[i] = 0x10
}
- return dAtA[:n], nil
-}
-
-func (m *MsgResume) MarshalTo(dAtA []byte) (int, error) {
- size := m.Size()
- return m.MarshalToSizedBuffer(dAtA[:size])
-}
-
-func (m *MsgResume) MarshalToSizedBuffer(dAtA []byte) (int, error) {
- i := len(dAtA)
- _ = i
- var l int
- _ = l
if len(m.Guardian) > 0 {
i -= len(m.Guardian)
copy(dAtA[i:], m.Guardian)
@@ -2253,7 +2092,7 @@ func (m *MsgResume) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
-func (m *MsgResumeResponse) Marshal() (dAtA []byte, err error) {
+func (m *MsgSetBridgeStatusResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -2263,12 +2102,12 @@ func (m *MsgResumeResponse) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
-func (m *MsgResumeResponse) MarshalTo(dAtA []byte) (int, error) {
+func (m *MsgSetBridgeStatusResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *MsgResumeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *MsgSetBridgeStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
@@ -2532,7 +2371,7 @@ func (m *MsgAddVoteForRoleResponse) Size() (n int) {
return n
}
-func (m *MsgHalt) Size() (n int) {
+func (m *MsgSetBridgeStatus) Size() (n int) {
if m == nil {
return 0
}
@@ -2542,32 +2381,13 @@ func (m *MsgHalt) Size() (n int) {
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
- return n
-}
-
-func (m *MsgHaltResponse) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- return n
-}
-
-func (m *MsgResume) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- l = len(m.Guardian)
- if l > 0 {
- n += 1 + l + sovTx(uint64(l))
+ if m.Status != 0 {
+ n += 1 + sovTx(uint64(m.Status))
}
return n
}
-func (m *MsgResumeResponse) Size() (n int) {
+func (m *MsgSetBridgeStatusResponse) Size() (n int) {
if m == nil {
return 0
}
@@ -4137,7 +3957,7 @@ func (m *MsgAddVoteForRoleResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *MsgHalt) Unmarshal(dAtA []byte) error {
+func (m *MsgSetBridgeStatus) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4160,10 +3980,10 @@ func (m *MsgHalt) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: MsgHalt: wiretype end group for non-group")
+ return fmt.Errorf("proto: MsgSetBridgeStatus: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: MsgHalt: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: MsgSetBridgeStatus: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@@ -4198,111 +4018,11 @@ func (m *MsgHalt) Unmarshal(dAtA []byte) error {
}
m.Guardian = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipTx(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if (skippy < 0) || (iNdEx+skippy) < 0 {
- return ErrInvalidLengthTx
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MsgHaltResponse) Unmarshal(dAtA []byte) error {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowTx
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MsgHaltResponse: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MsgHaltResponse: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipTx(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if (skippy < 0) || (iNdEx+skippy) < 0 {
- return ErrInvalidLengthTx
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *MsgResume) Unmarshal(dAtA []byte) error {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowTx
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: MsgResume: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: MsgResume: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Guardian", wireType)
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
}
- var stringLen uint64
+ m.Status = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
@@ -4312,24 +4032,11 @@ func (m *MsgResume) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- stringLen |= uint64(b&0x7F) << shift
+ m.Status |= BridgeStatus(b&0x7F) << shift
if b < 0x80 {
break
}
}
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthTx
- }
- postIndex := iNdEx + intStringLen
- if postIndex < 0 {
- return ErrInvalidLengthTx
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Guardian = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
@@ -4351,7 +4058,7 @@ func (m *MsgResume) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *MsgResumeResponse) Unmarshal(dAtA []byte) error {
+func (m *MsgSetBridgeStatusResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4374,10 +4081,10 @@ func (m *MsgResumeResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: MsgResumeResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: MsgSetBridgeStatusResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: MsgResumeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: MsgSetBridgeStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
From 948acae6b63c6b0fa7b0494971c68c0ede4cb6d3 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 04:06:46 +0900
Subject: [PATCH 33/49] lint
---
x/fbridge/client/cli/tx.go | 5 +++--
x/fbridge/keeper/abci.go | 2 +-
x/fbridge/keeper/auth.go | 3 ++-
x/fbridge/keeper/auth_test.go | 2 ++
x/fbridge/keeper/keeper.go | 1 +
x/fbridge/testutil/setup.go | 4 ++--
x/fbridge/types/genesis.go | 1 +
x/fbridge/types/keys.go | 1 +
x/fbridge/types/params.go | 6 +++---
x/fbridge/types/params_test.go | 3 ++-
10 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/x/fbridge/client/cli/tx.go b/x/fbridge/client/cli/tx.go
index fef1a3dda8..887e5bf586 100644
--- a/x/fbridge/client/cli/tx.go
+++ b/x/fbridge/client/cli/tx.go
@@ -2,15 +2,16 @@ package cli
import (
"fmt"
- "github.com/Finschia/finschia-sdk/version"
- "github.com/spf13/cobra"
"strconv"
+ "github.com/spf13/cobra"
+
"github.com/Finschia/finschia-sdk/client"
"github.com/Finschia/finschia-sdk/client/flags"
"github.com/Finschia/finschia-sdk/client/tx"
sdk "github.com/Finschia/finschia-sdk/types"
sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
+ "github.com/Finschia/finschia-sdk/version"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
diff --git a/x/fbridge/keeper/abci.go b/x/fbridge/keeper/abci.go
index e8976cc702..fdc6279dfd 100644
--- a/x/fbridge/keeper/abci.go
+++ b/x/fbridge/keeper/abci.go
@@ -2,6 +2,7 @@ package keeper
import (
"fmt"
+
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
@@ -47,7 +48,6 @@ func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) {
func GuardianInvariant(k Keeper) sdk.Invariant {
return func(ctx sdk.Context) (string, bool) {
-
numGuardian := 0
for _, p := range k.GetRolePairs(ctx) {
if p.Role == types.RoleGuardian {
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index fddfed7879..e5f209446f 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -3,10 +3,11 @@ package keeper
import (
"encoding/binary"
"fmt"
+ "time"
+
sdk "github.com/Finschia/finschia-sdk/types"
sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
- "time"
)
func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAddress, role types.Role) (types.RoleProposal, error) {
diff --git a/x/fbridge/keeper/auth_test.go b/x/fbridge/keeper/auth_test.go
index 5506e612a2..c7b1411a25 100644
--- a/x/fbridge/keeper/auth_test.go
+++ b/x/fbridge/keeper/auth_test.go
@@ -19,6 +19,7 @@ func TestAssignRole(t *testing.T) {
// 1. Bridge authority assigns an address to a guardian role
p, err := k.RegisterRoleProposal(ctx, addrs[0], addrs[1], types.RoleGuardian)
require.Error(t, err, "role proposal must not be passed without authority")
+ require.Equal(t, types.RoleProposal{}, p)
p, err = k.RegisterRoleProposal(ctx, auth, addrs[0], types.RoleGuardian)
require.NoError(t, err)
require.EqualValues(t, 1, p.Id)
@@ -36,6 +37,7 @@ func TestAssignRole(t *testing.T) {
require.NoError(t, err)
require.Equal(t, types.OptionYes, opt)
err = k.updateRole(ctx, types.RoleGuardian, addrs[1])
+ require.NoError(t, err)
require.Equal(t, types.RoleMetadata{Guardian: 2, Operator: 0, Judge: 0}, k.GetRoleMetadata(ctx))
sws := k.GetBridgeSwitches(ctx)
diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go
index 4e65ca3d2f..f14df7be38 100644
--- a/x/fbridge/keeper/keeper.go
+++ b/x/fbridge/keeper/keeper.go
@@ -3,6 +3,7 @@ package keeper
import (
"errors"
"fmt"
+
"github.com/tendermint/tendermint/libs/log"
"github.com/Finschia/finschia-sdk/codec"
diff --git a/x/fbridge/testutil/setup.go b/x/fbridge/testutil/setup.go
index 6b4ef7dc22..a7258e9cf8 100644
--- a/x/fbridge/testutil/setup.go
+++ b/x/fbridge/testutil/setup.go
@@ -1,8 +1,6 @@
package testutil
import (
- "github.com/Finschia/finschia-sdk/crypto/keys/secp256k1"
- authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
"testing"
"github.com/golang/mock/gomock"
@@ -14,11 +12,13 @@ import (
"github.com/Finschia/finschia-sdk/client"
"github.com/Finschia/finschia-sdk/codec"
codectypes "github.com/Finschia/finschia-sdk/codec/types"
+ "github.com/Finschia/finschia-sdk/crypto/keys/secp256k1"
"github.com/Finschia/finschia-sdk/std"
"github.com/Finschia/finschia-sdk/store"
storetypes "github.com/Finschia/finschia-sdk/store/types"
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/x/auth/tx"
+ authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 6d45c501c1..56621a2f73 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -2,6 +2,7 @@ package types
import (
"errors"
+
sdk "github.com/Finschia/finschia-sdk/types"
authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
foundationtypes "github.com/Finschia/finschia-sdk/x/foundation"
diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go
index f34472803b..3356bf7af6 100644
--- a/x/fbridge/types/keys.go
+++ b/x/fbridge/types/keys.go
@@ -2,6 +2,7 @@ package types
import (
"encoding/binary"
+
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/types/address"
"github.com/Finschia/finschia-sdk/types/kv"
diff --git a/x/fbridge/types/params.go b/x/fbridge/types/params.go
index e1071aeace..3ef148d1e8 100644
--- a/x/fbridge/types/params.go
+++ b/x/fbridge/types/params.go
@@ -1,8 +1,9 @@
package types
import (
- sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
"time"
+
+ sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
)
func DefaultParams() Params {
@@ -37,7 +38,6 @@ func ValidateParams(params Params) error {
}
return nil
-
}
func CheckTrustLevelThreshold(total, current uint64, trustLevel Fraction) bool {
@@ -46,7 +46,7 @@ func CheckTrustLevelThreshold(total, current uint64, trustLevel Fraction) bool {
}
if total*trustLevel.Numerator <= current*trustLevel.Denominator &&
- total > 0 && current >= 0 &&
+ total > 0 &&
current <= total {
return true
}
diff --git a/x/fbridge/types/params_test.go b/x/fbridge/types/params_test.go
index 22157462bf..025ee7bbd0 100644
--- a/x/fbridge/types/params_test.go
+++ b/x/fbridge/types/params_test.go
@@ -1,9 +1,10 @@
package types_test
import (
- "github.com/stretchr/testify/require"
"testing"
+ "github.com/stretchr/testify/require"
+
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
From 72ff22f6bce704fc5594bf7fa0a796db97fe4b79 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 04:08:30 +0900
Subject: [PATCH 34/49] Add CHANGELOG
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e2c15134a..317a2b61fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (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)
* (x/fswap) [\#1345](https://github.com/Finschia/finschia-sdk/pull/1345) Implement fswap's basic functionality(MsgSwap, MsgSwapAll, Query, Proposal)
+* (x/fbridge) [\#1350](https://github.com/Finschia/finschia-sdk/pull/1350) Add Role-based Access Control
### Improvements
* (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md
From 1a50d25e116ef595df261c9f5ad93ed0780af437 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 04:13:02 +0900
Subject: [PATCH 35/49] add ERRORS docs
---
x/ERRORS.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/x/ERRORS.md b/x/ERRORS.md
index dcf56afb65..d8dc1ea25e 100644
--- a/x/ERRORS.md
+++ b/x/ERRORS.md
@@ -7,6 +7,7 @@
* [Crisis](#crisis)
* [Distribution](#distribution)
* [Evidence](#evidence)
+ * [Fbridge](#fbridge)
* [Feegrant](#feegrant)
* [Foundation](#foundation)
* [Fswap](#fswap)
@@ -151,6 +152,17 @@
>You can also find detailed information in the following Errors.go files:
* [evidence/types/errors.go](evidence/types/errors.go)
+## Fbridge
+
+|Error Name|Codespace|Code|Description|
+|:-|:-|:-|:-|
+|ErrUnknownProposal|fbridge|2|unknown proposal|
+|ErrUnknownVote|fbridge|3|unknown vote|
+|ErrInactiveBridge|fbridge|4|the bridge has halted|
+
+>You can also find detailed information in the following Errors.go files:
+ * [fbridge/types/errors.go](fbridge/types/errors.go)
+
## Feegrant
|Error Name|Codespace|Code|Description|
From d8bbd64aa3c016ae844d8573dc4a2ebbbfe17697 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 04:18:10 +0900
Subject: [PATCH 36/49] chore
---
x/fbridge/keeper/auth.go | 58 +++++++++++++++++-----------------
x/fbridge/keeper/auth_test.go | 6 ++--
x/fbridge/keeper/msg_server.go | 2 +-
3 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index e5f209446f..dbe3d8f726 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -111,6 +111,35 @@ func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
return nil
}
+func (k Keeper) updateBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
+ if k.GetRole(ctx, guardian) != types.RoleGuardian {
+ return sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action")
+ }
+
+ if sw, err := k.GetBridgeSwitch(ctx, guardian); err == nil && sw.Status == status {
+ return sdkerrors.ErrInvalidRequest.Wrapf("%s already set %s", guardian, status)
+ } else if err != nil {
+ return err
+ }
+
+ bsMeta := k.GetBridgeStatusMetadata(ctx)
+ switch status {
+ case types.StatusActive:
+ bsMeta.Active++
+ case types.StatusInactive:
+ bsMeta.Inactive++
+ default:
+ return sdkerrors.ErrInvalidRequest.Wrap("invalid bridge switch status")
+ }
+ k.setBridgeStatusMetadata(ctx, bsMeta)
+
+ if err := k.setBridgeSwitch(ctx, guardian, status); err != nil {
+ return err
+ }
+
+ return nil
+}
+
func (k Keeper) setNextProposalID(ctx sdk.Context, seq uint64) {
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 8)
@@ -249,35 +278,6 @@ func (k Keeper) deleteRole(ctx sdk.Context, addr sdk.AccAddress) {
store.Delete(types.RoleKey(addr))
}
-func (k Keeper) UpdateBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
- if k.GetRole(ctx, guardian) != types.RoleGuardian {
- return sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action")
- }
-
- if sw, err := k.GetBridgeSwitch(ctx, guardian); err == nil && sw.Status == status {
- return sdkerrors.ErrInvalidRequest.Wrapf("%s already set %s", guardian, status)
- } else if err != nil {
- return err
- }
-
- bsMeta := k.GetBridgeStatusMetadata(ctx)
- switch status {
- case types.StatusActive:
- bsMeta.Active++
- case types.StatusInactive:
- bsMeta.Inactive++
- default:
- return sdkerrors.ErrInvalidRequest.Wrap("invalid bridge switch status")
- }
- k.setBridgeStatusMetadata(ctx, bsMeta)
-
- if err := k.setBridgeSwitch(ctx, guardian, status); err != nil {
- return err
- }
-
- return nil
-}
-
func (k Keeper) setBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 4)
diff --git a/x/fbridge/keeper/auth_test.go b/x/fbridge/keeper/auth_test.go
index c7b1411a25..b1f3fbc040 100644
--- a/x/fbridge/keeper/auth_test.go
+++ b/x/fbridge/keeper/auth_test.go
@@ -59,15 +59,15 @@ func TestBridgeHaltAndResume(t *testing.T) {
}
require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (3/3)")
- err = k.UpdateBridgeSwitch(ctx, addrs[0], types.StatusInactive)
+ err = k.updateBridgeSwitch(ctx, addrs[0], types.StatusInactive)
require.NoError(t, err)
require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (2/3)")
- err = k.UpdateBridgeSwitch(ctx, addrs[1], types.StatusInactive)
+ err = k.updateBridgeSwitch(ctx, addrs[1], types.StatusInactive)
require.NoError(t, err)
require.Equal(t, types.StatusInactive, k.GetBridgeStatus(ctx), "bridge status must be inactive (1/3)")
- err = k.UpdateBridgeSwitch(ctx, addrs[0], types.StatusActive)
+ err = k.updateBridgeSwitch(ctx, addrs[0], types.StatusActive)
require.NoError(t, err)
require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (2/3)")
}
diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go
index 1c6b6327f6..4d6061882e 100644
--- a/x/fbridge/keeper/msg_server.go
+++ b/x/fbridge/keeper/msg_server.go
@@ -141,7 +141,7 @@ func (m msgServer) SetBridgeStatus(goCtx context.Context, msg *types.MsgSetBridg
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid guardian address (%s)", err)
}
- if err := m.UpdateBridgeSwitch(ctx, addr, msg.Status); err != nil {
+ if err := m.updateBridgeSwitch(ctx, addr, msg.Status); err != nil {
return nil, err
}
From 0694e1e192db451575b2ca565e1774d024f60764 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 14:11:15 +0900
Subject: [PATCH 37/49] apply 0tech review
---
x/fbridge/keeper/auth.go | 27 +++++++++++++++++----------
x/fbridge/keeper/auth_test.go | 2 ++
x/fbridge/types/fbridge.go | 9 +++++++++
x/fbridge/types/genesis.go | 15 +++++++++------
4 files changed, 37 insertions(+), 16 deletions(-)
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index dbe3d8f726..76c5acca10 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -11,8 +11,14 @@ import (
)
func (k Keeper) RegisterRoleProposal(ctx sdk.Context, proposer, target sdk.AccAddress, role types.Role) (types.RoleProposal, error) {
- if k.GetRole(ctx, proposer) != types.RoleGuardian && proposer.String() != k.authority {
- return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrapf("only guardian or %s can execute this action", k.authority)
+ if k.GetRoleMetadata(ctx).Guardian > 0 {
+ if k.GetRole(ctx, proposer) != types.RoleGuardian {
+ return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrapf("only guardian can execute this action")
+ }
+ } else {
+ if proposer.String() != k.authority {
+ return types.RoleProposal{}, sdkerrors.ErrUnauthorized.Wrapf("only %s can execute this action", k.authority)
+ }
}
if k.GetRole(ctx, target) == role {
@@ -71,10 +77,13 @@ func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
panic(err)
}
- if sw.Status == types.StatusActive {
- bsMeta.Active--
- } else {
- bsMeta.Inactive--
+ switch sw.Status {
+ case types.StatusActive:
+ bsMeta.Active++
+ case types.StatusInactive:
+ bsMeta.Inactive++
+ default:
+ return sdkerrors.ErrInvalidRequest.Wrap("invalid bridge switch status")
}
k.deleteBridgeSwitch(ctx, addr)
@@ -112,10 +121,6 @@ func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
}
func (k Keeper) updateBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
- if k.GetRole(ctx, guardian) != types.RoleGuardian {
- return sdkerrors.ErrUnauthorized.Wrap("only guardian can execute this action")
- }
-
if sw, err := k.GetBridgeSwitch(ctx, guardian); err == nil && sw.Status == status {
return sdkerrors.ErrInvalidRequest.Wrapf("%s already set %s", guardian, status)
} else if err != nil {
@@ -126,8 +131,10 @@ func (k Keeper) updateBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, sta
switch status {
case types.StatusActive:
bsMeta.Active++
+ bsMeta.Inactive--
case types.StatusInactive:
bsMeta.Inactive++
+ bsMeta.Active--
default:
return sdkerrors.ErrInvalidRequest.Wrap("invalid bridge switch status")
}
diff --git a/x/fbridge/keeper/auth_test.go b/x/fbridge/keeper/auth_test.go
index b1f3fbc040..2a112d8bf4 100644
--- a/x/fbridge/keeper/auth_test.go
+++ b/x/fbridge/keeper/auth_test.go
@@ -28,6 +28,8 @@ func TestAssignRole(t *testing.T) {
require.Equal(t, types.RoleGuardian, k.GetRole(ctx, addrs[0]))
// 2. Guardian assigns an address to a guardian role
+ _, err = k.RegisterRoleProposal(ctx, auth, addrs[1], types.RoleGuardian)
+ require.Error(t, err, "role proposal must be passed with guardian role after guardian group is formed")
p, err = k.RegisterRoleProposal(ctx, addrs[0], addrs[1], types.RoleGuardian)
require.NoError(t, err, "role proposal must be passed with guardian role")
require.EqualValues(t, 2, p.Id)
diff --git a/x/fbridge/types/fbridge.go b/x/fbridge/types/fbridge.go
index c13aff38ff..fa20ca542e 100644
--- a/x/fbridge/types/fbridge.go
+++ b/x/fbridge/types/fbridge.go
@@ -28,3 +28,12 @@ func IsValidVoteOption(option VoteOption) error {
return errors.New("unsupported vote option")
}
+
+func IsValidBridgeStatus(status BridgeStatus) error {
+ switch status {
+ case StatusActive, StatusInactive:
+ return nil
+ }
+
+ return errors.New("unsupported bridge status")
+}
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 56621a2f73..8d0b658695 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -50,6 +50,9 @@ func ValidateGenesis(data GenesisState) error {
}
sdk.MustAccAddressFromBech32(v.Proposer)
sdk.MustAccAddressFromBech32(v.Target)
+ if err := IsValidRole(v.Role); err != nil {
+ return err
+ }
}
for _, v := range data.Votes {
@@ -57,22 +60,22 @@ func ValidateGenesis(data GenesisState) error {
return errors.New("role proposal ID must be positive")
}
sdk.MustAccAddressFromBech32(v.Voter)
- if v.Option == OptionEmpty {
- return errors.New("invalid voting option")
+ if err := IsValidVoteOption(v.Option); err != nil {
+ return err
}
}
for _, v := range data.Roles {
sdk.MustAccAddressFromBech32(v.Address)
- if v.Role == RoleEmpty {
- return errors.New("invalid role")
+ if err := IsValidRole(v.Role); err != nil {
+ return err
}
}
for _, v := range data.BridgeSwitches {
sdk.MustAccAddressFromBech32(v.Guardian)
- if v.Status == StatusEmpty {
- return errors.New("invalid bridge switch status")
+ if err := IsValidBridgeStatus(v.Status); err != nil {
+ return err
}
}
From 00aefbfe50e5223248e8c9f655e803900d695824 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 14:14:49 +0900
Subject: [PATCH 38/49] enhance bridge switch unit test
---
x/fbridge/keeper/auth_test.go | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/x/fbridge/keeper/auth_test.go b/x/fbridge/keeper/auth_test.go
index 2a112d8bf4..9c92447f2c 100644
--- a/x/fbridge/keeper/auth_test.go
+++ b/x/fbridge/keeper/auth_test.go
@@ -61,15 +61,21 @@ func TestBridgeHaltAndResume(t *testing.T) {
}
require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (3/3)")
+ require.Equal(t, types.BridgeStatusMetadata{Active: 3, Inactive: 0}, k.GetBridgeStatusMetadata(ctx))
+
err = k.updateBridgeSwitch(ctx, addrs[0], types.StatusInactive)
require.NoError(t, err)
require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (2/3)")
+ require.Equal(t, types.BridgeStatusMetadata{Active: 2, Inactive: 1}, k.GetBridgeStatusMetadata(ctx))
err = k.updateBridgeSwitch(ctx, addrs[1], types.StatusInactive)
require.NoError(t, err)
require.Equal(t, types.StatusInactive, k.GetBridgeStatus(ctx), "bridge status must be inactive (1/3)")
+ require.Equal(t, types.BridgeStatusMetadata{Active: 1, Inactive: 2}, k.GetBridgeStatusMetadata(ctx))
err = k.updateBridgeSwitch(ctx, addrs[0], types.StatusActive)
require.NoError(t, err)
require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (2/3)")
+ require.Equal(t, types.BridgeStatusMetadata{Active: 2, Inactive: 1}, k.GetBridgeStatusMetadata(ctx))
+
}
From 73dd0780963a0329c3dfbd019039fe4cd584133c Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 14:18:40 +0900
Subject: [PATCH 39/49] chore
---
x/fbridge/types/genesis.go | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 8d0b658695..c66cd5a8bc 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -87,10 +87,16 @@ func validateSendingState(state SendingState) error {
return errors.New("next sequence must be positive")
}
+ seq := uint64(1)
for _, v := range state.SeqToBlocknum {
if v.Blocknum < 1 || v.Seq < 1 {
return errors.New("blocknum and seq must be positive")
}
+
+ if v.Seq != seq {
+ panic("sequence number is not in order")
+ }
+ seq++
}
return nil
From 369647da2dc99b0cc0044b83ba4c5478e43043bf Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 14:33:57 +0900
Subject: [PATCH 40/49] chore
---
x/fbridge/keeper/auth.go | 4 ++--
x/fbridge/keeper/auth_test.go | 11 ++++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index 76c5acca10..88d282908f 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -79,9 +79,9 @@ func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
switch sw.Status {
case types.StatusActive:
- bsMeta.Active++
+ bsMeta.Active--
case types.StatusInactive:
- bsMeta.Inactive++
+ bsMeta.Inactive--
default:
return sdkerrors.ErrInvalidRequest.Wrap("invalid bridge switch status")
}
diff --git a/x/fbridge/keeper/auth_test.go b/x/fbridge/keeper/auth_test.go
index 9c92447f2c..d845763d19 100644
--- a/x/fbridge/keeper/auth_test.go
+++ b/x/fbridge/keeper/auth_test.go
@@ -26,6 +26,7 @@ func TestAssignRole(t *testing.T) {
err = k.updateRole(ctx, types.RoleGuardian, addrs[0])
require.NoError(t, err)
require.Equal(t, types.RoleGuardian, k.GetRole(ctx, addrs[0]))
+ require.Equal(t, types.RoleMetadata{Guardian: 1, Operator: 0, Judge: 0}, k.GetRoleMetadata(ctx))
// 2. Guardian assigns an address to a guardian role
_, err = k.RegisterRoleProposal(ctx, auth, addrs[1], types.RoleGuardian)
@@ -40,13 +41,21 @@ func TestAssignRole(t *testing.T) {
require.Equal(t, types.OptionYes, opt)
err = k.updateRole(ctx, types.RoleGuardian, addrs[1])
require.NoError(t, err)
-
require.Equal(t, types.RoleMetadata{Guardian: 2, Operator: 0, Judge: 0}, k.GetRoleMetadata(ctx))
sws := k.GetBridgeSwitches(ctx)
require.Len(t, sws, 2)
for _, sw := range sws {
require.Equal(t, types.StatusActive, sw.Status)
}
+
+ // 3. Guardian assigns an address to an operator role
+ err = k.updateRole(ctx, types.RoleOperator, addrs[1])
+ require.NoError(t, err)
+ require.Equal(t, types.RoleMetadata{Guardian: 1, Operator: 1, Judge: 0}, k.GetRoleMetadata(ctx))
+
+ // 4. Guardian assigns an address to a same role
+ err = k.updateRole(ctx, types.RoleOperator, addrs[1])
+ require.Error(t, err, "role must not be updated to the same role")
}
func TestBridgeHaltAndResume(t *testing.T) {
From 3aa223342df514daaf25f900c898da8bbc1e39cb Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 14:36:10 +0900
Subject: [PATCH 41/49] chore
---
x/fbridge/types/genesis.go | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index c66cd5a8bc..71ac6c0cd0 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -87,16 +87,13 @@ func validateSendingState(state SendingState) error {
return errors.New("next sequence must be positive")
}
- seq := uint64(1)
+ if state.NextSeq-1 != uint64(len(state.SeqToBlocknum)) {
+ return errors.New("sequence to blocknum mapping is invalid")
+ }
for _, v := range state.SeqToBlocknum {
if v.Blocknum < 1 || v.Seq < 1 {
return errors.New("blocknum and seq must be positive")
}
-
- if v.Seq != seq {
- panic("sequence number is not in order")
- }
- seq++
}
return nil
From de9cfde182e9f95bb920fc0679f9ba20942b752c Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 16:04:04 +0900
Subject: [PATCH 42/49] maintain bridge status metadata based on permanent
states
---
docs/core/proto-docs.md | 2 +-
proto/lbm/fbridge/v1/fbridge.proto | 1 +
proto/lbm/fbridge/v1/tx.proto | 2 +-
x/fbridge/keeper/abci.go | 20 ++++++++---
x/fbridge/keeper/auth.go | 48 +++++++++++++------------
x/fbridge/keeper/auth_test.go | 1 -
x/fbridge/keeper/genesis.go | 4 ++-
x/fbridge/keeper/keeper.go | 56 ++++++++++++++++--------------
x/fbridge/keeper/msg_server.go | 4 ---
x/fbridge/types/keys.go | 6 ++--
x/fbridge/types/tx.pb.go | 4 +--
11 files changed, 81 insertions(+), 67 deletions(-)
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 5a8121cdf8..379b2d65ea 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -12703,7 +12703,7 @@ MsgTransfer is input values required for bridge transfer
| `Claim` | [MsgClaim](#lbm.fbridge.v1.MsgClaim) | [MsgClaimResponse](#lbm.fbridge.v1.MsgClaimResponse) | Claim processes the claiming of a provision with a specific sequence number | |
| `SuggestRole` | [MsgSuggestRole](#lbm.fbridge.v1.MsgSuggestRole) | [MsgSuggestRoleResponse](#lbm.fbridge.v1.MsgSuggestRoleResponse) | SuggestRole suggests updating the role of an address in the bridge module. The role can be one of the following: guardian, operator, judge. The proposal will be passed only with the consent of +2/3 Guardian members. | |
| `AddVoteForRole` | [MsgAddVoteForRole](#lbm.fbridge.v1.MsgAddVoteForRole) | [MsgAddVoteForRoleResponse](#lbm.fbridge.v1.MsgAddVoteForRoleResponse) | AddVoteForRole adds a vote for a role change proposal. | |
-| `SetBridgeStatus` | [MsgSetBridgeStatus](#lbm.fbridge.v1.MsgSetBridgeStatus) | [MsgSetBridgeStatusResponse](#lbm.fbridge.v1.MsgSetBridgeStatusResponse) | SetBridgeStatus operates a switch to halt/resume the bridge module. If the ratio of active bridge switches does not exceed TrustLevel, the bridge module halts. | |
+| `SetBridgeStatus` | [MsgSetBridgeStatus](#lbm.fbridge.v1.MsgSetBridgeStatus) | [MsgSetBridgeStatusResponse](#lbm.fbridge.v1.MsgSetBridgeStatusResponse) | SetBridgeStatus operates a switch to halt/resume the bridge module. If the ratio of inactive bridge switches exceed TrustLevel, the bridge module halts. | |
diff --git a/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto
index 509557c7d9..c3c4d5b6c7 100644
--- a/proto/lbm/fbridge/v1/fbridge.proto
+++ b/proto/lbm/fbridge/v1/fbridge.proto
@@ -118,6 +118,7 @@ enum BridgeStatus {
// BRIDGE_STATUS_UNSPECIFIED defines an unspecified bridge status.
BRIDGE_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "StatusEmpty"];
+
// BRIDGE_STATUS_ACTIVE defines an active bridge status.
BRIDGE_STATUS_ACTIVE = 1 [(gogoproto.enumvalue_customname) = "StatusActive"];
// BRIDGE_STATUS_INACTIVE defines an inactive bridge status.
diff --git a/proto/lbm/fbridge/v1/tx.proto b/proto/lbm/fbridge/v1/tx.proto
index 3bf8234a5e..e1186ec588 100644
--- a/proto/lbm/fbridge/v1/tx.proto
+++ b/proto/lbm/fbridge/v1/tx.proto
@@ -37,7 +37,7 @@ service Msg {
rpc AddVoteForRole(MsgAddVoteForRole) returns (MsgAddVoteForRoleResponse);
// SetBridgeStatus operates a switch to halt/resume the bridge module.
- // If the ratio of active bridge switches does not exceed TrustLevel, the bridge module halts.
+ // If the ratio of inactive bridge switches exceed TrustLevel, the bridge module halts.
rpc SetBridgeStatus(MsgSetBridgeStatus) returns (MsgSetBridgeStatusResponse);
}
diff --git a/x/fbridge/keeper/abci.go b/x/fbridge/keeper/abci.go
index fdc6279dfd..72de6bc624 100644
--- a/x/fbridge/keeper/abci.go
+++ b/x/fbridge/keeper/abci.go
@@ -56,12 +56,22 @@ func GuardianInvariant(k Keeper) sdk.Invariant {
}
numBridgeSw := len(k.GetBridgeSwitches(ctx))
+ if numGuardian != numBridgeSw {
+ return sdk.FormatInvariant(
+ types.ModuleName, "guardian-invariant",
+ fmt.Sprintf("number of guardians(%d) != number of bridge switches(%d)", numGuardian, numBridgeSw),
+ ), true
+ }
- broken := numGuardian != numBridgeSw
+ bsMeta := k.GetBridgeStatusMetadata(ctx)
+ roleMeta := k.GetRoleMetadata(ctx)
+ if (bsMeta.Inactive + bsMeta.Active) != roleMeta.Guardian {
+ return sdk.FormatInvariant(
+ types.ModuleName, "guardian-invariant",
+ fmt.Sprintf("Bridge status metadata (%+v) does not match with guardian role metadata(%d)", bsMeta, roleMeta.Guardian),
+ ), true
+ }
- return sdk.FormatInvariant(
- types.ModuleName, "guardian-invariant",
- fmt.Sprintf("number of guardians(%d) != number of bridge switches(%d)", numGuardian, numBridgeSw),
- ), broken
+ return sdk.FormatInvariant(types.ModuleName, "guardian-invariant", ""), false
}
}
diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go
index 88d282908f..86070efe83 100644
--- a/x/fbridge/keeper/auth.go
+++ b/x/fbridge/keeper/auth.go
@@ -51,7 +51,7 @@ func (k Keeper) addVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress
}
if err := types.IsValidVoteOption(option); err != nil {
- return err
+ return sdkerrors.ErrInvalidRequest.Wrap(err.Error())
}
k.setVote(ctx, proposalID, voter, option)
@@ -66,24 +66,19 @@ func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
}
roleMeta := k.GetRoleMetadata(ctx)
- bsMeta := k.GetBridgeStatusMetadata(ctx)
+ nInactive := k.GetBridgeInactiveCounter(ctx)
switch previousRole {
case types.RoleGuardian:
roleMeta.Guardian--
- sw, err := k.GetBridgeSwitch(ctx, addr)
+ bs, err := k.GetBridgeSwitch(ctx, addr)
if err != nil {
- panic(err)
+ return err
}
- switch sw.Status {
- case types.StatusActive:
- bsMeta.Active--
- case types.StatusInactive:
- bsMeta.Inactive--
- default:
- return sdkerrors.ErrInvalidRequest.Wrap("invalid bridge switch status")
+ if bs.Status == types.StatusInactive {
+ nInactive--
}
k.deleteBridgeSwitch(ctx, addr)
@@ -98,7 +93,9 @@ func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
k.deleteRole(ctx, addr)
return nil
} else {
- k.setRole(ctx, role, addr)
+ if err := k.setRole(ctx, role, addr); err != nil {
+ return err
+ }
}
switch role {
@@ -107,7 +104,6 @@ func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
if err := k.setBridgeSwitch(ctx, addr, types.StatusActive); err != nil {
panic(err)
}
- bsMeta.Active++
case types.RoleOperator:
roleMeta.Operator++
case types.RoleJudge:
@@ -115,7 +111,7 @@ func (k Keeper) updateRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress
}
k.setRoleMetadata(ctx, roleMeta)
- k.setBridgeStatusMetadata(ctx, bsMeta)
+ k.setBridgeInactiveCounter(ctx, nInactive)
return nil
}
@@ -127,18 +123,16 @@ func (k Keeper) updateBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, sta
return err
}
- bsMeta := k.GetBridgeStatusMetadata(ctx)
+ nInactive := k.GetBridgeInactiveCounter(ctx)
switch status {
case types.StatusActive:
- bsMeta.Active++
- bsMeta.Inactive--
+ nInactive--
case types.StatusInactive:
- bsMeta.Inactive++
- bsMeta.Active--
+ nInactive++
default:
- return sdkerrors.ErrInvalidRequest.Wrap("invalid bridge switch status")
+ return sdkerrors.ErrInvalidRequest.Wrapf("unknown bridge status: %d", status)
}
- k.setBridgeStatusMetadata(ctx, bsMeta)
+ k.setBridgeInactiveCounter(ctx, nInactive)
if err := k.setBridgeSwitch(ctx, guardian, status); err != nil {
return err
@@ -250,11 +244,17 @@ func (k Keeper) GetProposalVotes(ctx sdk.Context, proposalID uint64) []types.Vot
return votes
}
-func (k Keeper) setRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) {
+func (k Keeper) setRole(ctx sdk.Context, role types.Role, addr sdk.AccAddress) error {
+ if err := types.IsValidRole(role); err != nil {
+ return sdkerrors.ErrInvalidRequest.Wrap(err.Error())
+ }
+
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 4)
binary.BigEndian.PutUint32(bz, uint32(role))
store.Set(types.RoleKey(addr), bz)
+
+ return nil
}
func (k Keeper) GetRole(ctx sdk.Context, addr sdk.AccAddress) types.Role {
@@ -286,6 +286,10 @@ func (k Keeper) deleteRole(ctx sdk.Context, addr sdk.AccAddress) {
}
func (k Keeper) setBridgeSwitch(ctx sdk.Context, guardian sdk.AccAddress, status types.BridgeStatus) error {
+ if err := types.IsValidBridgeStatus(status); err != nil {
+ return sdkerrors.ErrInvalidRequest.Wrap(err.Error())
+ }
+
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 4)
binary.BigEndian.PutUint32(bz, uint32(status))
diff --git a/x/fbridge/keeper/auth_test.go b/x/fbridge/keeper/auth_test.go
index d845763d19..fb773014e3 100644
--- a/x/fbridge/keeper/auth_test.go
+++ b/x/fbridge/keeper/auth_test.go
@@ -86,5 +86,4 @@ func TestBridgeHaltAndResume(t *testing.T) {
require.NoError(t, err)
require.Equal(t, types.StatusActive, k.GetBridgeStatus(ctx), "bridge status must be active (2/3)")
require.Equal(t, types.BridgeStatusMetadata{Active: 2, Inactive: 1}, k.GetBridgeStatusMetadata(ctx))
-
}
diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go
index 2ebf18aacd..486f35ea68 100644
--- a/x/fbridge/keeper/genesis.go
+++ b/x/fbridge/keeper/genesis.go
@@ -15,7 +15,9 @@ func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error {
}
for _, pair := range gs.Roles {
- k.setRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address))
+ if err := k.setRole(ctx, pair.Role, sdk.MustAccAddressFromBech32(pair.Address)); err != nil {
+ panic(err)
+ }
}
for _, sw := range gs.BridgeSwitches {
diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go
index f14df7be38..8c71e1a4fa 100644
--- a/x/fbridge/keeper/keeper.go
+++ b/x/fbridge/keeper/keeper.go
@@ -1,6 +1,7 @@
package keeper
import (
+ "encoding/binary"
"errors"
"fmt"
@@ -82,18 +83,8 @@ func (k Keeper) InitMemStore(ctx sdk.Context) {
}
k.setRoleMetadata(noGasCtx, roleMetadata)
- bsMeta := types.BridgeStatusMetadata{Inactive: 0, Active: 0}
- for _, bs := range k.GetBridgeSwitches(noGasCtx) {
- switch bs.Status {
- case types.StatusInactive:
- bsMeta.Inactive++
- case types.StatusActive:
- bsMeta.Active++
- default:
- panic("invalid bridge switch status")
- }
- }
- k.setBridgeStatusMetadata(noGasCtx, types.BridgeStatusMetadata{})
+ nInactive := k.GetBridgeInactiveCounter(noGasCtx)
+ k.setBridgeInactiveCounter(noGasCtx, nInactive)
memStore := noGasCtx.KVStore(k.memKey)
memStore.Set(types.KeyMemInitialized, []byte{1})
@@ -132,30 +123,41 @@ func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata {
}
func (k Keeper) GetBridgeStatus(ctx sdk.Context) types.BridgeStatus {
- memStore := ctx.KVStore(k.memKey)
- bsMeta := types.BridgeStatusMetadata{}
- bz := memStore.Get(types.KeyMemBridgeStatus)
- k.cdc.MustUnmarshal(bz, &bsMeta)
-
- if types.CheckTrustLevelThreshold(bsMeta.Active+bsMeta.Inactive, bsMeta.Active, k.GetParams(ctx).GuardianTrustLevel) {
- return types.StatusActive
+ roleMeta := k.GetRoleMetadata(ctx)
+ bsMeta := k.GetBridgeStatusMetadata(ctx)
+ if types.CheckTrustLevelThreshold(roleMeta.Guardian, bsMeta.Inactive, k.GetParams(ctx).GuardianTrustLevel) {
+ return types.StatusInactive
}
- return types.StatusInactive
+ return types.StatusActive
}
-func (k Keeper) setBridgeStatusMetadata(ctx sdk.Context, status types.BridgeStatusMetadata) {
+func (k Keeper) setBridgeInactiveCounter(ctx sdk.Context, nInactive uint64) {
memStore := ctx.KVStore(k.memKey)
- memStore.Set(types.KeyMemBridgeStatus, k.cdc.MustMarshal(&status))
+ bz := make([]byte, 8)
+ binary.BigEndian.PutUint64(bz, nInactive)
+ memStore.Set(types.KeyMemBridgeInactiveCounter, bz)
}
-func (k Keeper) GetBridgeStatusMetadata(ctx sdk.Context) types.BridgeStatusMetadata {
+func (k Keeper) GetBridgeInactiveCounter(ctx sdk.Context) uint64 {
memStore := ctx.KVStore(k.memKey)
- bsMeta := types.BridgeStatusMetadata{}
- bz := memStore.Get(types.KeyMemBridgeStatus)
+ bz := memStore.Get(types.KeyMemBridgeInactiveCounter)
if bz == nil {
- return types.BridgeStatusMetadata{}
+ n := uint64(0)
+ for _, bs := range k.GetBridgeSwitches(ctx) {
+ if bs.Status == types.StatusInactive {
+ n++
+ }
+ }
+ return n
}
- k.cdc.MustUnmarshal(bz, &bsMeta)
+
+ return binary.BigEndian.Uint64(bz)
+}
+
+func (k Keeper) GetBridgeStatusMetadata(ctx sdk.Context) types.BridgeStatusMetadata {
+ bsMeta := types.BridgeStatusMetadata{}
+ bsMeta.Inactive = k.GetBridgeInactiveCounter(ctx)
+ bsMeta.Active = k.GetRoleMetadata(ctx).Guardian - bsMeta.Inactive
return bsMeta
}
diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go
index 4d6061882e..9db41b8149 100644
--- a/x/fbridge/keeper/msg_server.go
+++ b/x/fbridge/keeper/msg_server.go
@@ -114,10 +114,6 @@ func (m msgServer) AddVoteForRole(goCtx context.Context, msg *types.MsgAddVoteFo
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid proposer address (%s)", err)
}
- if err := types.IsValidVoteOption(msg.Option); err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
- }
-
if err := m.addVote(ctx, msg.ProposalId, voter, msg.Option); err != nil {
return nil, err
}
diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go
index 3356bf7af6..81653c6456 100644
--- a/x/fbridge/types/keys.go
+++ b/x/fbridge/types/keys.go
@@ -44,9 +44,9 @@ var (
KeyRolePrefix = []byte{0x13} // key prefix for the role of an address
KeyBridgeSwitchPrefix = []byte{0x14} // key for the switch to halt
- KeyMemInitialized = []byte{0xF0}
- KeyMemRoleMetadata = []byte{0xF1} // key for the role metadata
- KeyMemBridgeStatus = []byte{0xF2} // key for the bridge status
+ KeyMemInitialized = []byte{0xF0}
+ KeyMemRoleMetadata = []byte{0xF1} // key for the role metadata
+ KeyMemBridgeInactiveCounter = []byte{0xF2} // key for the bridge inactive status
)
func SeqToBlocknumKey(seq uint64) []byte {
diff --git a/x/fbridge/types/tx.pb.go b/x/fbridge/types/tx.pb.go
index 8cc462afb1..150c4f9476 100644
--- a/x/fbridge/types/tx.pb.go
+++ b/x/fbridge/types/tx.pb.go
@@ -1090,7 +1090,7 @@ type MsgClient interface {
// AddVoteForRole adds a vote for a role change proposal.
AddVoteForRole(ctx context.Context, in *MsgAddVoteForRole, opts ...grpc.CallOption) (*MsgAddVoteForRoleResponse, error)
// SetBridgeStatus operates a switch to halt/resume the bridge module.
- // If the ratio of active bridge switches does not exceed TrustLevel, the bridge module halts.
+ // If the ratio of inactive bridge switches exceed TrustLevel, the bridge module halts.
SetBridgeStatus(ctx context.Context, in *MsgSetBridgeStatus, opts ...grpc.CallOption) (*MsgSetBridgeStatusResponse, error)
}
@@ -1215,7 +1215,7 @@ type MsgServer interface {
// AddVoteForRole adds a vote for a role change proposal.
AddVoteForRole(context.Context, *MsgAddVoteForRole) (*MsgAddVoteForRoleResponse, error)
// SetBridgeStatus operates a switch to halt/resume the bridge module.
- // If the ratio of active bridge switches does not exceed TrustLevel, the bridge module halts.
+ // If the ratio of inactive bridge switches exceed TrustLevel, the bridge module halts.
SetBridgeStatus(context.Context, *MsgSetBridgeStatus) (*MsgSetBridgeStatusResponse, error)
}
From 4136321416c65ba28c79ed03f873a91edc89adb1 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 17:10:44 +0900
Subject: [PATCH 43/49] change panic msg for unimplemented features
---
x/fbridge/keeper/grpc_query.go | 13 +++++++------
x/fbridge/keeper/msg_server.go | 12 ++++++------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go
index 176663ef06..50c7455fe9 100644
--- a/x/fbridge/keeper/grpc_query.go
+++ b/x/fbridge/keeper/grpc_query.go
@@ -3,6 +3,7 @@ package keeper
import (
"context"
"fmt"
+ sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -62,27 +63,27 @@ func (k Keeper) SeqToBlocknums(goCtx context.Context, req *types.QuerySeqToBlock
}
func (k Keeper) GreatestSeqByOperator(ctx context.Context, request *types.QueryGreatestSeqByOperatorRequest) (*types.QueryGreatestSeqByOperatorResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (k Keeper) GreatestConsecutiveConfirmedSeq(ctx context.Context, request *types.QueryGreatestConsecutiveConfirmedSeqRequest) (*types.QueryGreatestConsecutiveConfirmedSeqResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (k Keeper) SubmittedProvision(ctx context.Context, request *types.QuerySubmittedProvisionRequest) (*types.QuerySubmittedProvisionResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (k Keeper) ConfirmedProvision(ctx context.Context, request *types.QueryConfirmedProvisionRequest) (*types.QueryConfirmedProvisionResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (k Keeper) NeededSubmissionSeqs(ctx context.Context, request *types.QueryNeededSubmissionSeqsRequest) (*types.QueryNeededSubmissionSeqsResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (k Keeper) Commitments(ctx context.Context, request *types.QueryCommitmentsRequest) (*types.QueryCommitmentsResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (k Keeper) Members(goCtx context.Context, req *types.QueryMembersRequest) (*types.QueryMembersResponse, error) {
diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go
index 9db41b8149..5f6775f4bc 100644
--- a/x/fbridge/keeper/msg_server.go
+++ b/x/fbridge/keeper/msg_server.go
@@ -52,27 +52,27 @@ func (m msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ
}
func (m msgServer) Provision(ctx context.Context, msg *types.MsgProvision) (*types.MsgProvisionResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (m msgServer) HoldTransfer(ctx context.Context, msg *types.MsgHoldTransfer) (*types.MsgHoldTransferResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (m msgServer) ReleaseTransfer(ctx context.Context, msg *types.MsgReleaseTransfer) (*types.MsgReleaseTransferResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (m msgServer) RemoveProvision(ctx context.Context, msg *types.MsgRemoveProvision) (*types.MsgRemoveProvisionResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (m msgServer) ClaimBatch(ctx context.Context, msg *types.MsgClaimBatch) (*types.MsgClaimBatchResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (m msgServer) Claim(ctx context.Context, msg *types.MsgClaim) (*types.MsgClaimResponse, error) {
- panic("implement me")
+ panic(sdkerrors.ErrNotSupported)
}
func (m msgServer) SuggestRole(goCtx context.Context, msg *types.MsgSuggestRole) (*types.MsgSuggestRoleResponse, error) {
From b6c2f138edc33e6ab682db901ad0431c4f115257 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 17:22:45 +0900
Subject: [PATCH 44/49] check duplicate seq in genesis
---
x/fbridge/types/genesis.go | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go
index 71ac6c0cd0..358f64b2fa 100644
--- a/x/fbridge/types/genesis.go
+++ b/x/fbridge/types/genesis.go
@@ -90,10 +90,18 @@ func validateSendingState(state SendingState) error {
if state.NextSeq-1 != uint64(len(state.SeqToBlocknum)) {
return errors.New("sequence to blocknum mapping is invalid")
}
+
+ chkSeq := make(map[uint64]struct{})
for _, v := range state.SeqToBlocknum {
- if v.Blocknum < 1 || v.Seq < 1 {
+ if v.Blocknum == 0 || v.Seq == 0 {
return errors.New("blocknum and seq must be positive")
}
+
+ if _, ok := chkSeq[v.Seq]; ok {
+ return errors.New("duplicate sequence")
+ }
+
+ chkSeq[v.Seq] = struct{}{}
}
return nil
From 0d21ba2ef652eff2a6d36c6e5b20a65cca7de3d1 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 18:07:32 +0900
Subject: [PATCH 45/49] bridge inactive counter must always be initialization
---
x/fbridge/keeper/keeper.go | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go
index 8c71e1a4fa..7d87a7e979 100644
--- a/x/fbridge/keeper/keeper.go
+++ b/x/fbridge/keeper/keeper.go
@@ -83,7 +83,12 @@ func (k Keeper) InitMemStore(ctx sdk.Context) {
}
k.setRoleMetadata(noGasCtx, roleMetadata)
- nInactive := k.GetBridgeInactiveCounter(noGasCtx)
+ nInactive := uint64(0)
+ for _, bs := range k.GetBridgeSwitches(ctx) {
+ if bs.Status == types.StatusInactive {
+ nInactive++
+ }
+ }
k.setBridgeInactiveCounter(noGasCtx, nInactive)
memStore := noGasCtx.KVStore(k.memKey)
@@ -143,13 +148,7 @@ func (k Keeper) GetBridgeInactiveCounter(ctx sdk.Context) uint64 {
memStore := ctx.KVStore(k.memKey)
bz := memStore.Get(types.KeyMemBridgeInactiveCounter)
if bz == nil {
- n := uint64(0)
- for _, bs := range k.GetBridgeSwitches(ctx) {
- if bs.Status == types.StatusInactive {
- n++
- }
- }
- return n
+ panic("bridge inactive counter must be set at initialization")
}
return binary.BigEndian.Uint64(bz)
From 26fe40d559b612e2caae2eeeda9d2b89ac342eeb Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 19:00:15 +0900
Subject: [PATCH 46/49] bridge is always inactive if there is no guardian
---
x/fbridge/keeper/keeper.go | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go
index 7d87a7e979..18cc8e0ef9 100644
--- a/x/fbridge/keeper/keeper.go
+++ b/x/fbridge/keeper/keeper.go
@@ -129,12 +129,16 @@ func (k Keeper) GetRoleMetadata(ctx sdk.Context) types.RoleMetadata {
func (k Keeper) GetBridgeStatus(ctx sdk.Context) types.BridgeStatus {
roleMeta := k.GetRoleMetadata(ctx)
- bsMeta := k.GetBridgeStatusMetadata(ctx)
- if types.CheckTrustLevelThreshold(roleMeta.Guardian, bsMeta.Inactive, k.GetParams(ctx).GuardianTrustLevel) {
- return types.StatusInactive
+ if roleMeta.Guardian != 0 {
+ bsMeta := k.GetBridgeStatusMetadata(ctx)
+ if types.CheckTrustLevelThreshold(roleMeta.Guardian, bsMeta.Inactive, k.GetParams(ctx).GuardianTrustLevel) {
+ return types.StatusInactive
+ }
+
+ return types.StatusActive
}
- return types.StatusActive
+ return types.StatusInactive
}
func (k Keeper) setBridgeInactiveCounter(ctx sdk.Context, nInactive uint64) {
From bc831be7f6543f9d777338e95100adb2300fa082 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 19:18:03 +0900
Subject: [PATCH 47/49] lint
---
x/fbridge/keeper/grpc_query.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go
index 50c7455fe9..7c7046a535 100644
--- a/x/fbridge/keeper/grpc_query.go
+++ b/x/fbridge/keeper/grpc_query.go
@@ -3,13 +3,13 @@ package keeper
import (
"context"
"fmt"
- sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/Finschia/finschia-sdk/store/prefix"
sdk "github.com/Finschia/finschia-sdk/types"
+ sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
"github.com/Finschia/finschia-sdk/types/query"
"github.com/Finschia/finschia-sdk/x/fbridge/types"
)
From c2451736d0885673e0a98393b634bd78acc76c32 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 19:37:19 +0900
Subject: [PATCH 48/49] start fbridge module after auth/bank
---
simapp/app.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/simapp/app.go b/simapp/app.go
index a148bb385d..9b064b19b2 100644
--- a/simapp/app.go
+++ b/simapp/app.go
@@ -471,6 +471,7 @@ func NewSimApp(
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
+ fbridgetypes.ModuleName,
distrtypes.ModuleName,
stakingtypes.ModuleName,
slashingtypes.ModuleName,
@@ -488,7 +489,6 @@ func NewSimApp(
token.ModuleName,
collection.ModuleName,
fswaptypes.ModuleName,
- fbridgetypes.ModuleName,
)
// Uncomment if you want to set a custom migration order here.
From 3e332f7d4fed50eab9e84782aff14840ebf0fdd2 Mon Sep 17 00:00:00 2001
From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com>
Date: Tue, 7 May 2024 19:51:01 +0900
Subject: [PATCH 49/49] remove redundant invariant checking
---
x/fbridge/keeper/abci.go | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/x/fbridge/keeper/abci.go b/x/fbridge/keeper/abci.go
index 72de6bc624..28b5333b1f 100644
--- a/x/fbridge/keeper/abci.go
+++ b/x/fbridge/keeper/abci.go
@@ -56,22 +56,10 @@ func GuardianInvariant(k Keeper) sdk.Invariant {
}
numBridgeSw := len(k.GetBridgeSwitches(ctx))
- if numGuardian != numBridgeSw {
- return sdk.FormatInvariant(
- types.ModuleName, "guardian-invariant",
- fmt.Sprintf("number of guardians(%d) != number of bridge switches(%d)", numGuardian, numBridgeSw),
- ), true
- }
-
- bsMeta := k.GetBridgeStatusMetadata(ctx)
- roleMeta := k.GetRoleMetadata(ctx)
- if (bsMeta.Inactive + bsMeta.Active) != roleMeta.Guardian {
- return sdk.FormatInvariant(
- types.ModuleName, "guardian-invariant",
- fmt.Sprintf("Bridge status metadata (%+v) does not match with guardian role metadata(%d)", bsMeta, roleMeta.Guardian),
- ), true
- }
-
- return sdk.FormatInvariant(types.ModuleName, "guardian-invariant", ""), false
+ broken := numGuardian != numBridgeSw
+ return sdk.FormatInvariant(
+ types.ModuleName, "guardian-invariant",
+ fmt.Sprintf("number of guardians(%d) != number of bridge switches(%d)", numGuardian, numBridgeSw),
+ ), broken
}
}