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 argumentskwargs
: 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