fc

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: Apache-2.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

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

func ValidateGenericFeeCreditTx

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

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

Types

type FeeBalanceValidator

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

func NewFeeBalanceValidator

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

func (*FeeBalanceValidator) IsCredible

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

type FeeCreditModule

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

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

func (*FeeCreditModule) CalculateCost

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

func (*FeeCreditModule) FeeCreditRecordUnitType

func (f *FeeCreditModule) FeeCreditRecordUnitType() uint32

func (*FeeCreditModule) IsCredible

func (*FeeCreditModule) IsFeeCreditTx

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

func (*FeeCreditModule) IsFeelessMode

func (f *FeeCreditModule) IsFeelessMode() bool

func (*FeeCreditModule) IsPermissionedMode

func (f *FeeCreditModule) IsPermissionedMode() bool

func (*FeeCreditModule) IsValid

func (f *FeeCreditModule) IsValid() error

func (*FeeCreditModule) NewFeeCreditRecordID

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

func (*FeeCreditModule) TxHandlers

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

type NoFeeHandling

type NoFeeHandling struct{}

func NewNoFeeCreditModule

func NewNoFeeCreditModule() *NoFeeHandling

func (*NoFeeHandling) BuyGas

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

func (*NoFeeHandling) CalculateCost

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

func (*NoFeeHandling) FeeCreditRecordUnitType

func (f *NoFeeHandling) FeeCreditRecordUnitType() uint32

func (*NoFeeHandling) IsCredible

func (*NoFeeHandling) IsFeeCreditTx

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

func (*NoFeeHandling) IsFeelessMode

func (f *NoFeeHandling) IsFeelessMode() bool

func (*NoFeeHandling) IsPermissionedMode

func (f *NoFeeHandling) IsPermissionedMode() bool

func (*NoFeeHandling) TxHandlers

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

type Observability

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

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