Add initial height, app version, evidence maxbytes to migration (#1134)

* Add initial height, app version, evidence maxbytes

* Update Evidence.MaxBytes to 50000

* Add test for Evidence.MaxBytes <= Block.MaxBytes
This commit is contained in:
Derrick Lee 2022-01-14 14:56:57 -08:00 committed by GitHub
parent 1a51d1fb00
commit 4426ca3c0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -37,5 +37,12 @@ func Migrate(genDoc *tmtypes.GenesisDoc, ctx client.Context) (*tmtypes.GenesisDo
genDoc.GenesisTime = GenesisTime
genDoc.ChainID = ChainID
genDoc.InitialHeight = 1
genDoc.ConsensusParams.Version.AppVersion = 1
genDoc.ConsensusParams.Evidence.MaxBytes = 50000
return genDoc, nil
}

View File

@ -30,11 +30,16 @@ func TestMigrateGenesisDoc(t *testing.T) {
expected := getTestDataJSON("genesis-v16.json")
genDoc, err := tmtypes.GenesisDocFromFile(filepath.Join("testdata", "genesis-v15.json"))
assert.NoError(t, err)
actualGenDoc, err := Migrate(genDoc, newClientContext())
assert.NoError(t, err)
actualJson, err := tmjson.Marshal(actualGenDoc)
assert.NoError(t, err)
assert.JSONEq(t, expected, string(actualJson))
assert.LessOrEqual(t, actualGenDoc.ConsensusParams.Evidence.MaxBytes, actualGenDoc.ConsensusParams.Block.MaxBytes)
}
func TestMigrateFull(t *testing.T) {

View File

@ -10,10 +10,13 @@
},
"evidence": {
"max_age_num_blocks": "100000",
"max_age_duration": "172800000000000"
"max_age_duration": "172800000000000",
"max_bytes": "50000"
},
"validator": { "pub_key_types": ["ed25519"] },
"version": {}
"version": {
"app_version": "1"
}
},
"app_hash": "",
"app_state": {