Cosmos-sdk: block.TimeIotaMs is 0 on exported genesis

Created on 16 Jun 2020  Â·  6Comments  Â·  Source: cosmos/cosmos-sdk

Summary of Bug

After exporting and reinitialising the chain the consensus_params.block.time_iota_ms value is 0. This fails when restarting the chain with the new genesis.json.

Version


v0.34.4-0.20200511222341-80be50319ca5

Steps to Reproduce

  1. gaiad export --for-zero-height > newgenesis.json
  2. gaiad unsafe-reset-all
  3. cp newgenesis.json ~/.gaiad/config/genesis.json
  4. gaiad start

Fails with:

block.TimeIotaMs must be greater than 0. Got 0.

For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
bug stale

All 6 comments

Yes, this is because we're not saving/exporting Block.TimeIotaMs -- I intentionally didn't include this because this value really isn't meant to change. I guess we have no choice but to include it.

@jgimeno do you think you have the bandwidth to take this on? It should be pretty straight forward.

Ok, I think we have two options here.

  1. When exporting search for this value in the genesis file (maybe a little bit ugly just for one value?) or 2. provide this value in the abci.ConsensusParams from tendermint that is included in abci.RequestInitChain (but I saw a comment that this specific field is not shared with the application).

@aaronc , @alexanderbez , @alessio opinions?

@jgimeno it's a one-line fix:

diff --git a/server/export.go b/server/export.go
index 672432ad0..ff3f9be5f 100644
--- a/server/export.go
+++ b/server/export.go
@@ -75,8 +75,9 @@ func ExportCmd(ctx *Context, cdc codec.JSONMarshaler, appExporter AppExporter) *
                        doc.Validators = validators
                        doc.ConsensusParams = &tmtypes.ConsensusParams{
                                Block: tmtypes.BlockParams{
-                                       MaxBytes: cp.Block.MaxBytes,
-                                       MaxGas:   cp.Block.MaxGas,
+                                       MaxBytes:   cp.Block.MaxBytes,
+                                       MaxGas:     cp.Block.MaxGas,
+                                       TimeIotaMs: doc.ConsensusParams.Block.TimeIotaMs,
                                },
                                Evidence: tmtypes.EvidenceParams{
                                        MaxAgeNumBlocks: cp.Evidence.MaxAgeNumBlocks,

Oh yes, the doc was there :D

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Marked as done and merged. I'm closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rigelrozanski picture rigelrozanski  Â·  3Comments

johnmcdowall picture johnmcdowall  Â·  3Comments

ValarDragon picture ValarDragon  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

kevlubkcm picture kevlubkcm  Â·  3Comments