Skip to content

Commit 6df03ea

Browse files
committed
poi tracing
1 parent e2e6925 commit 6df03ea

File tree

5 files changed

+384
-0
lines changed

5 files changed

+384
-0
lines changed

graph/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ fn main() {
1313
)
1414
.expect("Failed to compile Firehose proto(s)");
1515

16+
tonic_build::configure()
17+
.out_dir("src/components/tracing")
18+
.compile(&["proto/x-ray.proto"], &["proto"])
19+
.expect("Failed to compile common proto(s)");
20+
1621
tonic_build::configure()
1722
.protoc_arg("--experimental_allow_proto3_optional")
1823
.out_dir("src/substreams")

graph/proto/x-ray.proto

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
syntax = "proto3";
2+
3+
package thegraph.tracing.v1;
4+
5+
message EthereumABIToken {
6+
message FixedBytes {
7+
uint32 size = 1;
8+
bytes items = 2;
9+
}
10+
11+
message FixedArray {
12+
uint32 size = 1;
13+
repeated EthereumABIToken items = 2;
14+
}
15+
16+
message Array {
17+
repeated EthereumABIToken array = 1;
18+
}
19+
20+
oneof value {
21+
string address = 1;
22+
FixedBytes bytes = 2;
23+
int64 int = 3;
24+
uint64 uint = 4;
25+
bool bool = 5;
26+
string str = 6;
27+
Array array = 7;
28+
Array tuple = 8;
29+
}
30+
}
31+
32+
message EthCallResult {
33+
oneof result {
34+
string error = 1;
35+
EthereumABIToken.Array array = 2;
36+
}
37+
}
38+
39+
message EthereumCall {
40+
string contract_name = 1;
41+
string contract_address = 2;
42+
string function_name = 3;
43+
string function_signature = 4;
44+
repeated EthereumABIToken function_args = 5;
45+
EthCallResult result = 6;
46+
}
47+
48+
message WasmError {
49+
string message = 1;
50+
bool deterministic = 2;
51+
}
52+
53+
message Output {
54+
oneof output {
55+
EntityChanges entity_changes = 1;
56+
WasmError error = 2;
57+
}
58+
}
59+
60+
message Trigger {}
61+
62+
message Input {
63+
repeated Trigger triggers = 1;
64+
repeated ChainSpecificInput chain_inputs = 2;
65+
}
66+
67+
message ChainSpecificInput {
68+
oneof input{
69+
EthereumCall call = 1;
70+
}
71+
}
72+
73+
message Trace {
74+
Input inputs = 1;
75+
Output output = 2;
76+
string poi = 3;
77+
}
78+
79+
80+
message EntityChanges {
81+
repeated EntityChange entity_changes = 5;
82+
}
83+
84+
message EntityChange {
85+
string entity = 1;
86+
string id = 2;
87+
uint64 ordinal = 3;
88+
enum Operation {
89+
UNSET = 0; // Protobuf default should not be used, this is used so that the consume can ensure that the value was actually specified
90+
CREATE = 1;
91+
UPDATE = 2;
92+
DELETE = 3;
93+
}
94+
Operation operation = 4;
95+
repeated Field fields = 5;
96+
}
97+
98+
message Value {
99+
oneof typed {
100+
int32 int32 = 1;
101+
string bigdecimal = 2;
102+
string bigint = 3;
103+
string string = 4;
104+
bytes bytes = 5;
105+
bool bool = 6;
106+
107+
Array array = 10;
108+
}
109+
}
110+
111+
message Array {
112+
repeated Value value = 1;
113+
}
114+
115+
message Field {
116+
string name = 1;
117+
optional Value new_value = 3;
118+
optional Value old_value = 5;
119+
}

graph/src/components/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ pub mod versions;
6262

6363
pub mod adapter;
6464

65+
pub mod tracing;
66+
6567
/// A component that receives events of type `T`.
6668
pub trait EventConsumer<E> {
6769
/// Get the event sink.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#[rustfmt::skip]
2+
#[path = "thegraph.tracing.v1.rs"]
3+
mod pbtracing;

0 commit comments

Comments
 (0)