Documentation ¶
Index ¶
- func BurnerAddressForChain(chainID flow.ChainID) flow.Address
- func ByteCountIEC(b int64) string
- func MigrateByAccount(log zerolog.Logger, nWorker int, registersByAccount *registers.ByAccount, ...) error
- func MigrateGroupConcurrently(log zerolog.Logger, migrations []AccountBasedMigration, ...) error
- func NewCadence1CompositeStaticTypeConverter(chainID flow.ChainID) statictypes.CompositeTypeConverterFunc
- func NewCadence1InterfaceStaticTypeConverter(chainID flow.ChainID) statictypes.InterfaceTypeConverterFunc
- func NewStaticTypeMigration[T interpreter.StaticType](rules StaticTypeMigrationRules) func(staticType T) interpreter.StaticType
- func NewUserDefinedTypeChangeCheckerFunc(chainID flow.ChainID) func(oldTypeID common.TypeID, newTypeID common.TypeID) (checked, valid bool)
- func PruneEmptyMigration(payload []ledger.Payload) ([]ledger.Payload, error)
- type AccountBasedMigration
- type AccountUsageMigration
- type BasicMigrationRuntime
- type BurnerContractChange
- type CadenceBaseMigration
- func NewCadence1CapabilityValueMigration(rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, ...) *CadenceBaseMigration
- func NewCadence1LinkValueMigration(rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, ...) *CadenceBaseMigration
- func NewCadence1ValueMigration(rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, ...) *CadenceBaseMigration
- type CadenceValueDiffReporter
- type Contract
- type EVMContractChange
- 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 Metrics
- type MetricsCollectingMigration
- func (m *MetricsCollectingMigration) CanSkip(interpreter.StaticType) bool
- func (m *MetricsCollectingMigration) Close() error
- func (m *MetricsCollectingMigration) Domains() map[string]struct{}
- func (m *MetricsCollectingMigration) InitMigration(_ zerolog.Logger, _ *registers.ByAccount, _ int) error
- func (m *MetricsCollectingMigration) Migrate(_ interpreter.StorageKey, _ interpreter.StorageMapKey, value interpreter.Value, ...) (newValue interpreter.Value, err error)
- func (m *MetricsCollectingMigration) MigrateAccount(_ context.Context, address common.Address, ...) error
- func (*MetricsCollectingMigration) Name() string
- type MigrationMetricsCollector
- type NamedMigration
- func NewCadence1ContractsMigrations(log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options) (migs []NamedMigration)
- func NewCadence1Migrations(log zerolog.Logger, outputDir string, rwf reporters.ReportWriterFactory, ...) (migs []NamedMigration)
- func NewCadence1ValueMigrations(log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options) (migs []NamedMigration)
- type Options
- type RegistersMigration
- func NewAccountBasedMigration(log zerolog.Logger, nWorker int, migrations []AccountBasedMigration) 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 NewBurnerDeploymentMigration(chainID flow.ChainID, logger zerolog.Logger) RegistersMigration
- func NewCadence1PruneMigration(chainID flow.ChainID, log zerolog.Logger, nWorkers int) RegistersMigration
- func NewContractCheckingMigration(log zerolog.Logger, rwf reporters.ReportWriterFactory, chainID flow.ChainID, ...) RegistersMigration
- func NewDeploymentMigration(chainID flow.ChainID, contract Contract, authorizer flow.Address, ...) RegistersMigration
- func NewEVMDeploymentMigration(chainID flow.ChainID, logger zerolog.Logger) RegistersMigration
- func NewTransactionBasedMigration(tx *flow.TransactionBody, chainID flow.ChainID, logger zerolog.Logger, ...) RegistersMigration
- type StagedContract
- type StagedContractsMigration
- func (m *StagedContractsMigration) Close() error
- func (m *StagedContractsMigration) InitMigration(log zerolog.Logger, registersByAccount *registers.ByAccount, _ int) error
- func (m *StagedContractsMigration) MigrateAccount(_ context.Context, address common.Address, ...) error
- func (m *StagedContractsMigration) WithContractUpdateValidation() *StagedContractsMigration
- func (m *StagedContractsMigration) WithStagedContractUpdates(stagedContracts []StagedContract) *StagedContractsMigration
- type StagedContractsMigrationOptions
- type StaticTypeMigrationRules
- type SystemContractsMigrationOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BurnerAddressForChain ¶ added in v0.33.30
func ByteCountIEC ¶ added in v0.33.30
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 MigrateGroupConcurrently ¶ added in v0.29.0
func MigrateGroupConcurrently( log zerolog.Logger, migrations []AccountBasedMigration, registersByAccount *registers.ByAccount, nWorker int, ) error
MigrateGroupConcurrently migrate the registers in the given account groups. The registers in each account are processed sequentially by the given migrations in order.
func NewCadence1CompositeStaticTypeConverter ¶ added in v0.33.30
func NewCadence1CompositeStaticTypeConverter(chainID flow.ChainID) statictypes.CompositeTypeConverterFunc
func NewCadence1InterfaceStaticTypeConverter ¶ added in v0.33.30
func NewCadence1InterfaceStaticTypeConverter(chainID flow.ChainID) statictypes.InterfaceTypeConverterFunc
func NewStaticTypeMigration ¶ added in v0.33.30
func NewStaticTypeMigration[T interpreter.StaticType]( rules StaticTypeMigrationRules, ) func(staticType T) interpreter.StaticType
func NewUserDefinedTypeChangeCheckerFunc ¶ added in v0.33.30
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
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 { 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 BurnerContractChange ¶ added in v0.33.30
type BurnerContractChange uint8
const ( BurnerContractChangeNone BurnerContractChange = iota BurnerContractChangeDeploy BurnerContractChangeUpdate )
type CadenceBaseMigration ¶ added in v0.33.30
type CadenceBaseMigration struct {
// contains filtered or unexported fields
}
func NewCadence1CapabilityValueMigration ¶ added in v0.33.30
func NewCadence1CapabilityValueMigration( rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, programs map[runtime.Location]*interpreter.Program, capabilityMapping *capcons.CapabilityMapping, opts Options, ) *CadenceBaseMigration
NewCadence1CapabilityValueMigration creates a new CadenceBaseMigration which migrates path capability values to ID capability values. It requires a map the IDs of the capability controllers, generated by the link value migration.
func NewCadence1LinkValueMigration ¶ added in v0.33.30
func NewCadence1LinkValueMigration( rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, programs map[runtime.Location]*interpreter.Program, capabilityMapping *capcons.CapabilityMapping, opts Options, ) *CadenceBaseMigration
NewCadence1LinkValueMigration creates a new CadenceBaseMigration which migrates links to capability controllers. It populates the given map with the IDs of the capability controller it issues.
func NewCadence1ValueMigration ¶ added in v0.33.30
func NewCadence1ValueMigration( rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, programs map[runtime.Location]*interpreter.Program, compositeTypeConverter statictypes.CompositeTypeConverterFunc, interfaceTypeConverter statictypes.InterfaceTypeConverterFunc, opts Options, ) *CadenceBaseMigration
NewCadence1ValueMigration creates a new CadenceBaseMigration which runs some of the Cadence value migrations (static types, entitlements, strings)
func (*CadenceBaseMigration) Close ¶ added in v0.33.30
func (m *CadenceBaseMigration) Close() error
func (*CadenceBaseMigration) InitMigration ¶ added in v0.33.30
func (*CadenceBaseMigration) MigrateAccount ¶ added in v0.33.30
func (m *CadenceBaseMigration) MigrateAccount( _ context.Context, address common.Address, accountRegisters *registers.AccountRegisters, ) error
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(oldPayloads, newPayloads []*ledger.Payload, domains []string)
type EVMContractChange ¶ added in v0.33.30
type EVMContractChange uint8
const ( EVMContractChangeNone EVMContractChange = iota EVMContractChangeDeploy EVMContractChangeUpdate )
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( transactionState state.NestedTransactionPreparer, accounts environment.Accounts, ) ( runtime.Interface, error, )
type Metrics ¶ added in v0.33.30
type Metrics struct { // Total values in the storage TotalValues int `json:"totalValues"` // Total values with errors (un-migrated values) TotalErrors int `json:"TotalErrors"` // Values with errors (un-migrated) related to each contract ErrorsPerContract map[string]int `json:"errorsPerContract"` // Total values related to each contract ValuesPerContract map[string]int `json:"valuesPerContract"` }
type MetricsCollectingMigration ¶ added in v0.33.30
type MetricsCollectingMigration struct {
// contains filtered or unexported fields
}
func NewMetricsCollectingMigration ¶ added in v0.33.30
func NewMetricsCollectingMigration( chainID flow.ChainID, rwf reporters.ReportWriterFactory, programs map[common.Location]*interpreter.Program, ) *MetricsCollectingMigration
func (*MetricsCollectingMigration) CanSkip ¶ added in v0.33.30
func (m *MetricsCollectingMigration) CanSkip(interpreter.StaticType) bool
func (*MetricsCollectingMigration) Close ¶ added in v0.33.30
func (m *MetricsCollectingMigration) Close() error
func (*MetricsCollectingMigration) Domains ¶ added in v0.33.30
func (m *MetricsCollectingMigration) Domains() map[string]struct{}
func (*MetricsCollectingMigration) InitMigration ¶ added in v0.33.30
func (*MetricsCollectingMigration) Migrate ¶ added in v0.33.30
func (m *MetricsCollectingMigration) Migrate( _ interpreter.StorageKey, _ interpreter.StorageMapKey, value interpreter.Value, _ *interpreter.Interpreter, ) ( newValue interpreter.Value, err error, )
func (*MetricsCollectingMigration) MigrateAccount ¶ added in v0.33.30
func (m *MetricsCollectingMigration) MigrateAccount( _ context.Context, address common.Address, accountRegisters *registers.AccountRegisters, ) error
func (*MetricsCollectingMigration) Name ¶ added in v0.33.30
func (*MetricsCollectingMigration) Name() string
type MigrationMetricsCollector ¶ added in v0.33.30
type MigrationMetricsCollector struct { TotalValues int `json:"totalValues"` TotalErrors int `json:"totalErrors"` ValuesPerContract map[common.Location]int `json:"valuesPerContract"` ErrorsPerContract map[common.Location]int `json:"errorsPerContract"` // contains filtered or unexported fields }
func NewMigrationMetricsCollector ¶ added in v0.33.30
func NewMigrationMetricsCollector() *MigrationMetricsCollector
func (*MigrationMetricsCollector) RecordError ¶ added in v0.33.30
func (c *MigrationMetricsCollector) RecordError()
func (*MigrationMetricsCollector) RecordErrorForContract ¶ added in v0.33.30
func (c *MigrationMetricsCollector) RecordErrorForContract(location common.Location)
func (*MigrationMetricsCollector) RecordValue ¶ added in v0.33.30
func (c *MigrationMetricsCollector) RecordValue()
func (*MigrationMetricsCollector) RecordValueForContract ¶ added in v0.33.30
func (c *MigrationMetricsCollector) RecordValueForContract(location common.Location)
type NamedMigration ¶ added in v0.33.30
type NamedMigration struct { Name string Migrate RegistersMigration }
func NewCadence1ContractsMigrations ¶ added in v0.33.30
func NewCadence1ContractsMigrations( log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options, ) (migs []NamedMigration)
func NewCadence1Migrations ¶ added in v0.33.30
func NewCadence1Migrations( log zerolog.Logger, outputDir string, rwf reporters.ReportWriterFactory, opts Options, ) (migs []NamedMigration)
func NewCadence1ValueMigrations ¶ added in v0.33.30
func NewCadence1ValueMigrations( log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options, ) (migs []NamedMigration)
type Options ¶ added in v0.33.30
type Options struct { NWorker int DiffMigrations bool LogVerboseDiff bool CheckStorageHealthBeforeMigration bool VerboseErrorOutput bool ChainID flow.ChainID EVMContractChange EVMContractChange BurnerContractChange BurnerContractChange StagedContracts []StagedContract Prune bool MaxAccountSize uint64 FixSlabsWithBrokenReferences bool FilterUnreferencedSlabs bool ReportMetrics bool }
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 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 NewBurnerDeploymentMigration ¶ added in v0.33.30
func NewBurnerDeploymentMigration( chainID flow.ChainID, logger zerolog.Logger, ) RegistersMigration
func NewCadence1PruneMigration ¶ added in v0.33.30
func NewCadence1PruneMigration( chainID flow.ChainID, log zerolog.Logger, nWorkers int, ) RegistersMigration
NewCadence1PruneMigration prunes some values from the service account in the Testnet state
func NewContractCheckingMigration ¶ added in v0.33.30
func NewContractCheckingMigration( log zerolog.Logger, rwf reporters.ReportWriterFactory, chainID flow.ChainID, verboseErrorOutput bool, programs map[common.Location]*interpreter.Program, ) RegistersMigration
NewContractCheckingMigration returns a migration that checks all contracts. It parses and checks all contract code and stores the programs in the provided map.
func NewDeploymentMigration ¶ added in v0.33.30
func NewEVMDeploymentMigration ¶ added in v0.33.30
func NewEVMDeploymentMigration( chainID flow.ChainID, logger zerolog.Logger, ) RegistersMigration
func NewTransactionBasedMigration ¶ added in v0.33.30
func NewTransactionBasedMigration( tx *flow.TransactionBody, chainID flow.ChainID, logger zerolog.Logger, expectedWriteAddresses map[flow.Address]struct{}, ) RegistersMigration
type StagedContract ¶ added in v0.33.30
func NewSystemContractChange ¶ added in v0.33.1
func NewSystemContractChange( systemContract systemcontracts.SystemContract, newContractCode []byte, ) StagedContract
func StagedContractsFromCSV ¶ added in v0.33.30
func StagedContractsFromCSV(path string) ([]StagedContract, error)
func SystemContractChanges ¶ added in v0.33.1
func SystemContractChanges(chainID flow.ChainID, options SystemContractsMigrationOptions) []StagedContract
type StagedContractsMigration ¶ added in v0.33.30
type StagedContractsMigration struct {
// contains filtered or unexported fields
}
func NewStagedContractsMigration ¶ added in v0.33.30
func NewStagedContractsMigration( name string, reporterName string, log zerolog.Logger, rwf reporters.ReportWriterFactory, options StagedContractsMigrationOptions, ) *StagedContractsMigration
func NewSystemContractsMigration ¶ added in v0.33.30
func NewSystemContractsMigration( log zerolog.Logger, rwf reporters.ReportWriterFactory, options SystemContractsMigrationOptions, ) *StagedContractsMigration
func (*StagedContractsMigration) Close ¶ added in v0.33.30
func (m *StagedContractsMigration) Close() error
func (*StagedContractsMigration) InitMigration ¶ added in v0.33.30
func (*StagedContractsMigration) MigrateAccount ¶ added in v0.33.30
func (m *StagedContractsMigration) MigrateAccount( _ context.Context, address common.Address, accountRegisters *registers.AccountRegisters, ) error
func (*StagedContractsMigration) WithContractUpdateValidation ¶ added in v0.33.30
func (m *StagedContractsMigration) WithContractUpdateValidation() *StagedContractsMigration
func (*StagedContractsMigration) WithStagedContractUpdates ¶ added in v0.33.30
func (m *StagedContractsMigration) WithStagedContractUpdates(stagedContracts []StagedContract) *StagedContractsMigration
WithStagedContractUpdates prepares the contract updates as a map for easy lookup.
type StagedContractsMigrationOptions ¶ added in v0.33.30
type StaticTypeMigrationRules ¶ added in v0.33.30
type StaticTypeMigrationRules map[common.TypeID]interpreter.StaticType
func NewCompositeTypeConversionRules ¶ added in v0.33.30
func NewCompositeTypeConversionRules(chainID flow.ChainID) StaticTypeMigrationRules
func NewInterfaceTypeConversionRules ¶ added in v0.33.30
func NewInterfaceTypeConversionRules(chainID flow.ChainID) StaticTypeMigrationRules
type SystemContractsMigrationOptions ¶ added in v0.33.30
type SystemContractsMigrationOptions struct { StagedContractsMigrationOptions EVM EVMContractChange Burner BurnerContractChange }
Source Files ¶
- account_based_migration.go
- account_size_filter_migration.go
- account_storage_migration.go
- cadence.go
- cadence_value_diff.go
- cadence_values_migration.go
- change_contract_code_migration.go
- contract_checking_migration.go
- deploy_migration.go
- filter_unreferenced_slabs_migration.go
- fix_broken_data_migration.go
- migration_metrics_collector.go
- migrator_runtime.go
- prune_migration.go
- staged_contracts_migration.go
- static_type_migration.go
- storage_used_migration.go
- transaction_migration.go
- utils.go