Commit Graph

82 Commits

Author SHA1 Message Date
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
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
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
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
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
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
ee72632582
ante: remove unused AccessListDecorator (#797) 2021-11-30 09:06:34 +01:00
yihuang
c8d4d3f9a3
fix: improve error message in SendTransaction json-rpc api (#786)
* fix error message in `SendTransaction` json-rpc api

Closes: #785

Solution:
- Remove `stacktrace.Propagate`s, and recover error message in jsonrpc server

changelog

fix error messages

* Update x/evm/keeper/msg_server.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-11-26 15:19:28 +01:00
Daniel Burckhardt
93020f8786
feemarket: unit tests EIP1559 (#758)
* Fee-Market(Types): Setup Params tests

* Fee-Market(Types): Add all Params tests

* Fee-Market(Types): Add genesis tests

* Fee-Market(Keeper): Copy Keeper setup from EVM module and add Params tests

* Fee-Market(Keeper): Add Keeper tests

* Fee-Market(Keeper): Add review comments

* Fee-Market(Keeper): WIP grpc tests

* Fee-Market(Keeper): WIP ERIP1559 tests

* Fee-Market(Keeper): WIP ERIP1559 tests

* Fee-Market(Keeper): WIP ERIP1559 tests maxGas influences on baseFee

* Fee-Market(Keeper): Add last ERIP1559 tests

* Fee-Market(Keeper): Add abci tests
2021-11-19 16:22:25 +00:00
Adu
e04422b6ff
fix: tx fields are not authenticated by signature (#703)
Co-authored-by: Muggle-Du <adudu@CNMAC0342.local>
2021-11-08 14:00:35 +01:00
yihuang
1fe07edbf9
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
2021-10-22 19:21:03 +02:00
Federico Kunze Küllmer
b1aedf9a2a
deps: bump IBC-go (#693)
* deps: bump IBC-go

* fix
2021-10-22 15:38:52 +02:00
JayT106
1076307e6b
tests: DynamicFeeTx (#649)
* 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>
2021-10-19 08:49:29 +00:00
Thomas Nguy
75d553674c
evm, rpc: disable BaseFee for non London block (#662)
* disable basefee if not london block

* add london block check in state transition

* fix linter

* add unit test

* clean code

* add changelog
2021-10-13 15:39:47 +02:00
Federico Kunze Küllmer
a8722655bb
all: bump go-ethereum to v1.10.9 (#231)
* all: bump go-ethereum to v1.10.4

* build

* state transition and rpc

* wip rpc changes

* fix refund

* fixes

* no base fee param

* ante handler

* undo change

* fix test

* bump deps

* calculate base fee

* gRPC base fee query

* update RPC

* fix

* update'

* go.mod

* fix build

* fix panic

* rm changes in third_party

* json rpc changes

* reserved fields

* fixes fixes fixes

* rm no stringer

* fixes 2

* tests wip

* bump geth version

* update

* grpc traceTx

* rm fee market from ante

* fix TransactionArgs

* lint

* update proto

* update tx args

* changelog
2021-10-05 15:38:20 +00:00
Federico Kunze Küllmer
fb9adf979c
evm: geth 1.10.9 fee market changes to Keeper and AnteHandler (#620)
* evm: geth 1.10.9 fee market changes

* update

* changelog
2021-10-04 14:58:06 +00:00
Adu
8d3381a5f9
ante: fix &T{} to (*T)(nil) in error message (#592)
Co-authored-by: Adu Du <adudu@CNMAC0342.local>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-09-27 14:24:57 +00:00
Federico Kunze Küllmer
692fd9548a
ante: move deduct gas to EVM keeper (#584) 2021-09-22 10:26:29 +00:00
yihuang
b59d9a23ea
evm: add ApplyNativeMessage (#557)
* add ApplyNativeMessage

Closes #533

* fix lint

* Update x/evm/types/tracer.go

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

* Update x/evm/types/tracer.go

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

* no-op tracer

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>
2021-09-17 15:23:51 +00:00
Federico Kunze Küllmer
2e45a0665e
crypto: updates from reviews (#535) 2021-09-07 17:29:24 +00:00
Federico Kunze Küllmer
26c5eabb18
all: linter (#532)
* add additional linters

* fixes

* rm action
2021-09-05 11:03:06 +00:00
Ramiro Carlucho
3f19217d7f
ante, evm: AnteHandler refactor (#517)
* Refactor fees function

* Implement suggestions

* wip test

* checksenderbalance tests

* wip deductcost test

* Tests fixes

* Merge master and fix conflicts

* Merging account and bank interfaces

* Update x/evm/keeper/utils.go

Co-authored-by: Hanchon <guillermo.paoletti@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-09-03 15:55:37 +00:00
dependabot[bot]
b76d024225
build(deps): bump github.com/cosmos/cosmos-sdk from 0.43.0 to 0.44.0 (#519)
* build(deps): bump github.com/cosmos/cosmos-sdk from 0.43.0 to 0.44.0

Bumps [github.com/cosmos/cosmos-sdk](https://github.com/cosmos/cosmos-sdk) from 0.43.0 to 0.44.0.
- [Release notes](https://github.com/cosmos/cosmos-sdk/releases)
- [Changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.44.0/CHANGELOG.md)
- [Commits](https://github.com/cosmos/cosmos-sdk/compare/v0.43.0...v0.44.0)

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

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

* fix

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>
2021-09-02 12:26:16 +00:00
Federico Kunze Küllmer
87c4ea2dc2
evm: benchmark state DB (#514)
* evm: benchmark state DB

* add more bech funcs

* rm func from interface
2021-08-31 12:50:31 +00:00
Federico Kunze Küllmer
d068f5b331
server: logger handler (#343)
* Problem: verbose logs display with FATAL option (fix #320)
add my script

increase amount for metamask

add run

amount ok

hide log

show info

my logger

hook log

revive eth log

tidy up

use suplog

log replace ok

removed suplog

tidy up

tidy up

fix compile

remove sh

tidy up

tidy up

* logger handler

* fix

* fix eth log override (#371)

remove redundant log

tidy up

* log test

* c++

Co-authored-by: jongwhan lee <jonghwan@crypto.com>
Co-authored-by: Jongwhan Lee <51560997+leejw51crypto@users.noreply.github.com>
2021-08-19 16:55:13 +00:00
crypto-facs
fc46430e0f
evm: decouple tracer from evm creation (#459) 2021-08-19 04:18:20 -04:00
Federico Kunze Küllmer
6f5f15fc6d
proto: v1alpha to v1 (#448)
* proto: v1alpha to v1

* c++

* go mod
2021-08-17 15:30:35 +00:00
Federico Kunze Küllmer
aa1b728d34
feat: update chain-id format (#447)
* feat: update chain-id format

* c++

* docs

* additional context'
2021-08-17 14:11:26 +00:00
Federico Kunze Küllmer
cc3b2ff8e9
evm, server: configurable tracer (#434)
* server: update server and enable configurable tracer

* config validation

* fix import cycle

* fix start

* update fields

* c++

* c++
2021-08-16 09:45:10 +00:00
yihuang
353455def9
evm: prepare access list in eth_call (#348)
Closes: #335

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-08-16 08:19:27 +00:00
Federico Kunze Küllmer
d40c49834c
deps: bump ibc-go (#360)
* deps: bump ibc-go

* ibc ante decorator

* c++
2021-07-26 19:26:53 +00:00
Federico Kunze Küllmer
9d1ce30ecd
evm: use block proposer address for COINBASE opcode (#291)
* evm: use block proposer address for COINBASE opcode

* test

* c++
2021-07-14 20:44:51 +00:00
Federico Kunze Küllmer
e09bf23bd0
evm: move ChainConfig to Params (#266)
* evm: move ChainConfig to Params

* fixes

* fix test
2021-07-14 05:13:55 -04:00
Federico Kunze Küllmer
5f1f252361
evm: TxData as proto.Any (#220)
* evm: TxData as proto.Any

* proto message

* fix protobuf any generation

* Int pointer

* fix build and tests

* ante tests

* swagger

* cleanup

* c++
2021-07-05 16:39:08 +00:00
Thomas Nguy
5ba8ffe669
ante, evm: update gas consumption logic (#178)
* clean up logic by ignoring cosmos gas meter

* set gas used in txResponse

* reset and set the gas in context

* rename ante handler

* fix refundedgas logic

* remove gas update logic in keeper

* update context in keeper

* add test for EthSetupContextDecorator

* fix broken test due to gas logic change
2021-06-30 05:31:30 -04:00
Federico Kunze Küllmer
dcc9585595
all: bump SDK to v0.43.0-rc0 (#194)
* all: bump SDK to v0.43.0-rc0

* more updates

* keys

* accounting

* update account

* ante changes

* readonly

* readonly build

* minor changes from self review

* fixes

* evm debug

* custom config & rosetta

* fix
2021-06-29 13:02:21 -04:00
yihuang
fd19394fba
ante: don't skip EthSigVerificationDecorator for RecheckTx (#186)
Because it set the `From` field which is relied by other handlers

Closes #185
2021-06-25 09:28:28 -04:00
Federico Kunze
6000ab2098
chore: un-fork from cosmos (#166)
* chore: un-fork from cosmos

* rm LoC
2021-06-22 06:49:18 -04:00
yihuang
91ad6387bf
ante: ignore no signature error for evm transactions (#143)
fixes #118

don't sign unit test tx

since that's the same case as real tx

comment EthValidateBasicDecorator
2021-06-21 06:44:37 -04:00
yihuang
eee53a9500
ante: add ValidateMemoDecorator evm tx (#150)
fixes #149
2021-06-21 03:59:45 -04:00
hello-bwhour
d7da045fc4
ante: check that sender is a EOA (#125)
* ante: check that sender is a EOA

* fix: GetCodeSize handles nil case and comments

* docs: add TODO comment

* fix: use EmptyCodeHash check

* lint: evmtypes instead of types

* lint: fix suite error

* test: set code to act not as EOA

* undo comment on GetCodeSize

* keeper: fix input checks

* Apply suggestions from code review

Co-authored-by: Akash Khosla <me@akashkhosla.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-06-15 13:39:41 -04:00
Federico Kunze
7f72891c09
ante: add stacktrace (#123) 2021-06-15 03:19:31 -04:00
Federico Kunze
bb91d8d93d
ante, evm: fix panic when checking BlockGasMeter (#120)
* ante, evm: fix panic when checking BlockGasMeter

* update block gas limit function
2021-06-14 10:24:08 -04:00
Federico Kunze
e8f6f7838e
evm: support legacy tx (#109)
* evm: support legacy tx

* lint and minor fix

* tx data constructor

* tx data tests

* ante handler tests

* fill msg sender

* c++
2021-06-11 09:38:51 -04:00
Federico Kunze
9509e18842
encoding: fix test (#64) 2021-06-04 09:45:37 -04:00
Federico Kunze
b77aab43bb
evm: refactor state transition (#41)
* evm: keeper statedb refactor

* keeper: implement stateDB account, balance, nonce and suicide functions

* keeper: implement stateDB code and iterator functions

* keeper: implement stateDB log and preimage functions

* update code to use CommitStateDB

* tests updates

* journal changes (wip)

* cache fields

* journal and logs

* minor cleanup

* evm: state transition refactor

* evm: unpack revert errors

* evm: update state transition (wip)

* evm: remove journal related changes

* evm: delete empty account code and storage state

* update gas limit

* evm: header hash to/from context

* evm: minor params and state transition changes

* ante: state transition changes

* ante: refactor default sig gas consumer

* ante: ignore gas costs from ops other than intrinsic gas

* ante: CanTransferDecorator

* evm: refund gas

* update comments

* state transition comments

* ante: CanTransfer and AccessList decorator tests

* evm: cleanup state transition

* ignore nonce increment during ante handler on contract creation

* fix ante tests

* more test fixes
2021-06-02 04:52:53 -04:00
Federico Kunze
8e7ebe80e9
evm: fix signature verification (#61)
* evm: fix sig verification

* fixes

* test fixes
2021-06-01 13:14:33 -04:00
Federico Kunze
9a5654f70d
ante: AnteHandler changes from state transition refactor (#56)
* ante: cherry-pick changes from state transition refactor

* ante: test setup

* ante: fixes

* ante: test (wip)

* ante: finish unit tests

* ante: intrinsic gas test

* ante: chaindecorators test (wip)

* update tests

* ante: cleanup tests

* ante: add test consuption test
2021-05-31 05:05:32 -04:00
Federico Kunze
6c1e7fec01
app, ante, evm: Keeper StateDB refactor (#30)
* evm: keeper statedb refactor

* keeper: implement stateDB account, balance, nonce and suicide functions

* keeper: implement stateDB code and iterator functions

* keeper: implement stateDB log and preimage functions

* update code to use CommitStateDB

* tests updates

* journal changes (wip)

* cache fields

* journal and logs

* minor cleanup

* evm: remove journal related changes

* evm: delete empty account code and storage state

* app, evm: transient store

* ante, evm: refund gas transient

* evm: remove transient keeper state fields

* address comments from review

* evm: undo revision change
2021-05-25 08:56:36 -04:00
Federico Kunze
65453e4aa0
rpc, evm: secure tx signing (#20)
* rpc, evm: secure signing

* evm, ante: test signer

* tests
2021-05-12 09:08:31 -04:00