Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bandprotocol/chain into u…
Browse files Browse the repository at this point in the history
…pgrade-v3
  • Loading branch information
RogerKSI committed Nov 29, 2024
2 parents c704ed5 + 9086318 commit 202c768
Show file tree
Hide file tree
Showing 12 changed files with 1,691 additions and 286 deletions.
1,201 changes: 1,051 additions & 150 deletions api/band/tunnel/v1beta1/query.pulsar.go

Large diffs are not rendered by default.

53 changes: 46 additions & 7 deletions api/band/tunnel/v1beta1/query_grpc.pb.go

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

6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/bytecodealliance/wasmtime-go/v20 v20.0.0
github.com/cometbft/cometbft v0.38.12
github.com/cometbft/cometbft-db v0.11.0
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/cosmos-db v1.1.0
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.10
github.com/cosmos/go-bip39 v1.0.0
Expand All @@ -44,7 +44,7 @@ require (
github.com/spf13/cast v1.7.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.10.0
go.uber.org/mock v0.5.0
golang.org/x/crypto v0.26.0
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38
Expand Down Expand Up @@ -117,7 +117,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
Expand Down
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs=
github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA=
github.com/cosmos/cosmos-db v1.1.0 h1:KLHNVQ73h7vawXTpj9UJ7ZR2IXv51tsEHkQJJ9EBDzI=
github.com/cosmos/cosmos-db v1.1.0/go.mod h1:t7c4A6cfGdpUwwVxrQ0gQLeRQqGUBJu0yvE4F/26REg=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/cosmos-sdk v0.50.10 h1:zXfeu/z653tWZARr/jESzAEiCUYjgJwwG4ytnYWMoDM=
Expand Down Expand Up @@ -578,8 +578,8 @@ github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXi
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
Expand Down Expand Up @@ -1050,8 +1050,9 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
Expand Down
7 changes: 6 additions & 1 deletion grogu/signaller/signaller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,14 @@ func (s *SignallerTestSuite) TestGetAllSignalIDs() {
// Update internal variables
s.TestUpdateInternalVariables()

expectedSignalIDs := []string{"signal1", "signal2"}

signalIDs = s.Signaller.getAllSignalIDs()
s.Require().NotEmpty(signalIDs)
s.Require().Equal("signal1", signalIDs[0])

// sort signalIDs to compare
sort.Strings(signalIDs)
s.Require().Equal(expectedSignalIDs, signalIDs)
}

func (s *SignallerTestSuite) TestGetNonPendingSignalIDs() {
Expand Down
14 changes: 14 additions & 0 deletions proto/band/tunnel/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ service Query {
option (google.api.http).get = "/tunnel/v1beta1/tunnels/{tunnel_id}/packets/{sequence}";
}

// TotalFees is a RPC method that returns the total fees collected by the tunnel
rpc TotalFees(QueryTotalFeesRequest) returns (QueryTotalFeesResponse) {
option (google.api.http).get = "/tunnel/v1beta1/total_fees";
}

// Params is a RPC method that returns all parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/tunnel/v1beta1/params";
Expand Down Expand Up @@ -148,6 +153,15 @@ message QueryPacketResponse {
Packet packet = 1;
}

// QueryTotalFeesRequest is the request type for the Query/TotalFees RPC method.
message QueryTotalFeesRequest {}

// QueryTotalFeesResponse is the response type for the Query/TotalFees RPC method.
message QueryTotalFeesResponse {
// total_fees is the total fees collected by the tunnel.
TotalFees total_fees = 1 [(gogoproto.nullable) = false];
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {}

Expand Down
5 changes: 5 additions & 0 deletions x/tunnel/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
{ProtoField: "sequence"},
},
},
{
RpcMethod: "TotalFees",
Use: "total-fees",
Short: "Query total fees",
},
},
},
Tx: &autocliv1.ServiceCommandDescriptor{
Expand Down
10 changes: 10 additions & 0 deletions x/tunnel/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ func (q queryServer) Packet(c context.Context, req *types.QueryPacketRequest) (*
return &types.QueryPacketResponse{Packet: &packet}, nil
}

func (q queryServer) TotalFees(
c context.Context,
req *types.QueryTotalFeesRequest,
) (*types.QueryTotalFeesResponse, error) {
ctx := sdk.UnwrapSDKContext(c)

totalFees := q.k.GetTotalFees(ctx)
return &types.QueryTotalFeesResponse{TotalFees: totalFees}, nil
}

// Params queries all params of the module.
func (q queryServer) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
Expand Down
Loading

0 comments on commit 202c768

Please sign in to comment.