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
This commit is contained in:
@@ -159,6 +159,29 @@ message EntryPoint {
|
||||
bytes target = 2;
|
||||
// The signature of the function to analyse.
|
||||
string signature = 3;
|
||||
// The id of the component that uses this entrypoint.
|
||||
string component_id = 4;
|
||||
}
|
||||
|
||||
// Parameters to trace the entrypoint
|
||||
message EntryPointParams {
|
||||
// The entrypoint id.
|
||||
string entrypoint_id = 1;
|
||||
// [optional] The component that uses these entrypoint parameters. Currently used for debugging purposes only.
|
||||
string component_id = 2;
|
||||
// The strategy and its corresponding data
|
||||
oneof trace_data {
|
||||
RPCTraceData rpc = 3;
|
||||
// Add more strategies here
|
||||
}
|
||||
}
|
||||
|
||||
// RPC tracing strategy with its data
|
||||
message RPCTraceData {
|
||||
// [optional] The caller to be used for the trace. If none is provided a chain default will be used.
|
||||
bytes caller = 1;
|
||||
// The calldata to be used for the trace
|
||||
bytes calldata = 2;
|
||||
}
|
||||
|
||||
// A contract and associated storage changes
|
||||
@@ -187,6 +210,8 @@ message TransactionChanges {
|
||||
repeated BalanceChange balance_changes = 5;
|
||||
// An array of newly added entrypoints. Used for DCI enabled protocols.
|
||||
repeated EntryPoint entrypoints = 6;
|
||||
// An array of entrypoint tracing parameteres. Used for DCI enabled protocols.
|
||||
repeated EntryPointParams entrypoint_params = 7;
|
||||
}
|
||||
|
||||
// A set of storage changes aggregated by transaction.
|
||||
|
||||
@@ -184,6 +184,7 @@ impl TransactionChangesBuilder {
|
||||
.entrypoints
|
||||
.into_iter()
|
||||
.collect::<Vec<_>>(),
|
||||
entrypoint_params: Vec::new(), // TODO: Add entrypoint params to builder
|
||||
};
|
||||
if tx_changes.is_empty() {
|
||||
None
|
||||
|
||||
@@ -189,6 +189,45 @@ pub struct EntryPoint {
|
||||
/// The signature of the function to analyse.
|
||||
#[prost(string, tag="3")]
|
||||
pub signature: ::prost::alloc::string::String,
|
||||
/// The id of the component that uses this entrypoint.
|
||||
#[prost(string, tag="4")]
|
||||
pub component_id: ::prost::alloc::string::String,
|
||||
}
|
||||
/// Parameters to trace the entrypoint
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct EntryPointParams {
|
||||
/// The entrypoint id.
|
||||
#[prost(string, tag="1")]
|
||||
pub entrypoint_id: ::prost::alloc::string::String,
|
||||
/// \[optional\] The component that uses these entrypoint parameters. Currently used for debugging purposes only.
|
||||
#[prost(string, tag="2")]
|
||||
pub component_id: ::prost::alloc::string::String,
|
||||
/// The strategy and its corresponding data
|
||||
#[prost(oneof="entry_point_params::TraceData", tags="3")]
|
||||
pub trace_data: ::core::option::Option<entry_point_params::TraceData>,
|
||||
}
|
||||
/// Nested message and enum types in `EntryPointParams`.
|
||||
pub mod entry_point_params {
|
||||
/// The strategy and its corresponding data
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
||||
pub enum TraceData {
|
||||
/// Add more strategies here
|
||||
#[prost(message, tag="3")]
|
||||
Rpc(super::RpcTraceData),
|
||||
}
|
||||
}
|
||||
/// RPC tracing strategy with its data
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct RpcTraceData {
|
||||
/// \[optional\] The caller to be used for the trace. If none is provided a chain default will be used.
|
||||
#[prost(bytes="vec", tag="1")]
|
||||
pub caller: ::prost::alloc::vec::Vec<u8>,
|
||||
/// The calldata to be used for the trace
|
||||
#[prost(bytes="vec", tag="2")]
|
||||
pub calldata: ::prost::alloc::vec::Vec<u8>,
|
||||
}
|
||||
/// A contract and associated storage changes
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
@@ -227,6 +266,9 @@ pub struct TransactionChanges {
|
||||
/// An array of newly added entrypoints. Used for DCI enabled protocols.
|
||||
#[prost(message, repeated, tag="6")]
|
||||
pub entrypoints: ::prost::alloc::vec::Vec<EntryPoint>,
|
||||
/// An array of entrypoint tracing parameteres. Used for DCI enabled protocols.
|
||||
#[prost(message, repeated, tag="7")]
|
||||
pub entrypoint_params: ::prost::alloc::vec::Vec<EntryPointParams>,
|
||||
}
|
||||
/// A set of storage changes aggregated by transaction.
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
|
||||
Reference in New Issue
Block a user