Commit Graph

44 Commits

Author SHA1 Message Date
yihuang
2e067590a2
fix: nil pointer panic in ApplyNativeMessage (#660)
* Problem: nil pointer panic in ApplyNativeMessage

Solution:
- pass NoOpTracer

* use NewTracer

* changelog
2021-10-13 10:57:12 +02:00
Thomas Nguy
fe5fefbd8e
evm: fix panic when transaction is reverted (#650)
* fix panic when transaction is reverted

* update changelog

* Update x/evm/keeper/context_stack.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-10-08 11:29:40 +00:00
yihuang
78c8ceb244
evm: add benchmark for deep context stack (#627)
* 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>
2021-10-06 11:28:13 +00:00
yihuang
202bc5f1cd
evm: fix iterator on deeply nested cache contexts (#617)
* Problem: iterator on deeply nested cache contexts is extremely slow

Closes: #616

Solution:
- flatten cache contexts before doing `GetTxLogsTransient`

* Update x/evm/keeper/context_stack.go

* changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>
2021-10-05 16:08:55 +00: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
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
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
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
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
Federico Kunze Küllmer
540bd79f7f
all: remove telemetry (#545) 2021-09-09 16:39:55 +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
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
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
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
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
yihuang
0020e4f2cd
grpc: add eth_call query command (#236)
* add eth_call query command

Implement EthCall grpc query api

Closes #229

add eth_call query command

fix codec issue

use query client

use grpc status error and codes

validate address length in grpc handler

* Update x/evm/types/callargs.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-07-09 09:04:46 +00:00
Thomas Nguy
735f00d4a3
evm: store reverted tx as not failed (#228)
* add tx when evm revert

* add comment

* use cache ctx

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-07-08 08:14:11 +00:00
yihuang
0113b4d2c0
fix: return ethereum-formatted tx hash to client (#202)
* return eth tx hash to client

Closes #67

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

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

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

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

change GetTxByEthHash to method

add entry to changelog

* use eth tx hash internally
2021-06-30 05:35:11 -04: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
yihuang
036ffb7a39
evm: update block bloom (#193)
Closes #139
2021-06-30 03:37:03 -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
Federico Kunze
4ca7c43b62
deps: bump SDK and Tendermint versions (#165)
* deps: bump SDK and Tendermint versions

* use header hash from context

* c++

* typo
2021-06-22 04:25:38 -04:00
Federico Kunze
5af5dd9956
docs: update ADR-001 (#122)
* docs: update ADR-001

* update

* apply transaction changes:
2021-06-14 15:13: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
5fe785e917
evm: stacktrace errors for keeper (#105)
* evm: stacktrace errors for keeper

* fix godoc
2021-06-11 10:29:28 -04:00
Federico Kunze
0c6e44d3d3
evm: remove CommitStateDB, journal and stateObject (#84)
* evm: remove CommitStateDB and stateObject

* imported build fixes

* lint

* rm set nonce

* update account response

* changelog
2021-06-08 13:10:29 -04:00
Federico Kunze
6eadc8fdf8
rpc, evm: remove tx Receipt (#81)
* rpc, evm: remove tc receipt

* rm receipt from gRPC query service

* update eth block

* update tx service response

* rpc tx fixes

* update bloom

* fix

* more fixes

* c++
2021-06-08 07:11:37 -04:00
Federico Kunze
1ff3c46663
evm: replace block hash storage (#80)
* evm: replace block hash storage

* c++
2021-06-07 07:00:14 -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