Skip to content

Commit

Permalink
Problem: replay un-protected tx is not rejected (#585)
Browse files Browse the repository at this point in the history
* Problem: replay un-protected tx is not rejected

Solution:
- backport a non-breaking version of evmos/ethermint#1124

add integration test

* changelog

* fix lint
  • Loading branch information
yihuang authored Jul 15, 2022
1 parent e8f95d1 commit 21b7bc0
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- [cronos#489](https://github.com/crypto-org-chain/cronos/pull/489) Enable jemalloc memory allocator, and update rocksdb src to `v6.29.5`.
- [#513](https://github.com/crypto-org-chain/cronos/pull/513) Add `fix-unlucky-tx` command to patch txs post v0.7.0 upgrade.
- [cronos#522](https://github.com/crypto-org-chain/cronos/pull/522) Add `reindex-duplicated-tx` command to handle the tendermint tx duplicated issue.
- [#585](https://github.com/crypto-org-chain/cronos/pull/585) Reject replay unprotected tx, mainly the old transactions on ethereum.

*May 3, 2022*

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ replace (

github.com/tendermint/tendermint => github.com/tendermint/tendermint v0.34.20-rc0.0.20220630153554-17f4ea3680de

github.com/tharsis/ethermint => github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220714082230-7b2c9c059e88
github.com/tharsis/ethermint => github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220715022408-e190fec288d2

google.golang.org/grpc => google.golang.org/grpc v1.33.2
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220714082230-7b2c9c059e88 h1:dOZBEi6OfAOn4kAn0Ss3wCQ77T3Ds1sv/rrnbVm9edA=
github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220714082230-7b2c9c059e88/go.mod h1:T4f1p3L5kccbjBZMtJLKfOLiUXTO1OuS1I7FzQuJD+w=
github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220715022408-e190fec288d2 h1:ryOmHCj5Tg+ciZ8xUhDOd1xglmR+cMHZ5nAV+jFaof4=
github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220715022408-e190fec288d2/go.mod h1:T4f1p3L5kccbjBZMtJLKfOLiUXTO1OuS1I7FzQuJD+w=
github.com/crypto-org-chain/ibc-go/v2 v2.2.0-hooks2 h1:elj+Tb/3O9GA3pv62zkc1B0P8hl1WHmF6vF8PInEJm4=
github.com/crypto-org-chain/ibc-go/v2 v2.2.0-hooks2/go.mod h1:rAHRlBcRiHPP/JszN+08SJx3pegww9bcVncIb9QLx7I=
github.com/crypto-org-chain/keyring v1.1.6-fixes h1:AUFSu56NY6XobY6XfRoDx6v3loiOrHK5MNUm32GEjwA=
Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ schema = 3
version = "v0.6.7"
hash = "sha256-hl/3RrBrpkk2zA6dmrNlIYKs1/GfqegSscDSkA5Pjlo="
[mod."github.com/tharsis/ethermint"]
version = "v0.10.0-cronos.0.20220714082230-7b2c9c059e88"
hash = "sha256-8PmwPatF5BJ9oCgfFtHnQVl24E9KkbV+lBzS5ARmDCw="
version = "v0.10.0-cronos.0.20220715022408-e190fec288d2"
hash = "sha256-aFN3X77frizRc0yRVj0y5dvCVKItJ9jgwZWK5sPERTY="
replaced = "github.com/crypto-org-chain/ethermint"
[mod."github.com/tklauser/go-sysconf"]
version = "v0.3.10"
Expand Down

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,3 +690,18 @@ def test_tx_inclusion(cronos, max_gas_wanted):
== receipts[2].blockNumber
== receipts[3].blockNumber
)


def test_replay_protection(cronos):
w3 = cronos.w3
raw = (
(
Path(__file__).parent / "configs/replay-tx-0x"
"06d2fa464546e99d2147e1fc997ddb62"
"4cec9c8c5e25a050cc381ee8a384eed3.tx"
)
.read_text()
.strip()
)
with pytest.raises(Exception, match="eth tx is not replay-protected"):
w3.eth.send_raw_transaction(HexBytes(raw))

0 comments on commit 21b7bc0

Please sign in to comment.