Documentation ¶
Index ¶
- Variables
- func ByteCountIEC(b int64) string
- func MigrateAccountsConcurrently(log zerolog.Logger, migrations []AccountBasedMigration, ...) error
- func MigrateByAccount(log zerolog.Logger, nWorker int, registersByAccount *registers.ByAccount, ...) error
- func ShouldFixBrokenCompositeKeyedDictionary(atreeValue atree.Value) bool
- type AccountBasedMigration
- type AccountUsageMigration
- type BasicMigrationRuntime
- type CadenceValueDiffReporter
- type Contract
- type FilterUnreferencedSlabsMigration
- type FixSlabsWithBrokenReferencesMigration
- func (m *FixSlabsWithBrokenReferencesMigration) Close() error
- func (m *FixSlabsWithBrokenReferencesMigration) InitMigration(log zerolog.Logger, _ *registers.ByAccount, nWorkers int) error
- func (m *FixSlabsWithBrokenReferencesMigration) MigrateAccount(_ context.Context, address common.Address, ...) error
- type InterpreterMigrationRuntime
- type InterpreterMigrationRuntimeConfig
- type NamedMigration
- type RegistersMigration
- func NewAccountBasedMigration(log zerolog.Logger, nWorker int, migrations []AccountBasedMigration) RegistersMigration
- func NewAccountCreationMigration(address flow.Address, logger zerolog.Logger) RegistersMigration
- func NewAccountSizeFilterMigration(maxAccountSize uint64, exceptions map[string]struct{}, log zerolog.Logger) RegistersMigration
- func NewAccountStorageMigration(address common.Address, log zerolog.Logger, chainID flow.ChainID, ...) RegistersMigration
- func NewDeploymentMigration(chainID flow.ChainID, contract Contract, authorizer flow.Address, ...) RegistersMigration
- func NewTransactionBasedMigration(tx *flow.TransactionBody, chainID flow.ChainID, logger zerolog.Logger, ...) RegistersMigration
Constants ¶
This section is empty.
Variables ¶
var AllStorageMapDomains = []string{ common.PathDomainStorage.Identifier(), common.PathDomainPrivate.Identifier(), common.PathDomainPublic.Identifier(), runtime.StorageDomainContract, stdlib.InboxStorageDomain, stdlib.CapabilityControllerStorageDomain, stdlib.PathCapabilityStorageDomain, stdlib.AccountCapabilityStorageDomain, }
Functions ¶
func ByteCountIEC ¶ added in v0.33.30
func MigrateAccountsConcurrently ¶ added in v0.33.30
func MigrateAccountsConcurrently( log zerolog.Logger, migrations []AccountBasedMigration, registersByAccount *registers.ByAccount, nWorker int, ) error
MigrateAccountsConcurrently migrate the registers in the given account groups. The registers in each account are processed sequentially by the given migrations in order.
func MigrateByAccount ¶ added in v0.29.0
func MigrateByAccount( log zerolog.Logger, nWorker int, registersByAccount *registers.ByAccount, migrations []AccountBasedMigration, ) error
MigrateByAccount takes migrations and all the registers, grouped by account, and returns the migrated registers.
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 AccountBasedMigration ¶ added in v0.33.1
type AccountBasedMigration interface { InitMigration( log zerolog.Logger, registersByAccount *registers.ByAccount, nWorkers int, ) error MigrateAccount( ctx context.Context, address common.Address, accountRegisters *registers.AccountRegisters, ) error io.Closer }
AccountBasedMigration is an interface for migrations that migrate account by account concurrently getting all the payloads for each account at a time.
type AccountUsageMigration ¶ added in v0.33.30
type AccountUsageMigration struct {
// contains filtered or unexported fields
}
AccountUsageMigration iterates through each payload, and calculate the storage usage and update the accounts status with the updated storage usage. It also upgrades the account status registers to the latest version.
func NewAccountUsageMigration ¶ added in v0.36.2
func NewAccountUsageMigration(rw reporters.ReportWriterFactory) *AccountUsageMigration
func (*AccountUsageMigration) Close ¶ added in v0.33.30
func (m *AccountUsageMigration) Close() error
func (*AccountUsageMigration) InitMigration ¶ added in v0.33.30
func (*AccountUsageMigration) MigrateAccount ¶ added in v0.33.30
func (m *AccountUsageMigration) MigrateAccount( _ context.Context, address common.Address, accountRegisters *registers.AccountRegisters, ) error
type BasicMigrationRuntime ¶ added in v0.33.30
type BasicMigrationRuntime struct { Registers registers.Registers TransactionState state.NestedTransactionPreparer Storage *runtime.Storage AccountsLedger *util.AccountsAtreeLedger Accounts environment.Accounts }
func NewBasicMigrationRuntime ¶ added in v0.33.30
func NewBasicMigrationRuntime(regs registers.Registers) *BasicMigrationRuntime
NewBasicMigrationRuntime returns a basic runtime for migrations.
type CadenceValueDiffReporter ¶ added in v0.33.30
type CadenceValueDiffReporter struct {
// contains filtered or unexported fields
}
func NewCadenceValueDiffReporter ¶ added in v0.33.30
func NewCadenceValueDiffReporter( address common.Address, chainID flow.ChainID, rw reporters.ReportWriter, verboseLogging bool, nWorkers int, ) *CadenceValueDiffReporter
func (*CadenceValueDiffReporter) DiffStates ¶ added in v0.33.30
func (dr *CadenceValueDiffReporter) DiffStates(oldRegs, newRegs registers.Registers, domains []string)
type FilterUnreferencedSlabsMigration ¶ added in v0.33.30
type FilterUnreferencedSlabsMigration struct {
// contains filtered or unexported fields
}
func NewFilterUnreferencedSlabsMigration ¶ added in v0.33.30
func NewFilterUnreferencedSlabsMigration( outputDir string, rwf reporters.ReportWriterFactory, ) *FilterUnreferencedSlabsMigration
func (*FilterUnreferencedSlabsMigration) Close ¶ added in v0.33.30
func (m *FilterUnreferencedSlabsMigration) Close() error
func (*FilterUnreferencedSlabsMigration) InitMigration ¶ added in v0.33.30
func (*FilterUnreferencedSlabsMigration) MigrateAccount ¶ added in v0.33.30
func (m *FilterUnreferencedSlabsMigration) MigrateAccount( _ context.Context, address common.Address, accountRegisters *registers.AccountRegisters, ) error
type FixSlabsWithBrokenReferencesMigration ¶ added in v0.33.30
type FixSlabsWithBrokenReferencesMigration struct {
// contains filtered or unexported fields
}
func NewFixBrokenReferencesInSlabsMigration ¶ added in v0.33.30
func NewFixBrokenReferencesInSlabsMigration( outputDir string, rwf reporters.ReportWriterFactory, accountsToFix map[common.Address]struct{}, ) *FixSlabsWithBrokenReferencesMigration
func (*FixSlabsWithBrokenReferencesMigration) Close ¶ added in v0.33.30
func (m *FixSlabsWithBrokenReferencesMigration) Close() error
func (*FixSlabsWithBrokenReferencesMigration) InitMigration ¶ added in v0.33.30
func (*FixSlabsWithBrokenReferencesMigration) MigrateAccount ¶ added in v0.33.30
func (m *FixSlabsWithBrokenReferencesMigration) MigrateAccount( _ context.Context, address common.Address, accountRegisters *registers.AccountRegisters, ) error
type InterpreterMigrationRuntime ¶ added in v0.33.30
type InterpreterMigrationRuntime struct { *BasicMigrationRuntime Interpreter *interpreter.Interpreter ContractAdditionHandler stdlib.AccountContractAdditionHandler ContractNamesProvider stdlib.AccountContractNamesProvider }
func NewInterpreterMigrationRuntime ¶ added in v0.33.30
func NewInterpreterMigrationRuntime( regs registers.Registers, chainID flow.ChainID, config InterpreterMigrationRuntimeConfig, ) ( *InterpreterMigrationRuntime, error, )
NewInterpreterMigrationRuntime returns a runtime for migrations that need an interpreter.
type InterpreterMigrationRuntimeConfig ¶ added in v0.33.30
type InterpreterMigrationRuntimeConfig struct { GetCode util.GetContractCodeFunc GetContractNames util.GetContractNamesFunc GetOrLoadProgram util.GetOrLoadProgramFunc GetOrLoadProgramListener util.GerOrLoadProgramListenerFunc }
InterpreterMigrationRuntimeConfig is used to configure the InterpreterMigrationRuntime. The code, contract names, and program loading functions can be nil, in which case program loading will be configured to use the default behavior, loading contracts from the given payloads. The listener function is optional and can be used to listen for program loading events.
func (InterpreterMigrationRuntimeConfig) NewRuntimeInterface ¶ added in v0.33.30
func (c InterpreterMigrationRuntimeConfig) NewRuntimeInterface( chainID flow.ChainID, transactionState state.NestedTransactionPreparer, accounts environment.Accounts, ) ( runtime.Interface, error, )
type NamedMigration ¶ added in v0.33.30
type NamedMigration struct { Name string Migrate RegistersMigration }
type RegistersMigration ¶ added in v0.33.30
func NewAccountBasedMigration ¶ added in v0.33.30
func NewAccountBasedMigration( log zerolog.Logger, nWorker int, migrations []AccountBasedMigration, ) RegistersMigration
NewAccountBasedMigration creates a migration function that migrates the payloads account by account using the given migrations accounts are processed concurrently using the given number of workers but each account is processed sequentially by the given migrations in order. The migrations InitMigration function is called once before the migration starts And the Close function is called once after the migration finishes if the migration is a finisher.
func NewAccountCreationMigration ¶
func NewAccountCreationMigration( address flow.Address, logger zerolog.Logger, ) RegistersMigration
func NewAccountSizeFilterMigration ¶ added in v0.33.30
func NewAccountSizeFilterMigration( maxAccountSize uint64, exceptions map[string]struct{}, log zerolog.Logger, ) RegistersMigration
func NewAccountStorageMigration ¶ added in v0.33.30
func NewAccountStorageMigration( address common.Address, log zerolog.Logger, chainID flow.ChainID, migrate func(*runtime.Storage, *interpreter.Interpreter) error, ) RegistersMigration
func NewDeploymentMigration ¶ added in v0.33.30
func NewTransactionBasedMigration ¶ added in v0.33.30
func NewTransactionBasedMigration( tx *flow.TransactionBody, chainID flow.ChainID, logger zerolog.Logger, expectedWriteAddresses map[flow.Address]struct{}, ) RegistersMigration