github.com/koko1123/flow-go-1@v0.29.6/cmd/bootstrap/run/execution_state_test.go (about) 1 package run 2 3 import ( 4 "fmt" 5 "path/filepath" 6 "testing" 7 8 "github.com/stretchr/testify/require" 9 10 "github.com/koko1123/flow-go-1/fvm" 11 "github.com/koko1123/flow-go-1/model/bootstrap" 12 "github.com/koko1123/flow-go-1/model/flow" 13 "github.com/koko1123/flow-go-1/utils/unittest" 14 ) 15 16 // This tests generates a checkpoint file to be used by the execution node when booting. 17 func TestGenerateExecutionState(t *testing.T) { 18 seed := make([]byte, 48) 19 seed[0] = 1 20 sk, err := GenerateServiceAccountPrivateKey(seed) 21 require.NoError(t, err) 22 23 pk := sk.PublicKey(42) 24 bootstrapDir := t.TempDir() 25 trieDir := filepath.Join(bootstrapDir, bootstrap.DirnameExecutionState) 26 commit, err := GenerateExecutionState( 27 trieDir, 28 pk, 29 flow.Testnet.Chain(), 30 fvm.WithInitialTokenSupply(unittest.GenesisTokenSupply)) 31 require.NoError(t, err) 32 fmt.Printf("sk: %v\n", sk) 33 fmt.Printf("pk: %v\n", pk) 34 fmt.Printf("commit: %x\n", commit) 35 fmt.Printf("a checkpoint file is generated at: %v\n", trieDir) 36 }