Skip to content

Commit

Permalink
fix: refine the code of crosschain and oracle module (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
yutianwu authored Mar 17, 2023
1 parent debd6c0 commit 5e13784
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 17 deletions.
1 change: 1 addition & 0 deletions proto/cosmos/crosschain/v1/crosschain.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/crosschain/types";

// Params holds parameters for the cross chain module.
message Params {
// initial balance to mint for crosschain module when the chain starts
string init_module_balance = 1;
}
7 changes: 7 additions & 0 deletions proto/cosmos/crosschain/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,38 @@ message QueryParamsResponse {

// QueryCrossChainPackageRequest is the request type for the Query/CrossChainPackage RPC method.
message QueryCrossChainPackageRequest {
// channel id of the cross chain package
uint32 channel_id = 1;
// sequence of the cross chain package
uint64 sequence = 2;
}

// QueryCrossChainPackageResponse is the response type for the Query/CrossChainPackage RPC method.
message QueryCrossChainPackageResponse {
// content of the cross chain package
bytes package = 1;
}

// QuerySendSequenceRequest is the request type for the Query/SendSequence RPC method.
message QuerySendSequenceRequest {
// channel id of the cross chain package
uint32 channel_id = 1;
}

// QuerySendSequenceResponse is the response type for the Query/SendSequence RPC method.
message QuerySendSequenceResponse {
// sequence of the cross chain package
uint64 sequence = 1;
}

// QuerySendSequenceRequest is the request type for the Query/ReceiveSequence RPC method.
message QueryReceiveSequenceRequest {
// channel id of the cross chain package
uint32 channel_id = 1;
}

// QuerySendSequenceResponse is the response type for the Query/ReceiveSequence RPC method.
message QueryReceiveSequenceResponse {
// sequence of the cross chain package
uint64 sequence = 1;
}
8 changes: 8 additions & 0 deletions proto/cosmos/oracle/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ message MsgClaim {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

// sender address of the msg
string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// source chain id
uint32 src_chain_id = 2;
// destination chain id
uint32 dest_chain_id = 3;
// sequence of the oracle channel
uint64 sequence = 4;
// timestamp of the claim
uint64 timestamp = 5;
// payload of the claim
bytes payload = 6;
// bit map of the voted validators
repeated fixed64 vote_address_set = 7;
// bls signature of the claim
bytes agg_signature = 8;
}

Expand Down
1 change: 1 addition & 0 deletions x/crosschain/types/crosschain.pb.go

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

2 changes: 0 additions & 2 deletions x/crosschain/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ const (
SequenceLength = 8

GovChannelId = sdk.ChannelID(9)

QueryParameters = "parameters"
)

var (
Expand Down
9 changes: 8 additions & 1 deletion x/crosschain/types/query.pb.go

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

10 changes: 5 additions & 5 deletions x/oracle/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"github.com/cosmos/cosmos-sdk/x/oracle/types"
)

func (suite *TestSuite) TestQueryParams() {
res, err := suite.queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{})
suite.Require().NoError(err)
suite.Require().NotNil(res)
suite.Require().Equal(suite.app.OracleKeeper.GetParams(suite.ctx), res.GetParams())
func (s *TestSuite) TestQueryParams() {
res, err := s.queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{})
s.Require().NoError(err)
s.Require().NotNil(res)
s.Require().Equal(s.app.OracleKeeper.GetParams(s.ctx), res.GetParams())
}
2 changes: 1 addition & 1 deletion x/oracle/types/oracle.pb.go

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

1 change: 0 additions & 1 deletion x/oracle/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const (

var (
KeyParamRelayerTimeout = []byte("RelayerTimeout")
KeyParamRelayerBackoffTime = []byte("RelayerBackoffTime")
KeyParamRelayerRewardShare = []byte("RelayerRewardShare")
KeyParamRelayerInterval = []byte("RelayerInterval")
)
Expand Down
22 changes: 15 additions & 7 deletions x/oracle/types/tx.pb.go

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

0 comments on commit 5e13784

Please sign in to comment.