Skip to content

Commit

Permalink
FIX: storage log.
Browse files Browse the repository at this point in the history
  • Loading branch information
Softcloud88 committed May 14, 2024
1 parent 785ae18 commit a6141db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion executor/src/contract_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ impl OlaContractExecutor {
.batch_read(op0, 4)?
.try_into()
.expect("Wrong number of elements");
let loaded_value = storage.read(self.context.storage_addr, storage_key)?;
let loaded_value = storage.sload(self.context.storage_addr, storage_key)?;
let value = match loaded_value {
Some(value) => value,
None => [0, 0, 0, 0],
Expand Down
27 changes: 10 additions & 17 deletions executor/src/ola_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,6 @@ impl OlaCachedStorage {
storage_key: OlaStorageKey,
) -> anyhow::Result<Option<OlaStorageValue>> {
let pre_value = self.get_pre_value(contract_addr, storage_key)?;
self.tx_storage_logs.push(StorageAccessLog {
block_timestamp: self.block_timestamp,
kind: StorageAccessKind::Read,
contract_addr,
storage_key,
pre_value,
value: pre_value,
});
Ok(pre_value)
}

Expand All @@ -295,14 +287,6 @@ impl OlaCachedStorage {
}
disk_loaded
};
self.tx_storage_logs.push(StorageAccessLog {
block_timestamp: self.block_timestamp,
kind: StorageAccessKind::Read,
contract_addr,
storage_key,
pre_value: value,
value,
});
Ok(value)
}

Expand Down Expand Up @@ -377,7 +361,16 @@ impl OlaStorage for OlaCachedStorage {
contract_addr: ContractAddress,
storage_key: OlaStorageKey,
) -> anyhow::Result<Option<OlaStorageValue>> {
self.read(contract_addr, storage_key)
let pre_value = self.get_pre_value(contract_addr, storage_key)?;
self.tx_storage_logs.push(StorageAccessLog {
block_timestamp: self.block_timestamp,
kind: StorageAccessKind::Read,
contract_addr,
storage_key,
pre_value,
value: pre_value,
});
Ok(pre_value)
}

fn sstore(
Expand Down

0 comments on commit a6141db

Please sign in to comment.