cli: adjust resulting state object structure in upload-state command

`upload-state` suppose to create objects with key-value pairs instead of
full MPT nodes. Partially revert 5f80a14.

Ref. #3782

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
Ekaterina Pavlova 2025-03-26 13:16:27 +09:00
parent fd41598b8a
commit f60feefe45
5 changed files with 22 additions and 28 deletions

View file

@ -141,10 +141,10 @@ func newGraceContext() context.Context {
}
// InitBCWithMetrics initializes the blockchain with metrics with the given configuration.
func InitBCWithMetrics(cfg config.Config, log *zap.Logger) (*core.Blockchain, storage.Store, *metrics.Service, *metrics.Service, error) {
chain, store, err := initBlockChain(cfg, log)
func InitBCWithMetrics(cfg config.Config, log *zap.Logger) (*core.Blockchain, *metrics.Service, *metrics.Service, error) {
chain, _, err := initBlockChain(cfg, log)
if err != nil {
return nil, nil, nil, nil, cli.Exit(err, 1)
return nil, nil, nil, cli.Exit(err, 1)
}
prometheus := metrics.NewPrometheusService(cfg.ApplicationConfiguration.Prometheus, log)
pprof := metrics.NewPprofService(cfg.ApplicationConfiguration.Pprof, log)
@ -152,14 +152,14 @@ func InitBCWithMetrics(cfg config.Config, log *zap.Logger) (*core.Blockchain, st
go chain.Run()
err = prometheus.Start()
if err != nil {
return nil, nil, nil, nil, cli.Exit(fmt.Errorf("failed to start Prometheus service: %w", err), 1)
return nil, nil, nil, cli.Exit(fmt.Errorf("failed to start Prometheus service: %w", err), 1)
}
err = pprof.Start()
if err != nil {
return nil, nil, nil, nil, cli.Exit(fmt.Errorf("failed to start Pprof service: %w", err), 1)
return nil, nil, nil, cli.Exit(fmt.Errorf("failed to start Pprof service: %w", err), 1)
}
return chain, store, prometheus, pprof, nil
return chain, prometheus, pprof, nil
}
func dumpDB(ctx *cli.Context) error {
@ -190,7 +190,7 @@ func dumpDB(ctx *cli.Context) error {
defer outStream.Close()
writer := io.NewBinWriterFromIO(outStream)
chain, _, prometheus, pprof, err := InitBCWithMetrics(cfg, log)
chain, prometheus, pprof, err := InitBCWithMetrics(cfg, log)
if err != nil {
return err
}
@ -250,7 +250,7 @@ func restoreDB(ctx *cli.Context) error {
cfg.ApplicationConfiguration.SaveStorageBatch = true
}
chain, _, prometheus, pprof, err := InitBCWithMetrics(cfg, log)
chain, prometheus, pprof, err := InitBCWithMetrics(cfg, log)
if err != nil {
return err
}
@ -471,7 +471,7 @@ func startServer(ctx *cli.Context) error {
return cli.Exit(err, 1)
}
chain, _, prometheus, pprof, err := InitBCWithMetrics(cfg, log)
chain, prometheus, pprof, err := InitBCWithMetrics(cfg, log)
if err != nil {
return cli.Exit(err, 1)
}