Skip to content

Commit

Permalink
Revert "wip: ctx balance bug"
Browse files Browse the repository at this point in the history
This reverts commit 1446f25.
  • Loading branch information
drklee3 committed Apr 15, 2024
1 parent 9d25434 commit f730cc2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions x/evm/statedb/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ func (s *StateDB) Empty(addr common.Address) bool {

// GetBalance retrieves the balance from the given address or 0 if object not found
func (s *StateDB) GetBalance(addr common.Address) *big.Int {
// TODO: This should use the active ctx balance

stateObject := s.getStateObject(addr)
if stateObject != nil {
return stateObject.Balance()
Expand Down Expand Up @@ -551,11 +553,6 @@ func (s *StateDB) Commit() error {
obj.account.AccountNumber = accNumber
}

// Use the dirty balance to set the account balance
if err := s.keeper.SetBalance(s.ctx.CurrentCtx(), obj.Address(), obj.Balance()); err != nil {
return errorsmod.Wrap(err, "failed to set balance")
}

if err := s.keeper.SetAccount(s.ctx.CurrentCtx(), obj.Address(), obj.account); err != nil {
return errorsmod.Wrap(err, "failed to set account")
}
Expand All @@ -571,7 +568,7 @@ func (s *StateDB) Commit() error {
}
}

// s.ctx.Commit()
s.ctx.Commit()

return nil
}

0 comments on commit f730cc2

Please sign in to comment.