Skip to content

Commit

Permalink
Merge pull request #26 from carlosdmz/update-v2-type
Browse files Browse the repository at this point in the history
chore: update v2 type rust model definition
  • Loading branch information
sduchesneau authored Jun 20, 2024
2 parents a812620 + f613c18 commit d6668dd
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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.
* StreamingFast Firehose Block generated Rust code is now included in this library directly.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ substreams-ethereum-derive = { version = "0.9.11", path = "./derive" }
[profile.release]
lto = true
opt-level = 's'
strip = "debuginfo"
strip = "debuginfo"
42 changes: 42 additions & 0 deletions core/src/pb/sf.ethereum.type.v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ pub struct BlockHeader {
/// Only available in DetailLevel: EXTENDED
#[prost(bytes="vec", tag="19")]
pub withdrawals_root: ::prost::alloc::vec::Vec<u8>,
/// 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<Uint64NestedArray>,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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,
}
}
Expand Down Expand Up @@ -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<u8>,
/// 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();
///

Check failure on line 761 in core/src/pb/sf.ethereum.type.v2.rs

View workflow job for this annotation

GitHub Actions / Runs tests in release mode (stable)

cannot find value `old_value` in this scope
#[prost(message, optional, tag="2")]
pub old_value: ::core::option::Option<BigInt>,
/// 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();
///

Check failure on line 772 in core/src/pb/sf.ethereum.type.v2.rs

View workflow job for this annotation

GitHub Actions / Runs tests in release mode (stable)

cannot find value `new_value` in this scope
#[prost(message, optional, tag="3")]
pub new_value: ::core::option::Option<BigInt>,
/// 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\]
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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,
}
}
Expand Down
2 changes: 1 addition & 1 deletion gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit d6668dd

Please sign in to comment.