mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
a29032c2bf
* first version of the watchtower api * service files * Begin work on grpc server * More changes to server * REnames and mock setup * working test * merge * double propose detection test * nishant review * todo change * gaz * fix service * gaz * remove unused import * gaz * resolve circular dependency * resolve circular dependency 2nd try * remove package * fix package * fix test * added tests * gaz * remove status check * gaz * remove context * remove context * change var name * moved to rpc dir * gaz * remove server code * gaz * slasher server * visibility change * pb * service update * gaz * slasher grpc server * making it work * setup db and start * gaz * service flags fixes * grpc service running * go imports * remove new initializer * gaz * remove feature flags * change back SetupSlasherDB * fix SetupSlasherDB calls * define err * fix bad merge * fix test * fix imports * fix imports * fix imports * add cancel * comment stop * fix cancel issue * remove unneeded code * bring back bad merge that removed TODO * remove use of epoch as am input * fixed slasher to be runable again * wait for channel close * gaz * small test * flags fix * fix flag order
51 lines
1.0 KiB
Go
51 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/state/interop"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/db"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/db/filters"
|
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
|
)
|
|
|
|
var (
|
|
// Required fields
|
|
datadir = flag.String("datadir", "", "Path to data directory.")
|
|
|
|
state = flag.Uint("state", 0, "Extract state at this slot.")
|
|
)
|
|
|
|
func init() {
|
|
fc := featureconfig.Get()
|
|
fc.WriteSSZStateTransitions = true
|
|
featureconfig.Init(fc)
|
|
}
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
fmt.Println("Starting process...")
|
|
d, err := db.NewDB(*datadir)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
ctx := context.Background()
|
|
slot := uint64(*state)
|
|
roots, err := d.BlockRoots(ctx, filters.NewFilter().SetStartSlot(slot).SetEndSlot(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")
|
|
}
|