Skip to content

Commit d8a946e

Browse files
authored
deployment_store: Remove unfail confidence check for non-deterministic errors (#3015)
1 parent a46a865 commit d8a946e

File tree

2 files changed

+33
-25
lines changed

2 files changed

+33
-25
lines changed

store/postgres/src/deployment_store.rs

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,41 +1294,48 @@ impl DeploymentStore {
12941294
// Deployment head (current_ptr) advanced more than the error.
12951295
// That means it's healthy, and the non-deterministic error got
12961296
// solved (didn't happen on another try).
1297+
//
1298+
// This should be the scenario where the unfail happens, however
1299+
// for now we unfail in all cases that non-deterministic errors
1300+
// were found and the deployment head advanced.
12971301
(Bound::Included(error_block_number), _)
12981302
if current_ptr.number >= error_block_number =>
12991303
{
1300-
info!(
1301-
self.logger,
1302-
"Unfailing the deployment status";
1303-
"subgraph_id" => deployment_id,
1304-
);
1305-
1306-
// Unfail the deployment.
1307-
deployment::update_deployment_status(
1308-
conn,
1309-
deployment_id,
1310-
deployment::SubgraphHealth::Healthy,
1311-
None,
1312-
)?;
1313-
1314-
// Delete the fatal error.
1315-
deployment::delete_error(conn, &subgraph_error.id)
13161304
}
1317-
// NOOP, the deployment head is still before where non-deterministic error happened.
1305+
// The deployment head is still before where non-deterministic error happened.
1306+
//
1307+
// Technically we shouldn't unfail the subgraph and delete the error
1308+
// until it's head actually passed the error block range. But for
1309+
// now we'll only log this and keep the old behavior.
13181310
block_range => {
13191311
info!(
13201312
self.logger,
1321-
"Subgraph error is still ahead of deployment head, nothing to unfail";
1313+
"Subgraph error is still ahead of deployment head";
13221314
"subgraph_id" => deployment_id,
13231315
"block_number" => format!("{}", current_ptr.number),
13241316
"block_hash" => format!("{}", current_ptr.hash),
13251317
"error_block_range" => format!("{:?}", block_range),
13261318
"error_block_hash" => subgraph_error.block_hash.as_ref().map(|hash| format!("0x{}", hex::encode(hash))),
13271319
);
1328-
1329-
Ok(())
13301320
}
1331-
}
1321+
};
1322+
1323+
info!(
1324+
self.logger,
1325+
"Unfailing the deployment status";
1326+
"subgraph_id" => deployment_id,
1327+
);
1328+
1329+
// Unfail the deployment.
1330+
deployment::update_deployment_status(
1331+
conn,
1332+
deployment_id,
1333+
deployment::SubgraphHealth::Healthy,
1334+
None,
1335+
)?;
1336+
1337+
// Delete the fatal error.
1338+
deployment::delete_error(conn, &subgraph_error.id)
13321339
})
13331340
}
13341341

store/postgres/tests/subgraph.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -966,14 +966,15 @@ fn fail_unfail_non_deterministic_error_noop() {
966966
// Fail the subgraph with a non-deterministic error, but with an advanced block.
967967
writable.fail_subgraph(error).await.unwrap();
968968

969-
// Since the block range of the block won't match the deployment head, this will be NOOP.
969+
// Since the block range of the block won't match the deployment head, this would be NOOP,
970+
// but we're skipping the confidence check for now.
970971
writable.unfail_non_deterministic_error(&BLOCKS[1]).unwrap();
971972

972-
// State continues the same besides a new error added to the database.
973-
assert_eq!(count(), 2);
973+
// Unfail ocurrs as expected.
974+
assert_eq!(count(), 1);
974975
let vi = get_version_info(&store, NAME);
975976
assert_eq!(&*NAME, vi.deployment_id.as_str());
976-
assert_eq!(true, vi.failed);
977+
assert_eq!(false, vi.failed);
977978
assert_eq!(Some(1), vi.latest_ethereum_block_number);
978979

979980
test_store::remove_subgraphs();

0 commit comments

Comments
 (0)