Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion chain/ethereum/proto/ethereum.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,31 @@ message Block {

repeated TransactionTrace transaction_traces = 10;
repeated BalanceChange balance_changes = 11;

enum DetailLevel{
DETAILLEVEL_EXTENDED = 0;
// DETAILLEVEL_TRACE = 1; // TBD
DETAILLEVEL_BASE = 2;
}

// DetailLevel affects the data available in this block.
//
// ## DetailLevel_EXTENDED
//
// Describes the most complete block, with traces, balance changes, storage
// changes. It is extracted during the execution of the block.
//
// ## DetailLevel_BASE
//
// Describes a block that contains only the block header, transaction receipts
// and event logs: everything that can be extracted using the base JSON-RPC
// interface
// (https://ethereum.org/en/developers/docs/apis/json-rpc/#json-rpc-methods)
// Furthermore, the eth_getTransactionReceipt call has been avoided because it
// brings only minimal improvements at the cost of requiring an archive node
// or a full node with complete transaction index.
DetailLevel detail_level = 12;

repeated CodeChange code_changes = 20;

reserved 40; // bool filtering_applied = 40 [deprecated = true];
Expand Down Expand Up @@ -505,4 +530,4 @@ message GasChange {
}

uint64 ordinal = 4;
}
}
10 changes: 10 additions & 0 deletions chain/ethereum/src/adapter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::Error;
use ethabi::{Error as ABIError, Function, ParamType, Token};
use graph::blockchain::ChainIdentifier;
use graph::components::ethereum::BlockDetailLevel;
use graph::components::subgraph::MappingError;
use graph::data::store::ethereum::call;
use graph::firehose::CallToFilter;
Expand Down Expand Up @@ -262,6 +263,15 @@ impl TriggerFilter {
pub fn block(&self) -> &EthereumBlockFilter {
&self.block
}

/// Always require full blocks until we are able to strip down the block from the WASM ABI.
pub fn minimum_detail_level(&self) -> BlockDetailLevel {
if self.call.is_empty() && self.block.is_empty() {
return BlockDetailLevel::Light;
}

BlockDetailLevel::Full
}
}

impl bc::TriggerFilter<Chain> for TriggerFilter {
Expand Down
Loading