Skip to content

Commit

Permalink
fix: force slot insertion (#1575)
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhani-cw authored Jul 30, 2024
1 parent 83ea6e0 commit 64e72a6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/eth/storage/redis/redis_permanent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::eth::storage::PermanentStorage;
use crate::eth::storage::StoragePointInTime;
use crate::ext::from_json_str;
use crate::ext::to_json_string;
use crate::ext::to_json_value;
use crate::log_and_err;

type RedisVecOptString = RedisResult<Vec<Option<String>>>;
Expand Down Expand Up @@ -110,15 +111,17 @@ impl PermanentStorage for RedisPermanentStorage {
if let Some(bytecode) = changes.bytecode.take() {
account.bytecode = bytecode;
}

let account_value = to_json_string(&account);
mset_values.push((key_account(&account.address), account_value.clone()));
zadd_values.push((key_account_history(&account.address), account_value, block.number().as_u64()));

// slot
for slot in changes.slots.into_values() {
if let Some(slot) = slot.take() {
let slot_value = to_json_string(&slot);
let mut slot_value = to_json_value(slot);
slot_value.as_object_mut().unwrap().insert("block".to_owned(), to_json_value(block.number()));
let slot_value = to_json_string(&slot_value);

mset_values.push((key_slot(&account.address, &slot.index), slot_value.clone()));
zadd_values.push((key_slot_history(&account.address, &slot.index), slot_value, block.number().as_u64()));
}
Expand Down

0 comments on commit 64e72a6

Please sign in to comment.