fc

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeneralTxCostGasUnits = 400
	GasUnitsPerTema       = 1000
)

Variables

View Source
var (
	ErrMoneyPartitionIDMissing = errors.New("money transaction partition identifier is missing")
	ErrStateIsNil              = errors.New("state is nil")
	ErrTrustBaseIsNil          = errors.New("trust base is nil")
)
View Source
var (
	ErrUnitTypeIsNotFCR     = errors.New("invalid unit identifier: type is not fee credit record")
	ErrUnitDataTypeIsNotFCR = errors.New("invalid unit type: unit is not fee credit record")
)

Functions

func ValidateCloseFC added in v1.0.0

func ValidateCloseFC(attr *fc.CloseFeeCreditAttributes, fcr *fc.FeeCreditRecord) error

func ValidateGenericFeeCreditTx added in v1.0.0

func ValidateGenericFeeCreditTx(tx *types.TransactionOrder) error

ValidateGenericFeeCreditTx none of the fee credit transactions must contain fee credit reference or separate fee authorization proof

func VerifyMaxTxFeeDoesNotExceedFRCBalance added in v1.0.0

func VerifyMaxTxFeeDoesNotExceedFRCBalance(tx *types.TransactionOrder, fcrBalance uint64) error

Types

type FeeBalanceValidator added in v1.0.0

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

func NewFeeBalanceValidator added in v1.0.0

func NewFeeBalanceValidator(pdr types.PartitionDescriptionRecord, stateReader StateReader, execPredicate predicates.PredicateRunner, feeCreditRecordUnitType uint32) *FeeBalanceValidator

func (*FeeBalanceValidator) IsCredible added in v1.0.0

IsCredible implements the fee credit verification for ordinary transactions (everything else except fee credit txs)

type FeeCreditModule added in v1.0.0

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

FeeCreditModule contains fee credit related functionality.

func NewFeeCreditModule

func NewFeeCreditModule(pdr types.PartitionDescriptionRecord, moneyPartitionID types.PartitionID, state *state.State, trustBase types.RootTrustBase, obs Observability, opts ...Option) (*FeeCreditModule, error)

func (*FeeCreditModule) BuyGas added in v1.0.0

func (f *FeeCreditModule) BuyGas(maxTxCost uint64) uint64

func (*FeeCreditModule) CalculateCost added in v1.0.0

func (f *FeeCreditModule) CalculateCost(gasUsed uint64) uint64

func (*FeeCreditModule) FeeCreditRecordUnitType added in v1.0.0

func (f *FeeCreditModule) FeeCreditRecordUnitType() uint32

func (*FeeCreditModule) IsCredible added in v1.0.0

func (*FeeCreditModule) IsFeeCreditTx added in v1.0.0

func (f *FeeCreditModule) IsFeeCreditTx(tx *types.TransactionOrder) bool

func (*FeeCreditModule) IsFeelessMode added in v1.0.0

func (f *FeeCreditModule) IsFeelessMode() bool

func (*FeeCreditModule) IsPermissionedMode added in v1.0.0

func (f *FeeCreditModule) IsPermissionedMode() bool

func (*FeeCreditModule) IsValid added in v1.0.0

func (f *FeeCreditModule) IsValid() error

func (*FeeCreditModule) NewFeeCreditRecordID added in v1.0.0

func (f *FeeCreditModule) NewFeeCreditRecordID(ownerPredicate []byte, timeout uint64) (types.UnitID, error)

func (*FeeCreditModule) TxHandlers added in v1.0.0

func (f *FeeCreditModule) TxHandlers() map[uint16]txtypes.TxExecutor

type NoFeeHandling added in v1.0.0

type NoFeeHandling struct{}

func NewNoFeeCreditModule added in v1.0.0

func NewNoFeeCreditModule() *NoFeeHandling

func (*NoFeeHandling) BuyGas added in v1.0.0

func (f *NoFeeHandling) BuyGas(_ uint64) uint64

func (*NoFeeHandling) CalculateCost added in v1.0.0

func (f *NoFeeHandling) CalculateCost(_ uint64) uint64

func (*NoFeeHandling) FeeCreditRecordUnitType added in v1.0.0

func (f *NoFeeHandling) FeeCreditRecordUnitType() uint32

func (*NoFeeHandling) IsCredible added in v1.0.0

func (*NoFeeHandling) IsFeeCreditTx added in v1.0.0

func (f *NoFeeHandling) IsFeeCreditTx(tx *types.TransactionOrder) bool

func (*NoFeeHandling) IsFeelessMode added in v1.0.0

func (f *NoFeeHandling) IsFeelessMode() bool

func (*NoFeeHandling) IsPermissionedMode added in v1.0.0

func (f *NoFeeHandling) IsPermissionedMode() bool

func (*NoFeeHandling) TxHandlers added in v1.0.0

func (f *NoFeeHandling) TxHandlers() map[uint16]txtypes.TxExecutor

type Observability added in v1.0.0

type Observability interface {
	Meter(name string, opts ...metric.MeterOption) metric.Meter
	Logger() *slog.Logger
}

type Option

type Option func(f *FeeCreditModule)

func WithFeeCreditRecordUnitType

func WithFeeCreditRecordUnitType(feeCreditRecordUnitType uint32) Option

func WithHashAlgorithm

func WithHashAlgorithm(hashAlgorithm crypto.Hash) Option

type StateReader added in v1.0.0

type StateReader interface {
	GetUnit(id types.UnitID, committed bool) (state.Unit, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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