fc

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeneralTxCostGasUnits = 400
	GasUnitsPerTema       = 1000
)

Variables

View Source
var (
	ErrNetworkIdentifierMissing        = errors.New("network identifier is missing")
	ErrPartitionIdentifierMissing      = errors.New("partition identifier is missing")
	ErrMoneyPartitionIdentifierMissing = 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(stateReader StateReader, execPredicate predicates.PredicateRunner, feeCreditRecordUnitType []byte) *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(networkID types.NetworkID, partitionID types.PartitionID, moneyPartitionID types.PartitionID, state *state.State, trustBase types.RootTrustBase, 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) 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(unitID []byte, 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) IsCredible

func (*NoFeeHandling) IsFeeCreditTx

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

func (*NoFeeHandling) IsFeelessMode

func (m *NoFeeHandling) IsFeelessMode() bool

func (*NoFeeHandling) IsPermissionedMode

func (m *NoFeeHandling) IsPermissionedMode() bool

func (*NoFeeHandling) TxHandlers

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

type Option

type Option func(f *FeeCreditModule)

func WithFeeCreditRecordUnitType

func WithFeeCreditRecordUnitType(feeCreditRecordUnitType []byte) 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