Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Community Upgrade 1.1 #247

Merged
merged 4 commits into from
Dec 20, 2018
Merged

Community Upgrade 1.1 #247

merged 4 commits into from
Dec 20, 2018

Conversation

hendrikhofstadt
Copy link
Contributor

@hendrikhofstadt hendrikhofstadt 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

@Hyung-bharvest
Copy link

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
Copy link
Contributor

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.

@hendrikhofstadt
Copy link
Contributor Author

@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 ?

@Hyung-bharvest
Copy link

love it!

@nodebreaker0-0
Copy link
Contributor

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
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
Copy link
Contributor

clawmvp commented Dec 19, 2018

"game_of_stakes_1 Sounds good.

@hendrikhofstadt
Copy link
Contributor Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

might be worth mentioning that the new blocksize is 150kb

@sunnya97
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

@hendrikhofstadt
Copy link
Contributor Author

hendrikhofstadt 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
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
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

@hendrikhofstadt
Copy link
Contributor Author

hendrikhofstadt commented Dec 19, 2018 via email

@adrianbrink
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
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 Merge GoS point release back to develop 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
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 Merge GoS point release back to develop 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
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

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
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.

@Hyung-bharvest
Copy link

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
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.

@Hyung-bharvest
Copy link

great!

@gin
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
Copy link
Contributor

~$ 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet