mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 20:07:17 +00:00
7f7866ff2a
* Starting a quick PoC * Rate limit to one epoch worth of blocks in memory * Proof of concept working * Quick comment out * Save previous finalized checkpoint * Test * Minor fixes * More run time fixes * Remove panic * Feature flag * Removed unused methods * Fixed tests * E2e test * comment * Compatible with current initial sync * Starting * New cache * Cache getters and setters * It should be part of state gen * Need to use cache for DB * Don't have to use finalized state * Rm unused file * some changes to memory mgmt when using mempool * More run time fixes * Can sync to head * Feedback * Revert "some changes to memory mgmt when using mempool" This reverts commit f5b3e7ff4714fef9f0397007f519a45fa259ad24. * Fixed sync tests * Fixed existing tests * Test for state summary getter * Gaz * Fix kafka passthrough * Fixed inputs * Gaz * Fixed build * Fixed visibility * Trying without the ignore * Didn't work.. * Fix kafka Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
46 lines
1008 B
Go
46 lines
1008 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
|
|
"github.com/prysmaticlabs/go-ssz"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/cache"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/db"
|
|
)
|
|
|
|
// A basic tool to extract genesis.ssz from existing beaconchain.db.
|
|
// ex:
|
|
// bazel run //tools/interop/export-genesis:export-genesis -- /tmp/data/beaconchaindata /tmp/genesis.ssz
|
|
func main() {
|
|
if len(os.Args) < 3 {
|
|
fmt.Println("Usage: ./main /path/to/datadir /path/to/output/genesis.ssz")
|
|
os.Exit(1)
|
|
}
|
|
|
|
fmt.Printf("Reading db at %s and writing ssz output to %s.\n", os.Args[1], os.Args[2])
|
|
|
|
d, err := db.NewDB(os.Args[1], cache.NewStateSummaryCache())
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
defer d.Close()
|
|
gs, err := d.GenesisState(context.Background())
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if gs == nil {
|
|
panic("nil genesis state")
|
|
}
|
|
b, err := ssz.Marshal(gs)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if err := ioutil.WriteFile(os.Args[2], b, 0644); err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println("done")
|
|
}
|