capcons

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanSkipCapabilityValueMigration

func CanSkipCapabilityValueMigration(valueType interpreter.StaticType) bool

func IssueAccountCapabilities

func IssueAccountCapabilities(
	inter *interpreter.Interpreter,
	storage *runtime.Storage,
	reporter StorageCapabilityMigrationReporter,
	address common.Address,
	capabilities *AccountCapabilities,
	handler stdlib.CapabilityControllerIssueHandler,
	typedCapabilityMapping *PathTypeCapabilityMapping,
	untypedCapabilityMapping *PathCapabilityMapping,
	inferAuth func(valueType interpreter.StaticType) interpreter.Authorization,
)

Types

type AccountCapabilities

type AccountCapabilities struct {
	// contains filtered or unexported fields
}

func (*AccountCapabilities) ForEachSorted

func (c *AccountCapabilities) ForEachSorted(
	f func(AccountCapability) bool,
)

ForEachSorted will first sort the capabilities list, and iterates through the sorted list.

func (*AccountCapabilities) Record

func (c *AccountCapabilities) Record(
	path interpreter.PathValue,
	borrowType interpreter.StaticType,
	storageKey interpreter.StorageKey,
	storageMapKey interpreter.StorageMapKey,
)

type AccountCapability

type AccountCapability struct {
	TargetPath interpreter.PathValue
	BorrowType interpreter.StaticType
	StoredPath Path
}

type AccountsCapabilities

type AccountsCapabilities struct {
	// contains filtered or unexported fields
}

func (*AccountsCapabilities) ForEach

func (m *AccountsCapabilities) ForEach(
	address common.Address,
	f func(AccountCapability) bool,
)

func (*AccountsCapabilities) Get

func (*AccountsCapabilities) Record

func (m *AccountsCapabilities) Record(
	addressPath interpreter.AddressPath,
	borrowType interpreter.StaticType,
	storageKey interpreter.StorageKey,
	storageMapKey interpreter.StorageMapKey,
)

type CapabilityMigrationReporter

type CapabilityMigrationReporter interface {
	MigratedPathCapability(
		accountAddress common.Address,
		addressPath interpreter.AddressPath,
		borrowType *interpreter.ReferenceStaticType,
		capabilityID interpreter.UInt64Value,
	)
	MissingCapabilityID(
		accountAddress common.Address,
		addressPath interpreter.AddressPath,
	)
	MissingBorrowType(
		targetPath interpreter.AddressPath,
		storedPath interpreter.AddressPath,
	)
}

type CapabilityValueMigration

type CapabilityValueMigration struct {
	PrivatePublicCapabilityMapping  *PathCapabilityMapping
	TypedStorageCapabilityMapping   *PathTypeCapabilityMapping
	UntypedStorageCapabilityMapping *PathCapabilityMapping
	Reporter                        CapabilityMigrationReporter
}

CapabilityValueMigration migrates all path capabilities to ID capabilities, using the path to ID capability controller mapping generated by LinkValueMigration.

func (*CapabilityValueMigration) CanSkip

func (m *CapabilityValueMigration) CanSkip(valueType interpreter.StaticType) bool

func (*CapabilityValueMigration) Domains

func (*CapabilityValueMigration) Domains() map[string]struct{}

func (*CapabilityValueMigration) Migrate

Migrate migrates a path capability to an ID capability in the given value. If a value is returned, the value must be updated with the replacement in the parent. If nil is returned, the value was not updated and no operation has to be performed.

func (*CapabilityValueMigration) Name

type CyclicLinkError

type CyclicLinkError struct {
	Paths   []interpreter.PathValue
	Address common.Address
}

CyclicLinkError

func (CyclicLinkError) Error

func (e CyclicLinkError) Error() string

func (CyclicLinkError) IsUserError

func (CyclicLinkError) IsUserError()

type LinkMigrationReporter

type LinkMigrationReporter interface {
	MigratedLink(
		accountAddressPath interpreter.AddressPath,
		capabilityID interpreter.UInt64Value,
	)
	CyclicLink(err CyclicLinkError)
	MissingTarget(accountAddressPath interpreter.AddressPath)
}

type LinkValueMigration

type LinkValueMigration struct {
	CapabilityMapping *PathCapabilityMapping
	IssueHandler      stdlib.CapabilityControllerIssueHandler
	Handler           stdlib.CapabilityControllerHandler
	Reporter          LinkMigrationReporter
}

LinkValueMigration migrates all links to capability controllers.

func (*LinkValueMigration) CanSkip

func (m *LinkValueMigration) CanSkip(valueType interpreter.StaticType) bool

func (*LinkValueMigration) Domains

func (m *LinkValueMigration) Domains() map[string]struct{}

func (*LinkValueMigration) Migrate

func (*LinkValueMigration) Name

func (*LinkValueMigration) Name() string

type Path

type Path struct {
	Domain string
	Path   string
}

type PathCapabilityEntry

type PathCapabilityEntry struct {
	CapabilityID interpreter.UInt64Value
	BorrowType   *interpreter.ReferenceStaticType
}

type PathCapabilityEntryMap

type PathCapabilityEntryMap map[interpreter.PathValue]PathCapabilityEntry

type PathCapabilityMapping

type PathCapabilityMapping struct {
	// contains filtered or unexported fields
}

func (*PathCapabilityMapping) Get

func (*PathCapabilityMapping) Record

func (m *PathCapabilityMapping) Record(
	addressPath interpreter.AddressPath,
	capabilityID interpreter.UInt64Value,
	borrowType *interpreter.ReferenceStaticType,
)

type PathTypeCapabilityKey

type PathTypeCapabilityKey struct {
	Path       interpreter.PathValue
	BorrowType common.TypeID
}

type PathTypeCapabilityMapping

type PathTypeCapabilityMapping struct {
	// contains filtered or unexported fields
}

func (*PathTypeCapabilityMapping) Get

func (*PathTypeCapabilityMapping) Record

func (m *PathTypeCapabilityMapping) Record(
	addressPath interpreter.AddressPath,
	capabilityID interpreter.UInt64Value,
	borrowType common.TypeID,
)

type StorageCapMigration

type StorageCapMigration struct {
	StorageDomainCapabilities *AccountsCapabilities
}

StorageCapMigration records path capabilities with storage domain target. It does not actually migrate any values.

func (*StorageCapMigration) CanSkip

func (m *StorageCapMigration) CanSkip(valueType interpreter.StaticType) bool

func (*StorageCapMigration) Domains

func (*StorageCapMigration) Domains() map[string]struct{}

func (*StorageCapMigration) Migrate

Migrate records path capabilities with storage domain target. It does not actually migrate any values.

func (*StorageCapMigration) Name

func (*StorageCapMigration) Name() string

type StorageCapabilityMigrationReporter

type StorageCapabilityMigrationReporter interface {
	MissingBorrowType(
		targetPath interpreter.AddressPath,
		storedPath interpreter.AddressPath,
	)
	IssuedStorageCapabilityController(
		accountAddress common.Address,
		addressPath interpreter.AddressPath,
		borrowType *interpreter.ReferenceStaticType,
		capabilityID interpreter.UInt64Value,
	)
	InferredMissingBorrowType(
		targetPath interpreter.AddressPath,
		borrowType *interpreter.ReferenceStaticType,
		storedPath interpreter.AddressPath,
	)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL