Skip to content

Commit

Permalink
new query
Browse files Browse the repository at this point in the history
  • Loading branch information
Teja2045 committed Aug 29, 2024
1 parent 8353539 commit 23c3af7
Show file tree
Hide file tree
Showing 6 changed files with 589 additions and 65 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ require (
github.com/cometbft/cometbft-db v0.9.1 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.0.2 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.1.2 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
Expand Down Expand Up @@ -153,7 +153,7 @@ require (
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
Expand Down
5 changes: 5 additions & 0 deletions keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,8 @@ func (k *Keeper) UpdateBlobStatus(ctx sdk.Context, req *types.MsgUpdateBlobStatu
err := updateBlobStatus(ctx, store, *req.BlocksRange, status)
return &types.MsgUpdateBlobStatusResponse{}, err
}

func (k *Keeper) SubmitBlobStatus(ctx sdk.Context, _ *types.QuerySubmitBlobStatusRequest) (*types.QuerySubmitBlobStatusResponse, error) {
// Todo: implement query
return nil, nil
}
8 changes: 8 additions & 0 deletions keeper/query_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"cosmossdk.io/collections"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/vitwit/avail-da-module/types"
)

Expand Down Expand Up @@ -89,3 +90,10 @@ func (qs queryServer) ExpiredBlocks(ctx context.Context, _ *types.QueryExpiredBl
ExpiredBlocks: expiredBlocks,
}, nil
}

func (qs queryServer) SubmitBlobStatus(ctx context.Context, req *types.QuerySubmitBlobStatusRequest) (*types.QuerySubmitBlobStatusResponse, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)

//TODO: query the light client
return qs.k.SubmitBlobStatus(sdkCtx, req)
}
24 changes: 24 additions & 0 deletions proto/sdk/avail/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,52 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "sdk/avail/v1beta1/validator.proto";
import "google/protobuf/timestamp.proto";
import "sdk/avail/v1beta1/tx.proto";

option go_package = "github.com/vitwit/avail-da-module/types";

// query request
message QuerySubmitBlobStatusRequest {
Range range = 1;
}

// query response
message QuerySubmitBlobStatusResponse {
string status = 1;
}

// Query defines the gRPC querier service.
service Query {

// submit Blob Status
rpc SubmitBlobStatus(QuerySubmitBlobStatusRequest)
returns (QuerySubmitBlobStatusResponse) {
option (google.api.http).get = "/availblob/v1beta1/submitBlobStatus";
}
// Validators returns registered validators of the module.
rpc Validators(QueryValidatorsRequest)
returns (QueryValidatorsResponse) {
option (google.api.http).get = "/availblob/v1beta1/validators";
}



// Todo: will be removed
rpc AvailAddress(QueryAvailAddressRequest) returns (QueryAvailAddressResponse) {
option (google.api.http).get = "/availblob/v1beta1/avail_address";
}

// proven height
rpc ProvenHeight(QueryProvenHeightRequest) returns (QueryProvenHeightResponse) {
option (google.api.http).get = "/availblob/v1beta1/proven_height";
}

// pending blocks
rpc PendingBlocks(QueryPendingBlocksRequest) returns (QueryPendingBlocksResponse) {
option (google.api.http).get = "/availblob/v1beta1/pending_blocks";
}

// expired blocks
rpc ExpiredBlocks(QueryExpiredBlocksRequest) returns (QueryExpiredBlocksResponse) {
option (google.api.http).get = "/availblob/v1beta1/expired_blocks";
}
Expand All @@ -52,6 +75,7 @@ message QueryAvailAddressResponse {
string avail_address = 1;
}

// proven Height
message QueryProvenHeightRequest {}

message QueryProvenHeightResponse {
Expand Down
Loading

0 comments on commit 23c3af7

Please sign in to comment.