Documentation ¶
Index ¶
- func ShouldFixBrokenCompositeKeyedDictionary(atreeValue atree.Value) bool
- type AccountStorage
- func (i *AccountStorage) MigrateStorageMap(inter *interpreter.Interpreter, domain string, migrator StorageMapKeyMigrator, ...)
- func (i *AccountStorage) MigrateStringKeys(inter *interpreter.Interpreter, key string, migrator StorageMapKeyMigrator)
- func (i *AccountStorage) MigrateUint64Keys(inter *interpreter.Interpreter, key string, migrator StorageMapKeyMigrator)
- type CachedStaticType
- type DefaultStaticTypeCache
- type DomainMigration
- type LegacyCharacterValue
- func (v *LegacyCharacterValue) Equal(inter *interpreter.Interpreter, locationRange interpreter.LocationRange, ...) bool
- func (v *LegacyCharacterValue) HashInput(_ *interpreter.Interpreter, _ interpreter.LocationRange, scratch []byte) []byte
- func (v *LegacyCharacterValue) StoredValue(_ atree.SlabStorage) (atree.Value, error)
- func (v *LegacyCharacterValue) Transfer(interpreter *interpreter.Interpreter, _ interpreter.LocationRange, ...) interpreter.Value
- type LegacyIntersectionType
- type LegacyOptionalType
- type LegacyPrimitiveStaticType
- type LegacyReferenceType
- type LegacyStringValue
- func (v *LegacyStringValue) Equal(inter *interpreter.Interpreter, locationRange interpreter.LocationRange, ...) bool
- func (v *LegacyStringValue) HashInput(_ *interpreter.Interpreter, _ interpreter.LocationRange, scratch []byte) []byte
- func (v *LegacyStringValue) StoredValue(_ atree.SlabStorage) (atree.Value, error)
- func (v *LegacyStringValue) Transfer(interpreter *interpreter.Interpreter, _ interpreter.LocationRange, ...) interpreter.Value
- type Reporter
- type StaticTypeCache
- type StorageMapKeyMigrator
- type StorageMigration
- func (m *StorageMigration) Commit() error
- func (m *StorageMigration) DictionaryKeyConflictStorageMapKey(index int) interpreter.StringStorageMapKey
- func (m *StorageMigration) Migrate(migrator StorageMapKeyMigrator)
- func (m *StorageMigration) MigrateNestedValue(storageKey interpreter.StorageKey, storageMapKey interpreter.StorageMapKey, ...) (migratedValue interpreter.Value)
- func (m *StorageMigration) NewValueMigrationsPathMigrator(reporter Reporter, valueMigrations ...ValueMigration) StorageMapKeyMigrator
- func (m *StorageMigration) WithErrorStacktrace(stacktraceEnabled bool) *StorageMigration
- type StorageMigrationError
- type ValueConverter
- type ValueConverterPathMigrator
- type ValueMigration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldFixBrokenCompositeKeyedDictionary ¶
ShouldFixBrokenCompositeKeyedDictionary returns true if the given value is a dictionary with a composite key type.
It is useful for use with atree's PersistentSlabStorage.FixLoadedBrokenReferences.
NOTE: The intended use case is to enable migration programs in onflow/flow-go to fix broken references. As of April 2024, only 10 registers in testnet (not mainnet) were found to have broken references, and they seem to have resulted from a bug that was fixed 2 years ago by https://github.com/onflow/cadence/pull/1565.
Types ¶
type AccountStorage ¶
type AccountStorage struct {
// contains filtered or unexported fields
}
func NewAccountStorage ¶
func NewAccountStorage(storage *runtime.Storage, address common.Address) AccountStorage
NewAccountStorage constructs an `AccountStorage` for a given account.
func (*AccountStorage) MigrateStorageMap ¶
func (i *AccountStorage) MigrateStorageMap( inter *interpreter.Interpreter, domain string, migrator StorageMapKeyMigrator, atreeKeyToStorageMapKey func(atree.Value) interpreter.StorageMapKey, )
func (*AccountStorage) MigrateStringKeys ¶
func (i *AccountStorage) MigrateStringKeys( inter *interpreter.Interpreter, key string, migrator StorageMapKeyMigrator, )
func (*AccountStorage) MigrateUint64Keys ¶
func (i *AccountStorage) MigrateUint64Keys( inter *interpreter.Interpreter, key string, migrator StorageMapKeyMigrator, )
type CachedStaticType ¶
type CachedStaticType struct { StaticType interpreter.StaticType Error error }
type DefaultStaticTypeCache ¶
type DefaultStaticTypeCache struct {
// contains filtered or unexported fields
}
func NewDefaultStaticTypeCache ¶
func NewDefaultStaticTypeCache() *DefaultStaticTypeCache
func (*DefaultStaticTypeCache) Get ¶
func (c *DefaultStaticTypeCache) Get(typeID interpreter.TypeID) (CachedStaticType, bool)
func (*DefaultStaticTypeCache) Set ¶
func (c *DefaultStaticTypeCache) Set( typeID interpreter.TypeID, staticType interpreter.StaticType, err error, )
type DomainMigration ¶
type DomainMigration interface { Name() string Migrate( addressPath interpreter.AddressPath, ) }
type LegacyCharacterValue ¶
type LegacyCharacterValue struct {
interpreter.CharacterValue
}
LegacyCharacterValue simulates the old character-value which uses the un-normalized string for hashing.
func (*LegacyCharacterValue) Equal ¶
func (v *LegacyCharacterValue) Equal( inter *interpreter.Interpreter, locationRange interpreter.LocationRange, other interpreter.Value, ) bool
func (*LegacyCharacterValue) HashInput ¶
func (v *LegacyCharacterValue) HashInput(_ *interpreter.Interpreter, _ interpreter.LocationRange, scratch []byte) []byte
func (*LegacyCharacterValue) StoredValue ¶
func (v *LegacyCharacterValue) StoredValue(_ atree.SlabStorage) (atree.Value, error)
func (*LegacyCharacterValue) Transfer ¶
func (v *LegacyCharacterValue) Transfer( interpreter *interpreter.Interpreter, _ interpreter.LocationRange, _ atree.Address, remove bool, storable atree.Storable, _ map[atree.StorageID]struct{}, ) interpreter.Value
type LegacyIntersectionType ¶
type LegacyIntersectionType struct {
*interpreter.IntersectionStaticType
}
LegacyIntersectionType simulates the old, incorrect restricted-type type-ID generation, which did not sort the type IDs of the interface types.
func (*LegacyIntersectionType) Equal ¶
func (t *LegacyIntersectionType) Equal(other interpreter.StaticType) bool
func (*LegacyIntersectionType) ID ¶
func (t *LegacyIntersectionType) ID() common.TypeID
type LegacyOptionalType ¶
type LegacyOptionalType struct {
*interpreter.OptionalStaticType
}
LegacyOptionalType simulates the old optional type with the old typeID generation.
func (*LegacyOptionalType) Equal ¶
func (t *LegacyOptionalType) Equal(other interpreter.StaticType) bool
func (*LegacyOptionalType) ID ¶
func (t *LegacyOptionalType) ID() common.TypeID
type LegacyPrimitiveStaticType ¶
type LegacyPrimitiveStaticType struct {
interpreter.PrimitiveStaticType
}
LegacyPrimitiveStaticType simulates the old primitive-static-type which uses the old type-ids for hashing.
func (LegacyPrimitiveStaticType) Equal ¶
func (t LegacyPrimitiveStaticType) Equal(other interpreter.StaticType) bool
func (LegacyPrimitiveStaticType) ID ¶
func (t LegacyPrimitiveStaticType) ID() common.TypeID
type LegacyReferenceType ¶
type LegacyReferenceType struct {
*interpreter.ReferenceStaticType
}
LegacyReferenceType simulates the old reference type with the old typeID generation.
func (*LegacyReferenceType) Encode ¶
func (t *LegacyReferenceType) Encode(e *cbor.StreamEncoder) error
func (*LegacyReferenceType) Equal ¶
func (t *LegacyReferenceType) Equal(other interpreter.StaticType) bool
func (*LegacyReferenceType) ID ¶
func (t *LegacyReferenceType) ID() common.TypeID
type LegacyStringValue ¶
type LegacyStringValue struct {
*interpreter.StringValue
}
LegacyStringValue simulates the old string-value which uses the un-normalized string for hashing.
func (*LegacyStringValue) Equal ¶
func (v *LegacyStringValue) Equal( inter *interpreter.Interpreter, locationRange interpreter.LocationRange, other interpreter.Value, ) bool
func (*LegacyStringValue) HashInput ¶
func (v *LegacyStringValue) HashInput(_ *interpreter.Interpreter, _ interpreter.LocationRange, scratch []byte) []byte
func (*LegacyStringValue) StoredValue ¶
func (v *LegacyStringValue) StoredValue(_ atree.SlabStorage) (atree.Value, error)
func (*LegacyStringValue) Transfer ¶
func (v *LegacyStringValue) Transfer( interpreter *interpreter.Interpreter, _ interpreter.LocationRange, _ atree.Address, remove bool, storable atree.Storable, _ map[atree.StorageID]struct{}, ) interpreter.Value
type Reporter ¶
type Reporter interface { Migrated( storageKey interpreter.StorageKey, storageMapKey interpreter.StorageMapKey, migration string, ) DictionaryKeyConflict(addressPath interpreter.AddressPath) Error(err error) }
type StaticTypeCache ¶
type StaticTypeCache interface { Get(typeID interpreter.TypeID) (CachedStaticType, bool) Set( typeID interpreter.TypeID, staticType interpreter.StaticType, err error, ) }
type StorageMapKeyMigrator ¶
type StorageMapKeyMigrator interface { Migrate( inter *interpreter.Interpreter, storageKey interpreter.StorageKey, storageMap *interpreter.StorageMap, storageMapKey interpreter.StorageMapKey, ) Domains() map[string]struct{} }
func NewValueConverterPathMigrator ¶
func NewValueConverterPathMigrator( domains map[string]struct{}, convertValue ValueConverter, ) StorageMapKeyMigrator
type StorageMigration ¶
type StorageMigration struct {
// contains filtered or unexported fields
}
func NewStorageMigration ¶
func NewStorageMigration( interpreter *interpreter.Interpreter, storage *runtime.Storage, name string, address common.Address, ) ( *StorageMigration, error, )
func (*StorageMigration) Commit ¶
func (m *StorageMigration) Commit() error
func (*StorageMigration) DictionaryKeyConflictStorageMapKey ¶
func (m *StorageMigration) DictionaryKeyConflictStorageMapKey(index int) interpreter.StringStorageMapKey
func (*StorageMigration) Migrate ¶
func (m *StorageMigration) Migrate(migrator StorageMapKeyMigrator)
func (*StorageMigration) MigrateNestedValue ¶
func (m *StorageMigration) MigrateNestedValue( storageKey interpreter.StorageKey, storageMapKey interpreter.StorageMapKey, value interpreter.Value, valueMigrations []ValueMigration, reporter Reporter, allowMutation bool, ) (migratedValue interpreter.Value)
func (*StorageMigration) NewValueMigrationsPathMigrator ¶
func (m *StorageMigration) NewValueMigrationsPathMigrator( reporter Reporter, valueMigrations ...ValueMigration, ) StorageMapKeyMigrator
func (*StorageMigration) WithErrorStacktrace ¶
func (m *StorageMigration) WithErrorStacktrace(stacktraceEnabled bool) *StorageMigration
type StorageMigrationError ¶
type StorageMigrationError struct { StorageKey interpreter.StorageKey StorageMapKey interpreter.StorageMapKey Migration string Err error Stack []byte }
func (StorageMigrationError) Error ¶
func (e StorageMigrationError) Error() string
type ValueConverter ¶
type ValueConverter func( storageKey interpreter.StorageKey, storageMapKey interpreter.StorageMapKey, value interpreter.Value, ) interpreter.Value
type ValueConverterPathMigrator ¶
type ValueConverterPathMigrator struct { ConvertValue ValueConverter // contains filtered or unexported fields }
func (ValueConverterPathMigrator) Domains ¶
func (m ValueConverterPathMigrator) Domains() map[string]struct{}
func (ValueConverterPathMigrator) Migrate ¶
func (m ValueConverterPathMigrator) Migrate( inter *interpreter.Interpreter, storageKey interpreter.StorageKey, storageMap *interpreter.StorageMap, storageMapKey interpreter.StorageMapKey, )
type ValueMigration ¶
type ValueMigration interface { Name() string Migrate( storageKey interpreter.StorageKey, storageMapKey interpreter.StorageMapKey, value interpreter.Value, interpreter *interpreter.Interpreter, ) (newValue interpreter.Value, err error) CanSkip(valueType interpreter.StaticType) bool Domains() map[string]struct{} }