fee

package
v1.11.11-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: BSD-3-Clause Imports: 17 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IntrinsicAddPermissionlessValidatorTxComplexities = gas.Dimensions{
		gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] +
			intrinsicValidatorBandwidth +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen,
		gas.DBRead:  1,
		gas.DBWrite: 1,
		gas.Compute: 0,
	}
	IntrinsicAddPermissionlessDelegatorTxComplexities = gas.Dimensions{
		gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] +
			intrinsicValidatorBandwidth +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen,
		gas.DBRead:  1,
		gas.DBWrite: 1,
		gas.Compute: 0,
	}
	IntrinsicAddSubnetValidatorTxComplexities = gas.Dimensions{
		gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] +
			intrinsicSubnetValidatorBandwidth +
			wrappers.IntLen +
			wrappers.IntLen,
		gas.DBRead:  2,
		gas.DBWrite: 1,
		gas.Compute: 0,
	}
	IntrinsicBaseTxComplexities = gas.Dimensions{
		gas.Bandwidth: codec.VersionSize +
			wrappers.IntLen +
			wrappers.IntLen +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen,
		gas.DBRead:  0,
		gas.DBWrite: 0,
		gas.Compute: 0,
	}
	IntrinsicCreateChainTxComplexities = gas.Dimensions{
		gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] +
			ids.IDLen +
			wrappers.ShortLen +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen,
		gas.DBRead:  1,
		gas.DBWrite: 1,
		gas.Compute: 0,
	}
	IntrinsicCreateSubnetTxComplexities = gas.Dimensions{
		gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] +
			wrappers.IntLen,
		gas.DBRead:  0,
		gas.DBWrite: 1,
		gas.Compute: 0,
	}
	IntrinsicExportTxComplexities = gas.Dimensions{
		gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] +
			ids.IDLen +
			wrappers.IntLen,
		gas.DBRead:  0,
		gas.DBWrite: 0,
		gas.Compute: 0,
	}
	IntrinsicImportTxComplexities = gas.Dimensions{
		gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] +
			ids.IDLen +
			wrappers.IntLen,
		gas.DBRead:  0,
		gas.DBWrite: 0,
		gas.Compute: 0,
	}
	IntrinsicRemoveSubnetValidatorTxComplexities = gas.Dimensions{
		gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] +
			ids.NodeIDLen +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen,
		gas.DBRead:  2,
		gas.DBWrite: 1,
		gas.Compute: 0,
	}
	IntrinsicTransferSubnetOwnershipTxComplexities = gas.Dimensions{
		gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] +
			ids.IDLen +
			wrappers.IntLen +
			wrappers.IntLen +
			wrappers.IntLen,
		gas.DBRead:  1,
		gas.DBWrite: 1,
		gas.Compute: 0,
	}
)
View Source
var (
	ErrCalculatingComplexity = errors.New("error calculating complexity")
	ErrCalculatingGas        = errors.New("error calculating gas")
	ErrCalculatingCost       = errors.New("error calculating cost")
)
View Source
var ErrUnsupportedTx = errors.New("unsupported transaction type")

Functions

func AuthComplexity added in v1.11.11

func AuthComplexity(authIntf verify.Verifiable) (gas.Dimensions, error)

AuthComplexity returns the complexity an authorization adds to a transaction. It does not include the typeID of the authorization. It does includes the complexity that the corresponding credential will add. It does not include the typeID of the credential.

func InputComplexity added in v1.11.11

func InputComplexity(ins ...*avax.TransferableInput) (gas.Dimensions, error)

InputComplexity returns the complexity inputs add to a transaction. It includes the complexity that the corresponding credentials will add.

func OutputComplexity added in v1.11.11

func OutputComplexity(outs ...*avax.TransferableOutput) (gas.Dimensions, error)

OutputComplexity returns the complexity outputs add to a transaction.

func OwnerComplexity added in v1.11.11

func OwnerComplexity(ownerIntf fx.Owner) (gas.Dimensions, error)

OwnerComplexity returns the complexity an owner adds to a transaction. It does not include the typeID of the owner.

func SignerComplexity added in v1.11.11

func SignerComplexity(s signer.Signer) (gas.Dimensions, error)

SignerComplexity returns the complexity a signer adds to a transaction. It does not include the typeID of the signer.

func TxComplexity added in v1.11.11

func TxComplexity(txs ...txs.UnsignedTx) (gas.Dimensions, error)

Types

type Calculator

type Calculator interface {
	CalculateFee(tx txs.UnsignedTx) (uint64, error)
}

Calculator calculates the minimum required fee, in nAVAX, that an unsigned transaction must pay for valid inclusion into a block.

func NewDynamicCalculator added in v1.11.11

func NewDynamicCalculator(
	weights gas.Dimensions,
	price gas.Price,
) Calculator

func NewStaticCalculator

func NewStaticCalculator(config StaticConfig) Calculator

type StaticConfig

type StaticConfig struct {
	// Fee that is burned by every non-state creating transaction
	TxFee uint64 `json:"txFee"`

	// Fee that must be burned by every subnet creating transaction
	CreateSubnetTxFee uint64 `json:"createSubnetTxFee"`

	// Fee that must be burned by every transform subnet transaction
	TransformSubnetTxFee uint64 `json:"transformSubnetTxFee"`

	// Fee that must be burned by every blockchain creating transaction
	CreateBlockchainTxFee uint64 `json:"createBlockchainTxFee"`

	// Transaction fee for adding a primary network validator
	AddPrimaryNetworkValidatorFee uint64 `json:"addPrimaryNetworkValidatorFee"`

	// Transaction fee for adding a primary network delegator
	AddPrimaryNetworkDelegatorFee uint64 `json:"addPrimaryNetworkDelegatorFee"`

	// Transaction fee for adding a subnet validator
	AddSubnetValidatorFee uint64 `json:"addSubnetValidatorFee"`

	// Transaction fee for adding a subnet delegator
	AddSubnetDelegatorFee uint64 `json:"addSubnetDelegatorFee"`
}

Jump to

Keyboard shortcuts

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