Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: no rollback command to help with app-hash mismatch situation #481

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
### State Machine Breaking
- [cronos#429](https://github.com/crypto-org-chain/cronos/pull/429) Update ethermint to main, ibc-go to v3.0.0, cosmos sdk to v0.45.4 and gravity to latest, remove v0.7.0 related upgradeHandler.

### Improvements

- [cronos#481](https://github.com/crypto-org-chain/cronos/pull/481/) Add rollback command.

*May 3, 2022*

## v0.7.0
Expand Down
18 changes: 10 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ require (
github.com/spf13/cobra v1.4.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.1
github.com/tendermint/tendermint v0.34.19
github.com/tendermint/tendermint v0.34.20-0.20220517115723-e6f071164839
github.com/tendermint/tm-db v0.6.7
github.com/tharsis/ethermint v0.6.1-0.20220503175102-93d15db4d086
github.com/tharsis/ethermint v0.6.1-0.20220519101126-9edc87d1147f
google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4
google.golang.org/grpc v1.45.0
google.golang.org/grpc v1.46.2
google.golang.org/protobuf v1.28.0
gopkg.in/yaml.v2 v2.4.0
)
Expand Down Expand Up @@ -62,10 +62,10 @@ require (
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-stack/stack v1.8.0 // indirect
Expand Down Expand Up @@ -95,7 +95,7 @@ require (
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/lib/pq v1.10.4 // indirect
github.com/lib/pq v1.10.6 // indirect
github.com/libp2p/go-buffer-pool v0.0.2 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
Expand All @@ -111,7 +111,7 @@ require (
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
Expand Down Expand Up @@ -153,7 +153,7 @@ require (
replace (
// TODO: fix keyring upstream
github.com/99designs/keyring => github.com/crypto-org-chain/keyring v1.1.6-fixes
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.45.4
github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.44.4-0.20220518122256-e49cc20318cf
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// TODO: remove when middleware will be implemented
github.com/cosmos/ibc-go/v3 => github.com/crypto-org-chain/ibc-go/v3 v3.0.0-hooks
Expand All @@ -163,5 +163,7 @@ replace (
// TODO: remove when gravity update dependencies
github.com/peggyjv/gravity-bridge/module/v2 => github.com/crypto-org-chain/gravity-bridge/module/v2 v2.0.0-20220509015341-a016e2b04866

github.com/tendermint/tendermint => github.com/yihuang/tendermint v0.34.14-0.20220518061324-81344ac9464d
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


google.golang.org/grpc => google.golang.org/grpc v1.33.2
)
53 changes: 15 additions & 38 deletions go.sum

Large diffs are not rendered by default.

71 changes: 28 additions & 43 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -632,14 +632,6 @@
rev = "59de210119f50cedaa42d175dc88b6335fcf63f6"
sha256 = "0r9f7lvz6znl7yr6njg77m8hj472yhdshf1qaybwyw7j8as6c4r3"

["github.com/bketelsen/crypt"]
sumVersion = "v0.0.3-0.20200106085610-5cbc8cc4026c"
["github.com/bketelsen/crypt".fetch]
type = "git"
url = "https://github.com/bketelsen/crypt"
rev = "5cbc8cc4026c0c1d3bf9c5d4e5a30398f99c99a9"
sha256 = "006772d50c73llgz8chvynndk28qxcyr1fd18sm0b5w1g1rdw2wp"

["github.com/bmizerany/pat"]
sumVersion = "v0.0.0-20170815010413-6226ea591a40"
["github.com/bmizerany/pat".fetch]
Expand All @@ -664,15 +656,6 @@
rev = "2f508b3f86ed9ef87bcf3426b87b6c0dc0d3632c"
sha256 = "1hznnrl1pi5nyh6xm05wmb8knq1sm44pz4w998q01lqfpyc56z86"

["github.com/btcsuite/btcd/chaincfg"]
sumVersion = "v1.0.1"
relPath = "chaincfg"
["github.com/btcsuite/btcd/chaincfg".fetch]
type = "git"
url = "https://github.com/btcsuite/btcd"
rev = "fc36cb25a4bdc6d989f9161552e7b0fe08b02939"
sha256 = "0j6s4zh3bb42lihiiqmdd8wd6fvdqpa1x7hmvq2jvfpg47ng12md"

["github.com/btcsuite/btcd/chaincfg/chainhash"]
sumVersion = "v1.0.1"
relPath = "chaincfg/chainhash"
Expand Down Expand Up @@ -974,12 +957,12 @@
sha256 = "13d5l6p6c5wvkr6vn9hkhz9c593qifn7fgx0hg4d6jcvg1y0bnm2"

["github.com/coreos/etcd"]
sumVersion = "v3.3.13+incompatible"
sumVersion = "v3.3.10+incompatible"
["github.com/coreos/etcd".fetch]
type = "git"
url = "https://github.com/coreos/etcd"
rev = "98d308426819d892e149fe45f6fd542464cb1f9d"
sha256 = "1kac4qfr83f2hdz35403f1ald05wc85vvhw79vxb431n61jvyaqy"
rev = "27fc7e2296f506182f58ce846e48f36b34fe6842"
sha256 = "1x2ii1hj8jraba8rbxz6dmc03y3sjxdnzipdvg6fywnlq1f3l3wl"

["github.com/coreos/go-etcd"]
sumVersion = "v2.0.0+incompatible"
Expand Down Expand Up @@ -1030,12 +1013,13 @@
sha256 = "10x22k92ra1sdddj2pksprfhsm683sldflcnjm8nfz4rjjhjwkay"

["github.com/cosmos/cosmos-sdk"]
sumVersion = "v0.45.4"
sumVersion = "v0.44.4-0.20220518122256-e49cc20318cf"
vendorPath = "github.com/crypto-org-chain/cosmos-sdk"
["github.com/cosmos/cosmos-sdk".fetch]
type = "git"
url = "https://github.com/cosmos/cosmos-sdk"
rev = "ad9e5620fb3445c716e9de45cfcdb56e8f1745bf"
sha256 = "0ykh1rd3qidwbcmas644p1f016ym85b22ivmhshdbhms38aqbkyj"
url = "https://github.com/crypto-org-chain/cosmos-sdk"
rev = "e49cc20318cf13f81e3563a7a9139013bec0ec92"
sha256 = "12wjjzlc2wqmkg22fn2nb7gigsiw9xvnykbcma2bsgn8a08b3f9r"

["github.com/cosmos/go-bip39"]
sumVersion = "v1.0.0"
Expand Down Expand Up @@ -1472,12 +1456,12 @@
sha256 = "0d5njmwkfq2809vlimnlvy8ir6kln0c4cgdwr680fwsclpbr43qs"

["github.com/fsnotify/fsnotify"]
sumVersion = "v1.5.1"
sumVersion = "v1.5.4"
["github.com/fsnotify/fsnotify".fetch]
type = "git"
url = "https://github.com/fsnotify/fsnotify"
rev = "466b39d216616549a37ee93c7c47775f6a010790"
sha256 = "0xpdprvab4zgn5igymc5468hk5s429cqyxml9xjsk0cn53rikj87"
rev = "0f4b979323bea7ee6677faa4a88078ec558b1b80"
sha256 = "076q5iibk03m5njqah4xwm6dz7ywyn7bdyis97gg09n0j2g8iyw8"

["github.com/gballet/go-libpcsclite"]
sumVersion = "v0.0.0-20190607065134-2772fd86a8ff"
Expand Down Expand Up @@ -1569,12 +1553,12 @@
sha256 = "15cm24sjyvwxpprfha2k0s3c1hhpg5y2kljnw04hayfyazqc79wl"

["github.com/go-kit/log"]
sumVersion = "v0.2.0"
sumVersion = "v0.2.1"
["github.com/go-kit/log".fetch]
type = "git"
url = "https://github.com/go-kit/log"
rev = "71fa7d7d64785c98d3814e53b3544fd8cccff897"
sha256 = "13gbqrwvqy9j903j44x0kix5gnn34a8hl8skbdijy7arpkxpj6h3"
rev = "0b69c7049332e99c25d5fd0f4d08317cfe45e7d8"
sha256 = "1xjv2g1cd1iaghhm1c1zw0lcz89a9zq5xradyjipvrbqxbxckqm6"

["github.com/go-logfmt/logfmt"]
sumVersion = "v0.5.1"
Expand Down Expand Up @@ -2687,12 +2671,12 @@
sha256 = "1d4g1vkhc1180l1n7q48vl84b27c7cziywml78cyijbcdz2f8vim"

["github.com/lib/pq"]
sumVersion = "v1.10.4"
sumVersion = "v1.10.6"
["github.com/lib/pq".fetch]
type = "git"
url = "https://github.com/lib/pq"
rev = "8446d16b8935fdf2b5c0fe333538ac395e3e1e4b"
sha256 = "0kdr257l1gq82bx2g3qjab6haj31ib8ljbyaa1rg1xsva5j17ngx"
rev = "8c6de565f76fb5cd40a5c1b8ce583fbc3ba1bd0e"
sha256 = "0qf9xd8g1750q2hcn04r7086lv009bj0ddrsn8xc57v67zk3vglc"

["github.com/libp2p/go-buffer-pool"]
sumVersion = "v0.0.2"
Expand Down Expand Up @@ -3404,12 +3388,12 @@
sha256 = "0nri6hkfb0z3dkxf2fsfidr4bxbn91rjsqhg5s0c2jplf0aclppz"

["github.com/prometheus/client_golang"]
sumVersion = "v1.12.1"
sumVersion = "v1.12.2"
["github.com/prometheus/client_golang".fetch]
type = "git"
url = "https://github.com/prometheus/client_golang"
rev = "2e1c4818ccfdcf953ce399cadad615ff2bed968c"
sha256 = "0d46nindizpjgdygryc140fd94j1qfkzwyzwh9p2g3zp6v4fw0s1"
rev = "e203144f43306c1f344fbc548fd02c4b79962e30"
sha256 = "0caz7dxlfqc1x05rdk6bsgjbrz2v0sswnkk17sp8j57zqb44gk3p"

["github.com/prometheus/client_model"]
sumVersion = "v0.2.0"
Expand Down Expand Up @@ -3852,12 +3836,13 @@
sha256 = "1zcms3l5fihzg8nf4vhdk18qpn1jkbm3rpkjfpskfcrgzlxk6vi5"

["github.com/tendermint/tendermint"]
sumVersion = "v0.34.19"
sumVersion = "v0.34.14-0.20220518061324-81344ac9464d"
vendorPath = "github.com/yihuang/tendermint"
["github.com/tendermint/tendermint".fetch]
type = "git"
url = "https://github.com/tendermint/tendermint"
rev = "2f231ceb952a2426cf3c0abaf0b455aadd11e5b2"
sha256 = "1j04xnaf2l1swj5rfijiq7632v6nnj8mvn0gmd6qbqjgy5q47frm"
url = "https://github.com/yihuang/tendermint"
rev = "81344ac9464db02421fa115041f162ab9ace9372"
sha256 = "1hskmlkvlypymxf6arwkc9linvh7kqqlxs0913bf4vlcgs851wvp"

["github.com/tendermint/tm-db"]
sumVersion = "v0.6.7"
Expand All @@ -3868,12 +3853,12 @@
sha256 = "0nlf9w791ln0n49fiaczy7bsr0i1cnrrm78frhv4k9kbn13gfpw6"

["github.com/tharsis/ethermint"]
sumVersion = "v0.6.1-0.20220503175102-93d15db4d086"
sumVersion = "v0.6.1-0.20220519101126-9edc87d1147f"
["github.com/tharsis/ethermint".fetch]
type = "git"
url = "https://github.com/tharsis/ethermint"
rev = "93d15db4d086d65eb0a7bee744b453e5ae416ac0"
sha256 = "1ppxkqcxpbz7di7v43nxdrd3m97bxyz0i07y2pxqr7xla4vdardm"
rev = "9edc87d1147f3513d99370f41f7547c993e54572"
sha256 = "142bynf016f3g5k9dvzi057yk4zyckdah3lgs773p1ygspkwvl0d"

["github.com/tidwall/gjson"]
sumVersion = "v1.6.7"
Expand Down
8 changes: 8 additions & 0 deletions integration_tests/configs/broken-cronosd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ pkgs ? import ../../nix { } }:
let cronosd = (pkgs.callPackage ../../. { });
in
cronosd.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches or [ ] ++ [
./broken-cronosd.patch
];
})
15 changes: 15 additions & 0 deletions integration_tests/configs/broken-cronosd.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/app/app.go b/app/app.go
index 21eab4d..156fad7 100644
--- a/app/app.go
+++ b/app/app.go
@@ -773,6 +773,10 @@ func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.R

// EndBlocker application updates every end block
func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
+ if ctx.BlockHeight() % 10 == 0 {
+ store := ctx.KVStore(app.keys["cronos"])
+ store.Set([]byte("hello"), []byte("world"))
+ }
return app.mm.EndBlock(ctx, req)
}

59 changes: 59 additions & 0 deletions integration_tests/configs/rollback-test-network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
dotenv: ../../scripts/.env
cronos_777-1:
cmd: cronosd
start-flags: "--trace"
app-config:
minimum-gas-prices: 0basetcro
json-rpc:
address: "0.0.0.0:{EVMRPC_PORT}"
ws-address: "0.0.0.0:{EVMRPC_PORT_WS}"
api: "eth,net,web3,debug,cronos"
validators:
- coins: 1000000000000000000stake,10000000000000000000000basetcro
staked: 1000000000000000000stake
mnemonic: ${VALIDATOR1_MNEMONIC}
- coins: 1000000000000000000stake,10000000000000000000000basetcro
staked: 1000000000000000000stake
mnemonic: ${VALIDATOR2_MNEMONIC}
- name: fullnode
accounts:
- name: community
coins: 10000000000000000000000basetcro
mnemonic: ${COMMUNITY_MNEMONIC}
- name: signer1
coins: 20000000000000000000000basetcro
mnemonic: ${SIGNER1_MNEMONIC}
- name: signer2
coins: 30000000000000000000000basetcro
mnemonic: ${SIGNER2_MNEMONIC}

genesis:
consensus_params:
block:
max_bytes: "1048576"
max_gas: "81500000"
app_state:
evm:
params:
evm_denom: basetcro
cronos:
params:
cronos_admin: ${CRONOS_ADMIN}
enable_auto_deployment: true
ibc_cro_denom: ${IBC_CRO_DENOM}
gov:
voting_params:
voting_period: "10s"
deposit_params:
max_deposit_period: "10s"
min_deposit:
- denom: "basetcro"
amount: "1"
transfer:
params:
receive_enabled: true
send_enabled: true
feemarket:
params:
no_base_fee: false
initial_base_fee: 100000000000
3 changes: 3 additions & 0 deletions integration_tests/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,3 +1050,6 @@ def transfer_tokens(self, from_, to, amount, **kwargs):
**kwargs,
)
)

def rollback(self):
self.raw("rollback", home=self.data_dir)
9 changes: 6 additions & 3 deletions integration_tests/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ def __init__(self, cronos, geth, contract):
self.contract = contract


def setup_custom_cronos(path, base_port, config, post_init=None, chain_binary=None):
def setup_custom_cronos(
path, base_port, config, post_init=None, chain_binary=None, wait_port=True
):
cmd = [
"pystarport",
"init",
Expand All @@ -215,8 +217,9 @@ def setup_custom_cronos(path, base_port, config, post_init=None, chain_binary=No
preexec_fn=os.setsid,
)
try:
wait_for_port(ports.evmrpc_port(base_port))
wait_for_port(ports.evmrpc_ws_port(base_port))
if wait_port:
wait_for_port(ports.evmrpc_port(base_port))
wait_for_port(ports.evmrpc_ws_port(base_port))
yield Cronos(path / "cronos_777-1")
finally:
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
Expand Down
Loading