diff --git a/proto/tycho/evm/v1/common.proto b/proto/tycho/evm/v1/common.proto index 7f6d369..8da97e7 100644 --- a/proto/tycho/evm/v1/common.proto +++ b/proto/tycho/evm/v1/common.proto @@ -106,3 +106,63 @@ message BalanceChange { // If the protocol component includes multiple contracts, the balance change must be aggregated to reflect how much tokens can be traded. bytes component_id = 3; } + +// Native entities + +// A component is a set of attributes that are associated with a custom entity. +message EntityChanges { + // A unique identifier of the entity within the protocol. + string component_id = 1; + // The set of attributes that are associated with the entity. + repeated Attribute attributes = 2; +} + +// VM entities + +// A key value entry into contract storage. +message ContractSlot { + // A contract's storage slot. + bytes slot = 2; + // The new value for this storage slot. + bytes value = 3; +} + +// Changes made to a single contract's state. +message ContractChange { + // The contract's address + bytes address = 1; + // The new balance of the contract, empty bytes indicates no change. + bytes balance = 2; + // The new code of the contract, empty bytes indicates no change. + bytes code = 3; + // The changes to this contract's slots, empty sequence indicates no change. + repeated ContractSlot slots = 4; + // Whether this is an update, a creation or a deletion. + ChangeType change = 5; +} + +// Aggregate entities + +// A set of changes aggregated by transaction. +message TransactionChanges { + // The transaction instance that results in the changes. + Transaction tx = 1; + // Contains the changes induced by the above transaction, aggregated on a per-contract basis. + // Contains the contract changes induced by the above transaction, usually for tracking VM components. + repeated ContractChange contract_changes = 2; + // Contains the entity changes induced by the above transaction. + // Usually for tracking native components or used for VM extensions (plugins). + repeated EntityChanges entity_changes = 3; + // An array of newly added components. + repeated ProtocolComponent component_changes = 4; + // An array of balance changes to components. + repeated BalanceChange balance_changes = 5; +} + +// A set of transaction changes within a single block. +message BlockChanges { + // The block for which these changes are collectively computed. + Block block = 1; + // The set of transaction changes observed in the specified block. + repeated TransactionChanges changes = 2; +} \ No newline at end of file diff --git a/proto/tycho/evm/v1/entity.proto b/proto/tycho/evm/v1/entity.proto index 14539e4..221b309 100644 --- a/proto/tycho/evm/v1/entity.proto +++ b/proto/tycho/evm/v1/entity.proto @@ -4,16 +4,9 @@ package tycho.evm.v1; import "tycho/evm/v1/common.proto"; +// WARNING: DEPRECATED. Please use common.proto's TransactionChanges and BlockChanges instead. // This file contains the definition for the native integration of Substreams. -// A component is a set of attributes that are associated with a custom entity. -message EntityChanges { - // A unique identifier of the entity within the protocol. - string component_id = 1; - // The set of attributes that are associated with the entity. - repeated Attribute attributes = 2; -} - message TransactionEntityChanges { Transaction tx = 1; repeated EntityChanges entity_changes = 2; diff --git a/proto/tycho/evm/v1/vm.proto b/proto/tycho/evm/v1/vm.proto index a49dcf0..3f36fdd 100644 --- a/proto/tycho/evm/v1/vm.proto +++ b/proto/tycho/evm/v1/vm.proto @@ -4,38 +4,16 @@ package tycho.evm.v1; import "tycho/evm/v1/common.proto"; +// WARNING: DEPRECATED. Please use common.proto's TransactionChanges and BlockChanges instead. // This file contains proto definitions specific to the VM integration. -// A key value entry into contract storage. -message ContractSlot { - // A contract's storage slot. - bytes slot = 2; - // The new value for this storage slot. - bytes value = 3; -} - -// Changes made to a single contract's state. -message ContractChange { - // The contract's address - bytes address = 1; - // The new native balance of the contract, empty bytes indicates no change. - bytes balance = 2; - // The new code of the contract, empty bytes indicates no change. - bytes code = 3; - // The changes to this contract's slots, empty sequence indicates no change. - repeated ContractSlot slots = 4; - // Whether this is an update, a creation or a deletion. - ChangeType change = 5; -} - // A set of changes aggregated by transaction. message TransactionContractChanges { // The transaction instance that results in the changes. Transaction tx = 1; // Contains the changes induced by the above transaction, aggregated on a per-contract basis. - // Must include changes to every contract that is tracked by all ProtocolComponents. repeated ContractChange contract_changes = 2; - // An array of any component changes. + // An array of newly added components. repeated ProtocolComponent component_changes = 3; // An array of balance changes to components. repeated BalanceChange balance_changes = 4; diff --git a/substreams/crates/tycho-substreams/src/pb/tycho.evm.v1.rs b/substreams/crates/tycho-substreams/src/pb/tycho.evm.v1.rs index 5409eff..39cbcb3 100644 --- a/substreams/crates/tycho-substreams/src/pb/tycho.evm.v1.rs +++ b/substreams/crates/tycho-substreams/src/pb/tycho.evm.v1.rs @@ -115,6 +115,87 @@ pub struct BalanceChange { #[prost(bytes="vec", tag="3")] pub component_id: ::prost::alloc::vec::Vec, } +// Native entities + +/// A component is a set of attributes that are associated with a custom entity. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EntityChanges { + /// A unique identifier of the entity within the protocol. + #[prost(string, tag="1")] + pub component_id: ::prost::alloc::string::String, + /// The set of attributes that are associated with the entity. + #[prost(message, repeated, tag="2")] + pub attributes: ::prost::alloc::vec::Vec, +} +// VM entities + +/// A key value entry into contract storage. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ContractSlot { + /// A contract's storage slot. + #[prost(bytes="vec", tag="2")] + pub slot: ::prost::alloc::vec::Vec, + /// The new value for this storage slot. + #[prost(bytes="vec", tag="3")] + pub value: ::prost::alloc::vec::Vec, +} +/// Changes made to a single contract's state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ContractChange { + /// The contract's address + #[prost(bytes="vec", tag="1")] + pub address: ::prost::alloc::vec::Vec, + /// The new balance of the contract, empty bytes indicates no change. + #[prost(bytes="vec", tag="2")] + pub balance: ::prost::alloc::vec::Vec, + /// The new code of the contract, empty bytes indicates no change. + #[prost(bytes="vec", tag="3")] + pub code: ::prost::alloc::vec::Vec, + /// The changes to this contract's slots, empty sequence indicates no change. + #[prost(message, repeated, tag="4")] + pub slots: ::prost::alloc::vec::Vec, + /// Whether this is an update, a creation or a deletion. + #[prost(enumeration="ChangeType", tag="5")] + pub change: i32, +} +// Aggregate entities + +/// A set of changes aggregated by transaction. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionChanges { + /// The transaction instance that results in the changes. + #[prost(message, optional, tag="1")] + pub tx: ::core::option::Option, + /// Contains the changes induced by the above transaction, aggregated on a per-contract basis. + /// Contains the contract changes induced by the above transaction, usually for tracking VM components. + #[prost(message, repeated, tag="2")] + pub contract_changes: ::prost::alloc::vec::Vec, + /// Contains the entity changes induced by the above transaction. + /// Usually for tracking native components or used for VM extensions (plugins). + #[prost(message, repeated, tag="3")] + pub entity_changes: ::prost::alloc::vec::Vec, + /// An array of newly added components. + #[prost(message, repeated, tag="4")] + pub component_changes: ::prost::alloc::vec::Vec, + /// An array of balance changes to components. + #[prost(message, repeated, tag="5")] + pub balance_changes: ::prost::alloc::vec::Vec, +} +/// A set of transaction changes within a single block. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockChanges { + /// The block for which these changes are collectively computed. + #[prost(message, optional, tag="1")] + pub block: ::core::option::Option, + /// The set of transaction changes observed in the specified block. + #[prost(message, repeated, tag="2")] + pub changes: ::prost::alloc::vec::Vec, +} /// Enum to specify the type of a change. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -206,19 +287,9 @@ impl ImplementationType { } } } +// WARNING: DEPRECATED. Please use common.proto's TransactionChanges and BlockChanges instead. // This file contains the definition for the native integration of Substreams. -/// A component is a set of attributes that are associated with a custom entity. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EntityChanges { - /// A unique identifier of the entity within the protocol. - #[prost(string, tag="1")] - pub component_id: ::prost::alloc::string::String, - /// The set of attributes that are associated with the entity. - #[prost(message, repeated, tag="2")] - pub attributes: ::prost::alloc::vec::Vec, -} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionEntityChanges { @@ -293,39 +364,9 @@ pub struct BlockTransactionProtocolComponents { #[prost(message, repeated, tag="1")] pub tx_components: ::prost::alloc::vec::Vec, } +// WARNING: DEPRECATED. Please use common.proto's TransactionChanges and BlockChanges instead. // This file contains proto definitions specific to the VM integration. -/// A key value entry into contract storage. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ContractSlot { - /// A contract's storage slot. - #[prost(bytes="vec", tag="2")] - pub slot: ::prost::alloc::vec::Vec, - /// The new value for this storage slot. - #[prost(bytes="vec", tag="3")] - pub value: ::prost::alloc::vec::Vec, -} -/// Changes made to a single contract's state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ContractChange { - /// The contract's address - #[prost(bytes="vec", tag="1")] - pub address: ::prost::alloc::vec::Vec, - /// The new native balance of the contract, empty bytes indicates no change. - #[prost(bytes="vec", tag="2")] - pub balance: ::prost::alloc::vec::Vec, - /// The new code of the contract, empty bytes indicates no change. - #[prost(bytes="vec", tag="3")] - pub code: ::prost::alloc::vec::Vec, - /// The changes to this contract's slots, empty sequence indicates no change. - #[prost(message, repeated, tag="4")] - pub slots: ::prost::alloc::vec::Vec, - /// Whether this is an update, a creation or a deletion. - #[prost(enumeration="ChangeType", tag="5")] - pub change: i32, -} /// A set of changes aggregated by transaction. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -334,10 +375,9 @@ pub struct TransactionContractChanges { #[prost(message, optional, tag="1")] pub tx: ::core::option::Option, /// Contains the changes induced by the above transaction, aggregated on a per-contract basis. - /// Must include changes to every contract that is tracked by all ProtocolComponents. #[prost(message, repeated, tag="2")] pub contract_changes: ::prost::alloc::vec::Vec, - /// An array of any component changes. + /// An array of newly added components. #[prost(message, repeated, tag="3")] pub component_changes: ::prost::alloc::vec::Vec, /// An array of balance changes to components.