Skip to content

packages.valory.skills.abstract_round_abci.models

This module contains the core models for all the ABCI apps.

FrozenMixin Objects

class FrozenMixin()

Mixin for classes to enforce read-only attributes.

__delattr__

def __delattr__(*args: Any) -> None

Override delattr to make object immutable.

__setattr__

def __setattr__(*args: Any) -> None

Override setattr to make object immutable.

TypeCheckMixin Objects

class TypeCheckMixin()

Mixin for data classes & models to enforce attribute types on construction.

__post_init__

def __post_init__() -> None

Check that the type of the provided attributes is correct.

GenesisBlock Objects

@dataclass(frozen=True)
class GenesisBlock(TypeCheckMixin)

A dataclass to store the genesis block.

to_json

def to_json() -> Dict[str, str]

Get a GenesisBlock instance as a json dictionary.

GenesisEvidence Objects

@dataclass(frozen=True)
class GenesisEvidence(TypeCheckMixin)

A dataclass to store the genesis evidence.

to_json

def to_json() -> Dict[str, str]

Get a GenesisEvidence instance as a json dictionary.

GenesisValidator Objects

@dataclass(frozen=True)
class GenesisValidator(TypeCheckMixin)

A dataclass to store the genesis validator.

to_json

def to_json() -> Dict[str, List[str]]

Get a GenesisValidator instance as a json dictionary.

GenesisConsensusParams Objects

@dataclass(frozen=True)
class GenesisConsensusParams(TypeCheckMixin)

A dataclass to store the genesis consensus parameters.

from_json_dict

@classmethod
def from_json_dict(cls, json_dict: dict) -> "GenesisConsensusParams"

Get a GenesisConsensusParams instance from a json dictionary.

to_json

def to_json() -> Dict[str, Any]

Get a GenesisConsensusParams instance as a json dictionary.

GenesisConfig Objects

@dataclass(frozen=True)
class GenesisConfig(TypeCheckMixin)

A dataclass to store the genesis configuration.

from_json_dict

@classmethod
def from_json_dict(cls, json_dict: dict) -> "GenesisConfig"

Get a GenesisConfig instance from a json dictionary.

to_json

def to_json() -> Dict[str, Any]

Get a GenesisConfig instance as a json dictionary.

BaseParams Objects

class BaseParams(Model, FrozenMixin, TypeCheckMixin)

Parameters.

__init__

def __init__(*args: Any, **kwargs: Any) -> None

Initialize the parameters object.

The genesis configuration should be a dictionary with the following format: genesis_time: str chain_id: str consensus_params: block: max_bytes: str max_gas: str time_iota_ms: str evidence: max_age_num_blocks: str max_age_duration: str max_bytes: str validator: pub_key_types: List[str] version: dict voting_power: str

Arguments:

  • args: positional arguments
  • kwargs: keyword arguments

_MetaSharedState Objects

class _MetaSharedState(ABCMeta)

A metaclass that validates SharedState's attributes.

__new__

def __new__(mcs, name: str, bases: Tuple, namespace: Dict,
            **kwargs: Any) -> Type

Initialize the class.

SharedState Objects

class SharedState(Model, ABC, metaclass=_MetaSharedState)

Keep the current shared state of the skill.

__init__

def __init__(*args: Any, skill_context: SkillContext, **kwargs: Any) -> None

Initialize the state.

setup_slashing

def setup_slashing(validator_to_agent: Dict[str, str]) -> None

Initialize the structures required for slashing.

get_validator_address

def get_validator_address(agent_address: str) -> str

Get the validator address of an agent.

acn_container

def acn_container() -> Dict[str, Any]

Create a container for ACN results, i.e., a mapping from others' addresses to None.

setup

def setup() -> None

Set up the model.

round_sequence

@property
def round_sequence() -> RoundSequence

Get the round_sequence.

synchronized_data

@property
def synchronized_data() -> BaseSynchronizedData

Get the latest synchronized_data if available.

get_acn_result

def get_acn_result() -> Any

Get the majority of the ACN deliverables.

Requests Objects

class Requests(Model, FrozenMixin)

Keep the current pending requests.

__init__

def __init__(*args: Any, **kwargs: Any) -> None

Initialize the state.

UnexpectedResponseError Objects

class UnexpectedResponseError(Exception)

Exception class for unexpected responses from Apis.

ResponseInfo Objects

@dataclass
class ResponseInfo(TypeCheckMixin)

A dataclass to hold all the information related to the response.

from_json_dict

@classmethod
def from_json_dict(cls, kwargs: Dict) -> "ResponseInfo"

Initialize a response info object from kwargs.

RetriesInfo Objects

@dataclass
class RetriesInfo(TypeCheckMixin)

A dataclass to hold all the information related to the retries.

from_json_dict

@classmethod
def from_json_dict(cls, kwargs: Dict) -> "RetriesInfo"

Initialize a retries info object from kwargs.

suggested_sleep_time

@property
def suggested_sleep_time() -> float

The suggested amount of time to sleep.

TendermintRecoveryParams Objects

@dataclass(frozen=True)
class TendermintRecoveryParams(TypeCheckMixin)

A dataclass to hold all parameters related to agent <-> tendermint recovery procedures.

This must be frozen so that we make sure it does not get edited.

__hash__

def __hash__() -> int

Hash the object.

ApiSpecs Objects

class ApiSpecs(Model, FrozenMixin, TypeCheckMixin)

A model that wraps APIs to get cryptocurrency prices.

__init__

def __init__(*args: Any, **kwargs: Any) -> None

Initialize ApiSpecsModel.

get_spec

def get_spec() -> Dict

Returns dictionary containing api specifications.

process_response

def process_response(response: HttpMessage) -> Any

Process response from api.

increment_retries

def increment_retries() -> None

Increment the retries counter.

reset_retries

def reset_retries() -> None

Reset the retries counter.

is_retries_exceeded

def is_retries_exceeded() -> bool

Check if the retries amount has been exceeded.

BenchmarkBlockTypes Objects

class BenchmarkBlockTypes(Enum)

Benchmark block types.

BenchmarkBlock Objects

class BenchmarkBlock()

Benchmark

This class represents logic to measure the code block using a context manager.

__init__

def __init__(block_type: str) -> None

Benchmark for single round.

__enter__

def __enter__() -> None

Enter context.

__exit__

def __exit__(*args: List, **kwargs: Dict) -> None

Exit context

BenchmarkBehaviour Objects

class BenchmarkBehaviour()

BenchmarkBehaviour

This class represents logic to benchmark a single behaviour.

__init__

def __init__() -> None

Initialize Benchmark behaviour object.

local

def local() -> BenchmarkBlock

Measure local block.

consensus

def consensus() -> BenchmarkBlock

Measure consensus block.

BenchmarkTool Objects

class BenchmarkTool(Model, TypeCheckMixin, FrozenMixin)

BenchmarkTool

Tool to benchmark ABCI apps.

__init__

def __init__(*args: Any, **kwargs: Any) -> None

Benchmark tool for rounds behaviours.

measure

def measure(behaviour: str) -> BenchmarkBehaviour

Measure time to complete round.

data

@property
def data() -> List

Returns formatted data.

save

def save(period: int = 0, reset: bool = True) -> None

Save logs to a file.

reset

def reset() -> None

Reset benchmark data