Skip to content

Commit 0e6b720

Browse files
committed
address CI failures
1 parent ce9eee5 commit 0e6b720

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

runtime/wasm/src/host_exports.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ use crate::{error::DeterminismLevel, module::IntoTrap};
3333

3434
use super::module::WasmInstanceData;
3535

36+
use graph::schema::EntityKey;
37+
3638
fn write_poi_event(
3739
proof_of_indexing: &SharedProofOfIndexing,
3840
poi_event: &ProofOfIndexingEvent,
@@ -354,7 +356,7 @@ impl HostExports {
354356
.metrics
355357
.track_storage_size_change(&entity_type, &entity, false);
356358

357-
if !state.entity_cache.contains_key(&key) {
359+
if state.entity_cache.get(&key, GetScope::Store)?.is_none() {
358360
state.metrics.track_entity_count_change(&entity_type, 1);
359361
}
360362

@@ -1250,14 +1252,15 @@ impl HostExports {
12501252
.context("Failed to decode")
12511253
}
12521254

1253-
fn remove_entity(&mut self, key: &EntityKey) -> Result<(), HostExportError> {
1255+
fn remove_entity(
1256+
&mut self,
1257+
key: &EntityKey,
1258+
state: &mut BlockState,
1259+
) -> Result<(), HostExportError> {
12541260
let entity_type = key.entity_type.clone();
12551261

1256-
if let Some(entity) = state.entity_cache.get(&key, GetScope::Store)? {
1257-
// Track removal metrics while we still have the entity data
1258-
state
1259-
.metrics
1260-
.track_storage_size_change(&entity_type, &entity, true);
1262+
if let Some(entity) = state.entity_cache.get(key, GetScope::Store)? {
1263+
state.metrics.track_storage_size_change(&entity_type, &entity, true);
12611264
state.metrics.track_entity_count_change(&entity_type, -1);
12621265
}
12631266

@@ -1395,3 +1398,9 @@ fn bytes_to_string_is_lossy() {
13951398
)
13961399
)
13971400
}
1401+
1402+
impl From<StoreError> for HostExportError {
1403+
fn from(err: StoreError) -> Self {
1404+
HostExportError::Deterministic(DeterministicHostError::from(err))
1405+
}
1406+
}

0 commit comments

Comments
 (0)