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

feat(network): check no gentx are present in the initial genesis #2646

Merged
merged 7 commits into from
Jul 26, 2022

Conversation

lumtis
Copy link
Contributor

@lumtis lumtis commented Jul 22, 2022

  • Add a method in ChainGenesis object to count gentxs in a genesis
  • Add the check for no gentx in initGenesis. initGenesis generate the initial genesis of the chain so it makes sense to add this check here as a consideration that the initial genesis is only valid without gentx so that the condition is checked in any workflow using the initial genesis like publish but other command in the case a coordinator published a chain without the CLI

TESTING

Run a local spn:

ignite chain serve -c config_2.yml -r

Chain with default genesis can be published

ignite n chain publish https://github.com/tendermint/spn --spn-node-address http://0.0.0.0:26661/ --spn-faucet-address http://0.0.0.0:4502/ --chain-id spn-1

✔ Source code fetched
✔ Blockchain set up
✔ Chain's binary built
✔ Blockchain initialized
✔ Genesis initialized
✔ Network published
⋆ Launch ID: 1
⋆ Campaign ID: 1

Chain with a custom genesis with gentxs can't be published

ignite n chain publish https://github.com/tendermint/spn --spn-node-address http://0.0.0.0:26661/ --spn-faucet-address http://0.0.0.0:4502/ --chain-id spn-1 --genesis "https://gist.githubusercontent.com/lubtd/5d73e336948044b75b845696ee5918ee/raw/8fd2fd805d4dbfd60b7fbb9998564029f433e2cc/genesis_with_gentxs.json"

✔ Source code fetched
✔ Blockchain set up
✔ Chain's binary built
✔ Blockchain initialized
the initial genesis for the chain should not contain gentx

Chain with a custom genesis with no gentx can be published

ignite n chain publish https://github.com/tendermint/spn --spn-node-address http://0.0.0.0:26661/ --spn-faucet-address http://0.0.0.0:4502/ --chain-id spn-1 --genesis "https://gist.githubusercontent.com/lubtd/7d52c983b3f8b7773198a3f92c8a14d8/raw/91fafc323c625e11d40e29d109a8e67574258352/genesis_without_gentx.json"

✔ Source code fetched
✔ Blockchain set up
✔ Chain's binary built
✔ Blockchain initialized
✔ Genesis initialized
✔ Network published
⋆ Launch ID: 2
⋆ Campaign ID: 2

Copy link
Contributor

@tbruyelle tbruyelle left a comment

Choose a reason for hiding this comment

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

LGTM

Some questions though :

  1. gentxs represent pre-registered validators, and in the context of spn, you don't want to have them at this state, I suppose this is because spn has an other way to register them ?

  2. How gentxs are generated ? I found one way: the client of the x/genutil module, but the output format has different naming, so I'm confuse... (for instance the JSON field is named gentxs and not gen_txs, see https://github.com/cosmos/cosmos-sdk/blob/main/x/genutil/types/genesis.pb.go#L30)

@lumtis
Copy link
Contributor Author

lumtis commented Jul 23, 2022

gentxs represent pre-registered validators, and in the context of spn, you don't want to have them at this state, I suppose this is because spn has an other way to register them ?

Gentxs should not be defined if the monitoring module for incentivized testnet is used since spn relies on validator information stored on-chain through gentxs to establish a verified IBC connection.
Most chain will not be spn incentivized testnet but for now we set the condition for all chains for simplification as discussed in the attached issue. Possibly we want to enforce this condition for chains in the long run.

How gentxs are generated ? I found one way: the client of the x/genutil module, but the output format has different naming, so I'm confuse... (for instance the JSON field is named gentxs and not gen_txs, see https://github.com/cosmos/cosmos-sdk/blob/main/x/genutil/types/genesis.pb.go#L30)

Gentxs are generated from the gentx command of the chain app cli.

spnd gentx [key_name] [amount]

This command will generate a signed gentx for the validator in the chain home

@lumtis lumtis requested a review from fadeev as a code owner July 25, 2022 12:02
@lumtis lumtis self-assigned this Jul 25, 2022
@ilgooz ilgooz added this to the Priority milestone Jul 25, 2022
@lumtis lumtis merged commit d3eb838 into develop Jul 26, 2022
@lumtis lumtis deleted the network/check-gentx branch July 26, 2022 08:05
Jchicode pushed a commit to Jchicode/cli that referenced this pull request Aug 9, 2023
…gnite#2646)

* gentxs counter

* gentx check

* lint

* fix errors

* lint 2

* fix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

network init: Verify no gentx are present in the initial genesis
3 participants