costs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// A is the constant for NRG assignment. This scales the effect of the number of signatures on the energy.
	A uint64 = 100

	// B is the constant for NRG assignment. This scales the effect of transaction size on the energy.
	B uint64 = 1
)

Variables

View Source
var (
	// SimpleTransfer is an additional cost of a normal, account to account, transfer.
	SimpleTransfer = v2.Energy{Value: 300}

	// EncryptedTransfer is an additional cost of an encrypted transfer.
	EncryptedTransfer = v2.Energy{Value: 27000}

	// TransferToEncrypted is an additional cost of a transfer from public to encrypted balance.
	TransferToEncrypted = v2.Energy{Value: 600}

	// TransferToPublic is an additional cost of a transfer from encrypted to public balance.
	TransferToPublic = v2.Energy{Value: 14850}

	// AddBaker is an additional cost of registerding the account as a baker.
	AddBaker = v2.Energy{Value: 4050}

	// UpdateBakerKeys is an additional cost of updating baker's keys.
	UpdateBakerKeys = v2.Energy{Value: 4050}

	// UpdateBakerStake is an additional cost of updating the baker's stake, either increasing or lowering it.
	UpdateBakerStake = v2.Energy{Value: 300}

	// UpdateBakerRestake is an additional cost of updating the baker's restake flag.
	UpdateBakerRestake = v2.Energy{Value: 300}

	// RemoveBaker is an additional cost of removing a baker.
	RemoveBaker = v2.Energy{Value: 300}

	// RegisterData is an additional cost of registering a piece of data.
	RegisterData = v2.Energy{Value: 300}

	// ConfigureBakerWithKeys is an additional cost of configuring a baker if new keys are registered.
	ConfigureBakerWithKeys = v2.Energy{Value: 4050}

	// ConfigureBakerWithoutKeys is an additional cost of configuring a baker if new keys are **not** registered.
	ConfigureBakerWithoutKeys = v2.Energy{Value: 300}

	// ConfigureDelegation is an additional cost of configuring delegation.
	ConfigureDelegation = v2.Energy{Value: 300}

	// UpdateCredentialsBase cost is going to be negligible compared to
	// verifying the credential, if he credential updates are genuine.
	//
	// There is a non-trivial amount of lookup
	// that needs to be done before we can start any checking. This ensures
	// that those lookups are not a problem.
	UpdateCredentialsBase = v2.Energy{Value: 500}
)

Functions

func BaseCost

func BaseCost(transactionSize uint64, numSignatures uint32) v2.Energy

BaseCost returns base cost of a transaction, which is the minimum cost that accounts pays for transaction size and signature checking. In addition to base cost each transaction has a transaction-type specific cost.

func DeployCredential

func DeployCredential(credentialType v2.CredentialType, numKeys uint16) v2.Energy

DeployCredential returns additional cost of deploying a credential of the given type and with the given number of keys.

func DeployModuleCost

func DeployModuleCost(moduleSize uint64) v2.Energy

DeployModuleCost returns additional cost of deploying a smart contract module, parametrized by the size of the module, which is defined to be the size of the binary `.wasm` file that is sent as part of the transaction.

func ScheduledTransfer

func ScheduledTransfer(numReleases uint16) v2.Energy

ScheduledTransfer returns cost of a scheduled transfer, parametrized by the number of releases.

func UpdateCredentialKeys

func UpdateCredentialKeys(numCredentialsBefore uint16, numKeys uint16) v2.Energy

UpdateCredentialKeys returns an additional cost of updating existing credential keys. Parametrised by amount of existing credentials and new keys. Due to the way the accounts are stored a new copy of all credentials will be created, so we need to account for that storage increase.

func UpdateCredentials

func UpdateCredentials(numCredentialsBefore uint16, numKeys []uint16) v2.Energy

UpdateCredentials returns additional cost of updating account's credentials, parametrized by - the number of credentials on the account before the update - list of keys of credentials to be added.

func UpdateCredentialsVariable

func UpdateCredentialsVariable(numCredentialsBefore uint16, numKeys []uint16) v2.Energy

UpdateCredentialsVariable determines the cost of updating credentials on an account.

Types

This section is empty.

Jump to

Keyboard shortcuts

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