From b3e903d84a30170edbe875e439fe0e254a33b802 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Tue, 29 Oct 2024 05:15:46 -0400 Subject: [PATCH 1/2] fix: remove additional log line when exporting genesis (#3038) * remove additional log line when exporting genesis * modify comments on appExport * rename identifiers * add comments * remove unnecessary new line * Update cmd/zetacored/root.go Co-authored-by: Lucas Bertrand * use loadlatest flag for loading app for height --------- Co-authored-by: Lucas Bertrand --- app/app.go | 2 -- app/export.go | 1 - cmd/zetacored/root.go | 53 ++++++++++++++++++++----------------------- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/app/app.go b/app/app.go index 1e64321f21..3a42d51aff 100644 --- a/app/app.go +++ b/app/app.go @@ -372,8 +372,6 @@ func New( authAddr, ) - logger.Info("bank keeper blocklist addresses", "addresses", app.BlockedAddrs()) - app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, keys[banktypes.StoreKey], diff --git a/app/export.go b/app/export.go index 1f1ae26a96..61bc52659b 100644 --- a/app/export.go +++ b/app/export.go @@ -17,7 +17,6 @@ import ( func (app *App) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string, ) (servertypes.ExportedApp, error) { - // as if they could withdraw from the start of the next block ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) // We export at last height + 1, because that's the height at which diff --git a/cmd/zetacored/root.go b/cmd/zetacored/root.go index 440b921bc2..3880b12108 100644 --- a/cmd/zetacored/root.go +++ b/cmd/zetacored/root.go @@ -268,48 +268,43 @@ func (ac appCreator) newApp( ) } -// appExport creates a new simapp (optionally at a given height) +// appExport is used to export the state of the application for a genesis file. func (ac appCreator) appExport( logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string, appOpts servertypes.AppOptions, modulesToExport []string, ) (servertypes.ExportedApp, error) { - var anApp *app.App + var zetaApp *app.App homePath, ok := appOpts.Get(flags.FlagHome).(string) if !ok || homePath == "" { return servertypes.ExportedApp{}, errors.New("application home not set") } - if height != -1 { - anApp = app.New( - logger, - db, - traceStore, - false, - map[int64]bool{}, - homePath, - uint(1), - ac.encCfg, - appOpts, - ) - - if err := anApp.LoadHeight(height); err != nil { + loadLatest := false + if height == -1 { + loadLatest = true + } + + zetaApp = app.New( + logger, + db, + traceStore, + loadLatest, + map[int64]bool{}, + homePath, + uint(1), + ac.encCfg, + appOpts, + ) + + // If height is -1, it means we are using the latest height. + // For all other cases, we load the specified height from the Store + if !loadLatest { + if err := zetaApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } - } else { - anApp = app.New( - logger, - db, - traceStore, - true, - map[int64]bool{}, - homePath, - uint(1), - ac.encCfg, - appOpts, - ) } - return anApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) + return zetaApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) } From d9ee4f395da0bfdaa8dbc35cf1a876ebb080af36 Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Tue, 29 Oct 2024 11:54:15 +0100 Subject: [PATCH 2/2] fix(e2e): wrong evm client used for TestDAppV2ZEVM (#3060) --- cmd/zetae2e/config/contracts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zetae2e/config/contracts.go b/cmd/zetae2e/config/contracts.go index 9af3ccd812..6f2dff72c6 100644 --- a/cmd/zetae2e/config/contracts.go +++ b/cmd/zetae2e/config/contracts.go @@ -277,7 +277,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { if err != nil { return fmt.Errorf("invalid TestDAppV2Addr: %w", err) } - r.TestDAppV2ZEVM, err = testdappv2.NewTestDAppV2(r.TestDAppV2ZEVMAddr, r.EVMClient) + r.TestDAppV2ZEVM, err = testdappv2.NewTestDAppV2(r.TestDAppV2ZEVMAddr, r.ZEVMClient) if err != nil { return err }