Sitelet https://github.com/nullmastermind/graph-node/commit/226747c09ad05a55e117416481d1f6c4468870e7
Skip to content

Commit 226747c

Browse files
committed
graph, server, store: Report only the earliest block number in index-node
1 parent 25d5e44 commit 226747c

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

‎graph/src/data/subgraph/status.rs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ pub struct ChainInfo {
6161
pub network: String,
6262
/// The current head block of the chain.
6363
pub chain_head_block: Option<EthereumBlock>,
64-
/// The earliest block available for this subgraph.
65-
pub earliest_block: Option<EthereumBlock>,
64+
/// The earliest block available for this subgraph (only the number).
65+
pub earliest_block_number: BlockNumber,
6666
/// The latest block that the subgraph has synced to.
6767
pub latest_block: Option<EthereumBlock>,
6868
}
@@ -72,7 +72,7 @@ impl IntoValue for ChainInfo {
7272
let ChainInfo {
7373
network,
7474
chain_head_block,
75-
earliest_block,
75+
earliest_block_number,
7676
latest_block,
7777
} = self;
7878
object! {
@@ -81,7 +81,11 @@ impl IntoValue for ChainInfo {
8181
__typename: "EthereumIndexingStatus",
8282
network: network,
8383
chainHeadBlock: chain_head_block,
84-
earliestBlock: earliest_block,
84+
earliestBlock: object! {
85+
__typename: "EarliestBlock",
86+
number: earliest_block_number,
87+
hash: "0x0"
88+
},
8589
latestBlock: latest_block,
8690
}
8791
}

‎server/index-node/src/schema.graphql‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ type SubgraphIndexingStatus {
6868
interface ChainIndexingStatus {
6969
network: String!
7070
chainHeadBlock: Block
71-
earliestBlock: Block
71+
earliestBlock: EarliestBlock
7272
latestBlock: Block
7373
lastHealthyBlock: Block
7474
}
7575
7676
type EthereumIndexingStatus implements ChainIndexingStatus {
7777
network: String!
7878
chainHeadBlock: Block
79-
earliestBlock: Block
79+
earliestBlock: EarliestBlock
8080
latestBlock: Block
8181
lastHealthyBlock: Block
8282
}
@@ -101,6 +101,11 @@ type Block {
101101
number: BigInt!
102102
}
103103
104+
type EarliestBlock {
105+
hash: Bytes! @deprecated(reason: "hash will always be reported as 0x0.")
106+
number: BigInt!
107+
}
108+
104109
type SubgraphError {
105110
message: String!
106111

‎store/postgres/src/detail.rs‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ pub(crate) fn info_from_details(
193193
synced,
194194
fatal_error: _,
195195
non_fatal_errors: _,
196-
earliest_ethereum_block_hash,
197-
earliest_ethereum_block_number,
196+
earliest_block_number,
198197
latest_ethereum_block_hash,
199198
latest_ethereum_block_number,
200199
entity_count,
@@ -212,12 +211,6 @@ pub(crate) fn info_from_details(
212211
// This needs to be filled in later since it lives in a
213212
// different shard
214213
let chain_head_block = None;
215-
let earliest_block = block(
216-
&deployment,
217-
"earliest_ethereum_block",
218-
earliest_ethereum_block_hash,
219-
earliest_ethereum_block_number,
220-
)?;
221214
let latest_block = block(
222215
&deployment,
223216
"latest_ethereum_block",
@@ -228,7 +221,7 @@ pub(crate) fn info_from_details(
228221
let chain = status::ChainInfo {
229222
network: site.network.clone(),
230223
chain_head_block,
231-
earliest_block,
224+
earliest_block_number,
232225
latest_block,
233226
};
234227
let entity_count = entity_count.to_u64().ok_or_else(|| {

0 commit comments

Comments
 (0)