Documentation ¶
Overview ¶
TODO: Before Etna, address all TODOs in this package and ensure ACP-103 compliance.
Index ¶
- Variables
- func AuthComplexity(authIntf verify.Verifiable) (gas.Dimensions, error)
- func ConvertSubnetToL1ValidatorComplexity(l1Validators ...*txs.ConvertSubnetToL1Validator) (gas.Dimensions, error)
- func InputComplexity(ins ...*avax.TransferableInput) (gas.Dimensions, error)
- func OutputComplexity(outs ...*avax.TransferableOutput) (gas.Dimensions, error)
- func OwnerComplexity(ownerIntf fx.Owner) (gas.Dimensions, error)
- func SignerComplexity(s signer.Signer) (gas.Dimensions, error)
- func TxComplexity(txs ...txs.UnsignedTx) (gas.Dimensions, error)
- func WarpComplexity(message []byte) (gas.Dimensions, error)
- type Calculator
- type SimpleCalculator
Constants ¶
This section is empty.
Variables ¶
var ( IntrinsicAddSubnetValidatorTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + intrinsicSubnetValidatorBandwidth + wrappers.IntLen + wrappers.IntLen, gas.DBRead: 3, gas.DBWrite: 3, } IntrinsicCreateChainTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + ids.IDLen + wrappers.ShortLen + ids.IDLen + wrappers.IntLen + wrappers.IntLen + wrappers.IntLen + wrappers.IntLen, gas.DBRead: 3, gas.DBWrite: 1, } IntrinsicCreateSubnetTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + wrappers.IntLen, gas.DBWrite: 1, } IntrinsicImportTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + ids.IDLen + wrappers.IntLen, } IntrinsicExportTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + ids.IDLen + wrappers.IntLen, } IntrinsicRemoveSubnetValidatorTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + ids.NodeIDLen + ids.IDLen + wrappers.IntLen + wrappers.IntLen, gas.DBRead: 1, gas.DBWrite: 3, } 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: 3, } IntrinsicAddPermissionlessDelegatorTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + intrinsicValidatorBandwidth + ids.IDLen + wrappers.IntLen + wrappers.IntLen, gas.DBRead: 1, gas.DBWrite: 2, } IntrinsicTransferSubnetOwnershipTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + ids.IDLen + wrappers.IntLen + wrappers.IntLen + wrappers.IntLen, gas.DBRead: 1, gas.DBWrite: 1, } IntrinsicBaseTxComplexities = gas.Dimensions{ gas.Bandwidth: codec.VersionSize + wrappers.IntLen + wrappers.IntLen + ids.IDLen + wrappers.IntLen + wrappers.IntLen + wrappers.IntLen + wrappers.IntLen, } IntrinsicConvertSubnetToL1TxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + ids.IDLen + ids.IDLen + wrappers.IntLen + wrappers.IntLen + wrappers.IntLen + wrappers.IntLen, gas.DBRead: 3, gas.DBWrite: 2, } IntrinsicRegisterL1ValidatorTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + wrappers.LongLen + bls.SignatureLen + wrappers.IntLen, gas.DBRead: 5, gas.DBWrite: 6, gas.Compute: intrinsicBLSPoPVerifyCompute, } IntrinsicSetL1ValidatorWeightTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + wrappers.IntLen, gas.DBRead: 3, gas.DBWrite: 5, } IntrinsicIncreaseL1ValidatorBalanceTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + ids.IDLen + wrappers.LongLen, gas.DBRead: 1, gas.DBWrite: 5, } IntrinsicDisableL1ValidatorTxComplexities = gas.Dimensions{ gas.Bandwidth: IntrinsicBaseTxComplexities[gas.Bandwidth] + ids.IDLen + wrappers.IntLen + wrappers.IntLen, gas.DBRead: 1, gas.DBWrite: 6, } )
var ( ErrCalculatingComplexity = errors.New("error calculating complexity") ErrCalculatingGas = errors.New("error calculating gas") ErrCalculatingCost = errors.New("error calculating cost") )
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 ConvertSubnetToL1ValidatorComplexity ¶ added in v1.11.13
func ConvertSubnetToL1ValidatorComplexity(l1Validators ...*txs.ConvertSubnetToL1Validator) (gas.Dimensions, error)
ConvertSubnetToL1ValidatorComplexity returns the complexity the validators add to a transaction.
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)
func WarpComplexity ¶ added in v1.11.13
func WarpComplexity(message []byte) (gas.Dimensions, error)
WarpComplexity returns the complexity a warp message adds to a transaction.
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
type SimpleCalculator ¶ added in v1.12.2
type SimpleCalculator struct {
// contains filtered or unexported fields
}
func NewSimpleCalculator ¶ added in v1.12.2
func NewSimpleCalculator(fee uint64) *SimpleCalculator
func (*SimpleCalculator) CalculateFee ¶ added in v1.12.2
func (c *SimpleCalculator) CalculateFee(txs.UnsignedTx) (uint64, error)