yihuang
f7009b0e94
fix: base fee check logic in state transition ( #932 )
...
* fix base fee check logic in state transition
- should check london hardfork first, otherwise it panic if feemarket not registered.
* fix lint
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-02-15 12:01:30 +01:00
crypto-facs
aeedef9b4b
deps: upgrade geth to v1.10.15 ( #935 )
...
* upgrade geth to v1.10.15
* fix lint
* fix imports
* revert makefile change
* update changelog
* Update CHANGELOG.md
Co-authored-by: Guillermo Paoletti <guillermo.paoletti@gmail.com>
* update chain config
* add getblockvalue for chain config fork
Co-authored-by: Guillermo Paoletti <guillermo.paoletti@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-02-14 23:08:41 +00: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
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
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
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
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
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
3b0fa63832
evm: clear access list for each transaction ( #802 )
...
* Clear access list for each transaction
Closes : #801
* changelog
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-11-30 12:36:10 +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
yihuang
b7e8dd8216
fix: don't revert gas refund logic when transaction reverted ( #751 )
...
* fix gas consumption when reverted
Apply suggestions from code review
changelog
* comments
* Update x/evm/keeper/state_transition.go
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-11-16 14:49:59 +00:00
crypto-facs
d4621f3e82
fix: set EVM debug based on tracer config ( #746 )
...
* set debug based on tracer
* fix tests
* set default tracer
* remove debug from keeper
* remove unnecesary param
* remove unnecesary param
* Update x/evm/keeper/state_transition.go
* changelog
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
2021-11-16 08:57:03 +00: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
JayT106
40b3b9ae1b
evm: unit tests for gas refund ( #686 )
...
* add TestGetEthIntrinsicGas
* more test cases in TestGetEthIntrinsicGas
* add GasToRefund tests
* add TestRefundGas tests
* remove duplicate leftoverGas check
* made resetGasMeterAndConsumeGas public for testing
* TestResetGasMeterAndConsumeGas tmp
* add mintFeeCollector flag for gas refund tests
* add comment and check
* add TestResetGasMeterAndConsumeGas
* Update x/evm/keeper/state_transition_test.go
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2021-10-20 19:09:06 +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
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