Skip to content

[Feature]: Remove EVM instance creation in AnteHandler Balance-Check #351

@heijiLee

Description

@heijiLee

Summary

Eliminate the EVM instance that is currently created inside AnteHandler during the CanTransfer() balance check. Instead, read the sender’s balance directly via StateDB.GetBalance().

Problem Definition

Each transaction spawns two EVM instances.

  1. AnteHandler(Pre-validation) - runs CanTransfer()
  2. Execution(state-transition) - applies opcodes and commits state

In a block of 100 transactions, this results in 200 EVM instantiations, unnecessarily increasing CPU, memory, and GC overhead. Following why I think spawning an instance in the AnteHandler is needless.

  • The AnteHandler only needs a balance read; no state change occurs, so a full EVM is dispensable.
  • Reference: Geth’s pre-validation path also does not spin up an EVM instance.

Proposed Feature

Remove the evmKeeper.NewEVM() call in ante/evm/07_can_transfer.go.

Work Breakdown

#### Must have
- [ ] discuss proposal (if proposal rejected, close EPIC)
- [ ] create ADR (if ADR rejected, close EPIC)
- [ ] add sub-tasks needed to implement the proposed feature
#### Nice to have
- [ ] add sub-tasks that are nice to have for the proposed feature

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions