Documentation
¶
Index ¶
- func BurnerAddressForChain(chainID flow.ChainID) flow.Address
- func ByteCountIEC(b int64) string
- func MergeRegisterChanges(originalPayloads map[flow.RegisterID]*ledger.Payload, ...) ([]*ledger.Payload, error)
- func MigrateByAccount(log zerolog.Logger, nWorker int, allPayloads []*ledger.Payload, ...) ([]*ledger.Payload, error)
- func MigrateGroupConcurrently(log zerolog.Logger, migrations []AccountBasedMigration, ...) ([]*ledger.Payload, error)
- func NewAccountBasedMigration(log zerolog.Logger, nWorker int, migrations []AccountBasedMigration) func(payloads []*ledger.Payload) ([]*ledger.Payload, error)
- func NewAccountSizeFilterMigration(maxAccountSize uint64, exceptions map[string]struct{}, log zerolog.Logger) ledger.Migration
- func NewAccountStorageMigration(address common.Address, log zerolog.Logger, chainID flow.ChainID, ...) ledger.Migration
- func NewBurnerDeploymentMigration(chainID flow.ChainID, logger zerolog.Logger) ledger.Migration
- func NewCadence1CompositeStaticTypeConverter(chainID flow.ChainID) statictypes.CompositeTypeConverterFunc
- func NewCadence1InterfaceStaticTypeConverter(chainID flow.ChainID) statictypes.InterfaceTypeConverterFunc
- func NewCadence1PruneMigration(chainID flow.ChainID, log zerolog.Logger) ledger.Migration
- func NewContractCheckingMigration(log zerolog.Logger, rwf reporters.ReportWriterFactory, chainID flow.ChainID, ...) ledger.Migration
- func NewDeploymentMigration(chainID flow.ChainID, contract Contract, authorizer flow.Address, ...) ledger.Migration
- func NewStaticTypeMigrator[T interpreter.StaticType](rules StaticTypeMigrationRules) func(staticType T) interpreter.StaticType
- func NewTransactionBasedMigration(tx *flow.TransactionBody, chainID flow.ChainID, logger zerolog.Logger, ...) ledger.Migration
- func NewUserDefinedTypeChangeCheckerFunc(chainID flow.ChainID) func(oldTypeID common.TypeID, newTypeID common.TypeID) (checked, valid bool)
- func NoOpMigration(p []ledger.Payload) ([]ledger.Payload, error)
- func PruneEmptyMigration(payload []ledger.Payload) ([]ledger.Payload, error)
- type AccountBasedMigration
- type AccountUsageMigrator
- type AtreeRegisterMigrator
- func (m *AtreeRegisterMigrator) Close() error
- func (m *AtreeRegisterMigrator) InitMigration(log zerolog.Logger, _ []*ledger.Payload, nWorkers int) error
- func (m *AtreeRegisterMigrator) MigrateAccount(_ context.Context, address common.Address, oldPayloads []*ledger.Payload) ([]*ledger.Payload, error)
- type AtreeRegisterMigratorRuntime
- type BurnerContractChange
- type CadenceBaseMigrator
- func NewCadence1CapabilityValueMigrator(rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, ...) *CadenceBaseMigrator
- func NewCadence1LinkValueMigrator(rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, ...) *CadenceBaseMigrator
- func NewCadence1ValueMigrator(rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, ...) *CadenceBaseMigrator
- type CadenceValueDiffReporter
- type Contract
- type DeduplicateContractNamesMigration
- func (d *DeduplicateContractNamesMigration) Close() error
- func (d *DeduplicateContractNamesMigration) InitMigration(log zerolog.Logger, _ []*ledger.Payload, _ int) error
- func (d *DeduplicateContractNamesMigration) MigrateAccount(ctx context.Context, address common.Address, payloads []*ledger.Payload) ([]*ledger.Payload, error)
- type EVMContractChange
- type MigratorRuntime
- type MigratorRuntimeConfig
- type NamedMigration
- func NewCadence1ContractsMigrations(log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options) []NamedMigration
- func NewCadence1Migrations(log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options) []NamedMigration
- func NewCadence1ValueMigrations(log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options) (migrations []NamedMigration)
- type Options
- type StagedContract
- type StagedContractsMigration
- func (m *StagedContractsMigration) Close() error
- func (m *StagedContractsMigration) InitMigration(log zerolog.Logger, allPayloads []*ledger.Payload, _ int) error
- func (m *StagedContractsMigration) MigrateAccount(_ context.Context, address common.Address, oldPayloads []*ledger.Payload) ([]*ledger.Payload, 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 MergeRegisterChanges ¶
func MigrateByAccount ¶ added in v0.29.0
func MigrateByAccount( log zerolog.Logger, nWorker int, allPayloads []*ledger.Payload, migrations []AccountBasedMigration, ) ( []*ledger.Payload, error, )
MigrateByAccount takes migrations and all the Payloads, and returns the migrated Payloads.
func MigrateGroupConcurrently ¶ added in v0.29.0
func MigrateGroupConcurrently( log zerolog.Logger, migrations []AccountBasedMigration, accountGroups *util.PayloadAccountGrouping, nWorker int, ) ([]*ledger.Payload, error)
MigrateGroupConcurrently migrate the Payloads in the given account groups. It uses nWorker to process the Payloads concurrently. The Payloads in each account are processed sequentially by the given migrations in order.
func NewAccountBasedMigration ¶ added in v0.33.30
func NewAccountBasedMigration( log zerolog.Logger, nWorker int, migrations []AccountBasedMigration, ) func(payloads []*ledger.Payload) ([]*ledger.Payload, error)
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 NewAccountStorageMigration ¶ added in v0.33.30
func NewBurnerDeploymentMigration ¶ added in v0.33.30
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 NewCadence1PruneMigration ¶ added in v0.33.30
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, ) ledger.Migration
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 NewStaticTypeMigrator ¶ added in v0.35.4
func NewStaticTypeMigrator[T interpreter.StaticType]( rules StaticTypeMigrationRules, ) func(staticType T) interpreter.StaticType
func NewTransactionBasedMigration ¶ added in v0.33.30
func NewUserDefinedTypeChangeCheckerFunc ¶ added in v0.33.30
Types ¶
type AccountBasedMigration ¶ added in v0.33.1
type AccountBasedMigration interface { InitMigration( log zerolog.Logger, allPayloads []*ledger.Payload, nWorkers int, ) error MigrateAccount( ctx context.Context, address common.Address, payloads []*ledger.Payload, ) ([]*ledger.Payload, 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 AccountUsageMigrator ¶ added in v0.29.0
type AccountUsageMigrator struct {
// contains filtered or unexported fields
}
AccountUsageMigrator iterates through each payload, and calculate the storage usage and update the accounts status with the updated storage usage
func (*AccountUsageMigrator) Close ¶ added in v0.33.1
func (m *AccountUsageMigrator) Close() error
func (*AccountUsageMigrator) InitMigration ¶ added in v0.33.1
type AtreeRegisterMigrator ¶ added in v0.35.4
type AtreeRegisterMigrator struct {
// contains filtered or unexported fields
}
AtreeRegisterMigrator is a migrator that converts the storage of an account from the old atree format to the new atree format. Account "storage used" should be correctly updated after the migration.
func NewAtreeRegisterMigrator ¶ added in v0.35.4
func NewAtreeRegisterMigrator( rwf reporters.ReportWriterFactory, validateMigratedValues bool, logVerboseValidationError bool, continueMigrationOnValidationError bool, checkStorageHealthBeforeMigration bool, checkStorageHealthAfterMigration bool, ) *AtreeRegisterMigrator
func (*AtreeRegisterMigrator) Close ¶ added in v0.35.4
func (m *AtreeRegisterMigrator) Close() error
func (*AtreeRegisterMigrator) InitMigration ¶ added in v0.35.4
type AtreeRegisterMigratorRuntime ¶ added in v0.35.4
type AtreeRegisterMigratorRuntime struct { Snapshot *util.PayloadSnapshot TransactionState state.NestedTransactionPreparer Interpreter *interpreter.Interpreter Storage *runtime.Storage Payloads []*ledger.Payload Address common.Address AccountsAtreeLedger *util.AccountsAtreeLedger }
func NewAtreeRegisterMigratorRuntime ¶ added in v0.35.4
func NewAtreeRegisterMigratorRuntime( address common.Address, payloads []*ledger.Payload, ) ( *AtreeRegisterMigratorRuntime, error, )
NewAtreeRegisterMigratorRuntime returns a new runtime to be used with the AtreeRegisterMigrator.
type BurnerContractChange ¶ added in v0.33.30
type BurnerContractChange uint8
const ( BurnerContractChangeNone BurnerContractChange = iota BurnerContractChangeDeploy BurnerContractChangeUpdate )
type CadenceBaseMigrator ¶ added in v0.35.4
type CadenceBaseMigrator struct {
// contains filtered or unexported fields
}
func NewCadence1CapabilityValueMigrator ¶ added in v0.35.4
func NewCadence1CapabilityValueMigrator( rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, programs map[runtime.Location]*interpreter.Program, capabilityMapping *capcons.CapabilityMapping, opts Options, ) *CadenceBaseMigrator
NewCadence1CapabilityValueMigrator creates a new CadenceBaseMigrator 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 NewCadence1LinkValueMigrator ¶ added in v0.35.4
func NewCadence1LinkValueMigrator( rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, programs map[runtime.Location]*interpreter.Program, capabilityMapping *capcons.CapabilityMapping, opts Options, ) *CadenceBaseMigrator
NewCadence1LinkValueMigrator creates a new CadenceBaseMigrator which migrates links to capability controllers. It populates the given map with the IDs of the capability controller it issues.
func NewCadence1ValueMigrator ¶ added in v0.35.4
func NewCadence1ValueMigrator( rwf reporters.ReportWriterFactory, errorMessageHandler *errorMessageHandler, programs map[runtime.Location]*interpreter.Program, compositeTypeConverter statictypes.CompositeTypeConverterFunc, interfaceTypeConverter statictypes.InterfaceTypeConverterFunc, opts Options, ) *CadenceBaseMigrator
NewCadence1ValueMigrator creates a new CadenceBaseMigrator which runs some of the Cadence value migrations (static types, entitlements, strings)
func (*CadenceBaseMigrator) Close ¶ added in v0.35.4
func (m *CadenceBaseMigrator) Close() error
func (*CadenceBaseMigrator) InitMigration ¶ added in v0.35.4
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, rw reporters.ReportWriter, verboseLogging bool, ) *CadenceValueDiffReporter
func (*CadenceValueDiffReporter) DiffStates ¶ added in v0.33.30
func (dr *CadenceValueDiffReporter) DiffStates(oldPayloads, newPayloads []*ledger.Payload, domains []string)
type DeduplicateContractNamesMigration ¶ added in v0.33.1
type DeduplicateContractNamesMigration struct {
// contains filtered or unexported fields
}
DeduplicateContractNamesMigration checks if the contract names have been duplicated and removes the duplicate ones.
This migration de-syncs storage used, so it should be run before the StorageUsedMigration.
func (*DeduplicateContractNamesMigration) Close ¶ added in v0.33.1
func (d *DeduplicateContractNamesMigration) Close() error
func (*DeduplicateContractNamesMigration) InitMigration ¶ added in v0.33.1
type EVMContractChange ¶ added in v0.33.30
type EVMContractChange uint8
const ( EVMContractChangeNone EVMContractChange = iota EVMContractChangeFull )
type MigratorRuntime ¶ added in v0.35.4
type MigratorRuntime struct { Snapshot *util.PayloadSnapshot TransactionState state.NestedTransactionPreparer Interpreter *interpreter.Interpreter Storage *runtime.Storage Payloads []*ledger.Payload AccountsLedger *util.AccountsAtreeLedger Accounts environment.Accounts ContractAdditionHandler stdlib.AccountContractAdditionHandler ContractNamesProvider stdlib.AccountContractNamesProvider }
func NewMigratorRuntime ¶ added in v0.35.4
func NewMigratorRuntime( payloads []*ledger.Payload, chainID flow.ChainID, config MigratorRuntimeConfig, ) ( *MigratorRuntime, error, )
NewMigratorRuntime returns a runtime that can be used in migrations.
type MigratorRuntimeConfig ¶ added in v0.35.4
type MigratorRuntimeConfig struct { GetCode util.GetContractCodeFunc GetContractNames util.GetContractNamesFunc GetOrLoadProgram util.GetOrLoadProgramFunc GetOrLoadProgramListener util.GerOrLoadProgramListenerFunc }
MigratorRuntimeConfig is used to configure the MigratorRuntime. 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 (MigratorRuntimeConfig) NewRuntimeInterface ¶ added in v0.35.4
func (c MigratorRuntimeConfig) NewRuntimeInterface( transactionState state.NestedTransactionPreparer, accounts environment.Accounts, ) ( runtime.Interface, error, )
type NamedMigration ¶ added in v0.33.30
func NewCadence1ContractsMigrations ¶ added in v0.33.30
func NewCadence1ContractsMigrations( log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options, ) []NamedMigration
func NewCadence1Migrations ¶ added in v0.33.30
func NewCadence1Migrations( log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options, ) []NamedMigration
func NewCadence1ValueMigrations ¶ added in v0.33.30
func NewCadence1ValueMigrations( log zerolog.Logger, rwf reporters.ReportWriterFactory, opts Options, ) (migrations []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 }
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 (*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
- atree_register_migration.go
- atree_register_migrator_runtime.go
- cadence.go
- cadence_value_diff.go
- cadence_value_validation.go
- cadence_values_migration.go
- change_contract_code_migration.go
- contract_checking_migration.go
- deduplicate_contract_names_migration.go
- deploy_migration.go
- merge.go
- migrator_runtime.go
- noop.go
- prune_migration.go
- staged_contracts_migration.go
- static_type_migration.go
- storage_used_migration.go
- transaction_migration.go
- utils.go