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

Community Upgrade 1.1 #247

Merged
merged 4 commits into from Dec 20, 2018

Conversation

Projects
None yet
@Slamper
Copy link
Contributor

Slamper commented Dec 19, 2018

At height 11443 the GoS chain was halted by a bug in the unbonding and fee distribution logic of the cosmos-sdk. Issue: cosmos/cosmos-sdk#3160 ; Fix: cosmos/cosmos-sdk#3163

Also the chain was already suffering from the small block size limit as described in the attached README.md

Since we cannot rely on on-chain governance anymore we are proposing this genesis file together with an upgrade to an upcoming new gaiad version that fixes the root cause

This is a state dump from height 11441 (2 blocks before the chain halted). The inconsistency is resolved in this genesis file, since all fees have automatically been withdrawn in the postprocessing step of gaiad export.

What this improves:

  • It fixes the cause of the halt
  • BlockSize is increased

To reproduce this file:

  • Sync a node with pruning disabled to current game_of_stakes
  • gaiad start --pruning=nothing
  • gaiad export --height 11441 --for-zero-height
  • Modify chain_id and blockSize

README text by @zmanian

@Slamper Slamper requested a review from zmanian as a code owner Dec 19, 2018

@dlguddus

This comment has been minimized.

Copy link

dlguddus commented Dec 19, 2018

Thanks for the suggestion. I want to add some opinion for the plans ahead.

  1. I still want to hear some comments from Zaki before we move on to forked chain. Just to have more justification of canonical of the forked chain politically.

  2. I think the launch of the forked chain should give us pre-announcement at least 12 hours before execution, for the sake of different time zones.

Besides this two, I am totally agree with the fork!

@fkbenjamin

This comment has been minimized.

Copy link
Contributor

fkbenjamin commented Dec 19, 2018

While I'm personally also in favor of steaks, I believe it gets confusing if we change the chain_id too much. I'm therefore for "game_of_stakes_1" as the chain_id and for every new upgrade, we increment the id by one.

@Slamper

This comment has been minimized.

Copy link
Contributor

Slamper commented Dec 19, 2018

@fkbenjamin I see this point. Thanks for your feedback. The STAKE is now back :)

@dlguddus I fully agree. We will definitely wait for Zaki to approve that this will be the new GoS.

Also timing wise we will set the genesis time to something we all agree with once we have the OK from Zaki and then the chain can only start after that point in time as the genesis time is checked and enforced by gaiad. How about that ?

@dlguddus

This comment has been minimized.

Copy link

dlguddus commented Dec 19, 2018

love it!

@nodebreaker-carl

This comment has been minimized.

Copy link
Contributor

nodebreaker-carl commented Dec 19, 2018

I agree.

It's reasonable to start at that point.

There is no particular reason to disagree, you are very reasonable.

@dlguddus Opinion also speak for others.

@awrelll

This comment has been minimized.

Copy link
Contributor

awrelll commented Dec 19, 2018

I guess we don't need steaks anymore. We need to be taken seriously, bad actors can take advantage and mock the community efforts.

@clawmvp

This comment has been minimized.

Copy link
Contributor

clawmvp commented Dec 19, 2018

"game_of_stakes_1 Sounds good.

@Slamper Slamper force-pushed the certusone:upgrade_1 branch from dc597cf to 38d8e09 Dec 19, 2018

@Slamper

This comment has been minimized.

Copy link
Contributor

Slamper commented Dec 19, 2018

Ok implemented you recommendations

### Upgrade 1.
>brought to you by Zaki and Certus One
We chose a very conservative initial blocksize of `50kb` for the initial game of stakes launch as a conservative starting.

This comment has been minimized.

@mnugumanova

mnugumanova Dec 19, 2018

Contributor

might be worth mentioning that the new blocksize is 150kb

@sunnya97

This comment has been minimized.

Copy link
Member

sunnya97 commented Dec 19, 2018

@Slamper
Somebody sure did independently verify this!

Can you please fix the description in Proposal ID 2 🙂

Should be ipfs://QmaUHfQrh1RCbFEgC7j6AwuGLpAYsh76tBzhbZRQV6V1mH

@Slamper

This comment has been minimized.

Copy link
Contributor

Slamper commented Dec 19, 2018

@Slamper
Somebody sure did independently verify this!

Can you please fix the description in Proposal ID 2

@sunnya97
And the trophy goes to you 🏆 🎊 🎉

@fkbenjamin

This comment has been minimized.

Copy link
Contributor

fkbenjamin commented Dec 19, 2018

I tried to reproduce the file by resyncing a node (v0.28.0) using
gaiad start --pruning=nothing
and then using
gaiad export --height 11441 --for-zero-height.

However it generates the following error:
panic: app.mainKey expected to be nil; duplicate init?
Any ideas? I would like to verify the correctness of this file.

