Skip to content

Commit 2e534c1

Browse files
committed
ethereum: Improve comments
1 parent cbbb771 commit 2e534c1

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

chain/ethereum/src/block_stream.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ enum BlockStreamState {
6363
/// A single next step to take in reconciling the state of the subgraph store with the state of the
6464
/// chain store.
6565
enum ReconciliationStep {
66-
/// Revert the current block pointed at by the subgraph pointer.
66+
/// Revert the current block pointed at by the subgraph pointer. The pointer is to the current
67+
/// subgraph head, and a single block will be reverted so the new head will be the parent of the
68+
/// current one.
6769
Revert(EthereumBlockPointer),
6870

6971
/// Move forwards, processing one or more blocks. Second element is the block range size.
@@ -126,9 +128,12 @@ pub struct BlockStream<S, C> {
126128
ctx: BlockStreamContext<S, C>,
127129
}
128130

131+
// This is the same as `ReconciliationStep` but without retries.
129132
enum NextBlocks {
130133
/// Blocks and range size
131134
Blocks(VecDeque<EthereumBlockWithTriggers>, u64),
135+
136+
/// Revert the current block pointed at by the subgraph pointer.
132137
Revert(EthereumBlockPointer),
133138
Done,
134139
}

core/src/subgraph/instance_manager.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,10 @@ where
535535
// - Remove hosts for reverted dynamic data sources.
536536
// - Clear the entity cache.
537537
//
538-
// Note that we do not currently revert the filters,
539-
// which is not ideal, but also not incorrect.
538+
// Note that we do not currently revert the filters, which means the filters
539+
// will be broader than necessary. This is not ideal for performance, but is not
540+
// incorrect since we will discard triggers that match the filters but do not
541+
// match any data sources.
540542
ctx.state.instance.revert_data_sources(subgraph_ptr.number);
541543
ctx.state.entity_lfu_cache = LfuCache::new();
542544
continue;

runtime/wasm/src/host.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ impl PartialEq for RuntimeHost {
736736
data_source_block_handlers,
737737
host_exports,
738738

739-
// Data sources created at different blocks can be considered duplicated.
739+
// The creation block is ignored for detection duplicate data sources.
740740
data_source_creation_block: _,
741741
mapping_request_sender: _,
742742
metrics: _,

0 commit comments

Comments
 (0)