Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 21, 2024
1 parent feac897 commit 305a1fa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (rpc) [#536](https://github.com/crypto-org-chain/ethermint/pull/536) Fix validate basic after transaction conversion with raw field.
* (cli) [#537](https://github.com/crypto-org-chain/ethermint/pull/537) Fix unsuppored sign mode SIGN_MODE_TEXTUAL for bank transfer.
* (cli) [#543](https://github.com/crypto-org-chain/ethermint/pull/543) Fix graceful shutdown.
* (rpc) [#545](https://github.com/crypto-org-chain/ethermint/pull/545) Fix state overwrite in debug trace APIs.

### Improvements

Expand Down
6 changes: 5 additions & 1 deletion x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ func (k *Keeper) ApplyMessageWithConfig(
tracer := cfg.GetTracer()
if tracer != nil {
if cfg.DebugTrace {
stateDB.SubBalance(sender.Address(), new(big.Int).Mul(msg.GasPrice, new(big.Int).SetUint64(msg.GasLimit)))
amount := new(big.Int).Mul(msg.GasPrice, new(big.Int).SetUint64(msg.GasLimit))
stateDB.SubBalance(sender.Address(), amount)
if err := stateDB.Error(); err != nil {
return nil, err
}
stateDB.SetNonce(sender.Address(), stateDB.GetNonce(sender.Address())+1)
}
tracer.CaptureTxStart(leftoverGas)
Expand Down
14 changes: 0 additions & 14 deletions x/evm/keeper/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,6 @@ func (k *Keeper) SetAccount(ctx sdk.Context, addr common.Address, account stated
return nil
}

func (k *Keeper) incrNonce(ctx sdk.Context, addr sdk.AccAddress) error {
acct := k.accountKeeper.GetAccount(ctx, addr)
if acct == nil {
acct = k.accountKeeper.NewAccountWithAddress(ctx, addr)
}

if err := acct.SetSequence(acct.GetSequence() + 1); err != nil {
return err
}

k.accountKeeper.SetAccount(ctx, acct)
return nil
}

// SetState update contract storage, delete if value is empty.
func (k *Keeper) SetState(ctx sdk.Context, addr common.Address, key common.Hash, value []byte) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AddressStoragePrefix(addr))
Expand Down
4 changes: 4 additions & 0 deletions x/evm/statedb/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,10 @@ func (s *StateDB) RevertToSnapshot(revid int) {
s.validRevisions = s.validRevisions[:idx]
}

func (s *StateDB) Error() error {
return s.err

Check warning on line 641 in x/evm/statedb/statedb.go

View check run for this annotation

Codecov / codecov/patch

x/evm/statedb/statedb.go#L640-L641

Added lines #L640 - L641 were not covered by tests
}

// Commit writes the dirty states to keeper
// the StateDB object should be discarded after committed.
func (s *StateDB) Commit() error {
Expand Down

0 comments on commit 305a1fa

Please sign in to comment.