Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cadence values migration #5192

Merged
merged 31 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 112 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ff1df48
Merge branch 'feature/stable-cadence' of https://github.com/onflow/fl…
SupunS Jan 2, 2024
baf218f
Add cadence values migration step
SupunS Jan 2, 2024
7662f25
Add test for cadence value migrators
SupunS Jan 3, 2024
d1b2059
Merge updated paylaods with original payloads
SupunS Jan 4, 2024
af1cc82
Refactor
SupunS Jan 4, 2024
fdb0068
Write new payloads created during updates
SupunS Jan 8, 2024
d8669b1
Move PayloadsFromEmulatorSnapshot to utils
SupunS Jan 8, 2024
5fb1f02
Close migrator after completion
SupunS Jan 8, 2024
9eb4edb
Use LocalIDGenerator for generating Id's for link value migration
SupunS Jan 8, 2024
559fa95
Return commiting errors
SupunS Jan 9, 2024
92f88b7
Add transaction code used to store values in tests
SupunS Jan 9, 2024
a534015
Handle migration errors gracefully
SupunS Jan 9, 2024
f778b32
Separate link value migration from the rest
SupunS Jan 9, 2024
177c5c4
Add instructions for creating an emulator snapshot
SupunS Jan 9, 2024
8e59274
Add test for type-value/string-value key hashing
SupunS Jan 10, 2024
79d0d72
Add test for cacons and link value migrations
SupunS Jan 12, 2024
85b2076
Add environment.Accounts to migration runtime
SupunS Jan 12, 2024
cb39d98
Add test for account-types as dictionary keys
SupunS Jan 12, 2024
a7bdfb7
Add test for entitlements
SupunS Jan 17, 2024
88dd673
Update to the latest cadence migrations
SupunS Jan 18, 2024
650ffa1
Add test for running migrations in a diferent order
SupunS Jan 18, 2024
3be77eb
Update cadence
SupunS Jan 18, 2024
82365ae
Assert the account IDs
SupunS Jan 18, 2024
4de5312
Refactor
SupunS Jan 18, 2024
59def00
fix program loading
turbolent Jan 23, 2024
143ad1d
replace TODO with explanation
turbolent Jan 24, 2024
df8428b
Merge branch 'bastian/stable-cadence-update' of https://github.com/on…
SupunS Jan 25, 2024
ac05489
Fix tests
SupunS Jan 25, 2024
e0769ca
Merge branch 'feature/stable-cadence' into supun/cadence-migrations
turbolent Jan 25, 2024
bbe17b8
go mod tidy
turbolent Jan 25, 2024
039970c
Fix lint
SupunS Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion cmd/util/cmd/execution-state-extract/execution_state_extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/rs/zerolog"
"go.uber.org/atomic"

migrators "github.com/onflow/flow-go/cmd/util/ledger/migrations"
"github.com/onflow/flow-go/cmd/util/ledger/reporters"
"github.com/onflow/flow-go/ledger"
"github.com/onflow/flow-go/ledger/common/hash"
Expand All @@ -20,6 +21,8 @@ import (
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module/metrics"
"github.com/onflow/flow-go/storage"

"github.com/onflow/cadence/runtime/interpreter"
)

func getStateCommitment(commits storage.Commits, blockHash flow.Identifier) (flow.StateCommitment, error) {
Expand Down Expand Up @@ -82,7 +85,22 @@ func extractExecutionState(
<-compactor.Done()
}()

var migrations []ledger.Migration
rwf := reporters.NewReportFileWriterFactory(dir, log)

capabilityIDs := map[interpreter.AddressPath]interpreter.UInt64Value{}

var migrations = []ledger.Migration{
migrators.CreateAccountBasedMigration(
log,
nWorker,
[]migrators.AccountBasedMigration{
// do account usage migration before and after as a sanity check.
&migrators.AccountUsageMigrator{},
migrators.NewCadenceLinkValueMigrator(rwf, capabilityIDs),
migrators.NewCadenceValueMigrator(rwf, capabilityIDs),
&migrators.AccountUsageMigrator{},
}),
}
newState := ledger.State(targetHash)

// migrate the trie if there are migrations
Expand Down
Loading