Skip to content

Commit

Permalink
Broadcast proto (0xPolygonHermez#759)
Browse files Browse the repository at this point in the history
* Broadcast proto

* move batch_number outside of transaction

* address review comments

* add missing batch response fields

* updated generated code

* remove tx fields

* updated generated code

* Update proto/src/proto/broadcast/v1/broadcast.proto

Co-authored-by: a_bennassar <[email protected]>

* removed uneeded timestamp message and code regenerated

* reverted protoc version comment changes

Co-authored-by: a_bennassar <[email protected]>
  • Loading branch information
fgimenez and arnaubennassar authored Jun 16, 2022
1 parent f13073e commit 3e28edb
Show file tree
Hide file tree
Showing 4 changed files with 554 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ generate-code-from-proto: ## Generates code from proto files
cd proto/src/proto/zkprover/v1 && protoc --proto_path=. --go_out=../../../../../proverclient/pb --go-grpc_out=../../../../../proverclient/pb --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative zk-prover.proto
cd proto/src/proto/zkprover/v1 && protoc --proto_path=. --go_out=../../../../../proverservice/pb --go-grpc_out=../../../../../proverservice/pb --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative zk-prover.proto
cd proto/src/proto/executor/v1 && protoc --proto_path=. --go_out=../../../../../state/runtime/executor/pb --go-grpc_out=../../../../../state/runtime/executor/pb --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative executor.proto
cd proto/src/proto/broadcast/v1 && protoc --proto_path=. --go_out=../../../../../sequencerv2/broadcast/pb --go-grpc_out=../../../../../sequencerv2/broadcast/pb --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative broadcast.proto

.PHONY: update-external-dependencies
update-external-dependencies: ## Updates external dependencies like images, test vectors or proto files
Expand Down
34 changes: 34 additions & 0 deletions proto/src/proto/broadcast/v1/broadcast.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Broadcast service.
**/

syntax = "proto3";

package broadcast.v1;

option go_package = "github.com/hermeznetwork/hermez-core/sequencerv2/broadcast/pb";

service BroadcastService {
rpc GetLastBatch(Empty) returns (GetBatchResponse);
rpc GetBatch(GetBatchRequest) returns (GetBatchResponse);
}

// Requests
message GetBatchRequest {
uint64 batch_number = 1;
}

// Responses
message GetBatchResponse {
uint64 batch_number = 1;
string global_exit_root = 2;
uint64 timestamp = 3;
repeated Transaction transactions = 4;
}

// Common
message Transaction {
string encoded = 1;
}

message Empty{}
Loading

0 comments on commit 3e28edb

Please sign in to comment.