evm: refactor dup state transition code (#674)

* Problem: state transition code is duplicated

Closes: #672

Solution:
- move gas refund out from ApplyMessage
- move check into ApplyMessage
- move evm construction into ApplyMessage
- ensure context stack is clean after ApplyMessage return

fix unit tests

undo rename

add underflow check

* improve performance

- don't duplicate params loading
- passing EVMConfig around as pointer
This commit is contained in:
yihuang
2021-10-22 19:21:03 +02:00
committed by GitHub
parent b1aedf9a2a
commit 1fe07edbf9
10 changed files with 196 additions and 189 deletions
@@ -177,7 +177,7 @@ func (f *Filter) blockLogs(header *ethtypes.Header) ([]*ethtypes.Log, error) {
return []*ethtypes.Log{}, errors.Wrapf(err, "failed to fetch logs block number %d", header.Number.Int64())
}
var unfiltered []*ethtypes.Log
unfiltered := make([]*ethtypes.Log, 0)
for _, logs := range logsList {
unfiltered = append(unfiltered, logs...)
}