Commit Graph

1109 Commits

Author SHA1 Message Date
dependabot[bot]
0b92af406a
build(deps): bump follow-redirects in /tests/solidity (#909)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.4 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.4...v1.14.7)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-16 16:27:21 +01:00
yihuang
7d8664043e
impr: support batch eth txs (#901)
* support batch eth tx

Closes: 896

Allow multiple MsgEthereumTx in single tx

* fix transaction receipt api

* fix tx receipt api and accumulate tx gas used

* fix lint

* fix test

* fix rpc test

* cleanup

* fix cumulativeGasUsed and gasUsed

* fix lint

* Update app/ante/eth.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* Update app/ante/eth.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* Update rpc/ethereum/backend/utils.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* pr suggestions

* typo

* fix lint

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-01-14 10:37:33 +01:00
yihuang
aeb6aeb715
Problem: newPendingTransactions filter don't return ethereum tx hash (#900) 2022-01-13 13:12:57 +00:00
Federico Kunze Küllmer
cad7545f8a
deps: IBC v3 alpha2 (#892) 2022-01-07 14:15:44 +01:00
yihuang
5e15c64d02
fix: make gas estimation test reproducible (#890)
Closes: #536

Solution: Use a fixed test account.

The source of non-deterministic is tx's intrinsic gas is different according to different number of zeros in input data,
so to make sure the gas number is reproducible, and the randomly generated test address is included in that.
2022-01-07 14:04:16 +01:00
yihuang
e6c9b7723b
evm: improve test coverage of statedb package (#888)
Closes: #876
- coverage: 99.3% of statements
2022-01-06 18:10:51 +01:00
yihuang
f5b61e914e
docs: update evm spec to cover statedb refactoring changes (#885)
* update evm spec to cover statedb refactoring changes

Closes: #879

* Update x/evm/spec/02_state.md

Co-authored-by: yihuang <huang@crypto.com>

* Update x/evm/spec/02_state.md

Co-authored-by: yihuang <huang@crypto.com>

Co-authored-by: Daniel Burckhardt <daniel.m.burckhardt@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-01-06 10:58:10 +01:00
Federico Kunze Küllmer
4320f46fc8
types, evm: refactor accounts (#884)
* types,evm: refactor accounts

* fix

* fix panic

* changelog

* fix

* lint, rm dbErr
2022-01-05 19:18:02 +01:00
Federico Kunze Küllmer
eea80d50c3
evm: improve error message for invalid account (#883)
* evm: improve error message for invalid account

* fix
2022-01-05 15:08:31 +01:00
Federico Kunze Küllmer
8eaffe88a5
deps: IBC v3 alpha2 (#882) 2022-01-05 14:08:04 +01:00
dependabot[bot]
2a58069002
build(deps): bump technote-space/get-diff-action from 5 to 6.0.1 (#880) 2022-01-05 11:34:28 +01:00
Prajjwol Gautam
4ec794204c
fix: moving rpc tests to integration_test.go (#875)
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-01-05 08:41:36 +01:00
yihuang
ade84319e6
evm: refactor statedb implementation (#729)
* initial statedb module

unit tests

unit tests

keeper implementation

extract TxConfig

remove unused code

* keeper integration

* fix unit tests

* Apply suggestions from code review

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* fixup! initial statedb module

* changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-01-05 08:28:27 +01:00
yihuang
e9f1ab646c
fix: GetBlock rpc api reports wrong gasUsed (#878)
* GetBlock rpc api report wrong gasUsed

Closes: #877

Solution:
- workaround at rpc side, ignore the gasUsed in such cases.

* Update rpc/ethereum/backend/backend.go

* changelog
2022-01-05 08:26:59 +01:00
Federico Kunze Küllmer
03768c20cb
deps: update SDK to v0.45 release branch (#874)
* deps: update SDK to v0.45 release branch

* add modules

* fix modules

* fix modules
2022-01-04 17:00:37 +01:00
yihuang
8e4ff5aae2
evm: validate code hash in GenesisAccount (#873)
* Validate code hash in GenesisAccount

Closes: #872

* changelog
2022-01-04 15:21:32 +01:00
yihuang
7c53e32c78
fix: several issues with the passing receipt to hooks change (#869)
Closes: #868

Solution:
- contract address in receipt should only be the newly created contract
- fix the order of operations in state transition
- compute contract address in `ApplyTransaction` on the fly

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-01-04 12:02:41 +01:00
yihuang
7ec5e5fdef
fix: set correct nonce in EthCall/EstimateGas (#871)
* fix: set correct nonce in EthCall/EstimateGas

Closes: #870

* Update CHANGELOG.md

* unit test
2022-01-04 11:55:30 +01:00
Federico Kunze Küllmer
d34aa09610
deps: IBC v3-alpha (#867)
* deps: IBC v3

* fix app.go
2022-01-03 17:30:28 +01:00
Ramiro Carlucho
b9804505a3
evm: change Hook to use tx Receipt (#849)
* Change evm_hook to use Transaction Receipt

* use ethtypes.Receipt

* wip changes

* fix receipt creation

* receipt fixes

* check for contract addr

* changelog

* test

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
2022-01-03 17:18:13 +01:00
yihuang
9f4828e5bb
fix: wrong gas limit is wrong when adjust base fee (#832)
Closes: #823

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-01-03 17:07:26 +01:00
Federico Kunze Küllmer
4cb2737647
ante: update ante handler internals (#866)
* update ante handler internals

* update options

* changelog
2022-01-02 23:44:46 +01:00
crypto-facs
42cd3f5a4d
Add criteria to filter (#865) 2021-12-31 18:08:08 +01:00
yihuang
ced5280571
fix: OOM when eth_getLogs response too large (#860)
* fix: OOM when eth_getLogs response too large

Closes: #858

- add limit to number of logs of filter response
- make block limit and log limit configurable

* return error if exceeds log limit

* Apply suggestions from code review

* parse from config

* read cli flags

* add to config template

* fix bloomFilter

* changelog

* add validation

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-29 22:47:25 +01:00
dependabot[bot]
fdfe3d9761
build(deps): bump actions/setup-node from 2.5.0 to 2.5.1 (#863)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.5.0 to 2.5.1.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.5.0...v2.5.1)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-29 15:52:02 +01:00
yihuang
eb17366dcc
fix: consistent BaseFee check logic (#855)
Closes: #755

```
if not london_hardfork {
    # reject DynamicFeeTx
    # no `baseFeePerGas` field in block response
    # baseFee = nil
} else {
    # allow DynamicFeeTx
    # add `baseFeePerGas` field in block response
    if feemarketParams.NoBaseFee or height < feemarketParams.EnableHeight {
        # baseFee = 0
    } else {
        # init baseFee to initBaseFee and adjust in later blocks
    }
}
```

Update x/evm/keeper/keeper.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

add unit tests

Update app/ante/utils_test.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

changelog
2021-12-28 07:59:28 +00:00
yihuang
d822fee5c1
fix: contract address in contract creation receipt (#851)
* Problem: contract address in contract creation receipt is wrong

Closes: #850
- decrease nonce before evm.create
- add unit tests and rpc tests

* add changelog
2021-12-28 08:55:40 +01:00
yihuang
8bc3cc471b
fix: web3 client doesn't expect a nil baseFeePerGas (#854)
Closes: #853

Solution:
- only set baseFeePerGas when base fee is not nil.

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-23 16:12:05 +00:00
Prajjwol Gautam
0777d0b670
Merge pull request from GHSA-mx3r-7hpq-fr4g
* reject invalid `MsgEthereumTx` wrapping tx

Update CHANGELOG.md

* added a unit test

* reject invalid `MsgEthereumTx` wrapping tx in a non-breaking way

Update CHANGELOG.md

* delete code and state on suicide

* fix suicide tests

* update changelog

* update changelog

* delete code hash on suicide

* simplifies delete code

* Apply suggestions from code review

* Update app/ante/ante.go

Co-authored-by: Tomas Tauber <2410580+tomtau@users.noreply.github.com>
Co-authored-by: Freddy Caceres <freddy.caceres@crypto.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-23 08:07:23 -08:00
dependabot[bot]
bd2c7f2072
build(deps): bump github.com/rs/cors from 1.8.0 to 1.8.2 (#852) 2021-12-22 12:01:35 +01:00
Daniel Burckhardt
fd338cbf6b
docs(evm): Clean up remaining intrarelayer text on docs (#846)
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-16 23:41:25 +01:00
yihuang
e437c4331d
fix: increase nonce in ante handler for contract creation tx (#809)
Closes: #808
Solution:
- move nonce increment to ante handler
- revert nonce increment in apply message

build(deps): bump github.com/spf13/viper from 1.9.0 to 1.10.0 (#833)

Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

fix: remove unused code (#834)

Co-authored-by: Marko Baricevic <markobaricevic3778@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

rm

rm pkg

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-16 22:35:28 +00:00
yihuang
514785bd89
rpc: optimize tx index lookup (#810)
Closes: #760

Solution:
- emit tx index to cosmos events
- rpc side try to use the events, but fallback to heavier approach when fails.

Update rpc/ethereum/namespaces/eth/api.go

changelog

fix lint

fix TxIndexFromEvents

fix

Update rpc/ethereum/backend/backend.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-16 22:30:22 +00:00
yihuang
e752d80e9f
feekeeper: remove redundant code (#815) 2021-12-16 23:24:53 +01:00
yihuang
845bef6dab
fix broken tracer unit test (#847) 2021-12-16 01:21:06 +00:00
dependabot[bot]
09013d7ea0
build(deps): bump github.com/cosmos/ibc-go/v2 from 2.0.1 to 2.0.2 (#844)
Bumps [github.com/cosmos/ibc-go/v2](https://github.com/cosmos/ibc-go) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/cosmos/ibc-go/releases)
- [Changelog](https://github.com/cosmos/ibc-go/blob/v2.0.2/CHANGELOG.md)
- [Commits](https://github.com/cosmos/ibc-go/compare/v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: github.com/cosmos/ibc-go/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-15 19:44:13 +00:00
dependabot[bot]
9cf098b047
build(deps): bump github.com/spf13/viper from 1.10.0 to 1.10.1 (#845)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.10.0...v1.10.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-15 19:26:22 +00:00
dependabot[bot]
86def86fee
build(deps): bump github.com/spf13/cobra from 1.2.1 to 1.3.0 (#843)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-15 19:36:03 +01:00
yihuang
9828964f1f
fix: remove redundant ante handler (#819)
* remove redundant ante handler

They are already checked in EthValidateBasicDecorator

* changelog
2021-12-15 02:53:03 +00:00
Emmanuel T Odeke
66292080e4
x/evm/types: properly split in 32 chunks trace.Memory (#838)
This change fixes an insidious bug that unfortunately
tried to split values in multiples of 32, but unfortunately
due to the loop conditions, if the length of trace.Memory
was less than 32, nothing would be added; if the value wasn't
a multiple of 32, the ends wouldn't be added in.

Fixes #837
2021-12-15 02:29:49 +00:00
yihuang
ccc6f5b53d
fix: use EffectiveGasPrice in ante handler for dynamic fee tx (#817)
* 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>
2021-12-15 02:17:03 +00:00
yihuang
50e463725e
feemarket: update base fee in BeginBlock (#822)
* Update base fee in begin blocker

Closes: #820

* changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-15 02:10:52 +00:00
Emmanuel T Odeke
5d237a5ee4
fix: remove duplicated gasPrice derivation (#836)
Noticed in an audit, this change removes a duplicated gasPrice
conversion that was first made in:
423944bf79/x/evm/types/tx_args.go (L76-L78)

as well as in

423944bf79/x/evm/types/tx_args.go (L88-L90)

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-15 03:05:11 +01:00
Prajjwol Gautam
68f1d1c8e6
ci: resort to github's clean up policy (#842) 2021-12-14 19:05:03 +00:00
yihuang
924232f02e
fix: empty log topics shouldn't be encoded as nil (#840)
* Problem: empty topics shouldn't be encoded as nil

Closes: #839

Solution:
- encode it as empty array

* fix unit tests

* changelog
2021-12-14 15:52:22 +01:00
Emmanuel T Odeke
423944bf79
x/evm/types: use ethtypes.Transaction.To for cheaper retrieval (#835)
Following suit with PR #828, this change cuts down the expenses
from using .To doubly; yet using the Go in-condition variable idiom.

Updates #826
2021-12-13 17:28:02 -08:00
Emmanuel T Odeke
a2f246c2a6
x/evm/keeper: use the fastest slice making idiom for Keeper.EthereumTx.Logs (#827)
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
2021-12-14 00:05:12 +00:00
Thomas Nguy
4ee1d86377
fix: NobaseFee value should be consistent with height (#831)
* nobasefee param value should be consistent with block height

* update changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-13 23:55:41 +00:00
Emmanuel T Odeke
8333765b27
x/evm/keeper: save 24B with Go in-condition variable idiom (#828)
* 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>
2021-12-14 00:51:36 +01:00
Marko
876d9cfee3
fix: remove unused code (#834)
Co-authored-by: Marko Baricevic <markobaricevic3778@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-12-13 22:15:15 +01:00