From 8c052ad6fa7ca262fdb8eada9158b054c7a9a253 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 3 Apr 2024 00:42:36 -0400 Subject: [PATCH 01/16] add script to modify genesis --- app/app.go | 24 +-- app/init_genesis.go | 49 ++++++ cmd/zetacored/parse_genesis.go | 182 ++++++++++++++++++++++ cmd/zetacored/parse_genesis_test.go | 225 ++++++++++++++++++++++++++++ cmd/zetacored/root.go | 1 + testutil/sample/observer.go | 10 ++ testutil/sample/sample.go | 16 ++ 7 files changed, 484 insertions(+), 23 deletions(-) create mode 100644 app/init_genesis.go create mode 100644 cmd/zetacored/parse_genesis.go create mode 100644 cmd/zetacored/parse_genesis_test.go diff --git a/app/app.go b/app/app.go index 0625df5f08..b30335c128 100644 --- a/app/app.go +++ b/app/app.go @@ -574,29 +574,7 @@ func New( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. // NOTE: Cross-chain module must be initialized after observer module, as pending nonces in crosschain needs the tss pubkey from observer module - app.mm.SetOrderInitGenesis( - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - stakingtypes.ModuleName, - slashingtypes.ModuleName, - govtypes.ModuleName, - crisistypes.ModuleName, - evmtypes.ModuleName, - feemarkettypes.ModuleName, - paramstypes.ModuleName, - group.ModuleName, - genutiltypes.ModuleName, - upgradetypes.ModuleName, - evidencetypes.ModuleName, - vestingtypes.ModuleName, - observertypes.ModuleName, - crosschaintypes.ModuleName, - fungibletypes.ModuleName, - emissionstypes.ModuleName, - authz.ModuleName, - authoritytypes.ModuleName, - ) + app.mm.SetOrderInitGenesis(InitGenesisModuleList()...) app.mm.RegisterInvariants(&app.CrisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) diff --git a/app/init_genesis.go b/app/init_genesis.go new file mode 100644 index 0000000000..4156424e97 --- /dev/null +++ b/app/init_genesis.go @@ -0,0 +1,49 @@ +package app + +import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + evmtypes "github.com/evmos/ethermint/x/evm/types" + feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + emissionsModuleTypes "github.com/zeta-chain/zetacore/x/emissions/types" + fungibleModuleTypes "github.com/zeta-chain/zetacore/x/fungible/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +func InitGenesisModuleList() []string { + return []string{ + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + crisistypes.ModuleName, + evmtypes.ModuleName, + feemarkettypes.ModuleName, + paramstypes.ModuleName, + group.ModuleName, + genutiltypes.ModuleName, + upgradetypes.ModuleName, + evidencetypes.ModuleName, + vestingtypes.ModuleName, + observertypes.ModuleName, + crosschaintypes.ModuleName, + fungibleModuleTypes.ModuleName, + emissionsModuleTypes.ModuleName, + authz.ModuleName, + } +} diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go new file mode 100644 index 0000000000..c15a3f0fe7 --- /dev/null +++ b/cmd/zetacored/parse_genesis.go @@ -0,0 +1,182 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + evmtypes "github.com/evmos/ethermint/x/evm/types" + feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + "github.com/spf13/cobra" + "github.com/tendermint/tendermint/types" + "github.com/zeta-chain/zetacore/app" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + emissionsModuleTypes "github.com/zeta-chain/zetacore/x/emissions/types" + fungibleModuleTypes "github.com/zeta-chain/zetacore/x/fungible/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +var Copy = map[string]bool{ + slashingtypes.ModuleName: true, + govtypes.ModuleName: true, + crisistypes.ModuleName: true, + feemarkettypes.ModuleName: true, + paramstypes.ModuleName: true, + group.ModuleName: true, + upgradetypes.ModuleName: true, + evidencetypes.ModuleName: true, + vestingtypes.ModuleName: true, + fungibleModuleTypes.ModuleName: true, + emissionsModuleTypes.ModuleName: true, + authz.ModuleName: true, +} +var Skip = map[string]bool{ + evmtypes.ModuleName: true, + stakingtypes.ModuleName: true, + genutiltypes.ModuleName: true, + authtypes.ModuleName: true, + banktypes.ModuleName: true, + distributiontypes.ModuleName: true, +} + +var Modify = map[string]bool{ + crosschaintypes.ModuleName: true, + observertypes.ModuleName: true, +} + +func CmdParseGenesisFile() *cobra.Command { + cmd := &cobra.Command{ + Use: "parse-genesis-file [import-genesis-file] [optional-genesis-file]", + Short: "Parse the genesis file", + Args: cobra.MaximumNArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + cdc := clientCtx.Codec + genesisFilePath := filepath.Join(app.DefaultNodeHome, "config", "genesis.json") + if len(args) == 2 { + genesisFilePath = args[1] + } + genDoc, err := GetGenDoc(genesisFilePath) + importData, err := GetGenDoc(args[0]) + + err = ImportDataIntoFile(genDoc, importData, cdc) + if err != nil { + return err + } + + err = genutil.ExportGenesisFile(genDoc, genesisFilePath) + if err != nil { + return err + } + + return nil + }, + } + return cmd +} + +func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, cdc codec.Codec) error { + + appState, err := genutiltypes.GenesisStateFromGenDoc(*genDoc) + if err != nil { + return err + } + importAppState, err := genutiltypes.GenesisStateFromGenDoc(*importFile) + if err != nil { + return err + } + moduleList := app.InitGenesisModuleList() + for _, m := range moduleList { + if Skip[m] { + continue + } + if Copy[m] { + appState[m] = importAppState[m] + } + if Modify[m] { + switch m { + case crosschaintypes.ModuleName: + err := ModifyCrossChainState(appState, importAppState, cdc) + if err != nil { + return err + } + case observertypes.ModuleName: + err := ModifyObserverState(appState, importAppState, cdc) + if err != nil { + return err + } + default: + return fmt.Errorf("modify function for %s not found", m) + } + } + } + + appStateJSON, err := json.Marshal(appState) + if err != nil { + return fmt.Errorf("failed to marshal application genesis state: %w", err) + } + genDoc.AppState = appStateJSON + + return nil +} + +func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { + importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importAppState) + importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(10, len(importedCrossChainGenState.CrossChainTxs))] + importedCrossChainGenState.InTxHashToCctxList = importedCrossChainGenState.InTxHashToCctxList[:math.Min(10, len(importedCrossChainGenState.InTxHashToCctxList))] + importedCrossChainGenState.FinalizedInbounds = importedCrossChainGenState.FinalizedInbounds[:math.Min(10, len(importedCrossChainGenState.FinalizedInbounds))] + importedCrossChainStateBz, err := json.Marshal(importedCrossChainGenState) + if err != nil { + return fmt.Errorf("failed to marshal zetacrosschain genesis state: %w", err) + } + appState[crosschaintypes.ModuleName] = importedCrossChainStateBz + return nil +} + +func ModifyObserverState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { + importedObserverGenState := observertypes.GetGenesisStateFromAppState(cdc, importAppState) + importedObserverGenState.Ballots = importedObserverGenState.Ballots[:math.Min(10, len(importedObserverGenState.Ballots))] + importedObserverGenState.NonceToCctx = importedObserverGenState.NonceToCctx[:math.Min(10, len(importedObserverGenState.NonceToCctx))] + importedObserverStateBz, err := cdc.MarshalJSON(&importedObserverGenState) + if err != nil { + return fmt.Errorf("failed to marshal observer genesis state: %w", err) + } + + appState[observertypes.ModuleName] = importedObserverStateBz + return nil +} + +func GetGenDoc(fp string) (*types.GenesisDoc, error) { + path, err := filepath.Abs(fp) + if err != nil { + return nil, err + } + jsonBlob, err := os.ReadFile(filepath.Clean(path)) + if err != nil { + return nil, err + } + genData, err := types.GenesisDocFromJSON(jsonBlob) + if err != nil { + return nil, err + } + return genData, nil +} diff --git a/cmd/zetacored/parse_genesis_test.go b/cmd/zetacored/parse_genesis_test.go new file mode 100644 index 0000000000..eb96955c1d --- /dev/null +++ b/cmd/zetacored/parse_genesis_test.go @@ -0,0 +1,225 @@ +package main_test + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "testing" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/types" + "github.com/zeta-chain/zetacore/app" + zetacored "github.com/zeta-chain/zetacore/cmd/zetacored" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +func setCosmosConfig() { + cosmosConf := sdk.GetConfig() + cosmosConf.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) + cosmosConf.Seal() +} +func Test_ModifyCrossChainState(t *testing.T) { + setCosmosConfig() + t.Run("successfully modify cross chain state to reduce data", func(t *testing.T) { + cdc := keepertest.NewCodec() + appState := sample.AppState(t) + importData := GetImportData(t, cdc, 100) + err := zetacored.ModifyCrossChainState(appState, importData, cdc) + require.NoError(t, err) + + modifiedCrosschainAppState := crosschaintypes.GetGenesisStateFromAppState(cdc, appState) + require.Len(t, modifiedCrosschainAppState.CrossChainTxs, 10) + require.Len(t, modifiedCrosschainAppState.InTxHashToCctxList, 10) + require.Len(t, modifiedCrosschainAppState.FinalizedInbounds, 10) + }) + + t.Run("successfully modify cross chain state without changing data when not needed", func(t *testing.T) { + cdc := keepertest.NewCodec() + appState := sample.AppState(t) + importData := GetImportData(t, cdc, 8) + err := zetacored.ModifyCrossChainState(appState, importData, cdc) + require.NoError(t, err) + + modifiedCrosschainAppState := crosschaintypes.GetGenesisStateFromAppState(cdc, appState) + require.Len(t, modifiedCrosschainAppState.CrossChainTxs, 8) + require.Len(t, modifiedCrosschainAppState.InTxHashToCctxList, 8) + require.Len(t, modifiedCrosschainAppState.FinalizedInbounds, 8) + }) +} + +func Test_ModifyObserverState(t *testing.T) { + setCosmosConfig() + t.Run("successfully modify observer state to reduce data", func(t *testing.T) { + cdc := keepertest.NewCodec() + appState := sample.AppState(t) + importData := GetImportData(t, cdc, 100) + err := zetacored.ModifyObserverState(appState, importData, cdc) + require.NoError(t, err) + + modifiedObserverAppState := observertypes.GetGenesisStateFromAppState(cdc, appState) + require.Len(t, modifiedObserverAppState.Ballots, 10) + require.Len(t, modifiedObserverAppState.NonceToCctx, 10) + }) + + t.Run("successfully modify observer state without changing data when not needed", func(t *testing.T) { + cdc := keepertest.NewCodec() + appState := sample.AppState(t) + importData := GetImportData(t, cdc, 8) + err := zetacored.ModifyObserverState(appState, importData, cdc) + require.NoError(t, err) + + modifiedObserverAppState := observertypes.GetGenesisStateFromAppState(cdc, appState) + require.Len(t, modifiedObserverAppState.Ballots, 8) + require.Len(t, modifiedObserverAppState.NonceToCctx, 8) + }) + +} + +func Test_ImportDataIntoFile(t *testing.T) { + setCosmosConfig() + cdc := keepertest.NewCodec() + genDoc := sample.GenDoc(t) + importGenDoc := ImportGenDoc(t, cdc, 100) + + err := zetacored.ImportDataIntoFile(genDoc, importGenDoc, cdc) + require.NoError(t, err) + + appState, err := genutiltypes.GenesisStateFromGenDoc(*genDoc) + require.NoError(t, err) + + // Crosschain module is in Modify list + crosschainStateAfterImport := crosschaintypes.GetGenesisStateFromAppState(cdc, appState) + require.Len(t, crosschainStateAfterImport.CrossChainTxs, 10) + require.Len(t, crosschainStateAfterImport.InTxHashToCctxList, 10) + require.Len(t, crosschainStateAfterImport.FinalizedInbounds, 10) + + // Bank module is in Skip list + var bankStateAfterImport banktypes.GenesisState + if appState[banktypes.ModuleName] != nil { + err := cdc.UnmarshalJSON(appState[banktypes.ModuleName], &bankStateAfterImport) + if err != nil { + panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error())) + } + } + // 4 balances were present in the original genesis state + require.Len(t, bankStateAfterImport.Balances, 4) + + // Emissions module is in Copy list + var emissionStateAfterImport emissionstypes.GenesisState + if appState[emissionstypes.ModuleName] != nil { + err := cdc.UnmarshalJSON(appState[emissionstypes.ModuleName], &emissionStateAfterImport) + if err != nil { + panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error())) + } + } + require.Len(t, emissionStateAfterImport.WithdrawableEmissions, 100) +} + +func Test_GetGenDoc(t *testing.T) { + t.Run("successfully get genesis doc from file", func(t *testing.T) { + fp := filepath.Join(os.TempDir(), "genesis.json") + err := genutil.ExportGenesisFile(sample.GenDoc(t), fp) + require.NoError(t, err) + _, err = zetacored.GetGenDoc(fp) + require.NoError(t, err) + }) + t.Run("fail to get genesis doc from file", func(t *testing.T) { + _, err := zetacored.GetGenDoc("test") + require.ErrorContains(t, err, "no such file or directory") + }) +} + +func ImportGenDoc(t *testing.T, cdc *codec.ProtoCodec, n int) *types.GenesisDoc { + importGenDoc := sample.GenDoc(t) + importStateJson, err := json.Marshal(GetImportData(t, cdc, n)) + require.NoError(t, err) + importGenDoc.AppState = importStateJson + return importGenDoc +} + +func GetImportData(t *testing.T, cdc *codec.ProtoCodec, n int) map[string]json.RawMessage { + importData := sample.AppState(t) + + // Add crosschain data to genesis state + importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importData) + cctxList := make([]*crosschaintypes.CrossChainTx, n) + intxHashToCctxList := make([]crosschaintypes.InTxHashToCctx, n) + finalLizedInbounds := make([]string, n) + for i := 0; i < n; i++ { + cctxList[i] = sample.CrossChainTx(t, fmt.Sprintf("crosschain-%d", i)) + intxHashToCctxList[i] = sample.InTxHashToCctx(t, fmt.Sprintf("intxHashToCctxList-%d", i)) + finalLizedInbounds[i] = fmt.Sprintf("finalLizedInbounds-%d", i) + } + importedCrossChainGenState.CrossChainTxs = cctxList + importedCrossChainGenState.InTxHashToCctxList = intxHashToCctxList + importedCrossChainGenState.FinalizedInbounds = finalLizedInbounds + importedCrossChainStateBz, err := json.Marshal(importedCrossChainGenState) + require.NoError(t, err) + importData[crosschaintypes.ModuleName] = importedCrossChainStateBz + + // Add observer data to genesis state + importedObserverGenState := observertypes.GetGenesisStateFromAppState(cdc, importData) + ballots := make([]*observertypes.Ballot, n) + nonceToCctx := make([]observertypes.NonceToCctx, n) + for i := 0; i < n; i++ { + ballots[i] = sample.Ballot(t, fmt.Sprintf("ballots-%d", i)) + nonceToCctx[i] = sample.NonceToCCTX(t, fmt.Sprintf("nonceToCctx-%d", i)) + } + importedObserverGenState.Ballots = ballots + importedObserverGenState.NonceToCctx = nonceToCctx + importedObserverStateBz, err := cdc.MarshalJSON(&importedObserverGenState) + require.NoError(t, err) + importData[observertypes.ModuleName] = importedObserverStateBz + + // Add emission data to genesis state + var importedEmissionGenesis emissionstypes.GenesisState + if importData[emissionstypes.ModuleName] != nil { + err := cdc.UnmarshalJSON(importData[emissionstypes.ModuleName], &importedEmissionGenesis) + if err != nil { + panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error())) + } + } + withdrawableEmissions := make([]emissionstypes.WithdrawableEmissions, n) + for i := 0; i < n; i++ { + withdrawableEmissions[i] = sample.WithdrawableEmissions(t) + } + importedEmissionGenesis.WithdrawableEmissions = withdrawableEmissions + importedEmissionGenesisBz, err := cdc.MarshalJSON(&importedEmissionGenesis) + require.NoError(t, err) + importData[emissionstypes.ModuleName] = importedEmissionGenesisBz + + // Add bank data to genesis state + var importedBankGenesis banktypes.GenesisState + if importData[banktypes.ModuleName] != nil { + err := cdc.UnmarshalJSON(importData[banktypes.ModuleName], &importedBankGenesis) + if err != nil { + panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error())) + } + } + balances := make([]banktypes.Balance, n) + supply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.ZeroInt())) + for i := 0; i < n; i++ { + balances[i] = banktypes.Balance{ + Address: sample.AccAddress(), + Coins: sample.Coins(), + } + supply = supply.Add(balances[i].Coins...) + } + importedBankGenesis.Balances = balances + importedBankGenesis.Supply = supply + importedBankGenesisBz, err := cdc.MarshalJSON(&importedBankGenesis) + require.NoError(t, err) + importData[banktypes.ModuleName] = importedBankGenesisBz + + return importData +} diff --git a/cmd/zetacored/root.go b/cmd/zetacored/root.go index 9f1835c9bb..7c14d1bfcb 100644 --- a/cmd/zetacored/root.go +++ b/cmd/zetacored/root.go @@ -134,6 +134,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig genutilcli.ValidateGenesisCmd(app.ModuleBasics), AddGenesisAccountCmd(app.DefaultNodeHome), AddObserverAccountsCmd(), + CmdParseGenesisFile(), GetPubKeyCmd(), CollectObserverInfoCmd(), AddrConversionCmd(), diff --git a/testutil/sample/observer.go b/testutil/sample/observer.go index c90036ff07..011495a8b2 100644 --- a/testutil/sample/observer.go +++ b/testutil/sample/observer.go @@ -266,3 +266,13 @@ func VotesSuccessOnly(voteCount int) []types.VoteType { } return votes } + +func NonceToCCTX(t *testing.T, seed string) types.NonceToCctx { + r := newRandFromStringSeed(t, seed) + return types.NonceToCctx{ + ChainId: r.Int63(), + Nonce: r.Int63(), + CctxIndex: StringRandom(r, 64), + Tss: Tss().TssPubkey, + } +} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 71b9eac564..97183a7276 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -1,6 +1,7 @@ package sample import ( + "encoding/json" "errors" "hash/fnv" "math/rand" @@ -8,7 +9,9 @@ import ( "testing" sdkmath "cosmossdk.io/math" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ethcrypto "github.com/ethereum/go-ethereum/crypto" + "github.com/tendermint/tendermint/types" "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" @@ -164,3 +167,16 @@ func IntInRange(low, high int64) sdkmath.Int { i := Int64InRange(low, high) return sdkmath.NewInt(i) } +func AppState(t *testing.T) map[string]json.RawMessage { + + appState, err := genutiltypes.GenesisStateFromGenDoc(*GenDoc(t)) + require.NoError(t, err) + return appState +} + +func GenDoc(t *testing.T) *types.GenesisDoc { + jsonBlob := []byte("{\n \"genesis_time\": \"2024-04-02T04:39:30.314827Z\",\n \"chain_id\": \"localnet_101-1\",\n \"initial_height\": \"1\",\n \"consensus_params\": {\n \"block\": {\n \"max_bytes\": \"22020096\",\n \"max_gas\": \"10000000\",\n \"time_iota_ms\": \"1000\"\n },\n \"evidence\": {\n \"max_age_num_blocks\": \"100000\",\n \"max_age_duration\": \"172800000000000\",\n \"max_bytes\": \"1048576\"\n },\n \"validator\": {\n \"pub_key_types\": [\n \"ed25519\"\n ]\n },\n \"version\": {}\n },\n \"app_hash\": \"\",\n \"app_state\": {\n \"auth\": {\n \"params\": {\n \"max_memo_characters\": \"256\",\n \"tx_sig_limit\": \"7\",\n \"tx_size_cost_per_byte\": \"10\",\n \"sig_verify_cost_ed25519\": \"590\",\n \"sig_verify_cost_secp256k1\": \"1000\"\n },\n \"accounts\": [\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n }\n ]\n },\n \"authz\": {\n \"authorization\": [\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n }\n ]\n },\n \"bank\": {\n \"params\": {\n \"send_enabled\": [],\n \"default_send_enabled\": true\n },\n \"balances\": [\n {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n }\n ],\n \"supply\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"8402000000000000000000000\"\n }\n ],\n \"denom_metadata\": []\n },\n \"crisis\": {\n \"constant_fee\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000\"\n }\n },\n \"crosschain\": {\n \"params\": {},\n \"outTxTrackerList\": [],\n \"inTxHashToCctxList\": [],\n \"in_tx_tracker_list\": [],\n \"zeta_accounting\": {\n \"aborted_zeta_amount\": \"0\"\n }\n },\n \"distribution\": {\n \"params\": {\n \"community_tax\": \"0.020000000000000000\",\n \"base_proposer_reward\": \"0.010000000000000000\",\n \"bonus_proposer_reward\": \"0.040000000000000000\",\n \"withdraw_addr_enabled\": true\n },\n \"fee_pool\": {\n \"community_pool\": []\n },\n \"delegator_withdraw_infos\": [],\n \"previous_proposer\": \"\",\n \"outstanding_rewards\": [],\n \"validator_accumulated_commissions\": [],\n \"validator_historical_rewards\": [],\n \"validator_current_rewards\": [],\n \"delegator_starting_infos\": [],\n \"validator_slash_events\": []\n },\n \"emissions\": {\n \"params\": {\n \"max_bond_factor\": \"1.25\",\n \"min_bond_factor\": \"0.75\",\n \"avg_block_time\": \"6.00\",\n \"target_bond_ratio\": \"00.67\",\n \"validator_emission_percentage\": \"00.50\",\n \"observer_emission_percentage\": \"00.25\",\n \"tss_signer_emission_percentage\": \"00.25\",\n \"duration_factor_constant\": \"0.001877876953694702\",\n \"observer_slash_amount\": \"100000000000000000\"\n },\n \"withdrawableEmissions\": []\n },\n \"evidence\": {\n \"evidence\": []\n },\n \"evm\": {\n \"accounts\": [],\n \"params\": {\n \"evm_denom\": \"azeta\",\n \"enable_create\": true,\n \"enable_call\": true,\n \"extra_eips\": [],\n \"chain_config\": {\n \"homestead_block\": \"0\",\n \"dao_fork_block\": \"0\",\n \"dao_fork_support\": true,\n \"eip150_block\": \"0\",\n \"eip150_hash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n \"eip155_block\": \"0\",\n \"eip158_block\": \"0\",\n \"byzantium_block\": \"0\",\n \"constantinople_block\": \"0\",\n \"petersburg_block\": \"0\",\n \"istanbul_block\": \"0\",\n \"muir_glacier_block\": \"0\",\n \"berlin_block\": \"0\",\n \"london_block\": \"0\",\n \"arrow_glacier_block\": \"0\",\n \"gray_glacier_block\": \"0\",\n \"merge_netsplit_block\": \"0\",\n \"shanghai_block\": \"0\",\n \"cancun_block\": \"0\"\n },\n \"allow_unprotected_txs\": false\n }\n },\n \"feemarket\": {\n \"params\": {\n \"no_base_fee\": false,\n \"base_fee_change_denominator\": 8,\n \"elasticity_multiplier\": 2,\n \"enable_height\": \"0\",\n \"base_fee\": \"1000000000\",\n \"min_gas_price\": \"0.000000000000000000\",\n \"min_gas_multiplier\": \"0.500000000000000000\"\n },\n \"block_gas\": \"0\"\n },\n \"fungible\": {\n \"params\": {},\n \"foreignCoinsList\": [],\n \"systemContract\": null\n },\n \"genutil\": {\n \"gen_txs\": [\n {\n \"body\": {\n \"messages\": [\n {\n \"@type\": \"/cosmos.staking.v1beta1.MsgCreateValidator\",\n \"description\": {\n \"moniker\": \"Zetanode-Localnet\",\n \"identity\": \"\",\n \"website\": \"\",\n \"security_contact\": \"\",\n \"details\": \"\"\n },\n \"commission\": {\n \"rate\": \"0.100000000000000000\",\n \"max_rate\": \"0.200000000000000000\",\n \"max_change_rate\": \"0.010000000000000000\"\n },\n \"min_self_delegation\": \"1\",\n \"delegator_address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"validator_address\": \"zetavaloper13c7p3xrhd6q2rx3h235jpt8pjdwvacyw7tkass\",\n \"pubkey\": {\n \"@type\": \"/cosmos.crypto.ed25519.PubKey\",\n \"key\": \"ByI4L3eyFD5JbtlCr6HEASaUUMf8PWjLMBYjKd4Zqq8=\"\n },\n \"value\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n }\n ],\n \"memo\": \"9bb63c4104c15f332d0b25d6e982f2dcf389f24f@192.168.2.12:26656\",\n \"timeout_height\": \"0\",\n \"extension_options\": [],\n \"non_critical_extension_options\": []\n },\n \"auth_info\": {\n \"signer_infos\": [\n {\n \"public_key\": {\n \"@type\": \"/cosmos.crypto.secp256k1.PubKey\",\n \"key\": \"A05F6QuFVpb/5KrIPvlHr209ZsD22gW0omhLSXWAtQrh\"\n },\n \"mode_info\": {\n \"single\": {\n \"mode\": \"SIGN_MODE_DIRECT\"\n }\n },\n \"sequence\": \"0\"\n }\n ],\n \"fee\": {\n \"amount\": [],\n \"gas_limit\": \"200000\",\n \"payer\": \"\",\n \"granter\": \"\"\n },\n \"tip\": null\n },\n \"signatures\": [\n \"H0MPTY7zgX9+fscgDgtszGDbjG3llzlGOLb6lrTwfUxm/EO6Wz1eGmc51stq4D0gAGd8u8hSNCQKf5uU8V/Jdw==\"\n ]\n }\n ]\n },\n \"gov\": {\n \"starting_proposal_id\": \"1\",\n \"deposits\": [],\n \"votes\": [],\n \"proposals\": [],\n \"deposit_params\": {\n \"min_deposit\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"10000000\"\n }\n ],\n \"max_deposit_period\": \"172800s\"\n },\n \"voting_params\": {\n \"voting_period\": \"10s\"\n },\n \"tally_params\": {\n \"quorum\": \"0.334000000000000000\",\n \"threshold\": \"0.500000000000000000\",\n \"veto_threshold\": \"0.334000000000000000\"\n }\n },\n \"group\": {\n \"group_seq\": \"0\",\n \"groups\": [],\n \"group_members\": [],\n \"group_policy_seq\": \"0\",\n \"group_policies\": [],\n \"proposal_seq\": \"0\",\n \"proposals\": [],\n \"votes\": []\n },\n \"mint\": {\n \"params\": {\n \"mint_denom\": \"azeta\"\n }\n },\n \"observer\": {\n \"observers\": {\n \"observer_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"nodeAccountList\": [\n {\n \"operator\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"granteeAddress\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\"\n },\n \"nodeStatus\": 4\n },\n {\n \"operator\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"granteeAddress\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n },\n \"nodeStatus\": 4\n }\n ],\n \"crosschain_flags\": {\n \"isInboundEnabled\": true,\n \"isOutboundEnabled\": true\n },\n \"params\": {\n \"observer_params\": [\n {\n \"chain\": {\n \"chain_name\": 2,\n \"chain_id\": 101\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 15,\n \"chain_id\": 18444\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 14,\n \"chain_id\": 1337\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n }\n ],\n \"admin_policy\": [\n {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\"\n },\n {\n \"policy_type\": 1,\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\"\n }\n ],\n \"ballot_maturity_blocks\": 100\n },\n \"keygen\": {\n \"granteePubkeys\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ],\n \"blockNumber\": 5\n },\n \"chain_params_list\": {},\n \"tss\": {},\n \"tss_history\": [],\n \"tss_fund_migrators\": [],\n \"blame_list\": [],\n \"pending_nonces\": [],\n \"chain_nonces\": [],\n \"nonce_to_cctx\": []\n },\n \"params\": null,\n \"slashing\": {\n \"params\": {\n \"signed_blocks_window\": \"100\",\n \"min_signed_per_window\": \"0.500000000000000000\",\n \"downtime_jail_duration\": \"600s\",\n \"slash_fraction_double_sign\": \"0.050000000000000000\",\n \"slash_fraction_downtime\": \"0.010000000000000000\"\n },\n \"signing_infos\": [],\n \"missed_blocks\": []\n },\n \"staking\": {\n \"params\": {\n \"unbonding_time\": \"1814400s\",\n \"max_validators\": 100,\n \"max_entries\": 7,\n \"historical_entries\": 10000,\n \"bond_denom\": \"azeta\",\n \"min_commission_rate\": \"0.000000000000000000\"\n },\n \"last_total_power\": \"0\",\n \"last_validator_powers\": [],\n \"validators\": [],\n \"delegations\": [],\n \"unbonding_delegations\": [],\n \"redelegations\": [],\n \"exported\": false\n },\n \"upgrade\": {},\n \"vesting\": {}\n }\n}") + genDoc, err := types.GenesisDocFromJSON(jsonBlob) + require.NoError(t, err) + return genDoc +} From a661c6e00d89463f7a6f5ffbd46aedada4daac88 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 3 Apr 2024 00:51:14 -0400 Subject: [PATCH 02/16] fix unit tests --- app/init_genesis.go | 2 ++ cmd/zetacored/parse_genesis_test.go | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/init_genesis.go b/app/init_genesis.go index 4156424e97..f5d12a0746 100644 --- a/app/init_genesis.go +++ b/app/init_genesis.go @@ -17,6 +17,7 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" evmtypes "github.com/evmos/ethermint/x/evm/types" feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" emissionsModuleTypes "github.com/zeta-chain/zetacore/x/emissions/types" fungibleModuleTypes "github.com/zeta-chain/zetacore/x/fungible/types" @@ -45,5 +46,6 @@ func InitGenesisModuleList() []string { fungibleModuleTypes.ModuleName, emissionsModuleTypes.ModuleName, authz.ModuleName, + authoritytypes.ModuleName, } } diff --git a/cmd/zetacored/parse_genesis_test.go b/cmd/zetacored/parse_genesis_test.go index eb96955c1d..84eff883bd 100644 --- a/cmd/zetacored/parse_genesis_test.go +++ b/cmd/zetacored/parse_genesis_test.go @@ -23,13 +23,18 @@ import ( observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -func setCosmosConfig() { - cosmosConf := sdk.GetConfig() - cosmosConf.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) - cosmosConf.Seal() +func setConfig(t *testing.T) { + defer func(t *testing.T) { + if r := recover(); r != nil { + t.Log("config is already sealed", r) + } + }(t) + cfg := sdk.GetConfig() + cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) + cfg.Seal() } func Test_ModifyCrossChainState(t *testing.T) { - setCosmosConfig() + setConfig(t) t.Run("successfully modify cross chain state to reduce data", func(t *testing.T) { cdc := keepertest.NewCodec() appState := sample.AppState(t) @@ -58,7 +63,7 @@ func Test_ModifyCrossChainState(t *testing.T) { } func Test_ModifyObserverState(t *testing.T) { - setCosmosConfig() + setConfig(t) t.Run("successfully modify observer state to reduce data", func(t *testing.T) { cdc := keepertest.NewCodec() appState := sample.AppState(t) @@ -86,7 +91,7 @@ func Test_ModifyObserverState(t *testing.T) { } func Test_ImportDataIntoFile(t *testing.T) { - setCosmosConfig() + setConfig(t) cdc := keepertest.NewCodec() genDoc := sample.GenDoc(t) importGenDoc := ImportGenDoc(t, cdc, 100) From 7726c9416a31fa306d58ed0d9ef3a13205292894 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Mon, 8 Apr 2024 16:30:12 -0400 Subject: [PATCH 03/16] copy only nonce to cctx and ballot list while importing genesis state --- cmd/zetacored/parse_genesis.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index c15a3f0fe7..9e84950dcf 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -156,12 +156,17 @@ func ModifyObserverState(appState map[string]json.RawMessage, importAppState map importedObserverGenState := observertypes.GetGenesisStateFromAppState(cdc, importAppState) importedObserverGenState.Ballots = importedObserverGenState.Ballots[:math.Min(10, len(importedObserverGenState.Ballots))] importedObserverGenState.NonceToCctx = importedObserverGenState.NonceToCctx[:math.Min(10, len(importedObserverGenState.NonceToCctx))] - importedObserverStateBz, err := cdc.MarshalJSON(&importedObserverGenState) + + currentGenState := observertypes.GetGenesisStateFromAppState(cdc, appState) + currentGenState.Ballots = importedObserverGenState.Ballots + currentGenState.NonceToCctx = importedObserverGenState.NonceToCctx + + currentGenStateBz, err := cdc.MarshalJSON(¤tGenState) if err != nil { return fmt.Errorf("failed to marshal observer genesis state: %w", err) } - appState[observertypes.ModuleName] = importedObserverStateBz + appState[observertypes.ModuleName] = currentGenStateBz return nil } From 67f64b91cf3f73b01eb9ed7544d2ed410d080905 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Mon, 8 Apr 2024 16:40:31 -0400 Subject: [PATCH 04/16] skip copying group data --- cmd/zetacored/parse_genesis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index 9e84950dcf..b3dad52b28 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -41,7 +41,6 @@ var Copy = map[string]bool{ crisistypes.ModuleName: true, feemarkettypes.ModuleName: true, paramstypes.ModuleName: true, - group.ModuleName: true, upgradetypes.ModuleName: true, evidencetypes.ModuleName: true, vestingtypes.ModuleName: true, @@ -56,6 +55,7 @@ var Skip = map[string]bool{ authtypes.ModuleName: true, banktypes.ModuleName: true, distributiontypes.ModuleName: true, + group.ModuleName: true, } var Modify = map[string]bool{ From 5e627f9ff34a881078c4aa996dfa64d1f20fda43 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 11 Apr 2024 18:49:16 -0400 Subject: [PATCH 05/16] generate files --- changelog.md | 1 + cmd/zetacored/parse_genesis.go | 2 +- docs/cli/zetacored/zetacored.md | 1 + .../zetacored/zetacored_parse-genesis-file.md | 27 +++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 docs/cli/zetacored/zetacored_parse-genesis-file.md diff --git a/changelog.md b/changelog.md index 04181421f9..7c4f1d0d64 100644 --- a/changelog.md +++ b/changelog.md @@ -32,6 +32,7 @@ * [1884](https://github.com/zeta-chain/node/pull/1884) - added zetatool cmd, added subcommand to filter deposits * [1935](https://github.com/zeta-chain/node/pull/1935) - add an operational authority group * [1954](https://github.com/zeta-chain/node/pull/1954) - add metric for concurrent keysigns +* [1979](https://github.com/zeta-chain/node/pull/1979) - add script to import genesis data into an existing genesis file ### Tests diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index b3dad52b28..218b48191f 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -66,7 +66,7 @@ var Modify = map[string]bool{ func CmdParseGenesisFile() *cobra.Command { cmd := &cobra.Command{ Use: "parse-genesis-file [import-genesis-file] [optional-genesis-file]", - Short: "Parse the genesis file", + Short: "Parse the provided genesis file and import the required data into the optionally provided genesis file", Args: cobra.MaximumNArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) diff --git a/docs/cli/zetacored/zetacored.md b/docs/cli/zetacored/zetacored.md index 4b5f360d55..3c5e74d749 100644 --- a/docs/cli/zetacored/zetacored.md +++ b/docs/cli/zetacored/zetacored.md @@ -29,6 +29,7 @@ Zetacore Daemon (server) * [zetacored index-eth-tx](zetacored_index-eth-tx.md) - Index historical eth txs * [zetacored init](zetacored_init.md) - Initialize private validator, p2p, genesis, and application configuration files * [zetacored keys](zetacored_keys.md) - Manage your application's keys +* [zetacored parse-genesis-file](zetacored_parse-genesis-file.md) - Parse the genesis file * [zetacored query](zetacored_query.md) - Querying subcommands * [zetacored rollback](zetacored_rollback.md) - rollback cosmos-sdk and tendermint state by one height * [zetacored rosetta](zetacored_rosetta.md) - spin up a rosetta server diff --git a/docs/cli/zetacored/zetacored_parse-genesis-file.md b/docs/cli/zetacored/zetacored_parse-genesis-file.md new file mode 100644 index 0000000000..ed0a855dc6 --- /dev/null +++ b/docs/cli/zetacored/zetacored_parse-genesis-file.md @@ -0,0 +1,27 @@ +# parse-genesis-file + +Parse the genesis file + +``` +zetacored parse-genesis-file [import-genesis-file] [optional-genesis-file] [flags] +``` + +### Options + +``` + -h, --help help for parse-genesis-file +``` + +### Options inherited from parent commands + +``` + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored](zetacored.md) - Zetacore Daemon (server) + From 64aba57e5cb261200e189a4497a81c19a0a3fafd Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 11 Apr 2024 18:51:10 -0400 Subject: [PATCH 06/16] use constant for max items --- cmd/zetacored/parse_genesis.go | 12 +++++++----- cmd/zetacored/parse_genesis_test.go | 10 +++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index 218b48191f..ff752a9ddc 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -35,6 +35,8 @@ import ( observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) +const Max_items_for_list = 10 + var Copy = map[string]bool{ slashingtypes.ModuleName: true, govtypes.ModuleName: true, @@ -141,9 +143,9 @@ func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importAppState) - importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(10, len(importedCrossChainGenState.CrossChainTxs))] - importedCrossChainGenState.InTxHashToCctxList = importedCrossChainGenState.InTxHashToCctxList[:math.Min(10, len(importedCrossChainGenState.InTxHashToCctxList))] - importedCrossChainGenState.FinalizedInbounds = importedCrossChainGenState.FinalizedInbounds[:math.Min(10, len(importedCrossChainGenState.FinalizedInbounds))] + importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(Max_items_for_list, len(importedCrossChainGenState.CrossChainTxs))] + importedCrossChainGenState.InTxHashToCctxList = importedCrossChainGenState.InTxHashToCctxList[:math.Min(Max_items_for_list, len(importedCrossChainGenState.InTxHashToCctxList))] + importedCrossChainGenState.FinalizedInbounds = importedCrossChainGenState.FinalizedInbounds[:math.Min(Max_items_for_list, len(importedCrossChainGenState.FinalizedInbounds))] importedCrossChainStateBz, err := json.Marshal(importedCrossChainGenState) if err != nil { return fmt.Errorf("failed to marshal zetacrosschain genesis state: %w", err) @@ -154,8 +156,8 @@ func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState m func ModifyObserverState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedObserverGenState := observertypes.GetGenesisStateFromAppState(cdc, importAppState) - importedObserverGenState.Ballots = importedObserverGenState.Ballots[:math.Min(10, len(importedObserverGenState.Ballots))] - importedObserverGenState.NonceToCctx = importedObserverGenState.NonceToCctx[:math.Min(10, len(importedObserverGenState.NonceToCctx))] + importedObserverGenState.Ballots = importedObserverGenState.Ballots[:math.Min(Max_items_for_list, len(importedObserverGenState.Ballots))] + importedObserverGenState.NonceToCctx = importedObserverGenState.NonceToCctx[:math.Min(Max_items_for_list, len(importedObserverGenState.NonceToCctx))] currentGenState := observertypes.GetGenesisStateFromAppState(cdc, appState) currentGenState.Ballots = importedObserverGenState.Ballots diff --git a/cmd/zetacored/parse_genesis_test.go b/cmd/zetacored/parse_genesis_test.go index 84eff883bd..3c51a2da04 100644 --- a/cmd/zetacored/parse_genesis_test.go +++ b/cmd/zetacored/parse_genesis_test.go @@ -72,8 +72,8 @@ func Test_ModifyObserverState(t *testing.T) { require.NoError(t, err) modifiedObserverAppState := observertypes.GetGenesisStateFromAppState(cdc, appState) - require.Len(t, modifiedObserverAppState.Ballots, 10) - require.Len(t, modifiedObserverAppState.NonceToCctx, 10) + require.Len(t, modifiedObserverAppState.Ballots, zetacored.Max_items_for_list) + require.Len(t, modifiedObserverAppState.NonceToCctx, zetacored.Max_items_for_list) }) t.Run("successfully modify observer state without changing data when not needed", func(t *testing.T) { @@ -104,9 +104,9 @@ func Test_ImportDataIntoFile(t *testing.T) { // Crosschain module is in Modify list crosschainStateAfterImport := crosschaintypes.GetGenesisStateFromAppState(cdc, appState) - require.Len(t, crosschainStateAfterImport.CrossChainTxs, 10) - require.Len(t, crosschainStateAfterImport.InTxHashToCctxList, 10) - require.Len(t, crosschainStateAfterImport.FinalizedInbounds, 10) + require.Len(t, crosschainStateAfterImport.CrossChainTxs, zetacored.Max_items_for_list) + require.Len(t, crosschainStateAfterImport.InTxHashToCctxList, zetacored.Max_items_for_list) + require.Len(t, crosschainStateAfterImport.FinalizedInbounds, zetacored.Max_items_for_list) // Bank module is in Skip list var bankStateAfterImport banktypes.GenesisState From 061bd1b85fe5d4d1f79811b0b3c0dbd8d4e2c648 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 11 Apr 2024 18:55:21 -0400 Subject: [PATCH 07/16] generate files 2 --- docs/cli/zetacored/zetacored.md | 2 +- docs/cli/zetacored/zetacored_parse-genesis-file.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cli/zetacored/zetacored.md b/docs/cli/zetacored/zetacored.md index 3c5e74d749..f501a6a46b 100644 --- a/docs/cli/zetacored/zetacored.md +++ b/docs/cli/zetacored/zetacored.md @@ -29,7 +29,7 @@ Zetacore Daemon (server) * [zetacored index-eth-tx](zetacored_index-eth-tx.md) - Index historical eth txs * [zetacored init](zetacored_init.md) - Initialize private validator, p2p, genesis, and application configuration files * [zetacored keys](zetacored_keys.md) - Manage your application's keys -* [zetacored parse-genesis-file](zetacored_parse-genesis-file.md) - Parse the genesis file +* [zetacored parse-genesis-file](zetacored_parse-genesis-file.md) - Parse the provided genesis file and import the required data into the optionally provided genesis file * [zetacored query](zetacored_query.md) - Querying subcommands * [zetacored rollback](zetacored_rollback.md) - rollback cosmos-sdk and tendermint state by one height * [zetacored rosetta](zetacored_rosetta.md) - spin up a rosetta server diff --git a/docs/cli/zetacored/zetacored_parse-genesis-file.md b/docs/cli/zetacored/zetacored_parse-genesis-file.md index ed0a855dc6..b35a5c6b97 100644 --- a/docs/cli/zetacored/zetacored_parse-genesis-file.md +++ b/docs/cli/zetacored/zetacored_parse-genesis-file.md @@ -1,6 +1,6 @@ # parse-genesis-file -Parse the genesis file +Parse the provided genesis file and import the required data into the optionally provided genesis file ``` zetacored parse-genesis-file [import-genesis-file] [optional-genesis-file] [flags] From 39b9692ed3f901496c036a02f5685a2dc445aad7 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Fri, 12 Apr 2024 01:10:52 -0400 Subject: [PATCH 08/16] undate sample genesis --- testutil/sample/sample.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 97183a7276..4ed1f9ce60 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -168,14 +168,13 @@ func IntInRange(low, high int64) sdkmath.Int { return sdkmath.NewInt(i) } func AppState(t *testing.T) map[string]json.RawMessage { - appState, err := genutiltypes.GenesisStateFromGenDoc(*GenDoc(t)) require.NoError(t, err) return appState } func GenDoc(t *testing.T) *types.GenesisDoc { - jsonBlob := []byte("{\n \"genesis_time\": \"2024-04-02T04:39:30.314827Z\",\n \"chain_id\": \"localnet_101-1\",\n \"initial_height\": \"1\",\n \"consensus_params\": {\n \"block\": {\n \"max_bytes\": \"22020096\",\n \"max_gas\": \"10000000\",\n \"time_iota_ms\": \"1000\"\n },\n \"evidence\": {\n \"max_age_num_blocks\": \"100000\",\n \"max_age_duration\": \"172800000000000\",\n \"max_bytes\": \"1048576\"\n },\n \"validator\": {\n \"pub_key_types\": [\n \"ed25519\"\n ]\n },\n \"version\": {}\n },\n \"app_hash\": \"\",\n \"app_state\": {\n \"auth\": {\n \"params\": {\n \"max_memo_characters\": \"256\",\n \"tx_sig_limit\": \"7\",\n \"tx_size_cost_per_byte\": \"10\",\n \"sig_verify_cost_ed25519\": \"590\",\n \"sig_verify_cost_secp256k1\": \"1000\"\n },\n \"accounts\": [\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n }\n ]\n },\n \"authz\": {\n \"authorization\": [\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n }\n ]\n },\n \"bank\": {\n \"params\": {\n \"send_enabled\": [],\n \"default_send_enabled\": true\n },\n \"balances\": [\n {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n }\n ],\n \"supply\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"8402000000000000000000000\"\n }\n ],\n \"denom_metadata\": []\n },\n \"crisis\": {\n \"constant_fee\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000\"\n }\n },\n \"crosschain\": {\n \"params\": {},\n \"outTxTrackerList\": [],\n \"inTxHashToCctxList\": [],\n \"in_tx_tracker_list\": [],\n \"zeta_accounting\": {\n \"aborted_zeta_amount\": \"0\"\n }\n },\n \"distribution\": {\n \"params\": {\n \"community_tax\": \"0.020000000000000000\",\n \"base_proposer_reward\": \"0.010000000000000000\",\n \"bonus_proposer_reward\": \"0.040000000000000000\",\n \"withdraw_addr_enabled\": true\n },\n \"fee_pool\": {\n \"community_pool\": []\n },\n \"delegator_withdraw_infos\": [],\n \"previous_proposer\": \"\",\n \"outstanding_rewards\": [],\n \"validator_accumulated_commissions\": [],\n \"validator_historical_rewards\": [],\n \"validator_current_rewards\": [],\n \"delegator_starting_infos\": [],\n \"validator_slash_events\": []\n },\n \"emissions\": {\n \"params\": {\n \"max_bond_factor\": \"1.25\",\n \"min_bond_factor\": \"0.75\",\n \"avg_block_time\": \"6.00\",\n \"target_bond_ratio\": \"00.67\",\n \"validator_emission_percentage\": \"00.50\",\n \"observer_emission_percentage\": \"00.25\",\n \"tss_signer_emission_percentage\": \"00.25\",\n \"duration_factor_constant\": \"0.001877876953694702\",\n \"observer_slash_amount\": \"100000000000000000\"\n },\n \"withdrawableEmissions\": []\n },\n \"evidence\": {\n \"evidence\": []\n },\n \"evm\": {\n \"accounts\": [],\n \"params\": {\n \"evm_denom\": \"azeta\",\n \"enable_create\": true,\n \"enable_call\": true,\n \"extra_eips\": [],\n \"chain_config\": {\n \"homestead_block\": \"0\",\n \"dao_fork_block\": \"0\",\n \"dao_fork_support\": true,\n \"eip150_block\": \"0\",\n \"eip150_hash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n \"eip155_block\": \"0\",\n \"eip158_block\": \"0\",\n \"byzantium_block\": \"0\",\n \"constantinople_block\": \"0\",\n \"petersburg_block\": \"0\",\n \"istanbul_block\": \"0\",\n \"muir_glacier_block\": \"0\",\n \"berlin_block\": \"0\",\n \"london_block\": \"0\",\n \"arrow_glacier_block\": \"0\",\n \"gray_glacier_block\": \"0\",\n \"merge_netsplit_block\": \"0\",\n \"shanghai_block\": \"0\",\n \"cancun_block\": \"0\"\n },\n \"allow_unprotected_txs\": false\n }\n },\n \"feemarket\": {\n \"params\": {\n \"no_base_fee\": false,\n \"base_fee_change_denominator\": 8,\n \"elasticity_multiplier\": 2,\n \"enable_height\": \"0\",\n \"base_fee\": \"1000000000\",\n \"min_gas_price\": \"0.000000000000000000\",\n \"min_gas_multiplier\": \"0.500000000000000000\"\n },\n \"block_gas\": \"0\"\n },\n \"fungible\": {\n \"params\": {},\n \"foreignCoinsList\": [],\n \"systemContract\": null\n },\n \"genutil\": {\n \"gen_txs\": [\n {\n \"body\": {\n \"messages\": [\n {\n \"@type\": \"/cosmos.staking.v1beta1.MsgCreateValidator\",\n \"description\": {\n \"moniker\": \"Zetanode-Localnet\",\n \"identity\": \"\",\n \"website\": \"\",\n \"security_contact\": \"\",\n \"details\": \"\"\n },\n \"commission\": {\n \"rate\": \"0.100000000000000000\",\n \"max_rate\": \"0.200000000000000000\",\n \"max_change_rate\": \"0.010000000000000000\"\n },\n \"min_self_delegation\": \"1\",\n \"delegator_address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"validator_address\": \"zetavaloper13c7p3xrhd6q2rx3h235jpt8pjdwvacyw7tkass\",\n \"pubkey\": {\n \"@type\": \"/cosmos.crypto.ed25519.PubKey\",\n \"key\": \"ByI4L3eyFD5JbtlCr6HEASaUUMf8PWjLMBYjKd4Zqq8=\"\n },\n \"value\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n }\n ],\n \"memo\": \"9bb63c4104c15f332d0b25d6e982f2dcf389f24f@192.168.2.12:26656\",\n \"timeout_height\": \"0\",\n \"extension_options\": [],\n \"non_critical_extension_options\": []\n },\n \"auth_info\": {\n \"signer_infos\": [\n {\n \"public_key\": {\n \"@type\": \"/cosmos.crypto.secp256k1.PubKey\",\n \"key\": \"A05F6QuFVpb/5KrIPvlHr209ZsD22gW0omhLSXWAtQrh\"\n },\n \"mode_info\": {\n \"single\": {\n \"mode\": \"SIGN_MODE_DIRECT\"\n }\n },\n \"sequence\": \"0\"\n }\n ],\n \"fee\": {\n \"amount\": [],\n \"gas_limit\": \"200000\",\n \"payer\": \"\",\n \"granter\": \"\"\n },\n \"tip\": null\n },\n \"signatures\": [\n \"H0MPTY7zgX9+fscgDgtszGDbjG3llzlGOLb6lrTwfUxm/EO6Wz1eGmc51stq4D0gAGd8u8hSNCQKf5uU8V/Jdw==\"\n ]\n }\n ]\n },\n \"gov\": {\n \"starting_proposal_id\": \"1\",\n \"deposits\": [],\n \"votes\": [],\n \"proposals\": [],\n \"deposit_params\": {\n \"min_deposit\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"10000000\"\n }\n ],\n \"max_deposit_period\": \"172800s\"\n },\n \"voting_params\": {\n \"voting_period\": \"10s\"\n },\n \"tally_params\": {\n \"quorum\": \"0.334000000000000000\",\n \"threshold\": \"0.500000000000000000\",\n \"veto_threshold\": \"0.334000000000000000\"\n }\n },\n \"group\": {\n \"group_seq\": \"0\",\n \"groups\": [],\n \"group_members\": [],\n \"group_policy_seq\": \"0\",\n \"group_policies\": [],\n \"proposal_seq\": \"0\",\n \"proposals\": [],\n \"votes\": []\n },\n \"mint\": {\n \"params\": {\n \"mint_denom\": \"azeta\"\n }\n },\n \"observer\": {\n \"observers\": {\n \"observer_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"nodeAccountList\": [\n {\n \"operator\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"granteeAddress\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\"\n },\n \"nodeStatus\": 4\n },\n {\n \"operator\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"granteeAddress\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n },\n \"nodeStatus\": 4\n }\n ],\n \"crosschain_flags\": {\n \"isInboundEnabled\": true,\n \"isOutboundEnabled\": true\n },\n \"params\": {\n \"observer_params\": [\n {\n \"chain\": {\n \"chain_name\": 2,\n \"chain_id\": 101\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 15,\n \"chain_id\": 18444\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 14,\n \"chain_id\": 1337\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n }\n ],\n \"admin_policy\": [\n {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\"\n },\n {\n \"policy_type\": 1,\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\"\n }\n ],\n \"ballot_maturity_blocks\": 100\n },\n \"keygen\": {\n \"granteePubkeys\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ],\n \"blockNumber\": 5\n },\n \"chain_params_list\": {},\n \"tss\": {},\n \"tss_history\": [],\n \"tss_fund_migrators\": [],\n \"blame_list\": [],\n \"pending_nonces\": [],\n \"chain_nonces\": [],\n \"nonce_to_cctx\": []\n },\n \"params\": null,\n \"slashing\": {\n \"params\": {\n \"signed_blocks_window\": \"100\",\n \"min_signed_per_window\": \"0.500000000000000000\",\n \"downtime_jail_duration\": \"600s\",\n \"slash_fraction_double_sign\": \"0.050000000000000000\",\n \"slash_fraction_downtime\": \"0.010000000000000000\"\n },\n \"signing_infos\": [],\n \"missed_blocks\": []\n },\n \"staking\": {\n \"params\": {\n \"unbonding_time\": \"1814400s\",\n \"max_validators\": 100,\n \"max_entries\": 7,\n \"historical_entries\": 10000,\n \"bond_denom\": \"azeta\",\n \"min_commission_rate\": \"0.000000000000000000\"\n },\n \"last_total_power\": \"0\",\n \"last_validator_powers\": [],\n \"validators\": [],\n \"delegations\": [],\n \"unbonding_delegations\": [],\n \"redelegations\": [],\n \"exported\": false\n },\n \"upgrade\": {},\n \"vesting\": {}\n }\n}") + jsonBlob := []byte("{\n \"genesis_time\": \"2024-04-12T05:07:56.004517Z\",\n \"chain_id\": \"localnet_101-1\",\n \"initial_height\": \"1\",\n \"consensus_params\": {\n \"block\": {\n \"max_bytes\": \"22020096\",\n \"max_gas\": \"10000000\",\n \"time_iota_ms\": \"1000\"\n },\n \"evidence\": {\n \"max_age_num_blocks\": \"100000\",\n \"max_age_duration\": \"172800000000000\",\n \"max_bytes\": \"1048576\"\n },\n \"validator\": {\n \"pub_key_types\": [\n \"ed25519\"\n ]\n },\n \"version\": {}\n },\n \"app_hash\": \"\",\n \"app_state\": {\n \"auth\": {\n \"params\": {\n \"max_memo_characters\": \"256\",\n \"tx_sig_limit\": \"7\",\n \"tx_size_cost_per_byte\": \"10\",\n \"sig_verify_cost_ed25519\": \"590\",\n \"sig_verify_cost_secp256k1\": \"1000\"\n },\n \"accounts\": [\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n }\n ]\n },\n \"authority\": {\n \"policies\": {\n \"items\": [\n {\n \"policy_type\": \"groupEmergency\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": \"groupOperational\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": \"groupAdmin\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n }\n ]\n }\n },\n \"authz\": {\n \"authorization\": [\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n }\n ]\n },\n \"bank\": {\n \"params\": {\n \"send_enabled\": [],\n \"default_send_enabled\": true\n },\n \"balances\": [\n {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n }\n ],\n \"supply\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"8402000000000000000000000\"\n }\n ],\n \"denom_metadata\": []\n },\n \"crisis\": {\n \"constant_fee\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000\"\n }\n },\n \"crosschain\": {\n \"outTxTrackerList\": [],\n \"inTxHashToCctxList\": [],\n \"in_tx_tracker_list\": [],\n \"zeta_accounting\": {\n \"aborted_zeta_amount\": \"0\"\n }\n },\n \"distribution\": {\n \"params\": {\n \"community_tax\": \"0.020000000000000000\",\n \"base_proposer_reward\": \"0.010000000000000000\",\n \"bonus_proposer_reward\": \"0.040000000000000000\",\n \"withdraw_addr_enabled\": true\n },\n \"fee_pool\": {\n \"community_pool\": []\n },\n \"delegator_withdraw_infos\": [],\n \"previous_proposer\": \"\",\n \"outstanding_rewards\": [],\n \"validator_accumulated_commissions\": [],\n \"validator_historical_rewards\": [],\n \"validator_current_rewards\": [],\n \"delegator_starting_infos\": [],\n \"validator_slash_events\": []\n },\n \"emissions\": {\n \"params\": {\n \"max_bond_factor\": \"1.25\",\n \"min_bond_factor\": \"0.75\",\n \"avg_block_time\": \"6.00\",\n \"target_bond_ratio\": \"00.67\",\n \"validator_emission_percentage\": \"00.50\",\n \"observer_emission_percentage\": \"00.25\",\n \"tss_signer_emission_percentage\": \"00.25\",\n \"duration_factor_constant\": \"0.001877876953694702\",\n \"observer_slash_amount\": \"0\"\n },\n \"withdrawableEmissions\": []\n },\n \"evidence\": {\n \"evidence\": []\n },\n \"evm\": {\n \"accounts\": [],\n \"params\": {\n \"evm_denom\": \"azeta\",\n \"enable_create\": true,\n \"enable_call\": true,\n \"extra_eips\": [],\n \"chain_config\": {\n \"homestead_block\": \"0\",\n \"dao_fork_block\": \"0\",\n \"dao_fork_support\": true,\n \"eip150_block\": \"0\",\n \"eip150_hash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n \"eip155_block\": \"0\",\n \"eip158_block\": \"0\",\n \"byzantium_block\": \"0\",\n \"constantinople_block\": \"0\",\n \"petersburg_block\": \"0\",\n \"istanbul_block\": \"0\",\n \"muir_glacier_block\": \"0\",\n \"berlin_block\": \"0\",\n \"london_block\": \"0\",\n \"arrow_glacier_block\": \"0\",\n \"gray_glacier_block\": \"0\",\n \"merge_netsplit_block\": \"0\",\n \"shanghai_block\": \"0\",\n \"cancun_block\": \"0\"\n },\n \"allow_unprotected_txs\": false\n }\n },\n \"feemarket\": {\n \"params\": {\n \"no_base_fee\": false,\n \"base_fee_change_denominator\": 8,\n \"elasticity_multiplier\": 2,\n \"enable_height\": \"0\",\n \"base_fee\": \"1000000000\",\n \"min_gas_price\": \"0.000000000000000000\",\n \"min_gas_multiplier\": \"0.500000000000000000\"\n },\n \"block_gas\": \"0\"\n },\n \"fungible\": {\n \"params\": {},\n \"foreignCoinsList\": [],\n \"systemContract\": null\n },\n \"genutil\": {\n \"gen_txs\": [\n {\n \"body\": {\n \"messages\": [\n {\n \"@type\": \"/cosmos.staking.v1beta1.MsgCreateValidator\",\n \"description\": {\n \"moniker\": \"Zetanode-Localnet\",\n \"identity\": \"\",\n \"website\": \"\",\n \"security_contact\": \"\",\n \"details\": \"\"\n },\n \"commission\": {\n \"rate\": \"0.100000000000000000\",\n \"max_rate\": \"0.200000000000000000\",\n \"max_change_rate\": \"0.010000000000000000\"\n },\n \"min_self_delegation\": \"1\",\n \"delegator_address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"validator_address\": \"zetavaloper13c7p3xrhd6q2rx3h235jpt8pjdwvacyw7tkass\",\n \"pubkey\": {\n \"@type\": \"/cosmos.crypto.ed25519.PubKey\",\n \"key\": \"sBSs5r1vQn1idTp4uRTbdUK0jjmEscI3pn88LUXI4CQ=\"\n },\n \"value\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n }\n ],\n \"memo\": \"1db4f4185e68c1c17d508294de2592616dad37a5@192.168.2.12:26656\",\n \"timeout_height\": \"0\",\n \"extension_options\": [],\n \"non_critical_extension_options\": []\n },\n \"auth_info\": {\n \"signer_infos\": [\n {\n \"public_key\": {\n \"@type\": \"/cosmos.crypto.secp256k1.PubKey\",\n \"key\": \"A05F6QuFVpb/5KrIPvlHr209ZsD22gW0omhLSXWAtQrh\"\n },\n \"mode_info\": {\n \"single\": {\n \"mode\": \"SIGN_MODE_DIRECT\"\n }\n },\n \"sequence\": \"0\"\n }\n ],\n \"fee\": {\n \"amount\": [],\n \"gas_limit\": \"200000\",\n \"payer\": \"\",\n \"granter\": \"\"\n },\n \"tip\": null\n },\n \"signatures\": [\n \"y5YROwZmV0jcgv5BgRJCDE+Kq5OsX8+88or1ogekPLBw3ecPt8GsCeEbPQ24JONLzNwQEIUDNYTeSQnXnCfzyg==\"\n ]\n }\n ]\n },\n \"gov\": {\n \"starting_proposal_id\": \"1\",\n \"deposits\": [],\n \"votes\": [],\n \"proposals\": [],\n \"deposit_params\": {\n \"min_deposit\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"10000000\"\n }\n ],\n \"max_deposit_period\": \"172800s\"\n },\n \"voting_params\": {\n \"voting_period\": \"10s\"\n },\n \"tally_params\": {\n \"quorum\": \"0.334000000000000000\",\n \"threshold\": \"0.500000000000000000\",\n \"veto_threshold\": \"0.334000000000000000\"\n }\n },\n \"group\": {\n \"group_seq\": \"0\",\n \"groups\": [],\n \"group_members\": [],\n \"group_policy_seq\": \"0\",\n \"group_policies\": [],\n \"proposal_seq\": \"0\",\n \"proposals\": [],\n \"votes\": []\n },\n \"mint\": {\n \"params\": {\n \"mint_denom\": \"azeta\"\n }\n },\n \"observer\": {\n \"observers\": {\n \"observer_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"nodeAccountList\": [\n {\n \"operator\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"granteeAddress\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\"\n },\n \"nodeStatus\": 4\n },\n {\n \"operator\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"granteeAddress\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n },\n \"nodeStatus\": 4\n }\n ],\n \"crosschain_flags\": {\n \"isInboundEnabled\": true,\n \"isOutboundEnabled\": true\n },\n \"params\": {\n \"observer_params\": [\n {\n \"chain\": {\n \"chain_name\": 2,\n \"chain_id\": 101\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 15,\n \"chain_id\": 18444\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 14,\n \"chain_id\": 1337\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n }\n ],\n \"admin_policy\": [\n {\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": 1,\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n }\n ],\n \"ballot_maturity_blocks\": 100\n },\n \"keygen\": {\n \"status\": 1,\n \"granteePubkeys\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ]\n },\n \"chain_params_list\": {},\n \"tss\": {\n \"tss_pubkey\": \"zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p\",\n \"tss_participant_list\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ],\n \"operator_address_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"tss_history\": [],\n \"tss_fund_migrators\": [],\n \"blame_list\": [],\n \"pending_nonces\": [],\n \"chain_nonces\": [],\n \"nonce_to_cctx\": []\n },\n \"params\": null,\n \"slashing\": {\n \"params\": {\n \"signed_blocks_window\": \"100\",\n \"min_signed_per_window\": \"0.500000000000000000\",\n \"downtime_jail_duration\": \"600s\",\n \"slash_fraction_double_sign\": \"0.050000000000000000\",\n \"slash_fraction_downtime\": \"0.010000000000000000\"\n },\n \"signing_infos\": [],\n \"missed_blocks\": []\n },\n \"staking\": {\n \"params\": {\n \"unbonding_time\": \"1814400s\",\n \"max_validators\": 100,\n \"max_entries\": 7,\n \"historical_entries\": 10000,\n \"bond_denom\": \"azeta\",\n \"min_commission_rate\": \"0.000000000000000000\"\n },\n \"last_total_power\": \"0\",\n \"last_validator_powers\": [],\n \"validators\": [],\n \"delegations\": [],\n \"unbonding_delegations\": [],\n \"redelegations\": [],\n \"exported\": false\n },\n \"upgrade\": {},\n \"vesting\": {}\n }\n}") genDoc, err := types.GenesisDocFromJSON(jsonBlob) require.NoError(t, err) return genDoc From 26f5e2cda775c9d6e3ce7efa9324e1f3db31caff Mon Sep 17 00:00:00 2001 From: Tanmay Date: Fri, 12 Apr 2024 11:24:45 -0400 Subject: [PATCH 09/16] Fix lint --- cmd/zetacored/parse_genesis.go | 12 ++++++------ cmd/zetacored/parse_genesis_test.go | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index ff752a9ddc..bf672a69d5 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -35,7 +35,7 @@ import ( observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -const Max_items_for_list = 10 +const MaxItemsForList = 10 var Copy = map[string]bool{ slashingtypes.ModuleName: true, @@ -143,9 +143,9 @@ func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importAppState) - importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(Max_items_for_list, len(importedCrossChainGenState.CrossChainTxs))] - importedCrossChainGenState.InTxHashToCctxList = importedCrossChainGenState.InTxHashToCctxList[:math.Min(Max_items_for_list, len(importedCrossChainGenState.InTxHashToCctxList))] - importedCrossChainGenState.FinalizedInbounds = importedCrossChainGenState.FinalizedInbounds[:math.Min(Max_items_for_list, len(importedCrossChainGenState.FinalizedInbounds))] + importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(MaxItemsForList, len(importedCrossChainGenState.CrossChainTxs))] + importedCrossChainGenState.InTxHashToCctxList = importedCrossChainGenState.InTxHashToCctxList[:math.Min(MaxItemsForList, len(importedCrossChainGenState.InTxHashToCctxList))] + importedCrossChainGenState.FinalizedInbounds = importedCrossChainGenState.FinalizedInbounds[:math.Min(MaxItemsForList, len(importedCrossChainGenState.FinalizedInbounds))] importedCrossChainStateBz, err := json.Marshal(importedCrossChainGenState) if err != nil { return fmt.Errorf("failed to marshal zetacrosschain genesis state: %w", err) @@ -156,8 +156,8 @@ func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState m func ModifyObserverState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedObserverGenState := observertypes.GetGenesisStateFromAppState(cdc, importAppState) - importedObserverGenState.Ballots = importedObserverGenState.Ballots[:math.Min(Max_items_for_list, len(importedObserverGenState.Ballots))] - importedObserverGenState.NonceToCctx = importedObserverGenState.NonceToCctx[:math.Min(Max_items_for_list, len(importedObserverGenState.NonceToCctx))] + importedObserverGenState.Ballots = importedObserverGenState.Ballots[:math.Min(MaxItemsForList, len(importedObserverGenState.Ballots))] + importedObserverGenState.NonceToCctx = importedObserverGenState.NonceToCctx[:math.Min(MaxItemsForList, len(importedObserverGenState.NonceToCctx))] currentGenState := observertypes.GetGenesisStateFromAppState(cdc, appState) currentGenState.Ballots = importedObserverGenState.Ballots diff --git a/cmd/zetacored/parse_genesis_test.go b/cmd/zetacored/parse_genesis_test.go index 3c51a2da04..469b57c0ba 100644 --- a/cmd/zetacored/parse_genesis_test.go +++ b/cmd/zetacored/parse_genesis_test.go @@ -72,8 +72,8 @@ func Test_ModifyObserverState(t *testing.T) { require.NoError(t, err) modifiedObserverAppState := observertypes.GetGenesisStateFromAppState(cdc, appState) - require.Len(t, modifiedObserverAppState.Ballots, zetacored.Max_items_for_list) - require.Len(t, modifiedObserverAppState.NonceToCctx, zetacored.Max_items_for_list) + require.Len(t, modifiedObserverAppState.Ballots, zetacored.MaxItemsForList) + require.Len(t, modifiedObserverAppState.NonceToCctx, zetacored.MaxItemsForList) }) t.Run("successfully modify observer state without changing data when not needed", func(t *testing.T) { @@ -104,9 +104,9 @@ func Test_ImportDataIntoFile(t *testing.T) { // Crosschain module is in Modify list crosschainStateAfterImport := crosschaintypes.GetGenesisStateFromAppState(cdc, appState) - require.Len(t, crosschainStateAfterImport.CrossChainTxs, zetacored.Max_items_for_list) - require.Len(t, crosschainStateAfterImport.InTxHashToCctxList, zetacored.Max_items_for_list) - require.Len(t, crosschainStateAfterImport.FinalizedInbounds, zetacored.Max_items_for_list) + require.Len(t, crosschainStateAfterImport.CrossChainTxs, zetacored.MaxItemsForList) + require.Len(t, crosschainStateAfterImport.InTxHashToCctxList, zetacored.MaxItemsForList) + require.Len(t, crosschainStateAfterImport.FinalizedInbounds, zetacored.MaxItemsForList) // Bank module is in Skip list var bankStateAfterImport banktypes.GenesisState From 017048fc389f52121b9c31f5dea25d1bd6bed9e8 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 17 Apr 2024 12:01:03 -0400 Subject: [PATCH 10/16] Update cmd/zetacored/parse_genesis.go Co-authored-by: Lucas Bertrand --- cmd/zetacored/parse_genesis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index bf672a69d5..7c160aef18 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -141,7 +141,7 @@ func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, return nil } -func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { +func ModifyCrosschainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importAppState) importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(MaxItemsForList, len(importedCrossChainGenState.CrossChainTxs))] importedCrossChainGenState.InTxHashToCctxList = importedCrossChainGenState.InTxHashToCctxList[:math.Min(MaxItemsForList, len(importedCrossChainGenState.InTxHashToCctxList))] From 6d97efda4221d765390693ffe1f65136354d1b8b Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 17 Apr 2024 12:09:59 -0400 Subject: [PATCH 11/16] add more comments --- cmd/zetacored/parse_genesis.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index bf672a69d5..b25443460a 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -37,6 +37,7 @@ import ( const MaxItemsForList = 10 +// Copy represents a set of modules for which, the entire state is copied without any modifications var Copy = map[string]bool{ slashingtypes.ModuleName: true, govtypes.ModuleName: true, @@ -50,6 +51,8 @@ var Copy = map[string]bool{ emissionsModuleTypes.ModuleName: true, authz.ModuleName: true, } + +// Skip represents a set of modules for which, the entire state is skipped and nothing gets imported var Skip = map[string]bool{ evmtypes.ModuleName: true, stakingtypes.ModuleName: true, @@ -60,6 +63,7 @@ var Skip = map[string]bool{ group.ModuleName: true, } +// Modify represents a set of modules for which, the state is modified before importing. Each Module should have a corresponding Modify function var Modify = map[string]bool{ crosschaintypes.ModuleName: true, observertypes.ModuleName: true, @@ -141,6 +145,8 @@ func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, return nil } +// ModifyCrossChainState modifies the crosschain state before importing +// It truncates the crosschain transactions, inbound transactions and finalized inbounds to MaxItemsForList func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importAppState) importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(MaxItemsForList, len(importedCrossChainGenState.CrossChainTxs))] @@ -154,6 +160,8 @@ func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState m return nil } +// ModifyObserverState modifies the observer state before importing +// It truncates the ballots and nonce to cctx list to MaxItemsForList func ModifyObserverState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedObserverGenState := observertypes.GetGenesisStateFromAppState(cdc, importAppState) importedObserverGenState.Ballots = importedObserverGenState.Ballots[:math.Min(MaxItemsForList, len(importedObserverGenState.Ballots))] From b8d51418bf8bd06e46373ace546bd62af7508cf2 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 17 Apr 2024 12:12:04 -0400 Subject: [PATCH 12/16] add more comments --- cmd/zetacored/parse_genesis.go | 6 +++--- cmd/zetacored/parse_genesis_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index b25443460a..b94c5645a1 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -121,7 +121,7 @@ func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, if Modify[m] { switch m { case crosschaintypes.ModuleName: - err := ModifyCrossChainState(appState, importAppState, cdc) + err := ModifyCrosschainState(appState, importAppState, cdc) if err != nil { return err } @@ -145,9 +145,9 @@ func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, return nil } -// ModifyCrossChainState modifies the crosschain state before importing +// ModifyCrosschainState modifies the crosschain state before importing // It truncates the crosschain transactions, inbound transactions and finalized inbounds to MaxItemsForList -func ModifyCrossChainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { +func ModifyCrosschainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importAppState) importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(MaxItemsForList, len(importedCrossChainGenState.CrossChainTxs))] importedCrossChainGenState.InTxHashToCctxList = importedCrossChainGenState.InTxHashToCctxList[:math.Min(MaxItemsForList, len(importedCrossChainGenState.InTxHashToCctxList))] diff --git a/cmd/zetacored/parse_genesis_test.go b/cmd/zetacored/parse_genesis_test.go index 469b57c0ba..76a9e1247f 100644 --- a/cmd/zetacored/parse_genesis_test.go +++ b/cmd/zetacored/parse_genesis_test.go @@ -39,7 +39,7 @@ func Test_ModifyCrossChainState(t *testing.T) { cdc := keepertest.NewCodec() appState := sample.AppState(t) importData := GetImportData(t, cdc, 100) - err := zetacored.ModifyCrossChainState(appState, importData, cdc) + err := zetacored.ModifyCrosschainState(appState, importData, cdc) require.NoError(t, err) modifiedCrosschainAppState := crosschaintypes.GetGenesisStateFromAppState(cdc, appState) @@ -52,7 +52,7 @@ func Test_ModifyCrossChainState(t *testing.T) { cdc := keepertest.NewCodec() appState := sample.AppState(t) importData := GetImportData(t, cdc, 8) - err := zetacored.ModifyCrossChainState(appState, importData, cdc) + err := zetacored.ModifyCrosschainState(appState, importData, cdc) require.NoError(t, err) modifiedCrosschainAppState := crosschaintypes.GetGenesisStateFromAppState(cdc, appState) From 344c256825d9688d4dd2d3755d24f82fe8d78c64 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 18 Apr 2024 23:58:56 -0400 Subject: [PATCH 13/16] add error checks --- cmd/zetacored/parse_genesis.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index b94c5645a1..617de0c7c8 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -82,8 +82,13 @@ func CmdParseGenesisFile() *cobra.Command { genesisFilePath = args[1] } genDoc, err := GetGenDoc(genesisFilePath) + if err != nil { + return err + } importData, err := GetGenDoc(args[0]) - + if err != nil { + return err + } err = ImportDataIntoFile(genDoc, importData, cdc) if err != nil { return err From 78cedc73fd3a5e04bbf0189c60118fc14bdd243c Mon Sep 17 00:00:00 2001 From: Tanmay Date: Fri, 19 Apr 2024 09:54:18 -0400 Subject: [PATCH 14/16] Update cmd/zetacored/parse_genesis.go Co-authored-by: Lucas Bertrand --- cmd/zetacored/parse_genesis.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index 617de0c7c8..c8477ce52a 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -30,8 +30,8 @@ import ( "github.com/tendermint/tendermint/types" "github.com/zeta-chain/zetacore/app" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" - emissionsModuleTypes "github.com/zeta-chain/zetacore/x/emissions/types" - fungibleModuleTypes "github.com/zeta-chain/zetacore/x/fungible/types" + emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" + fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) From 5f3e3024815336f63a13e989606de9b61b4daf34 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Fri, 19 Apr 2024 15:17:14 -0400 Subject: [PATCH 15/16] generate files --- cmd/zetacored/parse_genesis.go | 22 ++++---- docs/cli/zetacored/zetacored.md | 1 - .../zetacored/zetacored_parse-genesis-file.md | 27 ---------- docs/cli/zetacored/zetacored_query.md | 1 - .../zetacored/zetacored_query_crosschain.md | 1 - ...uery_crosschain_update_rate_limit_flags.md | 33 ------------ .../cli/zetacored/zetacored_query_fungible.md | 1 + ....md => zetacored_query_fungible_params.md} | 10 ++-- .../zetacored/zetacored_query_lightclient.md | 33 ------------ ...red_query_lightclient_list-block-header.md | 33 ------------ ...red_query_lightclient_show-block-header.md | 33 ------------ ...ored_query_lightclient_show-chain-state.md | 33 ------------ ...ery_lightclient_show-verification-flags.md | 33 ------------ docs/cli/zetacored/zetacored_tx.md | 1 - .../cli/zetacored/zetacored_tx_lightclient.md | 29 ----------- ...x_lightclient_update-verification-flags.md | 52 ------------------- 16 files changed, 17 insertions(+), 326 deletions(-) delete mode 100644 docs/cli/zetacored/zetacored_parse-genesis-file.md delete mode 100644 docs/cli/zetacored/zetacored_query_crosschain_update_rate_limit_flags.md rename docs/cli/zetacored/{zetacored_query_lightclient_list-chain-state.md => zetacored_query_fungible_params.md} (74%) delete mode 100644 docs/cli/zetacored/zetacored_query_lightclient.md delete mode 100644 docs/cli/zetacored/zetacored_query_lightclient_list-block-header.md delete mode 100644 docs/cli/zetacored/zetacored_query_lightclient_show-block-header.md delete mode 100644 docs/cli/zetacored/zetacored_query_lightclient_show-chain-state.md delete mode 100644 docs/cli/zetacored/zetacored_query_lightclient_show-verification-flags.md delete mode 100644 docs/cli/zetacored/zetacored_tx_lightclient.md delete mode 100644 docs/cli/zetacored/zetacored_tx_lightclient_update-verification-flags.md diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index c8477ce52a..d0529b64d8 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -39,17 +39,17 @@ const MaxItemsForList = 10 // Copy represents a set of modules for which, the entire state is copied without any modifications var Copy = map[string]bool{ - slashingtypes.ModuleName: true, - govtypes.ModuleName: true, - crisistypes.ModuleName: true, - feemarkettypes.ModuleName: true, - paramstypes.ModuleName: true, - upgradetypes.ModuleName: true, - evidencetypes.ModuleName: true, - vestingtypes.ModuleName: true, - fungibleModuleTypes.ModuleName: true, - emissionsModuleTypes.ModuleName: true, - authz.ModuleName: true, + slashingtypes.ModuleName: true, + govtypes.ModuleName: true, + crisistypes.ModuleName: true, + feemarkettypes.ModuleName: true, + paramstypes.ModuleName: true, + upgradetypes.ModuleName: true, + evidencetypes.ModuleName: true, + vestingtypes.ModuleName: true, + fungibletypes.ModuleName: true, + emissionstypes.ModuleName: true, + authz.ModuleName: true, } // Skip represents a set of modules for which, the entire state is skipped and nothing gets imported diff --git a/docs/cli/zetacored/zetacored.md b/docs/cli/zetacored/zetacored.md index f501a6a46b..4b5f360d55 100644 --- a/docs/cli/zetacored/zetacored.md +++ b/docs/cli/zetacored/zetacored.md @@ -29,7 +29,6 @@ Zetacore Daemon (server) * [zetacored index-eth-tx](zetacored_index-eth-tx.md) - Index historical eth txs * [zetacored init](zetacored_init.md) - Initialize private validator, p2p, genesis, and application configuration files * [zetacored keys](zetacored_keys.md) - Manage your application's keys -* [zetacored parse-genesis-file](zetacored_parse-genesis-file.md) - Parse the provided genesis file and import the required data into the optionally provided genesis file * [zetacored query](zetacored_query.md) - Querying subcommands * [zetacored rollback](zetacored_rollback.md) - rollback cosmos-sdk and tendermint state by one height * [zetacored rosetta](zetacored_rosetta.md) - spin up a rosetta server diff --git a/docs/cli/zetacored/zetacored_parse-genesis-file.md b/docs/cli/zetacored/zetacored_parse-genesis-file.md deleted file mode 100644 index b35a5c6b97..0000000000 --- a/docs/cli/zetacored/zetacored_parse-genesis-file.md +++ /dev/null @@ -1,27 +0,0 @@ -# parse-genesis-file - -Parse the provided genesis file and import the required data into the optionally provided genesis file - -``` -zetacored parse-genesis-file [import-genesis-file] [optional-genesis-file] [flags] -``` - -### Options - -``` - -h, --help help for parse-genesis-file -``` - -### Options inherited from parent commands - -``` - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored](zetacored.md) - Zetacore Daemon (server) - diff --git a/docs/cli/zetacored/zetacored_query.md b/docs/cli/zetacored/zetacored_query.md index 2e390d1fa0..cb6eb60fde 100644 --- a/docs/cli/zetacored/zetacored_query.md +++ b/docs/cli/zetacored/zetacored_query.md @@ -40,7 +40,6 @@ zetacored query [flags] * [zetacored query fungible](zetacored_query_fungible.md) - Querying commands for the fungible module * [zetacored query gov](zetacored_query_gov.md) - Querying commands for the governance module * [zetacored query group](zetacored_query_group.md) - Querying commands for the group module -* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module * [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module * [zetacored query params](zetacored_query_params.md) - Querying commands for the params module * [zetacored query slashing](zetacored_query_slashing.md) - Querying commands for the slashing module diff --git a/docs/cli/zetacored/zetacored_query_crosschain.md b/docs/cli/zetacored/zetacored_query_crosschain.md index 48345c136d..db80778e2a 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain.md +++ b/docs/cli/zetacored/zetacored_query_crosschain.md @@ -39,5 +39,4 @@ zetacored query crosschain [flags] * [zetacored query crosschain show-gas-price](zetacored_query_crosschain_show-gas-price.md) - shows a gasPrice * [zetacored query crosschain show-in-tx-hash-to-cctx](zetacored_query_crosschain_show-in-tx-hash-to-cctx.md) - shows a inTxHashToCctx * [zetacored query crosschain show-out-tx-tracker](zetacored_query_crosschain_show-out-tx-tracker.md) - shows a OutTxTracker -* [zetacored query crosschain update_rate_limit_flags](zetacored_query_crosschain_update_rate_limit_flags.md) - shows the rate limiter flags diff --git a/docs/cli/zetacored/zetacored_query_crosschain_update_rate_limit_flags.md b/docs/cli/zetacored/zetacored_query_crosschain_update_rate_limit_flags.md deleted file mode 100644 index a4455cc6b0..0000000000 --- a/docs/cli/zetacored/zetacored_query_crosschain_update_rate_limit_flags.md +++ /dev/null @@ -1,33 +0,0 @@ -# query crosschain update_rate_limit_flags - -shows the rate limiter flags - -``` -zetacored query crosschain update_rate_limit_flags [flags] -``` - -### Options - -``` - --grpc-addr string the gRPC endpoint to use for this chain - --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS - --height int Use a specific height to query state at (this can error if the node is pruning state) - -h, --help help for update_rate_limit_flags - --node string [host]:[port] to Tendermint RPC interface for this chain - -o, --output string Output format (text|json) -``` - -### Options inherited from parent commands - -``` - --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored query crosschain](zetacored_query_crosschain.md) - Querying commands for the crosschain module - diff --git a/docs/cli/zetacored/zetacored_query_fungible.md b/docs/cli/zetacored/zetacored_query_fungible.md index 9ac579947a..52d7ccc81e 100644 --- a/docs/cli/zetacored/zetacored_query_fungible.md +++ b/docs/cli/zetacored/zetacored_query_fungible.md @@ -30,6 +30,7 @@ zetacored query fungible [flags] * [zetacored query fungible gas-stability-pool-balance](zetacored_query_fungible_gas-stability-pool-balance.md) - query the balance of a gas stability pool for a chain * [zetacored query fungible gas-stability-pool-balances](zetacored_query_fungible_gas-stability-pool-balances.md) - query all gas stability pool balances * [zetacored query fungible list-foreign-coins](zetacored_query_fungible_list-foreign-coins.md) - list all ForeignCoins +* [zetacored query fungible params](zetacored_query_fungible_params.md) - shows the parameters of the module * [zetacored query fungible show-foreign-coins](zetacored_query_fungible_show-foreign-coins.md) - shows a ForeignCoins * [zetacored query fungible system-contract](zetacored_query_fungible_system-contract.md) - query system contract diff --git a/docs/cli/zetacored/zetacored_query_lightclient_list-chain-state.md b/docs/cli/zetacored/zetacored_query_fungible_params.md similarity index 74% rename from docs/cli/zetacored/zetacored_query_lightclient_list-chain-state.md rename to docs/cli/zetacored/zetacored_query_fungible_params.md index eead2bf7a0..9845c39cf3 100644 --- a/docs/cli/zetacored/zetacored_query_lightclient_list-chain-state.md +++ b/docs/cli/zetacored/zetacored_query_fungible_params.md @@ -1,9 +1,9 @@ -# query lightclient list-chain-state +# query fungible params -List all the chain states +shows the parameters of the module ``` -zetacored query lightclient list-chain-state [flags] +zetacored query fungible params [flags] ``` ### Options @@ -12,7 +12,7 @@ zetacored query lightclient list-chain-state [flags] --grpc-addr string the gRPC endpoint to use for this chain --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS --height int Use a specific height to query state at (this can error if the node is pruning state) - -h, --help help for list-chain-state + -h, --help help for params --node string [host]:[port] to Tendermint RPC interface for this chain -o, --output string Output format (text|json) ``` @@ -29,5 +29,5 @@ zetacored query lightclient list-chain-state [flags] ### SEE ALSO -* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module +* [zetacored query fungible](zetacored_query_fungible.md) - Querying commands for the fungible module diff --git a/docs/cli/zetacored/zetacored_query_lightclient.md b/docs/cli/zetacored/zetacored_query_lightclient.md deleted file mode 100644 index a576a4e71b..0000000000 --- a/docs/cli/zetacored/zetacored_query_lightclient.md +++ /dev/null @@ -1,33 +0,0 @@ -# query lightclient - -Querying commands for the lightclient module - -``` -zetacored query lightclient [flags] -``` - -### Options - -``` - -h, --help help for lightclient -``` - -### Options inherited from parent commands - -``` - --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored query](zetacored_query.md) - Querying subcommands -* [zetacored query lightclient list-block-header](zetacored_query_lightclient_list-block-header.md) - List all the block headers -* [zetacored query lightclient list-chain-state](zetacored_query_lightclient_list-chain-state.md) - List all the chain states -* [zetacored query lightclient show-block-header](zetacored_query_lightclient_show-block-header.md) - Show a block header from its hash -* [zetacored query lightclient show-chain-state](zetacored_query_lightclient_show-chain-state.md) - Show a chain state from its chain id -* [zetacored query lightclient show-verification-flags](zetacored_query_lightclient_show-verification-flags.md) - Show the verification flags - diff --git a/docs/cli/zetacored/zetacored_query_lightclient_list-block-header.md b/docs/cli/zetacored/zetacored_query_lightclient_list-block-header.md deleted file mode 100644 index ade0e06c62..0000000000 --- a/docs/cli/zetacored/zetacored_query_lightclient_list-block-header.md +++ /dev/null @@ -1,33 +0,0 @@ -# query lightclient list-block-header - -List all the block headers - -``` -zetacored query lightclient list-block-header [flags] -``` - -### Options - -``` - --grpc-addr string the gRPC endpoint to use for this chain - --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS - --height int Use a specific height to query state at (this can error if the node is pruning state) - -h, --help help for list-block-header - --node string [host]:[port] to Tendermint RPC interface for this chain - -o, --output string Output format (text|json) -``` - -### Options inherited from parent commands - -``` - --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module - diff --git a/docs/cli/zetacored/zetacored_query_lightclient_show-block-header.md b/docs/cli/zetacored/zetacored_query_lightclient_show-block-header.md deleted file mode 100644 index 10d89a7794..0000000000 --- a/docs/cli/zetacored/zetacored_query_lightclient_show-block-header.md +++ /dev/null @@ -1,33 +0,0 @@ -# query lightclient show-block-header - -Show a block header from its hash - -``` -zetacored query lightclient show-block-header [block-hash] [flags] -``` - -### Options - -``` - --grpc-addr string the gRPC endpoint to use for this chain - --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS - --height int Use a specific height to query state at (this can error if the node is pruning state) - -h, --help help for show-block-header - --node string [host]:[port] to Tendermint RPC interface for this chain - -o, --output string Output format (text|json) -``` - -### Options inherited from parent commands - -``` - --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module - diff --git a/docs/cli/zetacored/zetacored_query_lightclient_show-chain-state.md b/docs/cli/zetacored/zetacored_query_lightclient_show-chain-state.md deleted file mode 100644 index 7647726bb9..0000000000 --- a/docs/cli/zetacored/zetacored_query_lightclient_show-chain-state.md +++ /dev/null @@ -1,33 +0,0 @@ -# query lightclient show-chain-state - -Show a chain state from its chain id - -``` -zetacored query lightclient show-chain-state [chain-id] [flags] -``` - -### Options - -``` - --grpc-addr string the gRPC endpoint to use for this chain - --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS - --height int Use a specific height to query state at (this can error if the node is pruning state) - -h, --help help for show-chain-state - --node string [host]:[port] to Tendermint RPC interface for this chain - -o, --output string Output format (text|json) -``` - -### Options inherited from parent commands - -``` - --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module - diff --git a/docs/cli/zetacored/zetacored_query_lightclient_show-verification-flags.md b/docs/cli/zetacored/zetacored_query_lightclient_show-verification-flags.md deleted file mode 100644 index d8e8d97527..0000000000 --- a/docs/cli/zetacored/zetacored_query_lightclient_show-verification-flags.md +++ /dev/null @@ -1,33 +0,0 @@ -# query lightclient show-verification-flags - -Show the verification flags - -``` -zetacored query lightclient show-verification-flags [flags] -``` - -### Options - -``` - --grpc-addr string the gRPC endpoint to use for this chain - --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS - --height int Use a specific height to query state at (this can error if the node is pruning state) - -h, --help help for show-verification-flags - --node string [host]:[port] to Tendermint RPC interface for this chain - -o, --output string Output format (text|json) -``` - -### Options inherited from parent commands - -``` - --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module - diff --git a/docs/cli/zetacored/zetacored_tx.md b/docs/cli/zetacored/zetacored_tx.md index dc2801a1f6..d0c41e4937 100644 --- a/docs/cli/zetacored/zetacored_tx.md +++ b/docs/cli/zetacored/zetacored_tx.md @@ -40,7 +40,6 @@ zetacored tx [flags] * [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands * [zetacored tx gov](zetacored_tx_gov.md) - Governance transactions subcommands * [zetacored tx group](zetacored_tx_group.md) - Group transaction subcommands -* [zetacored tx lightclient](zetacored_tx_lightclient.md) - lightclient transactions subcommands * [zetacored tx multi-sign](zetacored_tx_multi-sign.md) - Generate multisig signatures for transactions generated offline * [zetacored tx multisign-batch](zetacored_tx_multisign-batch.md) - Assemble multisig transactions in batch from batch signatures * [zetacored tx observer](zetacored_tx_observer.md) - observer transactions subcommands diff --git a/docs/cli/zetacored/zetacored_tx_lightclient.md b/docs/cli/zetacored/zetacored_tx_lightclient.md deleted file mode 100644 index 3bdada0122..0000000000 --- a/docs/cli/zetacored/zetacored_tx_lightclient.md +++ /dev/null @@ -1,29 +0,0 @@ -# tx lightclient - -lightclient transactions subcommands - -``` -zetacored tx lightclient [flags] -``` - -### Options - -``` - -h, --help help for lightclient -``` - -### Options inherited from parent commands - -``` - --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored tx](zetacored_tx.md) - Transactions subcommands -* [zetacored tx lightclient update-verification-flags](zetacored_tx_lightclient_update-verification-flags.md) - Update verification flags - diff --git a/docs/cli/zetacored/zetacored_tx_lightclient_update-verification-flags.md b/docs/cli/zetacored/zetacored_tx_lightclient_update-verification-flags.md deleted file mode 100644 index 08222afc69..0000000000 --- a/docs/cli/zetacored/zetacored_tx_lightclient_update-verification-flags.md +++ /dev/null @@ -1,52 +0,0 @@ -# tx lightclient update-verification-flags - -Update verification flags - -``` -zetacored tx lightclient update-verification-flags [eth-type-chain-enabled] [btc-type-chain-enabled] [flags] -``` - -### Options - -``` - -a, --account-number uint The account number of the signing account (offline mode only) - --aux Generate aux signer data instead of sending a tx - -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) - --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) - --fee-granter string Fee granter grants fees for the transaction - --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer - --fees string Fees to pay along with transaction; eg: 10uatom - --from string Name or address of private key with which to sign - --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) - --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) - --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) - --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) - -h, --help help for update-verification-flags - --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) - --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used - --ledger Use a connected Ledger device - --node string [host]:[port] to tendermint rpc interface for this chain - --note string Note to add a description to the transaction (previously --memo) - --offline Offline mode (does not allow any online functionality) - -o, --output string Output format (text|json) - -s, --sequence uint The sequence number of the signing account (offline mode only) - --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature - --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height - --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator - -y, --yes Skip tx broadcasting prompt confirmation -``` - -### Options inherited from parent commands - -``` - --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored tx lightclient](zetacored_tx_lightclient.md) - lightclient transactions subcommands - From 0a25acb2441c6ff4440be6dd3ad65487435782dc Mon Sep 17 00:00:00 2001 From: Tanmay Date: Fri, 19 Apr 2024 15:29:33 -0400 Subject: [PATCH 16/16] generate files --- docs/cli/zetacored/zetacored.md | 1 + .../zetacored/zetacored_parse-genesis-file.md | 27 ++++++++++ docs/cli/zetacored/zetacored_query.md | 1 + .../zetacored/zetacored_query_crosschain.md | 1 + ...uery_crosschain_update_rate_limit_flags.md | 33 ++++++++++++ .../cli/zetacored/zetacored_query_fungible.md | 1 - .../zetacored/zetacored_query_lightclient.md | 33 ++++++++++++ ...red_query_lightclient_list-block-header.md | 33 ++++++++++++ ...red_query_lightclient_list-chain-state.md} | 10 ++-- ...red_query_lightclient_show-block-header.md | 33 ++++++++++++ ...ored_query_lightclient_show-chain-state.md | 33 ++++++++++++ ...ery_lightclient_show-verification-flags.md | 33 ++++++++++++ docs/cli/zetacored/zetacored_tx.md | 1 + .../cli/zetacored/zetacored_tx_lightclient.md | 29 +++++++++++ ...x_lightclient_update-verification-flags.md | 52 +++++++++++++++++++ 15 files changed, 315 insertions(+), 6 deletions(-) create mode 100644 docs/cli/zetacored/zetacored_parse-genesis-file.md create mode 100644 docs/cli/zetacored/zetacored_query_crosschain_update_rate_limit_flags.md create mode 100644 docs/cli/zetacored/zetacored_query_lightclient.md create mode 100644 docs/cli/zetacored/zetacored_query_lightclient_list-block-header.md rename docs/cli/zetacored/{zetacored_query_fungible_params.md => zetacored_query_lightclient_list-chain-state.md} (74%) create mode 100644 docs/cli/zetacored/zetacored_query_lightclient_show-block-header.md create mode 100644 docs/cli/zetacored/zetacored_query_lightclient_show-chain-state.md create mode 100644 docs/cli/zetacored/zetacored_query_lightclient_show-verification-flags.md create mode 100644 docs/cli/zetacored/zetacored_tx_lightclient.md create mode 100644 docs/cli/zetacored/zetacored_tx_lightclient_update-verification-flags.md diff --git a/docs/cli/zetacored/zetacored.md b/docs/cli/zetacored/zetacored.md index 4b5f360d55..f501a6a46b 100644 --- a/docs/cli/zetacored/zetacored.md +++ b/docs/cli/zetacored/zetacored.md @@ -29,6 +29,7 @@ Zetacore Daemon (server) * [zetacored index-eth-tx](zetacored_index-eth-tx.md) - Index historical eth txs * [zetacored init](zetacored_init.md) - Initialize private validator, p2p, genesis, and application configuration files * [zetacored keys](zetacored_keys.md) - Manage your application's keys +* [zetacored parse-genesis-file](zetacored_parse-genesis-file.md) - Parse the provided genesis file and import the required data into the optionally provided genesis file * [zetacored query](zetacored_query.md) - Querying subcommands * [zetacored rollback](zetacored_rollback.md) - rollback cosmos-sdk and tendermint state by one height * [zetacored rosetta](zetacored_rosetta.md) - spin up a rosetta server diff --git a/docs/cli/zetacored/zetacored_parse-genesis-file.md b/docs/cli/zetacored/zetacored_parse-genesis-file.md new file mode 100644 index 0000000000..b35a5c6b97 --- /dev/null +++ b/docs/cli/zetacored/zetacored_parse-genesis-file.md @@ -0,0 +1,27 @@ +# parse-genesis-file + +Parse the provided genesis file and import the required data into the optionally provided genesis file + +``` +zetacored parse-genesis-file [import-genesis-file] [optional-genesis-file] [flags] +``` + +### Options + +``` + -h, --help help for parse-genesis-file +``` + +### Options inherited from parent commands + +``` + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored](zetacored.md) - Zetacore Daemon (server) + diff --git a/docs/cli/zetacored/zetacored_query.md b/docs/cli/zetacored/zetacored_query.md index cb6eb60fde..2e390d1fa0 100644 --- a/docs/cli/zetacored/zetacored_query.md +++ b/docs/cli/zetacored/zetacored_query.md @@ -40,6 +40,7 @@ zetacored query [flags] * [zetacored query fungible](zetacored_query_fungible.md) - Querying commands for the fungible module * [zetacored query gov](zetacored_query_gov.md) - Querying commands for the governance module * [zetacored query group](zetacored_query_group.md) - Querying commands for the group module +* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module * [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module * [zetacored query params](zetacored_query_params.md) - Querying commands for the params module * [zetacored query slashing](zetacored_query_slashing.md) - Querying commands for the slashing module diff --git a/docs/cli/zetacored/zetacored_query_crosschain.md b/docs/cli/zetacored/zetacored_query_crosschain.md index db80778e2a..48345c136d 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain.md +++ b/docs/cli/zetacored/zetacored_query_crosschain.md @@ -39,4 +39,5 @@ zetacored query crosschain [flags] * [zetacored query crosschain show-gas-price](zetacored_query_crosschain_show-gas-price.md) - shows a gasPrice * [zetacored query crosschain show-in-tx-hash-to-cctx](zetacored_query_crosschain_show-in-tx-hash-to-cctx.md) - shows a inTxHashToCctx * [zetacored query crosschain show-out-tx-tracker](zetacored_query_crosschain_show-out-tx-tracker.md) - shows a OutTxTracker +* [zetacored query crosschain update_rate_limit_flags](zetacored_query_crosschain_update_rate_limit_flags.md) - shows the rate limiter flags diff --git a/docs/cli/zetacored/zetacored_query_crosschain_update_rate_limit_flags.md b/docs/cli/zetacored/zetacored_query_crosschain_update_rate_limit_flags.md new file mode 100644 index 0000000000..a4455cc6b0 --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_crosschain_update_rate_limit_flags.md @@ -0,0 +1,33 @@ +# query crosschain update_rate_limit_flags + +shows the rate limiter flags + +``` +zetacored query crosschain update_rate_limit_flags [flags] +``` + +### Options + +``` + --grpc-addr string the gRPC endpoint to use for this chain + --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS + --height int Use a specific height to query state at (this can error if the node is pruning state) + -h, --help help for update_rate_limit_flags + --node string [host]:[port] to Tendermint RPC interface for this chain + -o, --output string Output format (text|json) +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query crosschain](zetacored_query_crosschain.md) - Querying commands for the crosschain module + diff --git a/docs/cli/zetacored/zetacored_query_fungible.md b/docs/cli/zetacored/zetacored_query_fungible.md index 52d7ccc81e..9ac579947a 100644 --- a/docs/cli/zetacored/zetacored_query_fungible.md +++ b/docs/cli/zetacored/zetacored_query_fungible.md @@ -30,7 +30,6 @@ zetacored query fungible [flags] * [zetacored query fungible gas-stability-pool-balance](zetacored_query_fungible_gas-stability-pool-balance.md) - query the balance of a gas stability pool for a chain * [zetacored query fungible gas-stability-pool-balances](zetacored_query_fungible_gas-stability-pool-balances.md) - query all gas stability pool balances * [zetacored query fungible list-foreign-coins](zetacored_query_fungible_list-foreign-coins.md) - list all ForeignCoins -* [zetacored query fungible params](zetacored_query_fungible_params.md) - shows the parameters of the module * [zetacored query fungible show-foreign-coins](zetacored_query_fungible_show-foreign-coins.md) - shows a ForeignCoins * [zetacored query fungible system-contract](zetacored_query_fungible_system-contract.md) - query system contract diff --git a/docs/cli/zetacored/zetacored_query_lightclient.md b/docs/cli/zetacored/zetacored_query_lightclient.md new file mode 100644 index 0000000000..a576a4e71b --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_lightclient.md @@ -0,0 +1,33 @@ +# query lightclient + +Querying commands for the lightclient module + +``` +zetacored query lightclient [flags] +``` + +### Options + +``` + -h, --help help for lightclient +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query](zetacored_query.md) - Querying subcommands +* [zetacored query lightclient list-block-header](zetacored_query_lightclient_list-block-header.md) - List all the block headers +* [zetacored query lightclient list-chain-state](zetacored_query_lightclient_list-chain-state.md) - List all the chain states +* [zetacored query lightclient show-block-header](zetacored_query_lightclient_show-block-header.md) - Show a block header from its hash +* [zetacored query lightclient show-chain-state](zetacored_query_lightclient_show-chain-state.md) - Show a chain state from its chain id +* [zetacored query lightclient show-verification-flags](zetacored_query_lightclient_show-verification-flags.md) - Show the verification flags + diff --git a/docs/cli/zetacored/zetacored_query_lightclient_list-block-header.md b/docs/cli/zetacored/zetacored_query_lightclient_list-block-header.md new file mode 100644 index 0000000000..ade0e06c62 --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_lightclient_list-block-header.md @@ -0,0 +1,33 @@ +# query lightclient list-block-header + +List all the block headers + +``` +zetacored query lightclient list-block-header [flags] +``` + +### Options + +``` + --grpc-addr string the gRPC endpoint to use for this chain + --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS + --height int Use a specific height to query state at (this can error if the node is pruning state) + -h, --help help for list-block-header + --node string [host]:[port] to Tendermint RPC interface for this chain + -o, --output string Output format (text|json) +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module + diff --git a/docs/cli/zetacored/zetacored_query_fungible_params.md b/docs/cli/zetacored/zetacored_query_lightclient_list-chain-state.md similarity index 74% rename from docs/cli/zetacored/zetacored_query_fungible_params.md rename to docs/cli/zetacored/zetacored_query_lightclient_list-chain-state.md index 9845c39cf3..eead2bf7a0 100644 --- a/docs/cli/zetacored/zetacored_query_fungible_params.md +++ b/docs/cli/zetacored/zetacored_query_lightclient_list-chain-state.md @@ -1,9 +1,9 @@ -# query fungible params +# query lightclient list-chain-state -shows the parameters of the module +List all the chain states ``` -zetacored query fungible params [flags] +zetacored query lightclient list-chain-state [flags] ``` ### Options @@ -12,7 +12,7 @@ zetacored query fungible params [flags] --grpc-addr string the gRPC endpoint to use for this chain --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS --height int Use a specific height to query state at (this can error if the node is pruning state) - -h, --help help for params + -h, --help help for list-chain-state --node string [host]:[port] to Tendermint RPC interface for this chain -o, --output string Output format (text|json) ``` @@ -29,5 +29,5 @@ zetacored query fungible params [flags] ### SEE ALSO -* [zetacored query fungible](zetacored_query_fungible.md) - Querying commands for the fungible module +* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module diff --git a/docs/cli/zetacored/zetacored_query_lightclient_show-block-header.md b/docs/cli/zetacored/zetacored_query_lightclient_show-block-header.md new file mode 100644 index 0000000000..10d89a7794 --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_lightclient_show-block-header.md @@ -0,0 +1,33 @@ +# query lightclient show-block-header + +Show a block header from its hash + +``` +zetacored query lightclient show-block-header [block-hash] [flags] +``` + +### Options + +``` + --grpc-addr string the gRPC endpoint to use for this chain + --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS + --height int Use a specific height to query state at (this can error if the node is pruning state) + -h, --help help for show-block-header + --node string [host]:[port] to Tendermint RPC interface for this chain + -o, --output string Output format (text|json) +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module + diff --git a/docs/cli/zetacored/zetacored_query_lightclient_show-chain-state.md b/docs/cli/zetacored/zetacored_query_lightclient_show-chain-state.md new file mode 100644 index 0000000000..7647726bb9 --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_lightclient_show-chain-state.md @@ -0,0 +1,33 @@ +# query lightclient show-chain-state + +Show a chain state from its chain id + +``` +zetacored query lightclient show-chain-state [chain-id] [flags] +``` + +### Options + +``` + --grpc-addr string the gRPC endpoint to use for this chain + --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS + --height int Use a specific height to query state at (this can error if the node is pruning state) + -h, --help help for show-chain-state + --node string [host]:[port] to Tendermint RPC interface for this chain + -o, --output string Output format (text|json) +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module + diff --git a/docs/cli/zetacored/zetacored_query_lightclient_show-verification-flags.md b/docs/cli/zetacored/zetacored_query_lightclient_show-verification-flags.md new file mode 100644 index 0000000000..d8e8d97527 --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_lightclient_show-verification-flags.md @@ -0,0 +1,33 @@ +# query lightclient show-verification-flags + +Show the verification flags + +``` +zetacored query lightclient show-verification-flags [flags] +``` + +### Options + +``` + --grpc-addr string the gRPC endpoint to use for this chain + --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS + --height int Use a specific height to query state at (this can error if the node is pruning state) + -h, --help help for show-verification-flags + --node string [host]:[port] to Tendermint RPC interface for this chain + -o, --output string Output format (text|json) +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query lightclient](zetacored_query_lightclient.md) - Querying commands for the lightclient module + diff --git a/docs/cli/zetacored/zetacored_tx.md b/docs/cli/zetacored/zetacored_tx.md index d0c41e4937..dc2801a1f6 100644 --- a/docs/cli/zetacored/zetacored_tx.md +++ b/docs/cli/zetacored/zetacored_tx.md @@ -40,6 +40,7 @@ zetacored tx [flags] * [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands * [zetacored tx gov](zetacored_tx_gov.md) - Governance transactions subcommands * [zetacored tx group](zetacored_tx_group.md) - Group transaction subcommands +* [zetacored tx lightclient](zetacored_tx_lightclient.md) - lightclient transactions subcommands * [zetacored tx multi-sign](zetacored_tx_multi-sign.md) - Generate multisig signatures for transactions generated offline * [zetacored tx multisign-batch](zetacored_tx_multisign-batch.md) - Assemble multisig transactions in batch from batch signatures * [zetacored tx observer](zetacored_tx_observer.md) - observer transactions subcommands diff --git a/docs/cli/zetacored/zetacored_tx_lightclient.md b/docs/cli/zetacored/zetacored_tx_lightclient.md new file mode 100644 index 0000000000..3bdada0122 --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_lightclient.md @@ -0,0 +1,29 @@ +# tx lightclient + +lightclient transactions subcommands + +``` +zetacored tx lightclient [flags] +``` + +### Options + +``` + -h, --help help for lightclient +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx](zetacored_tx.md) - Transactions subcommands +* [zetacored tx lightclient update-verification-flags](zetacored_tx_lightclient_update-verification-flags.md) - Update verification flags + diff --git a/docs/cli/zetacored/zetacored_tx_lightclient_update-verification-flags.md b/docs/cli/zetacored/zetacored_tx_lightclient_update-verification-flags.md new file mode 100644 index 0000000000..08222afc69 --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_lightclient_update-verification-flags.md @@ -0,0 +1,52 @@ +# tx lightclient update-verification-flags + +Update verification flags + +``` +zetacored tx lightclient update-verification-flags [eth-type-chain-enabled] [btc-type-chain-enabled] [flags] +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-verification-flags + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string [host]:[port] to tendermint rpc interface for this chain + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx lightclient](zetacored_tx_lightclient.md) - lightclient transactions subcommands +