From 28e5fc108bc27de24549ec0a5d381de275ecaff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Dam=C3=A1zio?= Date: Thu, 20 Jun 2024 12:36:49 -0300 Subject: [PATCH 1/2] chore: update v2 type rust model definition This updates the v2 type model to have additional enums that were previously left out in the buf.build --- core/src/pb/sf.ethereum.type.v2.rs | 42 ++++++++++++++++++++++++++++++ gen.sh | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/core/src/pb/sf.ethereum.type.v2.rs b/core/src/pb/sf.ethereum.type.v2.rs index 1ee177f..2269934 100644 --- a/core/src/pb/sf.ethereum.type.v2.rs +++ b/core/src/pb/sf.ethereum.type.v2.rs @@ -248,6 +248,13 @@ pub struct BlockHeader { /// Only available in DetailLevel: EXTENDED #[prost(bytes="vec", tag="19")] pub withdrawals_root: ::prost::alloc::vec::Vec, + /// TxDependency is list of transaction indexes that are dependent on each other in the block + /// header. This is metadata only that was used by the internal Polygon parallel execution engine. + /// + /// This field was available in a few versions on Polygon Mainnet and Polygon Mumbai chains. It was actually + /// removed and is not populated anymore. It's now embeded in the `extraData` field, refer to Polygon source + /// code to determine how to extract it if you need it. + /// /// Only available in DetailLevel: EXTENDED #[prost(message, optional, tag="20")] pub tx_dependency: ::core::option::Option, @@ -397,6 +404,8 @@ pub struct TransactionTrace { /// TransactionTraceStatus is the status of the transaction execution and will let you know if the transaction /// was successful or not. /// + /// ## Explanation relevant only for blocks with `DetailLevel: EXTENDED` + /// /// A successful transaction has been recorded to the blockchain's state for calls in it that were successful. /// This means it's possible only a subset of the calls were properly recorded, refer to \[calls[].state_reverted\] field /// to determine which calls were reverted. @@ -486,6 +495,8 @@ pub mod transaction_trace { TrxTypeArbitrumSubmitRetryable = 105, TrxTypeArbitrumInternal = 106, TrxTypeArbitrumLegacy = 120, + /// OPTIMISM-specific transactions + TrxTypeOptimismDeposit = 126, } impl Type { /// String value of the enum field names used in the ProtoBuf definition. @@ -505,6 +516,7 @@ pub mod transaction_trace { Type::TrxTypeArbitrumSubmitRetryable => "TRX_TYPE_ARBITRUM_SUBMIT_RETRYABLE", Type::TrxTypeArbitrumInternal => "TRX_TYPE_ARBITRUM_INTERNAL", Type::TrxTypeArbitrumLegacy => "TRX_TYPE_ARBITRUM_LEGACY", + Type::TrxTypeOptimismDeposit => "TRX_TYPE_OPTIMISM_DEPOSIT", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -521,6 +533,7 @@ pub mod transaction_trace { "TRX_TYPE_ARBITRUM_SUBMIT_RETRYABLE" => Some(Self::TrxTypeArbitrumSubmitRetryable), "TRX_TYPE_ARBITRUM_INTERNAL" => Some(Self::TrxTypeArbitrumInternal), "TRX_TYPE_ARBITRUM_LEGACY" => Some(Self::TrxTypeArbitrumLegacy), + "TRX_TYPE_OPTIMISM_DEPOSIT" => Some(Self::TrxTypeOptimismDeposit), _ => None, } } @@ -735,12 +748,32 @@ pub struct StorageChange { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BalanceChange { + /// Address is the address of the account that has changed balance. #[prost(bytes="vec", tag="1")] pub address: ::prost::alloc::vec::Vec, + /// OldValue is the balance of the address before the change. This value + /// can be **nil/null/None** if there was no previous balance for the address. + /// It is safe in those case(s) to consider the balance as being 0. + /// + /// If you consume this from a Substreams, you can safely use: + /// + /// let old_value = old_value.unwrap_or_default(); + /// #[prost(message, optional, tag="2")] pub old_value: ::core::option::Option, + /// NewValue is the balance of the address after the change. This value + /// can be **nil/null/None** if there was no previous balance for the address + /// after the change. It is safe in those case(s) to consider the balance as being + /// 0. + /// + /// If you consume this from a Substreams, you can safely use: + /// + /// let new_value = new_value.unwrap_or_default(); + /// #[prost(message, optional, tag="3")] pub new_value: ::core::option::Option, + /// Reason is the reason why the balance has changed. This is useful to determine + /// why the balance has changed and what is the context of the change. #[prost(enumeration="balance_change::Reason", tag="4")] pub reason: i32, /// The block's global ordinal when the balance change was recorded, refer to \[Block\] @@ -776,6 +809,11 @@ pub mod balance_change { /// Used on chain(s) where some Ether burning happens Burn = 15, Withdrawal = 16, + /// Rewards for Blob processing on BNB chain added in Tycho hard-fork, refers + /// to BNB documentation to check the timestamp at which it was activated. + RewardBlobFee = 17, + /// USE on optimism chan + IncreaseMint = 18, } impl Reason { /// String value of the enum field names used in the ProtoBuf definition. @@ -801,6 +839,8 @@ pub mod balance_change { Reason::CallBalanceOverride => "REASON_CALL_BALANCE_OVERRIDE", Reason::Burn => "REASON_BURN", Reason::Withdrawal => "REASON_WITHDRAWAL", + Reason::RewardBlobFee => "REASON_REWARD_BLOB_FEE", + Reason::IncreaseMint => "REASON_INCREASE_MINT", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -823,6 +863,8 @@ pub mod balance_change { "REASON_CALL_BALANCE_OVERRIDE" => Some(Self::CallBalanceOverride), "REASON_BURN" => Some(Self::Burn), "REASON_WITHDRAWAL" => Some(Self::Withdrawal), + "REASON_REWARD_BLOB_FEE" => Some(Self::RewardBlobFee), + "REASON_INCREASE_MINT" => Some(Self::IncreaseMint), _ => None, } } diff --git a/gen.sh b/gen.sh index 42ef8ab..719438f 100755 --- a/gen.sh +++ b/gen.sh @@ -5,4 +5,4 @@ set -e input="${BUF_MODULE_REF:-buf.build/streamingfast/firehose-ethereum}" echo "Generating Ethereum Protobuf using $input" -buf generate "$input" --exclude-path "sf/ethereum/transform,sf/ethereum/trxstream" +buf generate "$input" --exclude-path "sf/ethereum/transform" From f613c185f6419023f498a79f96cf9ffb043ea3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Dam=C3=A1zio?= Date: Thu, 20 Jun 2024 12:42:15 -0300 Subject: [PATCH 2/2] docs: add change to changelog --- CHANGELOG.md | 6 +++++- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23abc15..53a7f90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## UNRELEASED + +* Re-generated the Rust Ethereum bindings with latest Firehose Ethereum Protobuf definitions. + ## [0.9.11](https://github.com/streamingfast/substreams-ethereum/releases/tag/v0.9.11) * Added conversion from `&pb::BigInt` to `substreams::scalar::BigInt`. @@ -208,4 +212,4 @@ Abigen::from_bytes("Contract", content_bytes))? * Added `NULL_ADDRESS` constant that can be re-used by dependent projects. -* StreamingFast Firehose Block generated Rust code is now included in this library directly. \ No newline at end of file +* StreamingFast Firehose Block generated Rust code is now included in this library directly. diff --git a/Cargo.toml b/Cargo.toml index e776b94..99b6c46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,4 +28,4 @@ substreams-ethereum-derive = { version = "0.9.11", path = "./derive" } [profile.release] lto = true opt-level = 's' -strip = "debuginfo" \ No newline at end of file +strip = "debuginfo"