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
Forked from #3130
It appears that
gaiad collect-gentxsunexpectedly modifiesgenesis.jsonparameters that do not belong to the Gaia's app state, represented in the genesis file'sapp_stateJSON field.Description
As A Gaia User
I Want to retain all values in
genesis.jsonthat do not belong to theapp_statefield unmodified.Acceptance Criteria
Test case follows:
For Admin Use