Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions modules/network/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,28 @@ func (q *queryServer) SoftConfirmationStatus(c context.Context, req *types.Query
QuorumFraction: q.keeper.GetParams(ctx).QuorumFraction,
}, nil
}

// ValidatorSignature queries the signature of a validator for a specific height
func (q *queryServer) ValidatorSignature(c context.Context, req *types.QueryValidatorSignatureRequest) (*types.QueryValidatorSignatureResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}

ctx := sdk.UnwrapSDKContext(c)

signature, err := q.keeper.GetSignature(ctx, req.Height, req.Validator)
if err != nil {
if errors.Is(err, collections.ErrNotFound) {
return &types.QueryValidatorSignatureResponse{
Signature: nil,
Found: false,
}, nil
}
return nil, status.Error(codes.Internal, fmt.Sprintf("failed to get signature: %v", err))
}

return &types.QueryValidatorSignatureResponse{
Signature: signature,
Found: true,
}, nil
}
570 changes: 517 additions & 53 deletions modules/network/types/query.pb.go

Large diffs are not rendered by default.

123 changes: 123 additions & 0 deletions modules/network/types/query.pb.gw.go

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

33 changes: 25 additions & 8 deletions modules/proto/rollkitsdk/network/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,44 @@ syntax = "proto3";

package rollkitsdk.network.v1;

option go_package = "github.com/rollkit/go-execution-abci/modules/network/types";

import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "rollkitsdk/network/v1/types.proto";

option go_package = "github.com/rollkit/go-execution-abci/modules/network/types";

// Query defines the gRPC querier service for the network module.
service Query {
// Params queries the module parameters
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/rollkit/network/v1/params";
}

// AttestationBitmap queries the attestation bitmap for a specific height
rpc AttestationBitmap(QueryAttestationBitmapRequest) returns (QueryAttestationBitmapResponse) {
option (google.api.http).get = "/rollkit/network/v1/attestation/{height}";
}

// EpochInfo queries information about a specific epoch
rpc EpochInfo(QueryEpochInfoRequest) returns (QueryEpochInfoResponse) {
option (google.api.http).get = "/rollkit/network/v1/epoch/{epoch}";
}

// ValidatorIndex queries the bitmap index for a validator
rpc ValidatorIndex(QueryValidatorIndexRequest) returns (QueryValidatorIndexResponse) {
option (google.api.http).get = "/rollkit/network/v1/validator/{address}";
}

// SoftConfirmationStatus queries if a height is soft-confirmed
rpc SoftConfirmationStatus(QuerySoftConfirmationStatusRequest) returns (QuerySoftConfirmationStatusResponse) {
option (google.api.http).get = "/rollkit/network/v1/soft-confirmation/{height}";
}

// ValidatorSignature queries the signature of a validator for a specific height
rpc ValidatorSignature(QueryValidatorSignatureRequest) returns (QueryValidatorSignatureResponse) {
option (google.api.http).get = "/rollkit/network/v1/signature/{height}/{validator}";
}
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
Expand Down Expand Up @@ -92,4 +97,16 @@ message QuerySoftConfirmationStatusResponse {
uint64 voted_power = 2;
uint64 total_power = 3;
string quorum_fraction = 4;
}
}

// QueryValidatorSignatureRequest is the request type for the Query/ValidatorSignature RPC method.
message QueryValidatorSignatureRequest {
int64 height = 1;
string validator = 2;
}

// QueryValidatorSignatureResponse is the response type for the Query/ValidatorSignature RPC method.
message QueryValidatorSignatureResponse {
bytes signature = 1;
bool found = 2;
}
4 changes: 0 additions & 4 deletions pkg/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"github.com/rollkit/go-execution-abci/pkg/p2p"
)

var _ execution.Executor = &Adapter{}

Check failure on line 39 in pkg/adapter/adapter.go

View workflow job for this annotation

GitHub Actions / test / Run Unit Tests

cannot use &Adapter{} (value of type *Adapter) as execution.Executor value in variable declaration: *Adapter does not implement execution.Executor (missing method GetExecutionMode)

Check failure on line 39 in pkg/adapter/adapter.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

cannot use &Adapter{} (value of type *Adapter) as execution.Executor value in variable declaration: *Adapter does not implement execution.Executor (missing method GetExecutionMode) (typecheck)

type P2PClientInfo interface {
Info() (string, string, string, error)
Expand Down Expand Up @@ -731,7 +731,3 @@
a.Logger.Debug("remaining stack after soft consensus", "count", len(a.stackedEvents), "soft_consensus", softCommitHeight)
return nil
}

func (a *Adapter) GetExecutionMode() execution.ExecutionMode {
return execution.ExecutionModeDelayed
}
Loading
Loading