Edit: Didn't use 0.29 where export was fixed, thanks for clarifying!

@adrianbrink

This comment has been minimized.

Copy link

adrianbrink commented Dec 19, 2018

I can confirm @fkbenjamin problem.

You need to use 0.29.0-de1-0-g45a48f4e.
ref: cosmos/cosmos-sdk#3166

@Slamper

This comment has been minimized.

Copy link
Contributor

Slamper commented Dec 19, 2018

@adrianbrink

This comment has been minimized.

Copy link

adrianbrink commented Dec 19, 2018

I've modified the chain_id and max_bytes on the exported genesis file. However the sha512sum of the proposed and exported genesis files don't match.

Proposed Genesis File

adrian@gos-public-sentry-1:~/game-of-stakes$ sha512sum proposed_genesis.json
633afc54502f1df0ef8c1e8c5d6bf6b639a2dcd42ad57b2fd3772519e262eb5ed88d1d3f4d4688ebd7fe8b7f7209120c48fc787f9f6efea88cd4dbd6bcd6a6e6  proposed_genesis.json

Exported Genesis File

adrian@gos-public-sentry-1:~/.gaiad/config$ sha512sum exported_genesis.json
f7022efee6aae449cf3923c55766f9c0d2b183876766676866b7f1ff9eaa980d66c6d38e8f922a1779f398b3ef559d4a7cceb176b86910d1b1990073fd694a20  exported_genesis.json
@adrianbrink

This comment has been minimized.

Copy link

adrianbrink commented Dec 19, 2018

Procedure to verify the proposed genesis file

