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

Docs update #4176

Merged
merged 6 commits into from
Apr 25, 2019
Merged

Docs update #4176

merged 6 commits into from
Apr 25, 2019

Conversation

gamarin2
Copy link
Contributor

Docs update:

  • Fix gaia to cosmos-hub
  • Added doc about upgrading
  • Other little nits

Will open a PR back to develop once merged

  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added a relevant changelog entry: sdkch add [section] [stanza] [message]

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@gamarin2 gamarin2 changed the title Gamarin/docs update Docs update Apr 23, 2019
@codecov
Copy link

codecov bot commented Apr 23, 2019

Codecov Report

Merging #4176 into master will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4176      +/-   ##
==========================================
+ Coverage      60%   60.01%   +0.01%     
==========================================
  Files         212      212              
  Lines       15127    15127              
==========================================
+ Hits         9077     9079       +2     
+ Misses       5427     5425       -2     
  Partials      623      623

1 similar comment
@codecov
Copy link

codecov bot commented Apr 23, 2019

Codecov Report

Merging #4176 into master will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4176      +/-   ##
==========================================
+ Coverage      60%   60.01%   +0.01%     
==========================================
  Files         212      212              
  Lines       15127    15127              
==========================================
+ Hits         9077     9079       +2     
+ Misses       5427     5425       -2     
  Partials      623      623

@alexanderbez
Copy link
Contributor

Thanks @gamarin2! In order to avoid the conflict mess we had last time with v0.34.0 and until we have a single canonical git branch, this PR should be targeted towards master and develop.

@alexanderbez alexanderbez added T:Docs Changes and features related to documentation. ready-for-review labels Apr 23, 2019
@gamarin2
Copy link
Contributor Author

Yep @alexanderbez, indicated it cf "Will open a PR back to develop once merged". I will cherry pick, but want to wait for reviews first

Copy link
Member

@jackzampolin jackzampolin left a comment

Choose a reason for hiding this comment

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

So this PR has a couple of net new documents as well as typo fixes. It would be better if we could split those up in to separate PRs in the future. That being said, the general app explainer that is here is quite good. I think the upgrade guide needs a refactor.

# Upgrade Your Node

