Skip to content

Commit

Permalink
fix(levm): fixing main (#1161)
Browse files Browse the repository at this point in the history
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
- Test changes merged to main and fix problems that arose

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->
- Value transfer between sender and recipient was done twice, I removed
it in `validate_transaction()`

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #issue_number
  • Loading branch information
JereSalo authored Nov 14, 2024
1 parent 9076208 commit 15cf7e2
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions crates/vm/levm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ impl VM {
}

let origin = self.env.origin;
let to = call_frame.to;

let mut receiver_account = self.get_account(&to);
let mut sender_account = self.get_account(&origin);

// See if it's raised in upper layers
Expand All @@ -376,12 +374,8 @@ impl VM {
if sender_account.info.balance < call_frame.msg_value {
return Err(VMError::SenderBalanceShouldContainTransferValue);
}
// TODO: This belongs elsewhere.
sender_account.info.balance -= call_frame.msg_value;
receiver_account.info.balance += call_frame.msg_value;

self.cache.add_account(&origin, &sender_account);
self.cache.add_account(&to, &receiver_account);

// (7)
if self.env.gas_price < self.env.base_fee_per_gas {
Expand Down

0 comments on commit 15cf7e2

Please sign in to comment.