* Use effectiveGasPrice in ante handler for dynamic fee tx
Closes: #814
Solution:
- use effectiveGasPrice when check minimal-gas-prices, and deduct fee in ante handler
- implement an EthMempoolFeeDecorator
* add effectiveGasPrice to tx receipt
* changelog
* fix unit test
* fix comments
* add comments
* Apply suggestions from code review
Co-authored-by: Thomas Nguy <81727899+thomas-nguy@users.noreply.github.com>
* review suggestions
Co-authored-by: Thomas Nguy <81727899+thomas-nguy@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Uses the fastest slice making idiom of creating the well known
size of a slice using
make([]sdk.Attribute, len(response.Logs))
for i, log := range response.Logs {
txLogAttrs[i] = ...
}
instead of
make([]sdk.Attribute, 0)
for _, log := range response.Logs {
txLogAttrs = append(txLogAttrs, ...)
}
which had a few problems:
1. Using 0 for size then appending is quite slow yet we know the exact size
2. Using append instead of indexing is slower
If we examine the advisory at https://bencher.orijtech.com/perfclinic/sliceupdate/
and the verdict at https://bencher.orijtech.com/perfclinic/sliceupdate/#verdict
this new scheme shows a massive improvement in that call site.
Fixes#825
* x/evm/keeper: save 24B with Go in-condition variable idiom
The prior code doubly invoked (*ethereum/go-ethereum/core/types.Transaction).To()
which is quite expensive, and firstly copies 20 bytes each time, then
that gets rounded up to the proper size class/pointer alignment so on
64-bit machines 20B -> 24B.
Isolating a benchmark for this code per issue #826 shows this saves
quite a bit of bytes and some nano seconds which all count up towards
the transactions per seconds being processed:
```shell
$ benchstat before.txt after.txt
name old time/op new time/op delta
CopyAddr-8 38.4ns ± 3% 19.3ns ± 3% -49.66% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
CopyAddr-8 48.0B ± 0% 24.0B ± 0% -50.00% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
CopyAddr-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.000 n=10+10)
```
Fixes#826
* changelog
* lint
* Revert stray changes that were used in testing
* rm log
Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
* Problem: ForEachStorage sematic not compatible with go-ethereum
Solution:
- reversed the semantic of return value of the callback function.
* changelog
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Closes#709
fix index
Apply suggestions from code review
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
fix lint
transaction decoding unit test
test BuildTx
fix lint
changelog
* 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
* Problem: No test on the transaction receipt api
Closes: #582
- add receipt rpc test for erc20 transfer logs
* lower gas fee
* build with go 1.17 in CI
* use go 1.17 in test-solidity
* fix merge
* test DynamicFeeTx against state_transition_benchmark_test
* add feemarketGenesis in the app setup param
* add dynamicTxFee flag to KeeperTestSuite
* add feemarketGenesis.BaseFee setup
* update TestAddLog
* fix gasFeeCap assignment in newMsgEthereumTx
* modify keeperTestSuite helper functions to support dynamicTxFee
* update test cases in grpc_query_test w/ dynamicTxFee
* update the evm keeper utils tests
* add dynamic tx fee in the ante tests
* remove duplicate type define
* fix error return type
* update changelog
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* evm: fixed commented out simulations, pubsub, and handler tests
fixes#640
simulations are very basic: they can be built and executed,
but they don't generate any EVM-related transactions yet.
(It should be a matter of adding simulation-related code to the
modules + potentially extra helpers to the simulation.)
handler tests miss some extra assertions due to changes
in the return values snapshotting logic (ADR-001 and ADR-002).
Besides the test suites identified in the audit,
there's also "importer_test.go" which wasn't yet fixed.
(it'd require major rewriting + extra test resources)
* gofumpt
* evm: unit tests
* Add unit tests for DynamicFeeTx.Validate()
* Start get and set signature values tests
* get set values
* Add tests for GetTo()
* Add GetNonce test
* Add GetValue test
* Start copy test
* Add WIP newDynamicFeeTx test
* Add WIP legacy_tx_test
* pair programming session
* Add TestLegacyTxValidate
* Add TestLegacyTxSetSignatureValues & GetSignatureValues
* Add legacyTx tests
* Merge main, forgot to save one file
* Add AccessList tests
* Add chain Config (fork order)
* Add invalid genesis account test
* Add params tests
* Add WIP tracer test
* tracer tests
* Add FormatLogs tests
* Add NewNoOpTracer test
* Refactor to test suite
* Refactor Tx Test suits to only use TxDataTestSuite
* Update link to geth interpreter
* Update x/evm/types/params.go
* Refactor accessListTx Test suits to use TxDataTestSuite
Co-authored-by: Daniel Burckhardt <daniel.m.burckhardt@gmail.com>
* Problem: deep context stack efficienty is not benchmarked
Closes: #626
Solution:
- add a benchmark to demonstrate an extremely inefficiency in deep
context stack
* Update x/evm/keeper/benchmark_test.go
* prefix storage is irrelevant
* add comment to state_transition.go
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: tx log attribute value not parsable by some client
Closes: #614
Solution:
- encode the value to json string rather than bytes
Apply suggestions from code review
* rm cdc and changelog
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>