::: warning
The detailed procedure to upgrade a mainnet node from `cosmoshub-1` to `cosmoshub-2` can be found [here](https://gist.github.com/alexanderbez/5e87886221eb304b9e85ad4b167c99c8).
Copy link
Member

Choose a reason for hiding this comment

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

This is kinda incorrect. That is the procedure to generate the genesis.json file for cosmoshub-2 from the cosmoshub-1 state-dump at block 500,000. I don't think we need to link to those here.

@@ -0,0 +1,99 @@
# Upgrade Your Node
Copy link
Member

Choose a reason for hiding this comment

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

I think this guide needs a rethink and shouldn't block the rest of this PR. This should be a doc that describes the process for upgrading a network generically and explains each of the steps. This guide kinda jumps in at the mainnet upgrade and then has that content in less detail at the bottom of the doc.

The first step is to remove your current genesis:

```bash
rm $HOME/.gaiad/config/addrbook.json $HOME/.gaiad/config/genesis.json
Copy link
Member

Choose a reason for hiding this comment

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

I don't think users will want to remove their addrbook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh this should not be there, good catch

**Note: These commands need to be run on an online computer. It is more secure to perform them commands using a ledger device. For the offline procedure, click [here](#signing-transactions-from-an-offline-computer).**
:::

```bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should just point to the gaiacli.md docs? The develop branch has changed this to now:

$ gaiacli tx send [from_key_or_address] [to_address] [amount] [flags]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should keep it as what it is in mainnet, BUT I will update it when doing the cherry pick to develop (setting a reminder rn)

Copy link
Member

Choose a reason for hiding this comment

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

Did we kill the --from flag?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah but not on v0.34.x yet, which is what the master docs reflect.

## Reset Data

:::warning
If the version <new_version> you are upgrading to is not breaking from the previous one, you should not reset the data. If it is not breaking, you can skip to [Restart](#restart)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
If the version <new_version> you are upgrading to is not breaking from the previous one, you should not reset the data. If it is not breaking, you can skip to [Restart](#restart)
If the new version you are upgrading to doesn't have any braking changes, you can skip to the [Restart](#restart) section.

```
+
|
| Transaction relayed from Tendermint
| via DeliverTx
| Transaction relayed from the full-node's Tendermint engine
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unrelated, but it'd be cool to have an image here instead


To restart your node, just type:

```bash
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to add a link to the systemd example thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what's that

@ebuchman ebuchman merged commit bfb2b49 into master Apr 25, 2019
@ebuchman ebuchman deleted the gamarin/docs-update branch April 25, 2019 21:11
Copy link
Contributor

@rigelrozanski rigelrozanski left a comment

Choose a reason for hiding this comment

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

Here are a few post-merge comments, may want to consider another PR for any corrections


- `CheckTx`: When a transaction is received by Tendermint Core, it is passed to the application to check if a few basic requirements are met. `CheckTx` is used to protect the mempool of full-nodes against spam. A special handler called the "Ante Handler" is used to execute a series of validation steps such as checking for sufficient fees and validating the signatures. If the check is valid, the transaction is added to the [mempool](https://tendermint.com/docs/spec/reactors/mempool/functionality.html#mempool-functionality) and relayed to peer nodes. Note that transactions are not processed (i.e. no modification of the state occurs) with `CheckTx` since they have not been included in a block yet.
- `DeliverTx`: When a [valid block](https://tendermint.com/docs/spec/blockchain/blockchain.html#validation) is received by Tendermint Core, each transaction in the given block is passed to the application via `DeliverTx` to be processed. It is during this stage that the state transitions occur. The "Ante Handler" executes again along with the actual handlers for each message in the transaction.
- `BeginBlock`/`EndBlock`: These messages are executed at the beginning and the end of each block, whether the block contains transaction or not. It is useful to trigger automatic execution of logic. Proceed with caution though, as computationally expensive loops could slow down your blockchain, or even freeze it if the loop is infinite.
Copy link
Contributor

Choose a reason for hiding this comment

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

we should explain this concept in-terms of the state machine running as a single thread. that way I'm not sure we'd need to mention "or even freeze it .." which is kinda a funny sentence - that is implied.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will add a note about single threading


Here are the most important messages of the ABCI:

- `CheckTx`: When a transaction is received by Tendermint Core, it is passed to the application to check if a few basic requirements are met. `CheckTx` is used to protect the mempool of full-nodes against spam. A special handler called the "Ante Handler" is used to execute a series of validation steps such as checking for sufficient fees and validating the signatures. If the check is valid, the transaction is added to the [mempool](https://tendermint.com/docs/spec/reactors/mempool/functionality.html#mempool-functionality) and relayed to peer nodes. Note that transactions are not processed (i.e. no modification of the state occurs) with `CheckTx` since they have not been included in a block yet.
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to discuss what happens when CheckTx fails (before or after the signature verification part)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just an intro, not the full CheckTx explanation (which will be in another doc). We just want to give a general sense of what CheckTx does at this point


The main part of a Cosmos SDK application is a blockchain daemon that is run by each node in the network locally. If less than one third of the *validator set* is byzantine (i.e. malicious), then each node should obtain the same result when querying the state at the same time.

## ABCI
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to expand this acronym here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, will update

| | | |
| S +---------------->+ S' |
| | apply(T) | |
+--------+ +--------+
Copy link
Contributor

Choose a reason for hiding this comment

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

This (and the next) diagram are maybe a bit superfluous here. I think an clearly written description of determinism as it relates the state machine (without assigning letters ex. T or using diagrams) would be adequate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can touch on determinism, but I push back on the idea that the diagrams are superfluous. Remember that all this is intro material. We can assume no prior knowledge from people reading this, and we need to make it as gentle as possible.

A lot of people discovering the SDK come from the Ethereum community and may not even know what a state machine is. Or they may know it, but they may not be accustomed to thinking of a blockchain as a replicated, deterministic state-machine. What is obvious to us is NOT to most people getting started with the SDK.

We will have more advanced and rigorous docs later. The intro docs are high-level and must be as easy to understand as possible.

gaiad unsafe-reset-all
```

Your node is now in a pristine state while keeping the original `priv_validator.json` and `config.toml`. If you had any sentry nodes or full nodes setup before, your node will still try to connect to them, but may fail if they haven't also been upgraded.
Copy link
Contributor

Choose a reason for hiding this comment

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

is pristine the best word here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what do you suggest?

mv new_genesis.json genesis.json
```

At this point, you might want to run a script to update the exported genesis into a genesis that is compatible with your new version. For example, the attributes of a the `Account` type changed, a script should query encoded account from the account store, unmarshall them, update their type, re-marhsall and re-store them. You can find an example of such script [here](https://github.com/cosmos/cosmos-sdk/blob/develop/contrib/export/v0.33.x-to-v0.34.0.py).
Copy link
Contributor

Choose a reason for hiding this comment

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

re-marhsall -> re-marshal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T:Docs Changes and features related to documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants