Skip to main content

Version

Version

class Version

asU64()

func asU64() -> UInt64

Get the underlying u64 value of this version

getCongestedVersionSuggestedGasPrice()

func getCongestedVersionSuggestedGasPrice() throws -> UInt64

Returns the suggested_gas_price embedded in this congested shared object version. The suggested_gas_price here is used for a gas price feedback mechanism for transactions canceled due to shared object congestion.

isCanceled()

func isCanceled() -> Bool

Checks if this version is canceled, i.e., the corresponding object appears in a canceled transaction.

isCongested()

func isCongested() -> Bool

Check if this version is congested, i.e., the corresponding object is the reason for transaction cancellation.

isValid()

func isValid() -> Bool

Checks if this version is valid, i.e., the corresponding object does not appear in a canceled transaction.

next()

func next() throws -> Version

Returns the next version, or an error if overflow occurs.

previous()

func previous() throws -> Version

Returns the previous version, or an error if underflow occurs.

canceledRead()

static func canceledRead() -> Version

Special version that is assigned to objects which are accessed immutably in a canceled transaction.

congestedPriorToGasPriceFeedback()

static func congestedPriorToGasPriceFeedback() -> Version

Special version that was assigned to congested objects which cause transaction cancellations. Note that this special version was only used prior to the introduction of a gas price feedback mechanism, but it is kept for backward compatibility.

fromU64(value:)

static func fromU64(value: UInt64) -> Version

Create a new Version from a u64 value

lamportIncrement(inputs:)

static func lamportIncrement(inputs: [Version]) throws -> Version

Returns a new version that is greater than all versions in inputs, assuming this operation will not overflow.

maxValidExcl()

static func maxValidExcl() -> Version

An exclusive upper limit on a valid version: versions strictly smaller than this limit are valid versions.

A valid version means an object, which this version is assigned to, does not appear in a canceled transaction. Versions larger than this value are "special" and assigned to objects that appear in canceled transactions.

minValidIncl()

static func minValidIncl() -> Version

An inclusive lower limit on a valid version.

A valid version means an object, which this version is assigned to, does not appear in a canceled transaction.

newCongestedWithSuggestedGasPrice(suggestedGasPrice:)

static func newCongestedWithSuggestedGasPrice(suggestedGasPrice: UInt64) throws -> Version

Returns a special version used for congested shared objects: Version::MIN_CONGESTED + suggested_gas_price, where suggested_gas_price is embedded into a congested version to facilitate a gas price feedback mechanism for transactions canceled due to shared object congestion.

randomnessUnavailable()

static func randomnessUnavailable() -> Version