Skip to content

packages.valory.skills.transaction_settlement_abci.behaviours

This module contains the behaviours for the 'abci' skill.

TransactionSettlementBaseBehaviour Objects

class TransactionSettlementBaseBehaviour(BaseBehaviour, ABC)

Base behaviour for the common apps' skill.

synchronized_data

@property
def synchronized_data() -> SynchronizedData

Return the synchronized data.

params

@property
def params() -> TransactionParams

Return the params.

serialized_keepers

@staticmethod
def serialized_keepers(keepers: Deque[str], keeper_retries: int) -> str

Get the keepers serialized.

get_gas_price_params

def get_gas_price_params(tx_body: dict) -> List[str]

Guess the gas strategy from the transaction params

RandomnessTransactionSubmissionBehaviour Objects

class RandomnessTransactionSubmissionBehaviour(RandomnessBehaviour)

Retrieve randomness.

SelectKeeperTransactionSubmissionBehaviourA Objects

class SelectKeeperTransactionSubmissionBehaviourA(  # pylint: disable=too-many-ancestors
        SelectKeeperBehaviour, TransactionSettlementBaseBehaviour)

Select the keeper agent.

async_act

def async_act() -> Generator

Do the action.

SelectKeeperTransactionSubmissionBehaviourB Objects

class SelectKeeperTransactionSubmissionBehaviourB(  # pylint: disable=too-many-ancestors
        SelectKeeperTransactionSubmissionBehaviourA)

Select the keeper b agent.

async_act

def async_act() -> Generator

Do the action.

Steps: - If we have not selected enough keepers for the period, select a keeper randomly and add it to the keepers' queue, with top priority. - Otherwise, cycle through the keepers' subset, using the following logic: A PENDING verification status means that we have not received any errors, therefore, all we know is that the tx has not been mined yet due to low pricing. Consequently, we are going to retry with the same keeper in order to replace the transaction. However, if we receive a status other than PENDING, we need to cycle through the keepers' subset. Moreover, if the current keeper has reached the allowed number of retries, then we cycle anyway. - Send the transaction with the keepers and wait for it to be mined. - Wait until ABCI application transitions to the next round. - Go to the next behaviour (set done event).

SelectKeeperTransactionSubmissionBehaviourBAfterTimeout Objects

class SelectKeeperTransactionSubmissionBehaviourBAfterTimeout(  # pylint: disable=too-many-ancestors
        SelectKeeperTransactionSubmissionBehaviourB)

Select the keeper b agent after a timeout.

ValidateTransactionBehaviour Objects

class ValidateTransactionBehaviour(TransactionSettlementBaseBehaviour)

Validate a transaction.

async_act

def async_act() -> Generator

Do the action.

Steps: - Validate that the transaction hash provided by the keeper points to a valid transaction. - Send the transaction with the validation result and wait for it to be mined. - Wait until ABCI application transitions to the next round. - Go to the next behaviour (set done event).

has_transaction_been_sent

def has_transaction_been_sent() -> Generator[None, None, Optional[bool]]

Transaction verification.

CheckTransactionHistoryBehaviour Objects

class CheckTransactionHistoryBehaviour(TransactionSettlementBaseBehaviour)

Check the transaction history.

history

@property
def history() -> List[str]

Get the history of hashes.

async_act

def async_act() -> Generator

Do the action.

CheckLateTxHashesBehaviour Objects

class CheckLateTxHashesBehaviour(  # pylint: disable=too-many-ancestors
        CheckTransactionHistoryBehaviour)

Check the late-arriving transaction hashes.

history

@property
def history() -> List[str]

Get the history of hashes.

SynchronizeLateMessagesBehaviour Objects

class SynchronizeLateMessagesBehaviour(TransactionSettlementBaseBehaviour)

Synchronize late-arriving messages behaviour.

__init__

def __init__(**kwargs: Any)

Initialize a SynchronizeLateMessagesBehaviour

setup

def setup() -> None

Setup the SynchronizeLateMessagesBehaviour.

async_act

def async_act() -> Generator

Do the action.

SignatureBehaviour Objects

class SignatureBehaviour(TransactionSettlementBaseBehaviour)

Signature behaviour.

async_act

def async_act() -> Generator

Do the action.

Steps: - Request the signature of the transaction hash. - Send the signature as a transaction and wait for it to be mined. - Wait until ABCI application transitions to the next round. - Go to the next behaviour (set done event).

FinalizeBehaviour Objects

class FinalizeBehaviour(TransactionSettlementBaseBehaviour)

Finalize behaviour.

async_act

def async_act() -> Generator[None, None, None]

Do the action.

Steps: - If the agent is the keeper, then prepare the transaction and send it. - Otherwise, wait until the next round. - If a timeout is hit, set exit A event, otherwise set done event.

handle_late_messages

def handle_late_messages(behaviour_id: str, message: Message) -> None

Store a potentially late-arriving message locally.

Arguments:

  • behaviour_id: the id of the behaviour in which the message belongs to.
  • message: the late arriving message to handle.

ResetBehaviour Objects

class ResetBehaviour(TransactionSettlementBaseBehaviour)

Reset behaviour.

async_act

def async_act() -> Generator

Do the action.

TransactionSettlementRoundBehaviour Objects

class TransactionSettlementRoundBehaviour(AbstractRoundBehaviour)

This behaviour manages the consensus stages for the basic transaction settlement.