Skip to content

Commit

Permalink
feat: distinguish inturn relayer (#353)
Browse files Browse the repository at this point in the history
* distinguish inturn relayers

* fix test
  • Loading branch information
alexgao001 authored Oct 30, 2023
1 parent f5f1749 commit 771bd5d
Show file tree
Hide file tree
Showing 24 changed files with 431 additions and 134 deletions.
242 changes: 184 additions & 58 deletions api/cosmos/oracle/v1/query.pulsar.go

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion proto/cosmos/oracle/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,22 @@ message QueryParamsResponse {
Params params = 1 [(gogoproto.nullable) = false];
}

// ClaimSrcChain defines the src chain of a claim
enum ClaimSrcChain {
option (gogoproto.goproto_enum_prefix) = false;
// CLAIM_SRC_CHAIN_UNSPECIFIED
CLAIM_SRC_CHAIN_UNSPECIFIED = 0;
// CLAIM_SRC_CHAIN_BSC defines BSC source chain
CLAIM_SRC_CHAIN_BSC = 1;
// CLAIM_SRC_CHAIN_OP_BNB defines OPBNB source chain
CLAIM_SRC_CHAIN_OP_BNB = 2;
}

// QueryInturnRelayerRequest is the request type for the Query In-turn relayer RPC method.
message QueryInturnRelayerRequest {}
message QueryInturnRelayerRequest {
// ClaimSrcChain defines the src chain of a claim
ClaimSrcChain claim_src_chain = 1;
}

// QueryInturnRelayerResponse is the response type for the Query In-turn relayer RPC method.
message QueryInturnRelayerResponse {
Expand Down
1 change: 1 addition & 0 deletions snapshots/types/snapshot.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions tests/e2e/bank/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ func (s *E2ETestSuite) TestTotalSupplyGRPCHandler() {
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))),
),
Pagination: &query.PageResponse{
Total: 2,
},
Pagination: &query.PageResponse{},
},
},
{
Expand Down Expand Up @@ -160,7 +158,7 @@ func (s *E2ETestSuite) TestDenomMetadataGRPCHandler() {
Display: "eth",
},
},
Pagination: &query.PageResponse{Total: 2},
Pagination: &query.PageResponse{},
},
},
{
Expand Down Expand Up @@ -244,9 +242,7 @@ func (s *E2ETestSuite) TestBalancesGRPCHandler() {
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)),
),
Pagination: &query.PageResponse{
Total: 2,
},
Pagination: &query.PageResponse{},
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/bank/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (s *E2ETestSuite) TestGetCmdQueryDenomsMetadata() {
Display: "eth",
},
},
Pagination: &query.PageResponse{Total: 2},
Pagination: &query.PageResponse{},
},
},
{
Expand Down
4 changes: 1 addition & 3 deletions tests/e2e/slashing/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ func (s *E2ETestSuite) TestGRPCQueries() {
JailedUntil: time.Unix(0, 0),
},
},
Pagination: &query.PageResponse{
Total: uint64(1),
},
Pagination: &query.PageResponse{},
},
},
{
Expand Down
5 changes: 2 additions & 3 deletions tests/e2e/staking/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func (s *E2ETestSuite) TestGRPCQueryDelegatorDelegations() {
DelegationResponses: types.DelegationResponses{
types.NewDelegationResp(val.Address, val.ValAddress, sdk.NewDecFromInt(cli.DefaultTokens), sdk.NewCoin(sdk.DefaultBondDenom, cli.DefaultTokens)),
},
Pagination: &query.PageResponse{Total: 1},
Pagination: &query.PageResponse{},
},
},
{
Expand All @@ -413,7 +413,7 @@ func (s *E2ETestSuite) TestGRPCQueryDelegatorDelegations() {
&types.QueryDelegatorDelegationsResponse{},
&types.QueryDelegatorDelegationsResponse{
DelegationResponses: types.DelegationResponses{},
Pagination: &query.PageResponse{Total: 0},
Pagination: &query.PageResponse{},
},
},
}
Expand Down Expand Up @@ -592,7 +592,6 @@ func (s *E2ETestSuite) TestGRPCQueryDelegatorValidators() {
} else {
s.Require().NoError(err)
s.Require().Len(validators.Validators, len(s.network.Validators))
s.Require().Equal(int(validators.Pagination.Total), len(s.network.Validators))
}
})
}
Expand Down
9 changes: 9 additions & 0 deletions testutil/testdata/unknonwnproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions types/query/pagination.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions types/tx/signing/signing.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions types/tx/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions x/distribution/types/distribution.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions x/gashub/types/gashub.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions x/gov/testutil/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ type CrossChainKeeper interface {
GetReceiveSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) uint64

IsDestChainSupported(chainID sdk.ChainID) bool

GetDestOpChainID() sdk.ChainID
}
14 changes: 14 additions & 0 deletions x/gov/testutil/expected_keepers_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions x/gov/types/v1/gov.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions x/group/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/oracle/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ func (k Keeper) InturnRelayer(c context.Context, req *types.QueryInturnRelayerRe
}
ctx := sdk.UnwrapSDKContext(c)
_, relayerInterval := k.GetRelayerParams(ctx)
return k.GetInturnRelayer(ctx, relayerInterval)
return k.GetInturnRelayer(ctx, relayerInterval, req.ClaimSrcChain)
}
Loading

0 comments on commit 771bd5d

Please sign in to comment.