Commit Graph

195 Commits

Author SHA1 Message Date
Jacob Gadikian
524e25c038
chore: Gofumpt (#1298)
* fumpt

* golangci

* Update keeper_test.go

* Update keeper_test.go

* Update handler_test.go

* Update rpc_pending_test.go

* lll

* line length limits

* Update CHANGELOG.md
2022-08-26 10:30:55 +00:00
Adi Saravanan
1ea0cb31b7
eth_sendTransaction returns internal trace on missing param (#1284)
* added test, used get method for from param

* gosec fixes

* adding nosec v1

* added test to python tests, removed testing lines

* fixing flake issues

* test-unit-cover

* changelog fix

* changelog 2

* fix gomod2nix

* integration tests

Co-authored-by: Freddy Caceres <facs95@gmail.com>
2022-08-25 13:22:31 +02:00
yihuang
f9c74e239c
deps: Update cosmos-sdk to v0.46.1 (#1300)
* Update cosmos-sdk to 0.46.1

* update gomod2nix.toml
2022-08-25 08:06:45 +02:00
Daniel Burckhardt
9bbf356c6b
tests(rpc): add filter tests (#1233)
* tests(rpc): add pending transaction filter test

* tests(rpc): add block filter and event log  test

* tests(rpc): simplify to cluster instead of comparing types

* tests(rpc): wip filter by address

* tests(rpc): add get_logs test

* fix flake8 linter

* fix flake8 linter

* add caching to readme

* add caching to readme

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-08-12 13:57:57 +00:00
yihuang
94cab52ca1
fix(rpc): get_proof test fail because block numbers are not high enough (#1239)
* Problem: get_proof test fail because block numbers are not high enough

Solution:
- wait for app block height rather than tendermint block height

* Update tests/integration_tests/test_types.py

* keep get_proof response the same as geth

Co-authored-by: Daniel Burckhardt <daniel.m.burckhardt@gmail.com>
2022-08-12 13:20:17 +02:00
Freddy Caceres
989192028f
Add support for miner_setGasPrice API (#1237) 2022-08-12 08:23:13 +02:00
yihuang
77ed4aa754
feat!: Store eth tx index separately (#1121)
* Store eth tx index separately

Closes: #1075
Solution:
- run a optional indexer service
- adapt the json-rpc to the more efficient query

changelog

changelog

fix lint

fix backward compatibility

fix lint

timeout

better strconv

fix linter

fix package name

add cli command to index old tx

fix for loop

indexer cmd don't have access to local rpc

workaround exceed block gas limit situation

add unit tests for indexer

refactor

polish the indexer module

Update server/config/toml.go

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

improve comments

share code between GetTxByEthHash and GetTxByIndex

fix unit test

Update server/indexer.go

Co-authored-by: Freddy Caceres <facs95@gmail.com>

* Apply suggestions from code review

* test enable-indexer in integration test

* fix go lint

* address review suggestions

* fix linter

* address review suggestions

- test indexer in backend unit test
- add comments

* fix build

* fix test

* service name

Co-authored-by: Freddy Caceres <facs95@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-08-11 22:49:05 +02:00
yihuang
b1cd16e5bf
feat!: Apply feemarket to native cosmos tx (#1194)
* Problem: feemarket's query cli has redundant height parameter

Soluton:
- remove the positional height parameter, since there's a flag already.

Update CHANGELOG.md

* Apply feemarket to native cosmos tx

- add tx extension option for user to input tip price
- apply feemarket's base fee to native tx

comments and cleanup

fallback to default sdk logic when london hardfork not enabled

integration test

cleanup feemarket query cli commands

Update CHANGELOG.md

update unit tests

disable feemarket in simulation tests for now

fix lint

Update app/simulation_test.go

fix python lint

fix lint

Update x/evm/types/extension_option.go

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

address review suggestions

* fix unit tests

* fix integration test

* improve unit test coverage

* fix go lint

* refactor

* fix integration test

* fix simulation tests

* fix go linter

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-08-10 18:33:38 -04:00
Freddy Caceres
42abb259cb
Add support for MaxOpenConnections (#1229) 2022-08-10 08:26:51 -04:00
Daniel Burckhardt
e70d8fcb56
chore(rpc): restructure JSON-RPC APIs (#1218)
* move non api methods from eth/api.go to evm_backend: ClientCtx, QueryClient, Ctx, getBlockNumber, getTransactionByBlockAndIndex, doCall

* organize eth/api.go into sections and move backend logic to dedicated files

* remove unnecesary comment

* move resend to the backend

* refractor eth api

* refractor debug namespace

* refactor miner namespace

* refactor personal namespace

* update transactionReceipt from upstream

* update getBlockByNumber from upstream

* update getBalance from upstream

* update getProof from upstream

* update getBalance from upstream

* fix linter

* remove duplicated import

* remove duplicated import

* fix backend tests

* fix lint

* fix duplicated imports

* fix linter

* reorganize blocks

* backend folder refractor

* remove unnecessary file

* remove duplicate import

Co-authored-by: Freddy Caceres <facs95@gmail.com>
2022-08-09 07:52:28 +02:00
Ramiro Carlucho
d1543ce678
[ENG-626] Rpc types integration tests (#1207)
* types tests

* cleanup

* cleanup

* fix differences in the rpc calls with geth

* cleanup

* fix linter. getProof future queries now behave as geth

* fix spelling

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-08-08 09:01:42 -04:00
Freddy Caceres
ccbaf1fe05
imp(tests): prune node integration tests (#1212)
* first pass

* extra comment

* fixed pruned node tests. Fix getBalance on pruned. Fix BaseFee on pruned.

* fix tests execution

* check logs on tests

* address pr comments

* address comments

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

* update error msg check

* fix lint

* fix linter

* fix linter

* fix py lint

* test lint

* fix lint

* pin golangcli version

* pin golanci version

* pin lint to version 0.48

* fix linter

* fix last linter last file

Co-authored-by: ramacarlucho <ramirocarlucho@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-08-08 10:17:10 +02:00
yihuang
e1560849dd
feat(ante, evm): set priority for eth transactions (#1214)
* Set priority for eth transactions

Set the tx priority to the lowest priority in the messages.

fix unit tests

code cleanup and spec

update spec

fix go lint

add priority integration test

add python linter job

add access list tx type

fix gas limit

remove ledger tag, so no need to replace hid dependency

fix earlier check

ibc-go v5.0.0-beta1

* fix pruned node integration test

* Update x/feemarket/spec/09_antehandlers.md

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-08-05 15:00:31 +02:00
yihuang
8d3a2b1df2
fix pruned node integration test (#1223)
closes: #1222
2022-08-03 09:46:52 +02:00
Daniel Burckhardt
ee806fc41f
ENG 119 json rpc unit tests (#1189)
* tests(json-rpc): wip evm_backend unit test setup

* tests(json-rpc): wip evm_backend unit test setup

* fix viper

* wip query client mock

* fix first backend test except error message

* clean up

* wip Context with Height

* fix JSON RPC backend test setup

* typo

* refactor folder structure

* tests(json-rpc):add BlockBloom tests

* tests(json-rpc): remove unused malleate

* tests(json-rpc): add BaseFee tests

* refactor query tests

* add client mock

* add GetTendermintBlockByNumber tests

* refactor mock tests

* refactor

* wip backend EthBlockFromTendermint test

* wip backend EthBlockFromTendermint test

* refactor backend EthBlockFromTendermint test

* add TestGetTendermintBlockResultByNumber

* add GetBlockByNumber tests

* refactor mocks

* fix spelling

* add more tests and address comments
2022-07-29 10:35:07 +00:00
yihuang
29d3abcf09
!feat(deps): Upgrade cosmos-sdk to v0.46.0 (#1168)
* Reuse cosmos-sdk client library to create keyring

Extracted from https://github.com/evmos/ethermint/pull/1168
Cleanup cmd code for easier to migration to cosmos-sdk 0.46

* Update cosmos-sdk v0.46

prepare for implementing cosmos-sdk feemarket and tx prioritization

changelog

refactor cmd

use sdkmath

fix lint

fix unit tests

fix unit test genesis

fix unit tests

fix unit test env setup

fix unit tests

fix unit tests

register PrivKey impl

fix extension options

fix lint

fix unit tests

make HandlerOption.Validate private

gofumpt

fix msg response decoding

fix sim test

bump cosmos-sdk version

fix sim test

sdk 46

fix unit test

fix unit tests

update ibc-go
2022-07-28 15:43:49 +02:00
Daniel Burckhardt
c626a5c8ee
testing(json rpc): Add backend test suite with mock grpc query client (#1199)
* tests(json-rpc): wip evm_backend unit test setup

* tests(json-rpc): wip evm_backend unit test setup

* fix viper

* wip query client mock

* fix first backend test except error message

* clean up

* wip Context with Height

* fix JSON RPC backend test setup

* typo

* refactor folder structure

* Update rpc/backend/evm_backend_test.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-07-23 11:16:23 +02:00
yihuang
ffe78da36e
!fix(evm): Fix eth tx hashes in json-rpc responses (#1176)
* Fix eth tx hashes in json-rpc responses

Closes: #1175

- Remove Size_ field
- Validate From/Hash fields in ante handler
- Recompute tx hashes in json-rpc apis to cope with old blocks

Update CHANGELOG.md

remove Size_, validate Hash/From, add unit tests

update spec

Update CHANGELOG.md

Update app/ante/eth.go

populate From in SendRawTransaction

Apply suggestions from code review

keep Size_ field to avoid breaking tx format

* move some validation to ValidateBasic

* move validation to ValidateBasic

* make ToTransaction returns a valid msg

* restructure the protoTxProvider check

* add comment

* workaround tx hash issue in event parsing

* fix integration test

* fix unit test

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-07-19 15:12:48 +00:00
crypto-facs
da8fcc3ae2
fix(rpc): optimize eth_getBalance endpoint (#1169)
* optimize get balance endpoint

* add comment

* add changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-07-11 15:04:45 +00:00
crypto-facs
4a6f4fd6e0
imp(deps): Geth upgrade v1.10.19 (#1159)
* upgrade geth and fix build

* add support for

* update EIPs

* fix keeper tests

* update traceTx function with latest geth changes

* remove unnecessary comments

* fix tests

* update proto

* add migrations

* update module version

* fix grpc test

* fix lint

* fix lint

* update changelog

* fix typo

* remove unnecessary format logs

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

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

* remove debug true on default

* update comments

* fixing ante tests

* fixed cycle imports on migrate_test

* fix wrong naming

* update comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-07-08 10:58:04 +00:00
yihuang
2ce168526a
fix!: fix json-rpc failures for pruned nodes (#1126)
* fix json-rpc failures for pruned nodes

Closes: #1123
Solution:
- try to parse base fee from events if grpc query failed
- use a `nil` base fee if failed to parse base fee from events
- use zero address if query validator address failed
- optimize some json-rpc apis by the way.

* changelog

* fix lint

* use GetTendermintBlockResultByNumber

* refactor

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-22 13:26:20 +02:00
Federico Kunze Küllmer
3b852f723e
imp(rpc): restrict unprotected txs on the node RPC (#1143)
* imp(rpc): restrict unprotected txs on the node RPC

* lint

* send raw transaction

* c++
2022-06-22 12:50:36 +02:00
crypto-facs
494d646539
fix(rpc): Fix GasPrice calculation with relation to MinGasPrice (#1138)
* fix gasPrice minGasPrice comparison

* update changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-21 13:13:13 +02:00
Federico Kunze Küllmer
ec8e93b319
all: rename go module to evmos/ethermint (#1137) 2022-06-19 11:43:41 +02:00
crypto-facs
a8d3805ddf
rpc: add ws log on read loop break (#1127)
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-16 11:25:22 +02:00
crypto-facs
620f6a6770
imp(feemarket): update BaseFee based on GasWanted (#1105)
* add gasWanted transient store keys

* add gasWanted transient store keeper functions

* add gasWanted transient store tracker

* add comment

* remove unncesary comment

* remove unnecesary function

* fix tests

* fix bad comment

* remove unnecesary comment

* update comment

* update changelog

* Update CHANGELOG.md

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

* add GasWantedDecorator

* remove unnecesary comments

* gasWanted decorator test

* fix tests

* fix tests and build

* fix lint

* updated end block event

* Update app/ante/fee_market.go

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

* fix undeclared variable

* Update app/ante/fee_market_test.go

* remove unnecesary line

* migrate MinGasMultiplier to FeeMarket module

* set limited gas wanted

* remove old newKeeper param

* update proto comment

* fix test

* update comments

* Update x/feemarket/keeper/abci.go

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

* address comments from review

* tidy

* tests

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-05 09:22:33 +00:00
crypto-facs
da99f11be3
rpc: Update GetGasPrice RPC endpoint with global MinGasPrice (#1108)
* return MinGasPrice as minium on GetGasPrice api

* update logic

* update changelog

* globalmingsprice comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-03 13:31:57 +00:00
yihuang
5533beed71
fix(rpc, ante): Emit Ethereum tx hash in AnteHandler to support query failed transactions (#1062)
* Emit eth tx hash in ante handler to support query failed transactions

WIP: #1045
Solution:
- emit eth tx hash in ante handler
- modify rpc to use it

fix ante handler

support failed tx in receipt

add unit tests

need to patch cosmos-sdk to work

update cosmos-sdk to v0.45.x release branch

fix failed status

fix unit tests

add unit test cases

cleanup dead code

Apply suggestions from code review

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

fix lint

fix review suggestions

fix build

fix gas used of failed tx

add back the redundant events

* fix get tx by index

* add unit tests for events

* Update rpc/types/events.go

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

* update comments

* refactoring

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

* fix lint

* Apply suggestions from code review

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-05-31 10:26:40 +00:00
yihuang
f06df8c265
imp: clean up the block fetch logic in json-rpc (#1081)
* clean up the block fetch logic in json-rpc

deduplicate some codes

fix EthBlockFromTm

fix latest block height

* add bug fix changelog
2022-05-23 18:36:31 +02:00
yihuang
d359cbd9c9
fix: gas price value in eth_getTransaction JSON-RPC response (#1082)
Solution:
- pass the correct baseFee parameter

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-05-19 06:48:37 +00:00
Federico Kunze Küllmer
c25669c761
rpc: refactor rpc packages and backend to support cosmos namespace (#1070)
* rpc: refactor rpc packages and backend to support cosmos namespace

* changelog

* typo
2022-05-02 06:26:24 +00:00
yihuang
556c2cc8a3
fix!: london hardfork check logic in json-rpc apis (#1068) 2022-04-30 18:11:28 +02:00
Federico Kunze Küllmer
0f0996432a
fix: update BaseFee JSON-RPC (#1059)
* release: v0.14.0 changelog (#1057)

* fix: update BaseFee JSON-RPC

* typo

* changelog
2022-04-26 14:24:32 +00:00
yihuang
0543a28941
rpc: make json-rpc API namespaces extensible (#1056)
* make jsonrpc api namespaces extensible

Closes: #1052, #1037

* Apply suggestions from code review

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-04-19 12:49:05 +00:00
crypto-facs
7e359068d8
eth_getBlockByNumber fix on batch transactions (#1050) 2022-04-18 19:06:04 +02:00
crypto-facs
bc4b018b60
Context block height fix on TraceTx (#1051) 2022-04-16 19:31:30 +02:00
Federico Kunze Küllmer
1e03c0c603
deps: bump SDK to v0.45.3 (#1046)
* release: v0.13.0 (#1030)

* release: v0.12.0 changelog

* changelog: v0.12.1 (#1019)

* evm: update empty hash check for storage state (#1016)

* v0.12.1: changelog

* changelog: v0.12.2 (#1022)

* changelog: v0.12.2

* fix

* fix

* update changelog

* deps: bump SDK to v0.45.3

* changelog

* fixes
2022-04-12 15:31:25 +02:00
Federico Kunze Küllmer
3c8a95b012
imp: migrate JSON for feemarket (#1021)
* imp: migrate JSON for feemarket

* migrate JSON

* types

* fix

* fix unmarshal JSON error

* changelog

* fix lint

* fix test
2022-03-30 19:10:54 +02:00
yihuang
70d52948da
fix: eth_newPendingTransactionFilter doesn't return ethereum tx hash (#1012)
* Problem: eth_newPendingTransactionFilter don't return correct tx hash

Closes: #1011
Solution:
- use eth tx hash rather than tendermint one

* changelog

* remove copied TODO comment and ignore err result of Notify

* add e2e test

* fix ws client in e2e test

* fix test

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-03-24 07:56:59 +00:00
WilliamXieCrypto
01bc2ec170
fix: Update the JSON-RPC to correct the return information. (#1006)
* fix: Update the JSON-RPC to correct the return information.

* Update CHANGELOG.md

* update: move the tests to integration_test.go

* refactor the tests and use table tests instead

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-03-21 11:40:24 +00:00
Loredana Cirstea
d04787e97f
eth_feeHistory - fix reward calculation from MsgEthereumTx (#990)
* eth_feeHistory - fix reward calculation from MsgEthereumTx

Problem:
- rewards calculation based on percentiles took into consideration the tendermint tx count instead of `MsgEthereumTx` count.
- `sorter := make(sortGasAndReward, tendermintTxCount)` creates an array of `{0 <nil>}` values.
The `nil` value from the `reward` attribute was never rewritten for tendermint Tx without any `MsgEthereumTx`

Fixes:
- return early if there are 0 `MsgEthereumTx`
- use the `MsgEthereumTx` count to calculate rewards

* Add change log
2022-03-15 08:11:31 +01:00
Loredana Cirstea
805b2eada5
Quick fix for eth_feeHistory when reward is nil (#975)
* Quick fix for eth_feeHistory when reward is nil

`RPC method eth_feeHistory crashed: runtime error: invalid memory address or nil pointer dereference`
from caa1c5a6c6/rpc/ethereum/backend/feebackend.go (L29)

* Update CHANGELOG.md
2022-03-06 15:39:48 +02:00
Loredana Cirstea
caa1c5a6c6
fix: eth_feeHistory reward values cannot be nil (#970)
* eth_feeHistory reward values cannot be nil

* removed reward when rewardPercentiles is not specified

* fix lint

* refactor and fix typos

* add changelog

Co-authored-by: Freddy Caceres <freddy.caceres@crypto.com>
2022-03-03 23:55:09 +00:00
yihuang
40d5eff9fa
fix: Metamask keeps failing sending transactions (#968)
* Problem: Metamask keeps failing sending transactions

Closes: #967
Solution:
- add 1/8 buffer on top of base fee for default gas price

* changelog

* fix typo

Co-authored-by: Freddy Caceres <freddy.caceres@crypto.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-03-03 20:50:40 +00:00
Guillermo Paoletti
3bea3fa1ef
ante: EIP712 support (#950)
* code migrated

* signed_data ported to avoid conficting dependency

* correct payload

* eip712 working with evmos.me

* use geth TypedData types

* fix linter

* minor refactor

* test first try

* fix test

* fix tests

* enforce fee delegated eip712

* verify signature refactor

* SignedTypedData api refactor

* add AnteHandler test for EIP712

* remove comment

* code clean up

* return more detailed error messages

* fix linter

* remove unnecesary global vars

* Update app/ante/eip712.go

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

* fix pr comments

* remove hardcoded value

* add more tests

* add changelog

* use sdk errors

* add MsgDelegate test

Co-authored-by: Freddy Caceres <freddy.caceres@crypto.com>
Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: crypto-facs <84574577+crypto-facs@users.noreply.github.com>
2022-02-26 16:34:43 +00:00
yihuang
0d69a69625
fix: websocket client duplicated messages (#955)
* Problem: websocket client get duplicated messages

Closes: #954
Solution:
- localize the subscription management within current connection

* changelog

* fix linter

* fix test building

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-02-25 19:08:30 +00:00
crypto-facs
e41c713ffb
rpc: add support for eth_signedTypedData (#953)
* add signTypedData api

* fix typo

* fix lint issues

* add crypto recovery offset

* Apply suggestions from code review

* add changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-02-25 13:42:33 +00:00
crypto-facs
e16b7f8ab0
fix newPendingTransactions subscription deadlock issue (#933) 2022-02-10 03:10:37 +01:00
yihuang
724a06632b
fix: minimal-gas-prices and baseFeePerGas conflicts (#916)
* Problem: minimal-gas-prices and baseFeePerGas conflicts

Closes: #915

Solution:
- Don't check min-gas-price for evm tx if london hardfork and feemarket enabled.

comments and cleanup

changelog

* fix zero fee coins

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-01-26 10:44:41 +00:00
yihuang
351e6d6eb3
rpc: make trace transaction api work with batch tx (#907)
* make trace transaction api work with batch tx

Closes: #906

fix linter

* review suggestion

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-01-16 15:36:19 +00:00