Skip to content

Commit

Permalink
Implement feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed Jun 6, 2024
1 parent 8aeb230 commit fb0f2e2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 76 deletions.
10 changes: 4 additions & 6 deletions grpc-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ func (me *MultiEpoch) GetVersion(context.Context, *old_faithful_grpc.VersionRequ
}
return GitTag
}(),
Commit: GitCommit,
Epochs: me.GetEpochNumbers(),
}
return resp, nil
}
Expand Down Expand Up @@ -292,7 +290,7 @@ func (multi *MultiEpoch) GetBlock(ctx context.Context, params *old_faithful_grpc
{
pos, ok := transactionNode.GetPositionIndex()
if ok {
txResp.Position = ptrToUint64(uint64(pos))
txResp.Index = ptrToUint64(uint64(pos))
}
txResp.Transaction, txResp.Meta, err = getTransactionAndMetaFromNode(transactionNode, epochHandler.GetDataFrameByCid)
if err != nil {
Expand All @@ -305,10 +303,10 @@ func (multi *MultiEpoch) GetBlock(ctx context.Context, params *old_faithful_grpc
}

sort.Slice(allTransactions, func(i, j int) bool {
if allTransactions[i].Position == nil || allTransactions[j].Position == nil {
if allTransactions[i].Index == nil || allTransactions[j].Index == nil {
return false
}
return *allTransactions[i].Position < *allTransactions[j].Position
return *allTransactions[i].Index < *allTransactions[j].Index
})
tim.time("get transactions")
resp.Transactions = allTransactions
Expand Down Expand Up @@ -421,7 +419,7 @@ func (multi *MultiEpoch) GetTransaction(ctx context.Context, params *old_faithfu
{
pos, ok := transactionNode.GetPositionIndex()
if ok {
response.Position = ptrToUint64(uint64(pos))
response.Index = ptrToUint64(uint64(pos))
}
response.Transaction.Transaction, response.Transaction.Meta, err = getTransactionAndMetaFromNode(transactionNode, epochHandler.GetDataFrameByCid)
if err != nil {
Expand Down
108 changes: 44 additions & 64 deletions old-faithful-proto/old-faithful-grpc/old-faithful.pb.go

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

10 changes: 4 additions & 6 deletions old-faithful-proto/proto/old-faithful.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ message VersionRequest {}

message VersionResponse {
string version = 1;
string commit = 2;
repeated uint64 epochs = 3;
}

message BlockRequest {
Expand All @@ -41,11 +39,11 @@ message TransactionResponse {
Transaction transaction = 1;
uint64 slot = 2;
int64 block_time = 3;
optional uint64 position = 4; // position in the block
optional uint64 index = 4; // position in the block
}

message Transaction {
bytes transaction = 1; // solana native transaction
bytes meta = 2; // bincode or protobuf
optional uint64 position = 4; // position in the block
bytes transaction = 1; // solana native transaction
bytes meta = 2; // bincode or protobuf
optional uint64 index = 4; // position in the block
}

0 comments on commit fb0f2e2

Please sign in to comment.