Commit Graph

312 Commits

Author SHA1 Message Date
Federico Kunze Küllmer
acf15474e7
imp(evm): stateless custom precompiles (#1272)
* release: v0.17.0 changelog (#1153)

* release: v0.17.0 changelog

* rm newline

* update link

* imp(evm): EVM interface

* fixes

* fix lint

* fix lint pt 2

* initial wiring for stateful contracts

* Apply suggestions from code review

Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>

* changelog

* comments from review

* lint

Co-authored-by: Vladislav Varadinov <vladislav.varadinov@gmail.com>
2022-09-15 13:54:02 +02:00
Austin Chandra
723443abc7
feat(eip712): Create LedgerPreprocessHook to reformat EIP-712 payloads (#1277)
* Create ReformatLedgerTx to reformat EIP-712 payloads

* Fix issue with public key; minor refactors

* Refactor naming; add test case

* Update preprocess_test

* Add tests and fix lint

* Refactor preprocess test

* Implement minor fix and add changelog entry

Co-authored-by: Freddy Caceres <facs95@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-09-13 16:56:35 +02:00
Daniel Burckhardt
9f03ca713d
tests(rpc): add backend blocks tests (#1296)
* wip

* rename GetTendermintBlockByNumber to TendermintBlockByNumber

* rename GetTendermintBlockResultByNumber to TendermintBlockResultByNumber

* rename GetTendermintBlockByHash to TendermintBlockByHash

* rename BlockByNumber to EthBlockByNumber

* rename BlockByHash to EthBlockByHash

* rename GetBlockNumberByHash to BlockNumberFromTendermintByHash

* rename GetBlockNumber to BlockNumberFromTendermint

* rename GetEthereumMsgsFromTendermintBlock to EthMsgsFromTendermintBlock

* rename GetEthBlockFromTendermint to BlockFromTendermintBlock

* rename EthBlockFromTendermint to EthBlockFromTendermintBlock

* add TestEthBlockFromTendermintBlock with no transactions. Note that this endpoint is breaking when querying a block with transactions

* add block transaction count tests

* add TendermintBlockByHash test'

* add TestBlockNumberFromTendermint tests

* add HeaderByHash and HeaderByNumber tests

* add EthBlockFromTendermintBlock test

* add TestEthBlockByNumber tests

* Specificy that the endpoints are getting Etherum transactions in comments

* Refactor shared logic into GetBlockTransactionCount

* rename BlockFromTendermintBlock to RPCBlockFromTendermintBlock

* add CHangelog
2022-09-05 16:07:56 +02:00
yihuang
1a5b64d134
Change the fallback priority mechanism to be based on gas price (#1289)
* Change the fallback priority mechanism to be based on gas price

* Update CHANGELOG.md

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Freddy Caceres <facs95@gmail.com>
2022-09-02 01:34:05 +00:00
yihuang
ca070e21ef
test: add integration test for the rollback cmd (#1311)
* test the fixed rollback cmd

- check the rollback cmd works in integration tests

* Apply suggestions from code review

* upstream merged

* add changelog

Co-authored-by: Freddy Caceres <facs95@gmail.com>
2022-09-01 16:22:25 +02:00
Ramiro Carlucho
c9fe1d1913
fixes for 19.0.1 (#1305)
* fixes for 19.0.1

* changelog

* changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-08-26 20:25:12 +02:00
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
Federico Kunze Küllmer
3fbee18c46
chore(docs): Update Changelog (#1249)
* release: v0.17.0 changelog (#1153)

* release: v0.17.0 changelog

* rm newline

* update link

* chore(docs): Update Changelog
2022-08-12 17:38:34 +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
yihuang
b3242ea982
Problem: feemarket's query cli has redundant height parameter (#1230) 2022-08-10 08:51:39 +02:00
yihuang
7331cd2065
feat: support dynamic app db backend flag (#1226)
* support dynamic app db backend

* address pr reviews

* add comment

* Update server/start.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-08-05 15:01:20 +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
Federico Kunze Küllmer
53f160cbb0
chore(docs): update changelog (#1224)
* release: v0.17.0 changelog (#1153)

* release: v0.17.0 changelog

* rm newline

* update link

* chore(docs): update changelog
2022-08-03 09:59:25 +02:00
Freddy Caceres
ebbffc685c
change default maxGasWanted (#1208) 2022-07-28 19:14:46 +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
Victor Pham
cd41c48075
fix(evm): TxIndex is wrong when trace is the first tx of a block (#1187)
* Fix TxIndex wrongly when trace first Tx of a block

If `Predecessors` is empty, `txConfig.TxIndex` originally = 0 and when it reachs line 401 `txConfig.TxIndex++`, it will becomes 1. It should be 0

* apply suggestion and add change-log

* fix comment

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-07-20 16:48:50 +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
Federico Kunze Küllmer
73c9ea218e
fix(rpc): fix panic on breaking EVM and feemarket params (#1188)
* release: v0.17.0 changelog (#1153)

* release: v0.17.0 changelog

* rm newline

* update link

* fix(rpc): fix panic on breaking EVM and feemarket params

* changelog

* fix gosec
2022-07-19 17:00:43 +02:00
Daniel Burckhardt
969794c5b4
impr(evm): add check msg.Validate check to prevent 0 gas txs (#1174)
* impr(evm): add check msg.Validate check to prevent 0 gas txs

* add changelog

* impr(evm): add integration tests for zero gas txs

* go mod tidy and proto swagger

* fix comment

* move changelog to state machine breaking

* add ReadHeaderTimeout`

* revert ReadHeaderTimeout config change

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-07-18 22:21:04 +02:00
yihuang
b74b37f5f0
fix: traceTransaction returns zero gas used (#1179)
* Problem: traceTransaction returns zero gas used

Solution:
- call CaptureTxStart and CaptureTxEnd

* fix trace unit tests

* add overflow check

* add comment

* check gas used is positive

* Update x/evm/keeper/state_transition.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-07-18 22:16:28 +02: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
yihuang
9ae73b670b
deps: upgrade ibc-go to v4-rc (#1167)
changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-07-11 13:18:03 +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
Daniel Burckhardt
4a66ff95d9
feemarket(specs): add hint on different gas terminology for gas in Cosmos and Ethereum (#1165) 2022-07-01 13:55:19 +02:00
Federico Kunze Küllmer
ccf66cf36e
release: backport v0.17.0 changelog (#1155)
* release: v0.17.0 changelog (#1153)

* release: v0.17.0 changelog

* rm newline

* update link

* update mergify
2022-06-27 12:56:29 +02:00
Federico Kunze Küllmer
27ade5d731
deps: Go 1.18 (#1147)
* deps: Go 1.18

* changelog

* update
2022-06-24 18:16:19 +02: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
Daniel Burckhardt
d3333418c5
bug(feemarket): set lower bound of base fee to min gas price param (#1135)
* bug(feemarket): set lower bound of base fee to min gas price param)

* fix

* bug(feemarket): flag necessary improvement to integration tests, as the baseFee changes for every test

* bug(feemarket): add unit tests for CalculateBaseFee

* bug(feemarket): move integration test setup out of Describe block

* wip fix tests

* bug(feemarket): fix integration tests

* bug(feemarket): wip improve specs

* bug(feemarket): add spec concepts

* bug(feemarket): remove todo

* bug(feemarket): remove changes used for debugging in params

* bug(feemarket): remove todo in integration test

* add changelog

* address PR comments

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-22 12:57:16 +02:00
Federico Kunze Küllmer
8e2c65295f
imp(evm): rename RejectUnprotectedTx to AllowUnprotectedTxs (#1142)
* imp(evm): rename RejectUnprotectedTx to AllowUnprotectedTxs

* changelog
2022-06-22 12:51:14 +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
yihuang
6cf2b9fdd3
fix(evm): clear logs if tx failed in post processing hooks (#1128)
* Problem: clear logs if tx failed in post processing hooks

* Update x/evm/keeper/state_transition.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-21 13:21:52 +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
yihuang
8f932ddc6a
!feat(evm): Reject not replay-protected tx to prevent replay attack (#1124)
* Reject not replay-protected tx to prevent replay attack

Closes: #1122

- reject such txs in ante handler

* add reject unprotected parameter

* Update CHANGELOG.md

* Apply suggestions from code review

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

* pr suggestions

* add unit test case

* Reject not replay-protected tx to prevent replay attack

Closes: #1122

- reject such txs in ante handler

add reject unprotected parameter

Update CHANGELOG.md

Apply suggestions from code review

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

pr suggestions

add unit test case

use var

* add migrations

* Apply suggestions from code review

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

* rename

* update comments

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-13 09:41:53 +00:00
yihuang
82835307c7
imp(feemarket): min-gas-multiplier parameter should accept zero value (#1120)
* min-gas-multiplier parameter should accept zero value

update min-gas-multiplier validation logic

* fix unit test

* changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-06-09 11:20:50 +02:00
crypto-facs
b3fa23e6cb
fix(types): account type method (#1118)
* fix account type method

* update changelog
2022-06-08 17:53:07 +02:00
Federico Kunze Küllmer
23f88315e8
ante: refactor (#1113) 2022-06-06 10:15:10 +02:00
mmsqe
707b49d0fb
fix(types): avoid invalid account error on create vesting account (#1112)
* avoid invalid account error on create vesting account

* this change is related to https://github.com/cosmos/cosmos-sdk/pull/12154/files
* for more info see https://github.com/crypto-org-chain/cronos/issues/471

* add change doc

* add comment

* change under unreleased
2022-06-06 09:26:09 +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
8155e1f319
Move CanTransfer decorator before GasConsume (#1111) 2022-06-04 20:32:04 +02: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
Daniel Burckhardt
cad7ff66b0
analytics(app): update telemetry to Ethermint modules (#1106)
* analytics(evm): replace telemetry gauges with counters and add gasUsed counter

* analytics(feemarket): add telemetry gauges for base fee and block gas

* analytics(feemarket): add telemetry gauges for gas_used per gas_limit

* analytics(feemarket): remove refund telemetry

* analytics(app): update CHANGELOG

* remove unwanted change

* address PR comments

* update comment
2022-06-02 15:04:33 +02:00
Loredana Cirstea
046cd00174
feemarket: global MinGasPrice parameter (#1104)
* Add min_gas_price to feemarket params

* Add MinGasPriceDecorators

* feemarket integration tests for MinGasPrice

* Restructure integration tests

* Simplify integration tests context

We use DeliverTx context to set up the app, otherwise not all settings are initialized.
We test CheckTx with `s.app.BaseApp.CheckTx(req)`, which uses the `CheckTx` mode and context.

* Update MinGasPrice spec in feemarket module

* reorder ethermint module order for initializing genesis

* feemarket migrations for adding MinGasPrice param

* update changelog

* Additional unit tests for MinGasPrice = 0, tx gas price > 0 (PR review)

https://github.com/tharsis/ethermint/pull/1104#discussion_r884991661

* Use 0 MinGasPrice for transaction simulations

* Fix duplicate registration of feemarket GenesisState and Params (PR review)

https://github.com/tharsis/ethermint/pull/1104#issuecomment-1141893712
2022-05-31 18:28:46 +02: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
Daniel Burckhardt
928e018aa9
impr(evm): add tx_type, gas and counter telemetry for ethereum txs (#1101)
* impr(evm): add tx_type, gas and counter telemetry for ethereum txs

* impr(evm): Add CHANGELOG
2022-05-30 10:24:29 +02:00
Daniel Burckhardt
d23fb0c37d
specs(evm): Add concepts (#1095)
* specs(evm): Add concepts

* specs(evm): Add geth and bytecode concepts

* specs(evm): little fixes

* fix typo

* add CHANGELOG
2022-05-26 15:04:19 +00:00
crypto-facs
d5598932a7
imp(evm): add query params to CLI (#1091)
* add query params to evm

* update changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-05-25 14:02:01 +00:00