Skip to content

Commit c778e7d

Browse files
authored
feat: extend DCI message structs (#210)
* feat: extend DCI message structs * chore: add entrypoint params placeholder to transaction builder * fix: rename call_data as calldata
1 parent b13360c commit c778e7d

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

proto/tycho/evm/v1/common.proto

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,29 @@ message EntryPoint {
159159
bytes target = 2;
160160
// The signature of the function to analyse.
161161
string signature = 3;
162+
// The id of the component that uses this entrypoint.
163+
string component_id = 4;
164+
}
165+
166+
// Parameters to trace the entrypoint
167+
message EntryPointParams {
168+
// The entrypoint id.
169+
string entrypoint_id = 1;
170+
// [optional] The component that uses these entrypoint parameters. Currently used for debugging purposes only.
171+
string component_id = 2;
172+
// The strategy and its corresponding data
173+
oneof trace_data {
174+
RPCTraceData rpc = 3;
175+
// Add more strategies here
176+
}
177+
}
178+
179+
// RPC tracing strategy with its data
180+
message RPCTraceData {
181+
// [optional] The caller to be used for the trace. If none is provided a chain default will be used.
182+
bytes caller = 1;
183+
// The calldata to be used for the trace
184+
bytes calldata = 2;
162185
}
163186

164187
// A contract and associated storage changes
@@ -187,6 +210,8 @@ message TransactionChanges {
187210
repeated BalanceChange balance_changes = 5;
188211
// An array of newly added entrypoints. Used for DCI enabled protocols.
189212
repeated EntryPoint entrypoints = 6;
213+
// An array of entrypoint tracing parameteres. Used for DCI enabled protocols.
214+
repeated EntryPointParams entrypoint_params = 7;
190215
}
191216

192217
// A set of storage changes aggregated by transaction.

substreams/crates/tycho-substreams/src/models.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ impl TransactionChangesBuilder {
184184
.entrypoints
185185
.into_iter()
186186
.collect::<Vec<_>>(),
187+
entrypoint_params: Vec::new(), // TODO: Add entrypoint params to builder
187188
};
188189
if tx_changes.is_empty() {
189190
None

substreams/crates/tycho-substreams/src/pb/tycho.evm.v1.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,45 @@ pub struct EntryPoint {
189189
/// The signature of the function to analyse.
190190
#[prost(string, tag="3")]
191191
pub signature: ::prost::alloc::string::String,
192+
/// The id of the component that uses this entrypoint.
193+
#[prost(string, tag="4")]
194+
pub component_id: ::prost::alloc::string::String,
195+
}
196+
/// Parameters to trace the entrypoint
197+
#[allow(clippy::derive_partial_eq_without_eq)]
198+
#[derive(Clone, PartialEq, ::prost::Message)]
199+
pub struct EntryPointParams {
200+
/// The entrypoint id.
201+
#[prost(string, tag="1")]
202+
pub entrypoint_id: ::prost::alloc::string::String,
203+
/// \[optional\] The component that uses these entrypoint parameters. Currently used for debugging purposes only.
204+
#[prost(string, tag="2")]
205+
pub component_id: ::prost::alloc::string::String,
206+
/// The strategy and its corresponding data
207+
#[prost(oneof="entry_point_params::TraceData", tags="3")]
208+
pub trace_data: ::core::option::Option<entry_point_params::TraceData>,
209+
}
210+
/// Nested message and enum types in `EntryPointParams`.
211+
pub mod entry_point_params {
212+
/// The strategy and its corresponding data
213+
#[allow(clippy::derive_partial_eq_without_eq)]
214+
#[derive(Clone, PartialEq, ::prost::Oneof)]
215+
pub enum TraceData {
216+
/// Add more strategies here
217+
#[prost(message, tag="3")]
218+
Rpc(super::RpcTraceData),
219+
}
220+
}
221+
/// RPC tracing strategy with its data
222+
#[allow(clippy::derive_partial_eq_without_eq)]
223+
#[derive(Clone, PartialEq, ::prost::Message)]
224+
pub struct RpcTraceData {
225+
/// \[optional\] The caller to be used for the trace. If none is provided a chain default will be used.
226+
#[prost(bytes="vec", tag="1")]
227+
pub caller: ::prost::alloc::vec::Vec<u8>,
228+
/// The calldata to be used for the trace
229+
#[prost(bytes="vec", tag="2")]
230+
pub calldata: ::prost::alloc::vec::Vec<u8>,
192231
}
193232
/// A contract and associated storage changes
194233
#[allow(clippy::derive_partial_eq_without_eq)]
@@ -227,6 +266,9 @@ pub struct TransactionChanges {
227266
/// An array of newly added entrypoints. Used for DCI enabled protocols.
228267
#[prost(message, repeated, tag="6")]
229268
pub entrypoints: ::prost::alloc::vec::Vec<EntryPoint>,
269+
/// An array of entrypoint tracing parameteres. Used for DCI enabled protocols.
270+
#[prost(message, repeated, tag="7")]
271+
pub entrypoint_params: ::prost::alloc::vec::Vec<EntryPointParams>,
230272
}
231273
/// A set of storage changes aggregated by transaction.
232274
#[allow(clippy::derive_partial_eq_without_eq)]

0 commit comments

Comments
 (0)