Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
ArbOS clones, rather than steals, from the LRU
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-bousfield committed Apr 30, 2024
1 parent f7ff909 commit a61eee7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arbitrator/stylus/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl InitCache {
None
}

/// Inserts an item into the long term cache, stealing from the LRU cache if able.
/// Inserts an item into the long term cache, cloning from the LRU cache if able.
pub fn insert(
module_hash: Bytes32,
module: &[u8],
Expand All @@ -92,9 +92,9 @@ impl InitCache {
) -> Result<(Module, Store)> {
let key = CacheKey::new(module_hash, version, debug);

// if in LRU, move to ArbOS
// if in LRU, add to ArbOS
let mut cache = cache!();
if let Some(item) = cache.lru.pop(&key) {
if let Some(item) = cache.lru.peek(&key).cloned() {
cache.arbos.insert(key, item.clone());
return Ok(item.data());
}
Expand Down

0 comments on commit a61eee7

Please sign in to comment.