Commit Graph

131 Commits

Author SHA1 Message Date
Federico Kunze Küllmer
83627b9967
evm: check height overflow (#597)
* evm: check height overflow

* rm

* c++
2021-09-28 09:48:11 +00:00
yihuang
d6a64a275a
evm: fix import/export genesis for contract storage (#590)
* Problem: import/export roundtrip test fail contract storage

Closes: #589

- don't hash the key again in InitGenesis

* changelog

* try to fix estimate-gas undeterministics Closes #536
2021-09-27 12:26:45 +02:00
JayT106
2088297e3d
evm: benchmark evm keeper (#586)
* adds more erc20 token benchmark tests

* add more benchmark for statedb

* adds benchmark for state_transition

* fix typo

* refactor state_transition_benchmark_test

* update newSignedEthTx input argument

* revises tx template type

* modify tests for both LegacyTx and AccessListTx

* update changelog
2021-09-24 12:58:22 -03:00
Federico Kunze Küllmer
692fd9548a
ante: move deduct gas to EVM keeper (#584) 2021-09-22 10:26:29 +00:00
yihuang
01b789c3e9
rpc: tx receipt don't contain events (#580)
* tx receipt don't contains events

- Should convert tx hash when query transaction logs

* tx index should start from 0
2021-09-22 06:01:35 -03:00
Federico Kunze Küllmer
20785afeb7
evm: check tx cost not negative (#578) 2021-09-21 10:29:59 +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
davcrypto
742b6d1300
evm: fail early on StateDB functions (#566)
* ADD stateErr on keeper

* UPDATE init stateErr

* UPDATE test case

* Update x/evm/keeper/statedb.go

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

* ADD comment

* UPDATE clear evm state error

* REMOVE unnecessary clear

* ADD comment

* UPDATE false value

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-09-17 06:22:52 +00:00
crypto-facs
0463c8bfcd
rpc: fix TraceConfig param for tracers (#565) 2021-09-15 10:50:52 -03:00
yihuang
116de54617
evm: remove tx logs and block bloom from chain state (#556)
Closes #452

fix unit tests

changelog and fix lint

fix unit test

Update ethereum/rpc/backend/backend.go

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

Update ethereum/rpc/backend/utils.go

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

changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-09-15 09:45:03 +00:00
crypto-facs
3f1eeb30b6
rpc: debug_traceBlockByNumber endpoint (#555)
* Refactor traceTx

* add getTendermintBlock on backend

* keeper concurrency

* first version

* json rpc concurrency

* rever makefile change

* remove grpc traceblock

* create internal traceBlock function

* added types to evm module

* tendermintBlockByNumber rename

* added safe message check

* remove unnecesary line

* check error

* fix lint

* fix linter

* Update ethereum/rpc/namespaces/debug/api.go

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

* Update ethereum/rpc/namespaces/debug/api.go

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

* Update ethereum/rpc/backend/backend.go

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

* improve traceBlock performance

* fix linter

* add extra line on function parameters

* changed index to uint 64

* fix lint

* proto gen

* update endpoints documentation

* update changelog

* Apply suggestions from code review

* Update ethereum/rpc/namespaces/eth/filters/filters.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-09-15 08:46:01 +00:00
Federico Kunze Küllmer
540bd79f7f
all: remove telemetry (#545) 2021-09-09 16:39:55 +00:00
Federico Kunze Küllmer
587cf78b5c
evm: log pagination (#544)
* evm: log pagination

* tidy
2021-09-09 14:26:30 +00:00
Federico Kunze Küllmer
6a2914d4b0
evm: rm recover (#542)
* evm: rm recover

* rm query

* lint
2021-09-09 09:10:33 +00:00
Federico Kunze Küllmer
26c5eabb18
all: linter (#532)
* add additional linters

* fixes

* rm action
2021-09-05 11:03:06 +00:00
crypto-facs
c7554e96aa
rpc, evm: debug_traceTransaction endpoint (#506)
* fix typo

* Added tracers package to debug API

* Add GetTransactionByHash function to backend package

* first version

* traceTransaction first version

* clean PR

* revert debug changes

* Update proto/ethermint/evm/v1/query.proto

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

* remove unnecesary panic

* remove internal debug api

* trace transaction javascript tracer

* add support for custom logConfig

* added comment

* traceTransactions tests

* fix linter

* remove unused

* add comments to traceConfig

* update dependencies

* updated endpoints md

* Apply suggestions from code review

* Update x/evm/keeper/grpc_query.go

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

* Update x/evm/keeper/grpc_query.go

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

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-09-04 20:33:06 +00:00
Federico Kunze Küllmer
c73ce0f812
all: cleanup imports (#524) 2021-09-03 18:06:36 +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
Federico Kunze Küllmer
5fac39db38
evm: conditional hook snapshot (#520) 2021-09-02 17:47:39 +00:00
yihuang
089afe41a8
evm: implement ADR-002 EVM Hooks (#417)
* Allow evm to call native modules through logs

Closes #416

comment

add txHash parameter

review suggestions

add hooks test

* Update x/evm/keeper/hooks.go

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

* Update x/evm/keeper/hooks_test.go

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

* Update x/evm/keeper/keeper.go

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

* Update x/evm/keeper/keeper.go

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

* Update x/evm/keeper/keeper.go

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

* use table tests

* update adr comment

* update adr

* changelog

* Update CHANGELOG.md

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-09-02 12:36:33 +00:00
Federico Kunze Küllmer
22623a4090
evm: fix keeper tests (#516)
* evm: fix keeper tests

* rm func

* fix
2021-09-02 08:42:55 +00:00
Federico Kunze Küllmer
516ffe2bf1
evm: GetHashFn test (#515) 2021-08-31 15:58:46 +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
JayT106
9a8827e790
evm: increase performance of tx Log storage (#461)
* revise the way of the logs store into the stateDB

* wording

* refine GetTxLogs/SetLogs

* nit

* add bytes_uint16 convert helper

* using helper to instead of big.Int

* nit

* helper tests and fixes

* handle the logs length in SetLogs

* revise Get/Set logs with store.iterator

* remove Bytes<->Uint16 functions

* remove unused const

* simplify SetLog(s)

* make logs return determinism

* Add comments

* update changelog

* Update CHANGELOG.md

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-08-31 08:32:11 +00:00
yihuang
a5ab608336
evm: benchmark contract execution (#436)
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-08-30 03:14:58 +00:00
Federico Kunze Küllmer
f469db94ef
feat: fee market module (#491)
* feat: fee market module

* update proto

* queriers: CLI + gRPC

* gov params

* genesis

* enable height

* fixes

* fix app
2021-08-26 10:08:11 +00:00
Federico Kunze Küllmer
1ad9b4c1a5
evm: EIP1559 & go-ethereum related updates (#469)
* updates

* more changes

* proto updates

* tidy

* v1beta1

* update buf

* lint

* comments

* typo
2021-08-25 14:45:51 +00:00
crypto-facs
fc46430e0f
evm: decouple tracer from evm creation (#459) 2021-08-19 04:18:20 -04:00
Federico Kunze Küllmer
83c838330f
rpc: configure gas cap (#457)
* rpc: configure gas cap

* c++

* rm old const

* docs
2021-08-18 14:11:51 +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
ff8f63e99b
evm: fix params (#437) 2021-08-15 14:54:44 +00:00
yihuang
9227e78c79
evm: use stack of contexts to implement snapshot revert (#399)
* use stack of contexts to implement snapshot revert

Closes #338

add exception revert test case

verify partial revert

mutate state after the reverted subcall

polish

update comments

name the module after the type name

remove the unnecessary Snapshot in outer layer

and add snapshot unit test

assert context stack is clean after tx processing

cleanups

fix context revert

fix comments

update comments

it's ok to commit in failed case too

Update x/evm/keeper/context_stack.go

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

Update x/evm/keeper/context_stack.go

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

Update x/evm/keeper/context_stack.go

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

update comment and error message

add comment to cacheContext

k -> cs

Update x/evm/keeper/context_stack.go

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

evm can handle state revert

renames and unit tests

* use table driven tests

* keep all the cosmos events

* changelog

* check for if commit function is nil

* fix changelog

* Update x/evm/keeper/context_stack.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-08-10 07:22:46 +00:00
yihuang
73c2f8e529
evm: re-emit the cosmos events from cache context (#415)
Closes: #414
2021-08-09 09:38:43 +00:00
Federico Kunze Küllmer
098da6d0cc
evm: code comments and cleanup (#404)
* evm: code comments and cleanup

* context comment

* abci, tx type event and metrics

* statedb comments
2021-08-05 16:24:06 +00:00
yihuang
9bf3659718
evm: use clean context for GetCommittedState (#383)
* keep the original context for GetCommittedState api

* fix method mutation

* keep estimateGas consistant

* added test after the original context is recovered

* add integration test for the gas consumption of sstore

* test the committed case

* move methods to keeper module

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-08-04 07:49:02 +00:00
Thomas Nguy
63aa0de1e8
evm: update error format (#350)
* return geth error format

* fix format in gasestimate

* deal with other evm errors

* fix import

* fix lint

* add test

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-07-28 15:50:05 +00:00
Federico Kunze Küllmer
bc2a2eb8f3
evm: fix get storage (#375) 2021-07-27 14:33:56 +00:00
yihuang
54581269b8
evm: change log tx index to index in block (#354)
Closes #334
2021-07-26 04:40:59 -04:00
yihuang
2828fa1e62
evm: fix keep balance when resetting an account (#353)
* keep balance when override account

* Update CHANGELOG.md

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-07-26 08:15:59 +00:00
yihuang
f6dc80d949
evm: estimate gas unit tests (#324)
* add some unit tests for estimateGas

Also add some test environment setup, Closes #323

test estimateGas of erc20 token transfer

fix failed test case

the trick is to keep a clean transient store, by doing a commit

put artifacts to external file

* fix test failure

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-07-23 14:24:36 +00:00
yihuang
d54663c0b8
evm: fix infinite context usage on EndBlock (#329)
The previous code is not incorrect since the method `SetBlockBloom` use the `ctx` passed in rather than the `k.ctx`.
It's confusing that sometimes methods use ctx in parameter, sometimes use `k.ctx`, but that's another issue.

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-07-21 11:57:30 +00:00
Thomas Nguy
0276f3465d
rpc: fix Bloom filter response (#321)
* fix bloomfilter in rpc response

* add comments
2021-07-20 15:16:02 +00:00
yihuang
14b38af8bc
rpc, evm: use binary search to estimate gas (#272)
* do binary search to estimate gas

Closes #268

- Also refactor ApplyMessage to be more reuseable

move binary search to rpc api side to have a clean context each try

remove EstimateGas grpc api

* extract BinSearch function and add unit test

* do estimateGas in grpc query

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-07-19 15:19:23 +00:00
Thomas Nguy
c8b88a3a8b
evm, rpc: fix parameters and block gas limit in getBlockByHeight and getBlockByHash (#312)
* fix evm set parameters

* recompute header hash only if its not set

* Update x/evm/keeper/state_transition.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-07-19 01:52:44 +00:00
yihuang
297a35dbdd
evm: treat all vm errors the same as reverted (#276)
Closes: #274

evm: fix `ExtraEIP` activation (#288)

Closes: #287

Update x/evm/types/utils.go

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

Add `Failed` utility function and changelog
2021-07-15 02:01:05 -04: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
Thomas Nguy
aab793e7f4
rpc: fix BlockBloom not found in header (#258)
* fix context index

* return default bloom if cannot be found

* fix blockbloom error

* fix setting blockbloom transient in ctx

* clean comments

* remove unused method

* update changelog

* Update CHANGELOG.md

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-07-14 09:40:58 +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