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

fix: possible netsplits and chokes #2635

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5078baa
Merge pull request #6 from cosmos/main
faddat Feb 9, 2021
da6738f
Added init.go from Osmosis, please advise as to changes
faddat Aug 30, 2021
025390d
update to go 1.17
faddat Aug 30, 2021
b83166f
Merge remote-tracking branch 'origin/main' into seeds
faddat Sep 16, 2021
c6a7188
Seeds are now correctly added to config.toml by default. Validators …
faddat Sep 16, 2021
3b5dfd7
Merge https://github.com/cosmos/gaia into seeds
faddat Sep 16, 2021
613215a
merge latest main branch
faddat Sep 16, 2021
160f9bb
Update init.go
faddat Sep 16, 2021
247151e
Update join-mainnet.md
faddat Sep 16, 2021
5711b9d
Update CHANGELOG.md
faddat Sep 16, 2021
3b9e515
Merge branch 'main' into seeds
faddat Sep 30, 2021
ac4fb43
Merge branch 'main' into seeds
faddat Oct 16, 2021
8be13aa
Change golangci-lint version to the latest version of golangci-lint (…
psh4nk Oct 23, 2021
755f137
Merge branch 'main' into pr/960
faddat Oct 29, 2021
246dfa5
fix a Marshaler -> Codec
faddat Oct 29, 2021
0f079f7
Merge branch 'fix-golangci-lint-version' of https://github.com/psh4nk…
faddat Oct 29, 2021
d485b63
Merge branch 'main' into seeds
faddat Nov 20, 2021
3b3ef72
go.mod updates
faddat Nov 20, 2021
61edb1a
Merge remote-tracking branch 'origin/main' into seeds
faddat Mar 12, 2023
332e58e
Merge branch 'main' into seeds
faddat Mar 12, 2023
cbad008
add some helpful bumps
faddat Mar 12, 2023
a94a4f9
increase default inbound peers dramatically and embed seed nodes
faddat Mar 12, 2023
7420627
fix lint
faddat Mar 12, 2023
2b4c792
remove depguard and cleanup root.go
faddat Jul 2, 2023
062130c
Merge branch 'seeds' into faddat/root-cleanup
faddat Jul 2, 2023
243dfd4
fix shadowing of a name
faddat Jul 2, 2023
0ca5b82
Merge branch 'main' into faddat/root-cleanup
faddat Jul 3, 2023
bc3a05b
Update bech32_convert.go
faddat Jul 9, 2023
bf8ad81
use latest hermes
faddat Jul 9, 2023
d3c095b
Merge branch 'faddat/root-cleanup' of https://github.com/faddat/gaia …
faddat Jul 9, 2023
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
24 changes: 16 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# CHANGELOG

## [Unreleased]

* (gaia: ux) Add seed nodes to init.go

## [v10.0.1] 2023-05-25

* (deps) [#2543](https://github.com/cosmos/gaia/pull/2543) Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v4.4.1](https://github.com/cosmos/ibc-go/releases/tag/v4.4.1).

## [v10.0.0] 2023-05-19

* (deps) [#2498](https://github.com/cosmos/gaia/pull/2498) Bump multiple dependencies.
* Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.16-ics](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.16-ics). See the [v0.45.16 release notes](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.16) for details.
* (deps) [#2498](https://github.com/cosmos/gaia/pull/2498) Bump multiple dependencies.
* Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.16-ics](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.16-ics). See the [v0.45.16 release notes](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.16) for details.
* Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v4.4.0](https://github.com/cosmos/ibc-go/releases/tag/v4.4.0).
* Bump [CometBFT](https://github.com/cometbft/cometbft) to [v0.34.28](https://github.com/cometbft/cometbft/releases/tag/v0.34.28).
* (gaia) Bump Golang prerequisite from 1.18 to 1.20. See (https://go.dev/blog/go1.20) for details.
* (gaia) Bump Golang prerequisite from 1.18 to 1.20. See (<https://go.dev/blog/go1.20>) for details.

## [v9.1.1] - 2023-05-25

Expand All @@ -26,7 +30,7 @@ The first fix is to enable the use of multisigs and Ledger devices when assignin

### Multisig fix

On April 25th (a week and a half ago), we began receiving reports that validators using multisigs and Ledger devices were getting errors reading Error: unable to resolve type URL /interchain_security.ccv.provider.v1.MsgAssignConsumerKey: tx parse error when attempting to assign consensus keys for consumer chains.
On April 25th (a week and a half ago), we began receiving reports that validators using multisigs and Ledger devices were getting errors reading Error: unable to resolve type URL /interchain_security.ccv.provider.v1.MsgAssignConsumerKey: tx parse error when attempting to assign consensus keys for consumer chains.

This was surprising because we had never seen this error before, even though we have done many testnets. The reason for this is probably because people don’t bother to use high security key management techniques in testnets.

Expand All @@ -43,10 +47,12 @@ To fix this problem, we have re-blocked the FeePoolAddress and created a new add
Note: The fee of 10 Atoms was originally intended to be a parameter that could be changed by governance (10 Atoms might cost too much in the future). However, we ran into some problems creating a new parameter as part of an emergency upgrade. After consulting with the Cosmos-SDK team, we learned that creating new parameters is only supported as part of a scheduled upgrade. So in the current code, the number of Atoms is hardcoded. It will turn into a parameter in the next scheduled upgrade.

## [v9.0.3] - 2023-04-19
* (deps) [#2399](https://github.com/cosmos/gaia/pull/2399) Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.15-ics](https://github.com/cosmos/cosmos

* (deps) [#2399](https://github.com/cosmos/gaia/pull/2399) Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.15-ics](<https://github.com/cosmos/cosmos>
sdk/releases/tag/v0.45.15-ics) and migrate to [CometBFT](https://github.com/cometbft/cometbft).

## [v9.0.2] - 2023-04-03

* (feat) Bump [Interchain-Security](https://github.com/cosmos/interchain-security) [v1.1.0](https://github.com/cosmos/interchain-security/releases/tag/v1.1.0) provider module. See the [release notes](https://github.com/cosmos/interchain-security/releases/tag/v1.1.0) for details.
* (feat) Add two more msg types `/ibc.core.channel.v1.MsgTimeout` and `/ibc.core.channel.v1.MsgTimeoutOnClose` to default `bypass-min-fee-msg-types`.
* (feat) Change the bypassing gas usage criteria. Instead of requiring 200,000 gas per `bypass-min-fee-msg`, we will now allow a maximum total usage of 1,000,000 gas for all bypassed messages in a transaction. Note that all messages in the transaction must be the `bypass-min-fee-msg-types` for the bypass min fee to take effect, otherwise, fee payment will still apply.
Expand Down Expand Up @@ -94,14 +100,17 @@ sdk/releases/tag/v0.45.15-ics) and migrate to [CometBFT](https://github.com/come
* (gaia) bump [tendermint](https://github.com/tendermint/tendermint) to [0.34.25](https://github.com/informalsystems/tendermint/releases/tag/v0.34.25) to patch p2p issue. See [CHANGELOG.md](https://github.com/informalsystems/tendermint/blob/v0.34.25/CHANGELOG.md#v03425) for details.

## [v7.1.0] - 2022-10-14

* (gaia) bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.9) to fix the security vulnerability! See [CHANGELOG.md](https://github.com/cosmos/cosmos-sdk/blob/v0.45.9/CHANGELOG.md) for details.

## [v7.0.3] - 2022-08-03

* (gaia) update go to 1.18.
* (gaia) bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.6). See [CHANGELOG.md](https://github.com/cosmos/cosmos-sdk/blob/v0.45.6/CHANGELOG.md) for details.
* (gaia) bump [Liquidity](https://github.com/Gravity-Devs/liquidity) module to [v1.5.1](https://github.com/Gravity-Devs/liquidity/releases/tag/v1.5.1).
* (gaia) bump [cosmos ledger](https://github.com/cosmos/ledger-go) to [v0.9.3](https://github.com/cosmos/ledger-go/releases/tag/v0.9.3) to fix issue [#1573](https://github.com/cosmos/gaia/issues/1573) - Ledger Nano S Plus not detected by gaiad.
*
*

## [v7.0.2] -2022-05-09

* (gaia) bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.45.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.4). See [CHANGELOG.md](https://github.com/cosmos/cosmos-sdk/blob/v0.45.4/CHANGELOG.md#v0454---2022-04-25) for details.
Expand Down Expand Up @@ -133,7 +142,7 @@ sdk/releases/tag/v0.45.15-ics) and migrate to [CometBFT](https://github.com/come
* (gaia) [#1135](https://github.com/cosmos/gaia/pull/1135) Fix rocksdb build tag usage.
* (gaia) [#1160](https://github.com/cosmos/gaia/pull/1160) Improvement: update state sync configs.
* (gaia) [#1208](https://github.com/cosmos/gaia/pull/1208) Update statesync.bash.
* * (gaia) Bump [Cosmos-SDK](https://github.com/cosmos/cosmos-sdk) to [v0.44.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.6)
* * (gaia) Bump [Cosmos-SDK](https://github.com/cosmos/cosmos-sdk) to [v0.44.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.44.6)
* (gaia) Bump [Versions](https://github.com/cosmos/gaia/pull/1100) of various smaller dependencies, remove the Cosmos SDK replace statement, update `initiClientCtx` params, ensure `stdout` and `stderr` are handled correctly in the CLI.

## [v6.0.3] - 2022-02-18
Expand Down Expand Up @@ -556,4 +565,3 @@ See the [Tendermint v0.34.7 SDK changelog](https://github.com/tendermint/tenderm
[v2.0.1]: https://github.com/cosmos/gaia/releases/tag/v2.0.1
[v2.0.0]: https://github.com/cosmos/gaia/releases/tag/v2.0.0
[v1.0.0]: https://github.com/cosmos/gaia/releases/tag/v1.0.0

174 changes: 174 additions & 0 deletions cmd/gaiad/cmd/init.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
package cmd

import (
"bufio"
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"

"github.com/cosmos/go-bip39"
"github.com/pkg/errors"
"github.com/spf13/cobra"

tmcfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/cli"
tmos "github.com/tendermint/tendermint/libs/os"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/input"
"github.com/cosmos/cosmos-sdk/server"
appcfg "github.com/cosmos/cosmos-sdk/server/config"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/genutil"
)

const (
// FlagOverwrite defines a flag to overwrite an existing genesis JSON file.
FlagOverwrite = "overwrite"

// FlagSeed defines a flag to initialize the private validator key from a specific seed.
FlagRecover = "recover"
)

type printInfo struct {
Moniker string `json:"moniker" yaml:"moniker"`
ChainID string `json:"chain_id" yaml:"chain_id"`
NodeID string `json:"node_id" yaml:"node_id"`
GenTxsDir string `json:"gentxs_dir" yaml:"gentxs_dir"`
AppMessage json.RawMessage `json:"app_message" yaml:"app_message"`
}

func newPrintInfo(moniker, chainID, nodeID, genTxsDir string, appMessage json.RawMessage) printInfo {
return printInfo{
Moniker: moniker,
ChainID: chainID,
NodeID: nodeID,
GenTxsDir: genTxsDir,
AppMessage: appMessage,
}
}

func displayInfo(info printInfo) error {
out, err := json.MarshalIndent(info, "", " ")
if err != nil {
return err
}

_, err = fmt.Fprintf(os.Stderr, "%s\n", string(sdk.MustSortJSON(out)))

return err
}

// InitCmd returns a command that initializes all files needed for Tendermint
// and the respective application.
func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
cmd := &cobra.Command{
Use: "init [moniker]",
Short: "Initialize private validator, p2p, genesis, and application configuration files",
Long: `Initialize validators's and node's configuration files.`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
cdc := clientCtx.Codec

serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config

// An easy way to run a lightweight seed node is to use tenderseed: github.com/binaryholdings/tenderseed

seeds := []string{
"ba3bacc714817218562f743178228f23678b2873@public-seed-node.cosmoshub.certus.one:26656",
"[email protected]:14956",
"[email protected]:14956",
"57a5297537b9b6ef8b105c08a8ad3f6ac452c423@seeds.goldenratiostaking.net:1618",
}

config.P2P.Seeds = strings.Join(seeds, ",")
config.P2P.MaxNumInboundPeers = 300
config.P2P.MaxNumOutboundPeers = 40

config.SetRoot(clientCtx.HomeDir)

appConfig := appcfg.DefaultConfig()

chainID, _ := cmd.Flags().GetString(flags.FlagChainID)
if chainID == "" {
chainID = fmt.Sprintf("test-chain-%v", tmrand.Str(6))
}

fmt.Println("help")

// Get bip39 mnemonic
var mnemonic string
recovery, _ := cmd.Flags().GetBool(FlagRecover)
if recovery {
inBuf := bufio.NewReader(cmd.InOrStdin())
mnemonic, err := input.GetString("Enter your bip39 mnemonic", inBuf)
if err != nil {
return err
}

if !bip39.IsMnemonicValid(mnemonic) {
return errors.New("invalid mnemonic")
}
}

nodeID, _, err := genutil.InitializeNodeValidatorFilesFromMnemonic(config, mnemonic)
if err != nil {
return err
}

config.Moniker = args[0]

genFile := config.GenesisFile()
overwrite, _ := cmd.Flags().GetBool(FlagOverwrite)

if !overwrite && tmos.FileExists(genFile) {
return fmt.Errorf("genesis.json file already exists: %v", genFile)
}
appState, err := json.MarshalIndent(mbm.DefaultGenesis(cdc), "", " ")
if err != nil {
return errors.Wrap(err, "Failed to marshall default genesis state")
}

genDoc := &types.GenesisDoc{}
if _, err := os.Stat(genFile); err != nil {
if !os.IsNotExist(err) {
return err
}
} else {
genDoc, err = types.GenesisDocFromFile(genFile)
if err != nil {
return errors.Wrap(err, "Failed to read genesis doc from file")
}
}

genDoc.ChainID = chainID
genDoc.Validators = nil
genDoc.AppState = appState
if err = genutil.ExportGenesisFile(genDoc, genFile); err != nil {
return errors.Wrap(err, "Failed to export genesis file")
}

toPrint := newPrintInfo(config.Moniker, chainID, nodeID, "", appState)

tmcfg.WriteConfigFile(filepath.Join(config.RootDir, "config", "config.toml"), config)
appcfg.WriteConfigFile(filepath.Join(config.RootDir, "config", "app.toml"), appConfig)

return displayInfo(toPrint)
},
}

cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory")
cmd.Flags().BoolP(FlagOverwrite, "o", false, "overwrite the genesis.json file")
cmd.Flags().Bool(FlagRecover, false, "provide seed phrase to recover existing key instead of creating")
cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")

return cmd
}
Loading
Loading