Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poi tracing #5618

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions graph/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ fn main() {
)
.expect("Failed to compile Firehose proto(s)");

tonic_build::configure()
.out_dir("src/components/tracing")
.compile(&["proto/x-ray.proto"], &["proto"])
.expect("Failed to compile common proto(s)");

tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.out_dir("src/substreams")
Expand Down
119 changes: 119 additions & 0 deletions graph/proto/x-ray.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
syntax = "proto3";

package thegraph.tracing.v1;

message EthereumABIToken {
message FixedBytes {
uint32 size = 1;
bytes items = 2;
}

message FixedArray {
uint32 size = 1;
repeated EthereumABIToken items = 2;
}

message Array {
repeated EthereumABIToken array = 1;
}

oneof value {
string address = 1;
FixedBytes bytes = 2;
int64 int = 3;
uint64 uint = 4;
bool bool = 5;
string str = 6;
Array array = 7;
Array tuple = 8;
}
}

message EthCallResult {
oneof result {
string error = 1;
EthereumABIToken.Array array = 2;
}
}

message EthereumCall {
string contract_name = 1;
string contract_address = 2;
string function_name = 3;
string function_signature = 4;
repeated EthereumABIToken function_args = 5;
EthCallResult result = 6;
}

message WasmError {
string message = 1;
bool deterministic = 2;
}

message Output {
oneof output {
EntityChanges entity_changes = 1;
WasmError error = 2;
}
}

message Trigger {}

message Input {
repeated Trigger triggers = 1;
repeated ChainSpecificInput chain_inputs = 2;
}

message ChainSpecificInput {
oneof input{
EthereumCall call = 1;
}
}

message Trace {
Input inputs = 1;
Output output = 2;
string poi = 3;
}


message EntityChanges {
repeated EntityChange entity_changes = 5;
}

message EntityChange {
string entity = 1;
string id = 2;
uint64 ordinal = 3;
enum Operation {
UNSET = 0; // Protobuf default should not be used, this is used so that the consume can ensure that the value was actually specified
CREATE = 1;
UPDATE = 2;
DELETE = 3;
}
Operation operation = 4;
repeated Field fields = 5;
}

message Value {
oneof typed {
int32 int32 = 1;
string bigdecimal = 2;
string bigint = 3;
string string = 4;
bytes bytes = 5;
bool bool = 6;

Array array = 10;
}
}

message Array {
repeated Value value = 1;
}

message Field {
string name = 1;
optional Value new_value = 3;
optional Value old_value = 5;
}
2 changes: 2 additions & 0 deletions graph/src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ pub mod versions;

pub mod adapter;

pub mod tracing;

/// A component that receives events of type `T`.
pub trait EventConsumer<E> {
/// Get the event sink.
Expand Down
3 changes: 3 additions & 0 deletions graph/src/components/tracing/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[rustfmt::skip]
#[path = "thegraph.tracing.v1.rs"]
mod pbtracing;
Loading
Loading