mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 00:35:18 +00:00
4a8b5696cb
* initial sketch * add module migrations * add migrations for all accout types * test account migration * add tendermint migration and migrate cmd * remove need for errors pkg dependency * add bech32 decoding fork * add suggested params and cmd to write them * add basic upgrade instructions * fix tests * address some migration todos * tidy contrib folder * finalize params values * align cdp init genesis with other modules * add tendermint and distribution test add custom distribution migration to patch bug * add staking migration test * add slashing, evidence tests, refactor auth tests * add full migration test * remove go-amino dependency from go.mod also tidy up unused indirect dependencies * address remaining TODOs * remove commented out code from legacy types * add spot/liquidation markets ids to kava-3 params * Apply suggestions from code review Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * address code review suggestions * add validate genesis to migrate test * refactor add params func * remove commented out code from old types * fix add params * add deputy address * add tests using exported kava-2 state * incorporate new cdp params from master * update params from review Co-authored-by: Kevin Davis <karzak@users.noreply.github.com> * add deputy account * add committee permissions for new params Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
32 lines
969 B
Go
32 lines
969 B
Go
package v033
|
|
|
|
import (
|
|
"time"
|
|
|
|
v032tendermint "github.com/kava-labs/kava/migrate/v0_8/tendermint/v0_32"
|
|
tmtypes "github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
func Migrate(v032GenDoc v032tendermint.GenesisDoc) tmtypes.GenesisDoc {
|
|
|
|
// migrate evidence params
|
|
|
|
newConsensusParams := tmtypes.ConsensusParams{
|
|
Block: tmtypes.BlockParams(v032GenDoc.ConsensusParams.Block),
|
|
Evidence: tmtypes.EvidenceParams{
|
|
MaxAgeNumBlocks: v032GenDoc.ConsensusParams.Evidence.MaxAge,
|
|
MaxAgeDuration: time.Duration(int64(time.Second) * 6 * v032GenDoc.ConsensusParams.Evidence.MaxAge), // assume 6 second block times
|
|
},
|
|
Validator: tmtypes.ValidatorParams(v032GenDoc.ConsensusParams.Validator),
|
|
}
|
|
|
|
return tmtypes.GenesisDoc{
|
|
GenesisTime: v032GenDoc.GenesisTime,
|
|
ChainID: v032GenDoc.ChainID,
|
|
ConsensusParams: &newConsensusParams,
|
|
Validators: v032GenDoc.Validators,
|
|
AppHash: v032GenDoc.AppHash,
|
|
AppState: v032GenDoc.AppState,
|
|
}
|
|
}
|