Every validator should follow this procedure before starting a validator with the proposed genesis file. This is paramount for the security of the network, especially when we have to do this on mainnet.

  1. Sync a fullnode with gaiad start --pruning=nothing.
  2. Install 0.29.0-de1-0-g45a48f4e or any version that implements the changes to the export functionality (ref cosmos/cosmos-sdk#3166).
  3. Export the genesis file with gaiad export --height 11441 --for-zero-height > exported_genesis.json.
  4. Change the chain_id key to game_of_stakes_1 and the max_bytes key to 150000 in exported_genesis.json.
  5. Download the proposed genesis file with wget https://raw.githubusercontent.com/cosmos/game-of-stakes/master/genesis.json.
  6. Sort the keys in those two genesis files in order to make them deterministic. The export is not deterministic by default. You can do this with jq . --sort-keys proposed_genesis.json > sorted_proposed_genesis.json and jq . --sort-keys exported_genesis.json > sorted_exported_genesis.json.
  7. Calculate the sha512 of sorted_proposed_genesis.json and sorted_exported_genesis.json. It should be a2dd6951f12aa3e868c3fcdf43115d458140e56e or at least mine is.

To reiterate: Every validator should do this before starting their validator with the proposed file. Without doing this you have no idea what chain you are running and have zero way of verifying that someone didn't print infinite amounts of tokens or censored someone in comparison to the original genesis file.

@fkbenjamin

This comment has been minimized.

Copy link
Contributor

fkbenjamin commented Dec 19, 2018

Can verify the proposed genesis file:
sha512sum sorted_exported_genesis.json ac186a0a460956c9087002253579c686398428631f54773b0fcc5cb7214ccc6c78245c9949fbb3c148981a95208c988ee884a5d83aea28b53603fafd62d67971 sorted_exported_genesis.json

sha512sum sorted_proposed_genesis.json ac186a0a460956c9087002253579c686398428631f54773b0fcc5cb7214ccc6c78245c9949fbb3c148981a95208c988ee884a5d83aea28b53603fafd62d67971 sorted_proposed_genesis.json

To make the version of @adrianbrink a little bit more clear, here is an updated procedure:

  1. Sync a fullnode with gaiad start --pruning=nothing while you still have v0.28 of gaiad installed
  2. Install 0.29.0-de1-0-g45a48f4e or any version that implements the changes to the export functionality (ref cosmos/cosmos-sdk#3166).
    git fetch --tags
    git checkout v0.29.0-dev1
    make get_vendor_deps && make install
    gaiad version
    gaiad version should now display 0.29.0-de1-0-g45a48f4e
  3. Export the genesis file with
    gaiad export --height 11441 --for-zero-height > exported_genesis.json.
  4. Change the chain_id key to game_of_stakes_1 and the max_bytes key to 150000 in exported_genesis.json.
    EDIT: Also edit genesis_time to 2018-12-20T15:00:00.000000Z
    For example with: nano exported_genesis.json
  5. Download the proposed genesis file using
    wget https://raw.githubusercontent.com/cosmos/game-of-stakes/3fa89044f13c314076b83ee99879dabeed751ead/genesis.json -O proposed_genesis.json
    EDITED FOR: genesis_time
  6. Sort the keys in those two genesis files in order to make them deterministic. The export is not deterministic by default. You can do this with
    jq . --sort-keys proposed_genesis.json > sorted_proposed_genesis.json
    and
    jq . --sort-keys exported_genesis.json > sorted_exported_genesis.json
    Make sure, you have jq installed for this. If you get a permission error, just put the two commands in a bash file and execute them from there.
  7. Calculate the sha512 of sorted_proposed_genesis.json and sorted_exported_genesis.json.
    sha512sum sorted_exported_genesis.json
    sha512sum sorted_proposed_genesis.json
@npinto

This comment has been minimized.

Copy link

npinto commented Dec 20, 2018

Thanks for the clarification. It worked on my side:

sha512sum sorted_proposed_genesis.json
ac186a0a460956c9087002253579c686398428631f54773b0fcc5cb7214ccc6c78245c9949fbb3c148981a95208c988ee884a5d83aea28b53603fafd62d67971  sorted_proposed_genesis.json

sha512sum sorted_exported_genesis.json
ac186a0a460956c9087002253579c686398428631f54773b0fcc5cb7214ccc6c78245c9949fbb3c148981a95208c988ee884a5d83aea28b53603fafd62d67971  sorted_exported_genesis.json

@leoluk leoluk force-pushed the certusone:upgrade_1 branch from 8a0d4f1 to 5df5d80 Dec 20, 2018

Set genesis time to 2018-12-20 15:00 UTC
This will allow people to catch up and get some sleep.

After a discussion in Riot, a conclusion was made that 15:00 UTC
is the time that inconveniences the least number of validators.

This matches our analysis of the Riot chat logs:
https://medium.com/certus-one/a-story-of-four-cosmos-testnets-c8c7a4367078
@leoluk

This comment has been minimized.

Copy link
Contributor

leoluk commented Dec 20, 2018

We propose a genesis time of 2018-12-20 15:00 UTC, according the the original proposal to leave 12h+ of time between announcement and genesis.

This will allow people to catch up and get some sleep.

After a discussion in Riot, a conclusion was made that 15:00 UTC
is the time that inconveniences the least number of validators.

This matches our analysis of the Riot chat logs (scroll to bottom):
https://medium.com/certus-one/a-story-of-four-cosmos-testnets-c8c7a4367078


For those verifying our proposed genesis.json for correctness: in addition to the modifications Adrian described, you will also have to set genesis_time to 2018-12-20T15:00:00.000000Z in your export
that you're comparing ours to. Modifying the genesis time means gaiad won't start before
the genesis time, ensuring a coordinated launch.

@dlguddus

This comment has been minimized.

Copy link

dlguddus commented Dec 20, 2018

thanks for the info here Leo. It would be very helpful for lots of people if you can elaborate little bit about how utc15 in genesis.json will work as a launch time so we can prepare it before that?

@leoluk

This comment has been minimized.

Copy link
Contributor

leoluk commented Dec 20, 2018

thanks for the info here Leo. It would be very helpful for lots of people if you can elaborate little bit about how utc15 in genesis.json will work as a launch time so we can prepare it before that?

gaiad will simply refuse to start sleep, mostly for peace of mind - this ensures that the chain won't start early, given that this is likely to be the final genesis.json.

@dlguddus

This comment has been minimized.

Copy link

dlguddus commented Dec 20, 2018

great!

@gin

This comment has been minimized.

Copy link
Contributor

gin commented Dec 20, 2018

👍
Verified genesis.json from commit 3fa8904
(with the change in genesis_time)

$ sha512sum s11441.json                        
1989f3197275f6a7584934983f22959ea79dca33aedd89cb4749821dca364ebe53a06e83ae9208f77a3933d533e31e3f4d5a75efad54e03400e161d1bbc71095  s11441.json

$ sha512sum sgenesis.json
1989f3197275f6a7584934983f22959ea79dca33aedd89cb4749821dca364ebe53a06e83ae9208f77a3933d533e31e3f4d5a75efad54e03400e161d1bbc71095  sgenesis.json
$ shasum s11441.json 
f48f8d279e1157547ddd07c4e0448ae7be6dff0b  s11441.json

$ shasum sgenesis.json 
f48f8d279e1157547ddd07c4e0448ae7be6dff0b  sgenesis.json
@wlsaud619

This comment has been minimized.

Copy link
Contributor

wlsaud619 commented Dec 20, 2018

~$ sha512sum sorted_exported_genesis.json
ac186a0a460956c9087002253579c686398428631f54773b0fcc5cb7214ccc6c78245c9949fbb3c148981a95208c988ee884a5d83aea28b53603fafd62d67

~$ sha512sum sorted_proposed_genesis.json
ac186a0a460956c9087002253579c686398428631f54773b0fcc5cb7214ccc6c78245c9949fbb3c148981a95208c988ee884a5d83aea28b53603fafd62d67

@zmanian zmanian merged commit 9dbb511 into cosmos:master Dec 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment