Skip to content

Commit

Permalink
Merge pull request #678 from onflow/auto-update-onflow-cadence-v1.0.0…
Browse files Browse the repository at this point in the history
…-preview.29

Update to Cadence v1.0.0-preview.29
  • Loading branch information
SupunS authored May 17, 2024
2 parents 781f271 + 90426a5 commit 988cd96
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 33 deletions.
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ require (
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/improbable-eng/grpc-web v0.15.0
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/onflow/cadence v1.0.0-preview.26
github.com/onflow/cadence v1.0.0-preview.29
github.com/onflow/crypto v0.25.1
github.com/onflow/flow-core-contracts/lib/go/templates v1.0.0
github.com/onflow/flow-go v0.35.0-crescendo-preview.20.0.20240508235454-08aa027bb351
github.com/onflow/flow-go-sdk v1.0.0-preview.26
github.com/onflow/flow-nft/lib/go/contracts v1.2.0
github.com/onflow/flow/protobuf/go/flow v0.4.1
github.com/onflow/flow-go v0.35.5-0.20240517202625-55f862b45dfd
github.com/onflow/flow-go-sdk v1.0.0-preview.30
github.com/onflow/flow-nft/lib/go/contracts v1.2.1
github.com/onflow/flow/protobuf/go/flow v0.4.3
github.com/prometheus/client_golang v1.18.0
github.com/psiemens/graceland v1.0.0
github.com/psiemens/sconfig v0.1.0
Expand Down Expand Up @@ -135,14 +135,14 @@ require (
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onflow/atree v0.7.0-rc.1 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.0.0 // indirect
github.com/onflow/atree v0.7.0-rc.2 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.1.0 // indirect
github.com/onflow/flow-ft/lib/go/contracts v1.0.0 // indirect
github.com/onflow/flow-ft/lib/go/templates v1.0.0 // indirect
github.com/onflow/flow-nft/lib/go/templates v1.2.0 // indirect
github.com/onflow/go-ethereum v1.13.4 // indirect
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba // indirect
github.com/onflow/wal v0.0.0-20240208022732-d756cd497d3b // indirect
github.com/onflow/wal v1.0.2 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
Expand Down
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1981,40 +1981,40 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM=
github.com/onflow/atree v0.7.0-rc.1 h1:g2DFhC3JeaA+L7/HZOp4NwE+OfxvfJ8nibymHHw7i3g=
github.com/onflow/atree v0.7.0-rc.1/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM=
github.com/onflow/atree v0.7.0-rc.2 h1:mZmVrl/zPlfI44EjV3FdR2QwIqT8nz1sCONUBFcML/U=
github.com/onflow/atree v0.7.0-rc.2/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM=
github.com/onflow/cadence v1.0.0-M3/go.mod h1:odXGZZ/wGNA5mwT8bC9v8u8EXACHllB2ABSZK65TGL8=
github.com/onflow/cadence v1.0.0-preview.26 h1:FcinbrV7s7SIPzgxEAtA0wWqqf7QrvcSFvMVaKEedv4=
github.com/onflow/cadence v1.0.0-preview.26/go.mod h1:fGhLBbuEmv5rh48qv0ZS0tUz53gxWsHpB4dPsF09h6E=
github.com/onflow/cadence v1.0.0-preview.29 h1:kuglA1LXKsti1JWhZ25riVkIZsLnyiudF8fgzeblZ40=
github.com/onflow/cadence v1.0.0-preview.29/go.mod h1:3LM1VgE9HkJ815whY/F0LYWULwJa8p2nJiKyIIxpGAE=
github.com/onflow/crypto v0.25.0/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
github.com/onflow/crypto v0.25.1 h1:0txy2PKPMM873JbpxQNbJmuOJtD56bfs48RQfm0ts5A=
github.com/onflow/crypto v0.25.1/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.0.0 h1:tpyP/qMOub/ImWWCbf1PQjBLB9UKAzPvMCIRbGb/GYg=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.0.0/go.mod h1:ACen33wxzi3AsptCw/1rQ4McV5LumEhK0cC17RFG4o0=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.1.0 h1:AegPBm079X0qjneUYs+mRCpEUxSZ1lw5h4MbuXHlqn0=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.1.0/go.mod h1:u/mkP/B+PbV33tEG3qfkhhBlydSvAKxfLZSfB4lsJHg=
github.com/onflow/flow-core-contracts/lib/go/templates v1.0.0 h1:za6bxPPW4JIsthhasUDTa1ruKjIO8DIhun9INQfj61Y=
github.com/onflow/flow-core-contracts/lib/go/templates v1.0.0/go.mod h1:NgbMOYnMh0GN48VsNKZuiwK7uyk38Wyo8jN9+C9QE30=
github.com/onflow/flow-ft/lib/go/contracts v1.0.0 h1:mToacZ5NWqtlWwk/7RgIl/jeKB/Sy/tIXdw90yKHcV0=
github.com/onflow/flow-ft/lib/go/contracts v1.0.0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A=
github.com/onflow/flow-ft/lib/go/templates v1.0.0 h1:6cMS/lUJJ17HjKBfMO/eh0GGvnpElPgBXx7h5aoWJhs=
github.com/onflow/flow-ft/lib/go/templates v1.0.0/go.mod h1:uQ8XFqmMK2jxyBSVrmyuwdWjTEb+6zGjRYotfDJ5pAE=
github.com/onflow/flow-go v0.35.0-crescendo-preview.20.0.20240508235454-08aa027bb351 h1:F/+CR3wRmoiyShvzOk/PwP2jyjTka96UiH5rNEo5nOA=
github.com/onflow/flow-go v0.35.0-crescendo-preview.20.0.20240508235454-08aa027bb351/go.mod h1:xzlHMiZl1m99/PXKGPRfB9f6mT5RRFO56XJ5TdA/rOk=
github.com/onflow/flow-go v0.35.5-0.20240517202625-55f862b45dfd h1:bSoQMARSC4dk6sQPv6SRkV7QvovKoNksTnydK9e5hL4=
github.com/onflow/flow-go v0.35.5-0.20240517202625-55f862b45dfd/go.mod h1:5ysH9wggXlvJqbALEBZc2uNx6DIE+QsBoocuM8bSGC0=
github.com/onflow/flow-go-sdk v1.0.0-M1/go.mod h1:TDW0MNuCs4SvqYRUzkbRnRmHQL1h4X8wURsCw9P9beo=
github.com/onflow/flow-go-sdk v1.0.0-preview.26 h1:bxnbjcoaNICy4eR7snh8sk5EsmJUA0lBViVOtyBgOQ0=
github.com/onflow/flow-go-sdk v1.0.0-preview.26/go.mod h1:tYb83v2vHO+ew1g0VkPKf7w0geNuTqKOV9zyzqQxN5M=
github.com/onflow/flow-nft/lib/go/contracts v1.2.0 h1:TFH7GCJKcGi0+x14SCvF7Gbnxp68gJOGNV8PSIAM2J0=
github.com/onflow/flow-nft/lib/go/contracts v1.2.0/go.mod h1:2gpbza+uzs1k7x31hkpBPlggIRkI53Suo0n2AyA2HcE=
github.com/onflow/flow-go-sdk v1.0.0-preview.30 h1:62IwC7l8Uw1mxoZe7ewJII0HFHLUMsg04z1BW3JSEfM=
github.com/onflow/flow-go-sdk v1.0.0-preview.30/go.mod h1:PBIk3vLqU1aLdbWPw7ljRDmwSGLcsuk/ipL9eLMgWwc=
github.com/onflow/flow-nft/lib/go/contracts v1.2.1 h1:woAAS5z651sDpi7ihAHll8NvRS9uFXIXkL6xR+bKFZY=
github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkpBPlggIRkI53Suo0n2AyA2HcE=
github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc=
github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0=
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/flow/protobuf/go/flow v0.4.1 h1:mJ0kn5ptPvBbqiwpSz1fUs2jR3kTvVsZgLjTTqODSDo=
github.com/onflow/flow/protobuf/go/flow v0.4.1/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/flow/protobuf/go/flow v0.4.3 h1:gdY7Ftto8dtU+0wI+6ZgW4oE+z0DSDUMIDwVx8mqae8=
github.com/onflow/flow/protobuf/go/flow v0.4.3/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/go-ethereum v1.13.4 h1:iNO86fm8RbBbhZ87ZulblInqCdHnAQVY8okBrNsTevc=
github.com/onflow/go-ethereum v1.13.4/go.mod h1:cE/gEUkAffhwbVmMJYz+t1dAfVNHNwZCgc3BWtZxBGY=
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba h1:rIehuhO6bj4FkwE4VzwEjX7MoAlOhUJENBJLqDqVxAo=
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU=
github.com/onflow/wal v0.0.0-20240208022732-d756cd497d3b h1:6O/BEmA99PDT5QVjoJgrYlGsWnpxGJTAMmsC+V9gyds=
github.com/onflow/wal v0.0.0-20240208022732-d756cd497d3b/go.mod h1:iMC8gkLqu4nkbkAla5HkSBb+FGyQOZiWz3DYm2wSXCk=
github.com/onflow/wal v1.0.2 h1:5bgsJVf2O3cfMNK12fiiTyYZ8cOrUiELt3heBJfHOhc=
github.com/onflow/wal v1.0.2/go.mod h1:iMC8gkLqu4nkbkAla5HkSBb+FGyQOZiWz3DYm2wSXCk=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down
12 changes: 10 additions & 2 deletions storage/migration/cadence1.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/onflow/flow-go/cmd/util/ledger/migrations"
"github.com/onflow/flow-go/cmd/util/ledger/reporters"
"github.com/onflow/flow-go/cmd/util/ledger/util"
"github.com/onflow/flow-go/cmd/util/ledger/util/registers"
"github.com/onflow/flow-go/model/flow"
"github.com/rs/zerolog"

Expand Down Expand Up @@ -65,13 +66,20 @@ func MigrateCadence1(
},
)

byAccountRegisters, err := registers.NewByAccountFromPayloads(payloads)
if err != nil {
return err
}

for _, migration := range cadence1Migrations {
logger.Info().Str("migration", migration.Name).Msg("running migration")
payloads, err = migration.Migrate(payloads)
err = migration.Migrate(byAccountRegisters)
if err != nil {
return err
}
}

return WritePayloadsToSnapshot(store, payloads, payloadInfo)
newPayloads := byAccountRegisters.DestructIntoPayloads(nWorker)

return WritePayloadsToSnapshot(store, newPayloads, payloadInfo)
}
15 changes: 8 additions & 7 deletions storage/migration/cadence1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"os"
"testing"

"github.com/onflow/flow-go/cmd/util/ledger/util/snapshot"
"github.com/onflow/flow-go/cmd/util/ledger/util/registers"
"github.com/rs/zerolog"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -162,13 +162,14 @@ func checkMigratedPayloads(t *testing.T, store *sqlite.Store) {
payloads, _, _, err := util.PayloadsAndAccountsFromEmulatorSnapshot(store.DB())
require.NoError(t, err)

migratorRuntime, err := migrations.NewMigratorRuntime(
zerolog.New(zerolog.NewTestWriter(t)),
payloads,
byAccountRegisters, err := registers.NewByAccountFromPayloads(payloads)
require.NoError(t, err)

migratorRuntime, err := migrations.NewInterpreterMigrationRuntime(

byAccountRegisters,
flowgo.Emulator,
migrations.MigratorRuntimeConfig{},
snapshot.LargeChangeSetOrReadonlySnapshot,
1,
migrations.InterpreterMigrationRuntimeConfig{},
)
require.NoError(t, err)

Expand Down

0 comments on commit 988cd96

Please sign in to comment.