Version
Version Objects
class Version(VersionProtocol)
canceled_read
@classmethod
def canceled_read(cls) -> Version
Special version that is assigned to objects which are accessed immutably in a canceled transaction.
congested_prior_to_gas_price_feedback
@classmethod
def congested_prior_to_gas_price_feedback(cls) -> 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.
from_u64
@classmethod
def from_u64(cls, value: int) -> Version
Create a new Version from a u64 value
lamport_increment
@classmethod
def lamport_increment(cls, inputs: typing.List[Version]) -> Version
Returns a new version that is greater than all versions
in inputs, assuming this operation will not overflow.
max_valid_excl
@classmethod
def max_valid_excl(cls) -> 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.
min_valid_incl
@classmethod
def min_valid_incl(cls) -> 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.
new_congested_with_suggested_gas_price
@classmethod
def new_congested_with_suggested_gas_price(
cls, suggested_gas_price: int) -> 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.
as_u64
def as_u64() -> int
Get the underlying u64 value of this version
get_congested_version_suggested_gas_price
def get_congested_version_suggested_gas_price() -> int
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.
is_canceled
def is_canceled() -> bool
Checks if this version is canceled, i.e., the corresponding object appears in a canceled transaction.
is_congested
def is_congested() -> bool
Check if this version is congested, i.e., the corresponding object is the reason for transaction cancellation.
is_valid
def is_valid() -> bool
Checks if this version is valid, i.e., the corresponding object does not appear in a canceled transaction.
next
def next() -> Version
Returns the next version, or an error if overflow occurs.
previous
def previous() -> Version
Returns the previous version, or an error if underflow occurs.