github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/cmd/util/ledger/migrations/test-data/cadence_values_migration/README.md (about) 1 ## Instructions for creating a snapshot 2 3 To create a new snapshot for tests, follow the below steps. 4 5 - Download a CLI which uses cadence version pre-1.0 (e.g. CLI version `v1.5.0`) 6 7 - Start emulator with the `--persist` flag. 8 ```shell 9 flow emulator --persist 10 ``` 11 12 - Create an account name `test`. 13 ```shell 14 flow accounts create 15 ``` 16 17 - Update the `testAccountAddress` constant in the [cadence_values_migration_test.go](../../cadence_values_migration_test.go) 18 with the address of the account just created. 19 20 - Deploy the `Test` contract. For that, first add the below entries to the `flow.json` 21 ```json 22 { 23 "contracts": { 24 "Test": "./test_contract.cdc" 25 }, 26 "deployments": { 27 "emulator": { 28 "test": [ 29 "Test" 30 ] 31 } 32 } 33 } 34 ``` 35 Then run: 36 ```shell 37 flow deploy 38 ``` 39 40 - To store the values, run the transaction [store_transaction.cdc](store_transaction.cdc), 41 using the newly created `test` account as the signer. 42 ```shell 43 flow transactions send store_transaction.cdc --signer test 44 ``` 45 46 - Create a snapshot of the emulator state using the REST API: 47 ```shell 48 curl -H "Content-type: application/x-www-form-urlencoded" -X POST http://localhost:8080/emulator/snapshots -d "name=test_snapshot" 49 ``` 50 51 - Above will create file named `snapshot.test_snapshot` in a directly called `flowdb` where the flow project was initialized. 52 Copy it to this directly (`test-data/cadence_values_migration`) and rename it to `snapshot`.