-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[R4R] Update testnet to use canonical genesis time #2692
Changes from 1 commit
486be46
3379790
b8334c1
2b297c4
74c7dac
144907c
7499782
9d48722
06c9d2f
b95a42f
de04649
816bff8
07e4e60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,23 +209,26 @@ func initTestnet(config *cfg.Config, cdc *codec.Codec) error { | |
} | ||
} | ||
|
||
if err := initGenFiles(cdc, chainID, accs, genFiles); err != nil { | ||
if err := initGenFiles(cdc, chainID, accs, genFiles, numValidators); err != nil { | ||
return err | ||
} | ||
|
||
if err := collectGenFiles(cdc, config, chainID, monikers, nodeIDs, valPubKeys); err != nil { | ||
err := collectGenFiles( | ||
cdc, config, chainID, monikers, nodeIDs, valPubKeys, numValidators, outputDir, | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Printf("Successfully initialized %v node directories\n", viper.GetInt(nValidators)) | ||
fmt.Printf("Successfully initialized %d node directories\n", numValidators) | ||
return nil | ||
} | ||
|
||
func initGenFiles( | ||
cdc *codec.Codec, chainID string, accs []app.GenesisAccount, genFiles []string, | ||
cdc *codec.Codec, chainID string, accs []app.GenesisAccount, | ||
genFiles []string, numValidators int, | ||
) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a weird way to split up the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ughhh I find that so much less elegant and harder to read imho. I'll be happy to change it if it's our standard though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's prettier: a. foo := []string{"foo",
"bar", "cat"} b. foo := []string{
"foo", "bar", "cat",
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. k - yeah so-far the style I've suggested is used everywhere, so I think you should change it - we could open up a stylistic issue to discuss further (but post-launch change obv.). I think functions are unique from struct definition, I don't find it adequate to draw the comparison (but ftr obv. [if you create an issue should link it to this comment] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I'm vetoed here haha. I'll change it. Will open up an issue later to discuss this more openly. |
||
|
||
numValidators := viper.GetInt(nValidators) | ||
appGenState := app.NewDefaultGenesisState() | ||
appGenState.Accounts = accs | ||
|
||
|
@@ -253,19 +256,17 @@ func initGenFiles( | |
func collectGenFiles( | ||
cdc *codec.Codec, config *cfg.Config, chainID string, | ||
monikers, nodeIDs []string, valPubKeys []crypto.PubKey, | ||
numValidators int, outputDir string, | ||
) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same, feel weird about this style, suggest:
|
||
|
||
outDir := viper.GetString(outputDir) | ||
numValidators := viper.GetInt(nValidators) | ||
|
||
var appState json.RawMessage | ||
genTime := tmtime.Now() | ||
|
||
for i := 0; i < numValidators; i++ { | ||
nodeDirName := fmt.Sprintf("%s%d", viper.GetString(nodeDirPrefix), i) | ||
nodeDaemonHomeName := viper.GetString(nodeDaemonHome) | ||
nodeDir := filepath.Join(outDir, nodeDirName, nodeDaemonHomeName) | ||
gentxsDir := filepath.Join(outDir, "gentxs") | ||
nodeDir := filepath.Join(outputDir, nodeDirName, nodeDaemonHomeName) | ||
gentxsDir := filepath.Join(outputDir, "gentxs") | ||
moniker := monikers[i] | ||
config.Moniker = nodeDirName | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned below, there are several things weird here... (partially due to the weirdness of the original logic). We shouldn't be init'ing 4 times and then "collecting" (misnomer) 4 times.