Skip to content

Commit 755be1b

Browse files
committed
fix some failing tests
1 parent a0572ab commit 755be1b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

crates/vm/levm/src/opcode_handlers/system.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ impl<'a> VM<'a> {
920920
.pop()
921921
.ok_or(VMError::Internal(InternalError::CouldNotPopCallframe))?;
922922
if retdata.is_create {
923-
self.handle_return_create(tx_report, retdata)?;
923+
self.handle_return_create(call_frame, tx_report, retdata)?;
924924
} else {
925925
self.handle_return_call(call_frame, tx_report, retdata)?;
926926
}
@@ -960,6 +960,12 @@ impl<'a> VM<'a> {
960960
self.current_call_frame_mut()?
961961
.stack
962962
.push(SUCCESS_FOR_CALL)?;
963+
for (address, account_opt) in call_frame.cache_backup.clone() {
964+
self.current_call_frame_mut()?
965+
.cache_backup
966+
.entry(address)
967+
.or_insert(account_opt);
968+
}
963969
}
964970
TxResult::Revert(_) => {
965971
// Revert value transfer
@@ -976,6 +982,7 @@ impl<'a> VM<'a> {
976982
}
977983
pub fn handle_return_create(
978984
&mut self,
985+
call_frame: &CallFrame,
979986
tx_report: &ExecutionReport,
980987
retdata: RetData,
981988
) -> Result<(), VMError> {
@@ -1000,6 +1007,12 @@ impl<'a> VM<'a> {
10001007
self.current_call_frame_mut()?
10011008
.stack
10021009
.push(address_to_word(retdata.to))?;
1010+
for (address, account_opt) in call_frame.cache_backup.clone() {
1011+
self.current_call_frame_mut()?
1012+
.cache_backup
1013+
.entry(address)
1014+
.or_insert(account_opt);
1015+
}
10031016
}
10041017
TxResult::Revert(err) => {
10051018
// Return value to sender

0 commit comments

Comments
 (0)