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

gaiad collect-gentxs resets all genesis parameters that are foreign to app_state #4066

Closed
4 tasks
alessio opened this issue Apr 6, 2019 · 1 comment
Closed
4 tasks
Labels
Milestone

Comments

@alessio
Copy link
Contributor

alessio commented Apr 6, 2019

Forked from #3130

It appears that gaiad collect-gentxs unexpectedly modifies genesis.json parameters that do not belong to the Gaia's app state, represented in the genesis file's app_state JSON field.

Description

As A Gaia User
I Want to retain all values in genesis.json that do not belong to the app_state field unmodified.

Acceptance Criteria

Test case follows:

func TestGaiadCollectGentxs(t *testing.T) {
	t.Parallel()
	var customMaxBytes, customMaxGas int64 = 99999999, 1234567
	f := NewFixtures(t)

	// Initialise temporary directories
	gentxDir, err := ioutil.TempDir("", "")
	gentxDoc := filepath.Join(gentxDir, "gentx.json")
	require.NoError(t, err)

	// Reset testing path
	f.UnsafeResetAll()

	// Initialize keys
	f.KeysAdd(keyFoo)

	// Configure json output
	f.CLIConfig("output", "json")

	// Run init
	f.GDInit(keyFoo)

	// Customise genesis.json

	genFile := f.GenesisFile()
	genDoc, err := tmtypes.GenesisDocFromFile(genFile)
	require.NoError(t, err)
	genDoc.ConsensusParams.Block.MaxBytes = customMaxBytes
	genDoc.ConsensusParams.Block.MaxGas = customMaxGas
	genDoc.SaveAs(genFile)

	// Add account to genesis.json
	f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins)

	// Write gentx file
	f.GenTx(keyFoo, fmt.Sprintf("--output-document=%s", gentxDoc))

	// Collect gentxs from a custom directory
	f.CollectGenTxs(fmt.Sprintf("--gentx-dir=%s", gentxDir))

	genDoc, err = tmtypes.GenesisDocFromFile(genFile)
	require.NoError(t, err)
	require.Equal(t, genDoc.ConsensusParams.Block.MaxBytes, customMaxBytes)
	require.Equal(t, genDoc.ConsensusParams.Block.MaxGas, customMaxGas)

	f.Cleanup(gentxDir)
}

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alessio alessio added the T:Bug label Apr 6, 2019
@alessio alessio added this to the v0.34.0 milestone Apr 6, 2019
@alessio
Copy link
Contributor Author

alessio commented Apr 6, 2019

CC @jaekwon @zmanian

@alessio alessio changed the title gaiad collect-gentxs reset all genesis parameters that are foreign to app_state gaiad collect-gentxs resets all genesis parameters that are foreign to app_state Apr 7, 2019
alessio added a commit that referenced this issue Apr 8, 2019
ExportGenesisFile() overwrites all non-gaia related
sections of the genesis.json file as it always
creates a new one from scratch.

Remove cmd/gaia/init.LoadGenesisDoc() in favor of
tendermint's types.GenesisDocFromFile().

Closes: #4066
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant