From f730cc228b54b3dad80115b5586e6794ff19059d Mon Sep 17 00:00:00 2001 From: drklee3 Date: Mon, 15 Apr 2024 11:52:13 -0700 Subject: [PATCH] Revert "wip: ctx balance bug" This reverts commit 1446f25e1adb4d501c528c858ddbf1b559922873. --- x/evm/statedb/statedb.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/x/evm/statedb/statedb.go b/x/evm/statedb/statedb.go index 7187b77a87..839307cbee 100644 --- a/x/evm/statedb/statedb.go +++ b/x/evm/statedb/statedb.go @@ -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() @@ -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") } @@ -571,7 +568,7 @@ func (s *StateDB) Commit() error { } } - // s.ctx.Commit() + s.ctx.Commit() return nil }