Skip to content

Commit

Permalink
Merge pull request #5743 from onflow/fxamacker/sync-atree-inlining-ca…
Browse files Browse the repository at this point in the history
…dence-v1.0
  • Loading branch information
turbolent authored Apr 19, 2024
2 parents a36bb74 + dfb68b2 commit b4864e0
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 164 deletions.
27 changes: 16 additions & 11 deletions cmd/util/ledger/migrations/cadence_values_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,15 @@ func (m *CadenceBaseMigrator) MigrateAccount(
}
}

migration := migrations.NewStorageMigration(
migration, err := migrations.NewStorageMigration(
migrationRuntime.Interpreter,
storage,
m.name,
address,
)
if err != nil {
return nil, fmt.Errorf("failed to create storage migration: %w", err)
}

reporter := newValueMigrationReporter(
m.reporter,
Expand Down Expand Up @@ -290,7 +293,7 @@ func NewCadence1ValueMigrator(
}

return &CadenceBaseMigrator{
name: "cadence-value-migration",
name: "cadence_value_migration",
reporter: rwf.ReportWriter(cadenceValueMigrationReporterName),
diffReporter: diffReporter,
logVerboseDiff: opts.LogVerboseDiff,
Expand Down Expand Up @@ -331,7 +334,7 @@ func NewCadence1LinkValueMigrator(
}

return &CadenceBaseMigrator{
name: "cadence-link-value-migration",
name: "cadence_link_value_migration",
reporter: rwf.ReportWriter("cadence-link-value-migrator"),
diffReporter: diffReporter,
logVerboseDiff: opts.LogVerboseDiff,
Expand Down Expand Up @@ -378,7 +381,7 @@ func NewCadence1CapabilityValueMigrator(
}

return &CadenceBaseMigrator{
name: "cadence-capability-value-migration",
name: "cadence_capability_value_migration",
reporter: rwf.ReportWriter("cadence-capability-value-migrator"),
diffReporter: diffReporter,
logVerboseDiff: opts.LogVerboseDiff,
Expand Down Expand Up @@ -536,9 +539,9 @@ func (t *cadenceValueMigrationReporter) MissingTarget(accountAddressPath interpr
})
}

func (t *cadenceValueMigrationReporter) DictionaryKeyConflict(key interpreter.StringStorageMapKey) {
func (t *cadenceValueMigrationReporter) DictionaryKeyConflict(accountAddressPath interpreter.AddressPath) {
t.reportWriter.Write(dictionaryKeyConflictEntry{
Key: key,
AddressPath: accountAddressPath,
})
}

Expand Down Expand Up @@ -732,17 +735,19 @@ func (e linkMissingTargetEntry) MarshalJSON() ([]byte, error) {
// dictionaryKeyConflictEntry

type dictionaryKeyConflictEntry struct {
Key interpreter.StringStorageMapKey
AddressPath interpreter.AddressPath
}

var _ json.Marshaler = dictionaryKeyConflictEntry{}

func (e dictionaryKeyConflictEntry) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Kind string `json:"kind"`
Key string `json:"key"`
Kind string `json:"kind"`
AccountAddress string `json:"account_address"`
Path string `json:"path"`
}{
Kind: "dictionary-key-conflict",
Key: string(e.Key),
Kind: "dictionary-key-conflict",
AccountAddress: e.AddressPath.Address.HexWithPrefix(),
Path: e.AddressPath.Path.String(),
})
}
11 changes: 9 additions & 2 deletions cmd/util/ledger/migrations/cadence_values_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,13 @@ func TestDictionaryKeyConflictEntry_MarshalJSON(t *testing.T) {
t.Parallel()

e := dictionaryKeyConflictEntry{
Key: interpreter.StringStorageMapKey("test"),
AddressPath: interpreter.AddressPath{
Address: common.MustBytesToAddress([]byte{0x1}),
Path: interpreter.PathValue{
Domain: common.PathDomainPublic,
Identifier: "test",
},
},
}

actual, err := e.MarshalJSON()
Expand All @@ -1414,7 +1420,8 @@ func TestDictionaryKeyConflictEntry_MarshalJSON(t *testing.T) {
//language=JSON
`{
"kind": "dictionary-key-conflict",
"key": "test"
"account_address": "0x0000000000000001",
"path": "/public/test"
}`,
string(actual),
)
Expand Down
39 changes: 21 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
cloud.google.com/go/compute/metadata v0.2.3
cloud.google.com/go/profiler v0.3.0
cloud.google.com/go/storage v1.30.1
cloud.google.com/go/storage v1.36.0
github.com/antihax/optional v1.0.0
github.com/aws/aws-sdk-go-v2/config v1.25.5
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.5.1
Expand Down Expand Up @@ -50,13 +50,13 @@ require (
github.com/multiformats/go-multiaddr v0.12.2
github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/multiformats/go-multihash v0.2.3
github.com/onflow/atree v0.6.1-0.20240308163425-dc825c20b1a2
github.com/onflow/cadence v1.0.0-preview.20
github.com/onflow/atree v0.6.1-0.20240416233652-f4568c0c03df
github.com/onflow/cadence v1.0.0-preview.21
github.com/onflow/crypto v0.25.1
github.com/onflow/flow v0.3.4
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240416161444-1b20b4de9450
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240416161444-1b20b4de9450
github.com/onflow/flow-go-sdk v1.0.0-preview.19
github.com/onflow/flow-go-sdk v1.0.0-preview.20
github.com/onflow/flow/protobuf/go/flow v0.4.0
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
github.com/pierrec/lz4 v2.6.1+incompatible
Expand All @@ -74,22 +74,22 @@ require (
github.com/stretchr/testify v1.8.4
github.com/vmihailenco/msgpack v4.0.4+incompatible
github.com/vmihailenco/msgpack/v4 v4.3.11
go.opentelemetry.io/otel v1.22.0
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0
go.opentelemetry.io/otel/sdk v1.21.0
go.opentelemetry.io/otel/trace v1.22.0
go.opentelemetry.io/otel/sdk v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
go.uber.org/atomic v1.11.0
go.uber.org/multierr v1.11.0
golang.org/x/crypto v0.18.0
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
golang.org/x/sync v0.6.0
golang.org/x/sys v0.16.0
golang.org/x/sys v0.17.0
golang.org/x/text v0.14.0
golang.org/x/time v0.3.0
golang.org/x/time v0.5.0
golang.org/x/tools v0.17.0
google.golang.org/api v0.151.0
google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917
google.golang.org/grpc v1.60.1
google.golang.org/api v0.155.0
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80
google.golang.org/grpc v1.62.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0
google.golang.org/protobuf v1.32.0
gotest.tools v2.2.0+incompatible
Expand All @@ -112,13 +112,13 @@ require (
github.com/slok/go-http-metrics v0.10.0
github.com/sony/gobreaker v0.5.0
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028
google.golang.org/genproto/googleapis/api v0.0.0-20240108191215-35c7eff3a6b1
google.golang.org/genproto/googleapis/bytestream v0.0.0-20231030173426-d783a09b4405
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80
google.golang.org/genproto/googleapis/bytestream v0.0.0-20231212172506-995d672761c0
gopkg.in/yaml.v2 v2.4.0
)

require (
cloud.google.com/go v0.111.0 // indirect
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
Expand Down Expand Up @@ -168,6 +168,7 @@ require (
github.com/elastic/gosigar v0.14.2 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/flynn/noise v1.0.1 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand All @@ -187,7 +188,7 @@ require (
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/s2a-go v0.1.7 // indirect
Expand Down Expand Up @@ -303,8 +304,10 @@ require (
github.com/yusufpapurcu/wmi v1.2.2 // indirect
github.com/zeebo/blake3 v0.2.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/dig v1.17.1 // indirect
go.uber.org/fx v1.20.1 // indirect
Expand All @@ -316,7 +319,7 @@ require (
golang.org/x/term v0.16.0 // indirect
gonum.org/v1/gonum v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
Expand Down
Loading

0 comments on commit b4864e0

Please sign in to comment.