`zetacore` : reorder init geneisis to match the exact order used by cosmos sdk
The order used by zeta chain is
func OrderInitGenesis() []string {
return []string{
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
slashingtypes.ModuleName,
evmtypes.ModuleName,
feemarkettypes.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
group.ModuleName,
observertypes.ModuleName,
crosschaintypes.ModuleName,
fungibletypes.ModuleName,
emissionstypes.ModuleName,
authoritytypes.ModuleName,
lightclienttypes.ModuleName,
consensusparamtypes.ModuleName,
crisistypes.ModuleName,
}
}
Where as cosmos uses (modified to remove unused modules and add in our custom modules )
func OrderInitGenesis() []string {
return []string{
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
slashingtypes.ModuleName,
evmtypes.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
feemarkettypes.ModuleName,
group.ModuleName,
observertypes.ModuleName,
crosschaintypes.ModuleName,
fungibletypes.ModuleName,
emissionstypes.ModuleName,
authoritytypes.ModuleName,
lightclienttypes.ModuleName,
consensusparamtypes.ModuleName,
crisistypes.ModuleName,
}
}
The only difference being that the feemarket module is initialized before genutil by us
We need to do this as , getTx's (MsgCreateValidator) need to pay for the gas fee . We expect the MinGasPrice to be set before we try delivering the msg
Relevent code link https://github.com/zeta-chain/zeta-node/blob/80d6bc1d2b3dde73406b5a05958e6f3c7c65ab18/app/ante/fees.go#L97-L103
This check panics if minGasPrice is not set .
This is a low-priority issue, as InitiGenesis is only triggered when creating or forking a chain. However we should try to keep our logic as similar to cosmos as possible .
The easiest way to fix it should be to use a fixed gas price if the price is not available
minGasPrice := mpd.feesKeeper.GetParams(ctx).MinGasPrice
if minGasPrice.IsNil() {
minGasPrice = sdkmath.LegacyMustNewDecFromStr("10000000000.000000000000000000")
}
// Short-circuit if min gas price is 0 or if simulating
if minGasPrice.IsZero() || simulate {
return next(ctx, tx, simulate)
}
Even if we continue with the correct order we should try to avoid panics wherever possible
Doesn't https://github.com/zeta-chain/node/pull/3786 solve this?
No , we still have feemarket , before genutil .