mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 13:18:57 +00:00
84916672c6
* replace eth2 types * replace protos * regen proto * replace * gaz * deps * amend * regen proto * mod * gaz * gaz * ensure build * ssz * add dep * no more eth2 types * no more eth2 * remg * all builds * buidl * tidy * clean * fmt * val serv * gaz Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/transition/interop"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/db"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/db/kv"
|
|
"github.com/prysmaticlabs/prysm/config/features"
|
|
types "github.com/prysmaticlabs/prysm/consensus-types/primitives"
|
|
)
|
|
|
|
var (
|
|
// Required fields
|
|
datadir = flag.String("datadir", "", "Path to data directory.")
|
|
|
|
state = flag.Uint("state", 0, "Extract state at this slot.")
|
|
)
|
|
|
|
func main() {
|
|
resetCfg := features.InitWithReset(&features.Flags{WriteSSZStateTransitions: true})
|
|
defer resetCfg()
|
|
flag.Parse()
|
|
fmt.Println("Starting process...")
|
|
d, err := db.NewDB(context.Background(), *datadir, &kv.Config{})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
ctx := context.Background()
|
|
slot := types.Slot(*state)
|
|
_, roots, err := d.BlockRootsBySlot(ctx, slot)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if len(roots) != 1 {
|
|
fmt.Printf("Expected 1 block root for slot %d, got %d roots", *state, len(roots))
|
|
}
|
|
s, err := d.State(ctx, roots[0])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
interop.WriteStateToDisk(s)
|
|
fmt.Println("done")
|
|
}
|