-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0f70b8
commit c51fba7
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "chain-watch" | ||
version = "0.1.0" | ||
authors = ["Enzo Cioppettini <[email protected]>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
prost = "0.7" | ||
|
||
[dependencies.tonic] | ||
version = "0.4" | ||
default-features = false | ||
features = ["codegen", "prost"] | ||
|
||
[build-dependencies.tonic-build] | ||
version = "0.4" | ||
default-features = false | ||
features = ["prost"] | ||
|
||
[features] | ||
default = ["tonic/transport", "tonic-build/transport"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
tonic_build::compile_protos("proto/watch.proto").unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
syntax = "proto3"; | ||
|
||
package iohk.chain.watch; | ||
|
||
|
||
message Block { | ||
bytes content = 1; | ||
} | ||
|
||
message BlockSubscriptionRequest {} | ||
|
||
message TipSubscriptionRequest {} | ||
|
||
message MempoolSubscriptionRequest {} | ||
|
||
message SyncMultiverseRequest { | ||
// send blocks with this chain_length or greater | ||
uint32 from = 1; | ||
} | ||
|
||
message BlockId { | ||
bytes content = 1; | ||
} | ||
|
||
message MempoolEvent { | ||
bytes fragment_id = 1; | ||
oneof event { | ||
MempoolFragmentInserted inserted = 2; | ||
MempoolFragmentRejected rejected = 3; | ||
MempoolFragmentInABlock in_a_block = 4; | ||
}; | ||
} | ||
|
||
|
||
message MempoolFragmentInserted {} | ||
|
||
message MempoolFragmentRejected { | ||
string reason = 1; | ||
} | ||
|
||
message MempoolFragmentInABlock { | ||
BlockId block = 1; | ||
} | ||
|
||
|
||
service SubscriptionService { | ||
// get a stream of blocks succesfully processed by the node, this means they | ||
// are already validated. | ||
// the parent of a block will always be streamed before the block itself. | ||
rpc BlockSubscription(BlockSubscriptionRequest) returns (stream Block); | ||
|
||
// get tip updates | ||
rpc TipSubscription(TipSubscriptionRequest) returns (stream BlockId); | ||
|
||
rpc MempoolSubscription(MempoolSubscriptionRequest) returns (stream MempoolEvent); | ||
|
||
// fetch all blocks from the given initial chainlength to the tip, from all | ||
// possible branches and in increasing order | ||
rpc SyncMultiverse(SyncMultiverseRequest) returns (stream Block); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tonic::include_proto!("iohk.chain.watch"); |