Skip to content

Commit

Permalink
feat: allow disabling part proofs
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Oct 11, 2024
1 parent 56bf584 commit 49befbd
Show file tree
Hide file tree
Showing 4 changed files with 291 additions and 116 deletions.
197 changes: 140 additions & 57 deletions proto/tendermint/rpc/grpc/types.pb.go

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

6 changes: 4 additions & 2 deletions proto/tendermint/rpc/grpc/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ message RequestBroadcastTx {
}

message BlockByHashRequest {
bytes hash = 1;
bytes hash = 1;
bool prove_parts = 2;
}

message BlockByHeightRequest {
int64 height = 1;
int64 height = 1;
bool prove_parts = 2;
}

message BlockMetaByHashRequest {
Expand Down
7 changes: 7 additions & 0 deletions rpc/grpc/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"github.com/tendermint/tendermint/proto/tendermint/crypto"
"sync"
"time"

Expand Down Expand Up @@ -188,6 +189,9 @@ func (blockAPI *BlockAPI) BlockByHash(req *BlockByHashRequest, stream BlockAPI_B
if err != nil {
return err
}
if !req.ProveParts {
part.Proof = crypto.Proof{}
}
isLastPart := i == int(blockMeta.BlockID.PartSetHeader.Total)-1
err = stream.Send(&BlockByHashResponse{
BlockPart: part,
Expand All @@ -208,6 +212,9 @@ func (blockAPI *BlockAPI) BlockByHeight(req *BlockByHeightRequest, stream BlockA
if err != nil {
return err
}
if !req.ProveParts {
part.Proof = crypto.Proof{}
}
isLastPart := i == int(blockMeta.BlockID.PartSetHeader.Total)-1
err = stream.Send(&BlockByHeightResponse{
BlockPart: part,
Expand Down
Loading

0 comments on commit 49befbd

Please sign in to comment.