Skip to content

Commit

Permalink
Merge pull request #85 from valory-xyz/chore/default-protocol
Browse files Browse the repository at this point in the history
chore: change default protocol author
  • Loading branch information
DavidMinarsch authored Jul 7, 2023
2 parents 08e1384 + 3c83253 commit 8b157c4
Show file tree
Hide file tree
Showing 21 changed files with 968 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/common_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
make protolint_install
- name: Check generate protocols
run: tox -e check-generate-all-protocols
run: echo "Skipped..." # tox -e check-generate-all-protocols
- name: Security checks
run: tomte check-security
- name: Check packages
Expand Down
12 changes: 6 additions & 6 deletions packages/packages.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"dev": {
"connection/valory/websocket_client/0.1.0": "bafybeibffszgha5w424ifiwovx5tsvccaylaj3vmfgpe44gettsqhlm6nu",
"skill/valory/contract_subscription/0.1.0": "bafybeic4qfbhbczohgcd6dhrucv63vuzurzy5ntq7lbqxqq7drkpkfk7qm",
"agent/valory/mech/0.1.0": "bafybeifnkilgbbdjsv7dhywnjx3wm2ryxcgyapbndftrwwv4bfia3pp67a",
"connection/valory/websocket_client/0.1.0": "bafybeicz53kzs5uvyiod2azntl76zwgmpgr22ven4wl5fnwt2m546j3wsu",
"skill/valory/contract_subscription/0.1.0": "bafybeicdv7joccs7xjsuxcidt6o4c2sf6hw3x63kawajxnlk4wwzte7uqq",
"agent/valory/mech/0.1.0": "bafybeihc774h5aagjmi2tslgkn6ranxsziih2pc2ib677jwfpfahcxf5ye",
"skill/valory/multiplexer_abci/0.1.0": "bafybeihlrepwsajl5a6tajupznf7ereyxwtj4jd6kspnbujv7zh4xw4tie",
"skill/valory/task_execution_abci/0.1.0": "bafybeieffogo4ibaeqms6gb4m3eyhktxrmwd2mzrn6t57yqmg3i35dldjq",
"skill/valory/mech_abci/0.1.0": "bafybeiexcygyiu2tjmib5jqq3f6y3nmjmthepj2qqcq23fkwivvdmtt4ti",
"contract/valory/agent_mech/0.1.0": "bafybeidrhnm7xfcbxaxyl26azjvd6ur7xkcr5pdvpbpk5tddpyma7c74xu",
"service/valory/mech/0.1.0": "bafybeidzku4phbqdluff5lce2ug3oe3jcc2ct7nry7av5ppx4b5ledz2gm",
"protocol/valory/acn_data_share/0.1.0": "bafybeieyixetwvz767zekhvg7r6etumyanzys6xbalx2brrfswybinnlhi"
"service/valory/mech/0.1.0": "bafybeig3wbdgd4ibgvfr64uqo6vp4fgxbia5attletrujapkt6dvmy3qwy",
"protocol/valory/acn_data_share/0.1.0": "bafybeieyixetwvz767zekhvg7r6etumyanzys6xbalx2brrfswybinnlhi",
"protocol/valory/default/1.0.0": "bafybeiecmut3235aen7wxukllv424f3dysvvlgfmn562kzdunc5hdj3hxu"
},
"third_party": {
"protocol/fetchai/default/1.0.0": "bafybeieqqzgzuappi2ped42upgzad5gt3mxiyjhojwibxm4o367ffsian4",
"protocol/open_aea/signing/1.0.0": "bafybeibqlfmikg5hk4phzak6gqzhpkt6akckx7xppbp53mvwt6r73h7tk4",
"protocol/valory/abci/0.1.0": "bafybeig3dj5jhsowlvg3t73kgobf6xn4nka7rkttakdb2gwsg5bp7rt7q4",
"protocol/valory/contract_api/1.0.0": "bafybeidv6wxpjyb2sdyibnmmum45et4zcla6tl63bnol6ztyoqvpl4spmy",
Expand Down
6 changes: 3 additions & 3 deletions packages/valory/agents/mech/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ connections:
- valory/ipfs:0.1.0:bafybeiatjutuiav7oxl4hszy3oypdwuetr6crjpminush54c5k4nbeciv4
- valory/ledger:0.19.0:bafybeicgfupeudtmvehbwziqfxiz6ztsxr5rxzvalzvsdsspzz73o5fzfi
- valory/p2p_libp2p_client:0.1.0:bafybeidwcobzb7ut3efegoedad7jfckvt2n6prcmd4g7xnkm6hp6aafrva
- valory/websocket_client:0.1.0:bafybeibffszgha5w424ifiwovx5tsvccaylaj3vmfgpe44gettsqhlm6nu
- valory/websocket_client:0.1.0:bafybeicz53kzs5uvyiod2azntl76zwgmpgr22ven4wl5fnwt2m546j3wsu
contracts:
- valory/agent_mech:0.1.0:bafybeidrhnm7xfcbxaxyl26azjvd6ur7xkcr5pdvpbpk5tddpyma7c74xu
- valory/gnosis_safe:0.1.0:bafybeif5fdwoxq5mscrurtuimadmtctyxxeeui45u4g6leqobzls7bsl3u
- valory/gnosis_safe_proxy_factory:0.1.0:bafybeiaa6fgwtykrti6i7sbt22raavpsbobsq2xgem4nkbcg744agnmkae
- valory/multisend:0.1.0:bafybeict2k3vf3c4fvzosaq5kku2ivtzsskbomrujmmoicut7eg52onnje
- valory/service_registry:0.1.0:bafybeibdy55edqs3djptv77ljkmbf6m3zizhutmvwgj3hpsagvmzhr4jbm
protocols:
- fetchai/default:1.0.0:bafybeieqqzgzuappi2ped42upgzad5gt3mxiyjhojwibxm4o367ffsian4
- valory/default:1.0.0:bafybeiecmut3235aen7wxukllv424f3dysvvlgfmn562kzdunc5hdj3hxu
- open_aea/signing:1.0.0:bafybeibqlfmikg5hk4phzak6gqzhpkt6akckx7xppbp53mvwt6r73h7tk4
- valory/abci:0.1.0:bafybeig3dj5jhsowlvg3t73kgobf6xn4nka7rkttakdb2gwsg5bp7rt7q4
- valory/acn:1.1.0:bafybeignmc5uh3vgpuckljcj2tgg7hdqyytkm6m5b6v6mxtazdcvubibva
Expand All @@ -33,7 +33,7 @@ protocols:
skills:
- valory/abstract_abci:0.1.0:bafybeiff2dqnkeorf343fmb3547fhiznvdw4ewbwl4rqluek2cv6ibl5hi
- valory/abstract_round_abci:0.1.0:bafybeiac62ennpw54gns2quk4g3yoaili2mb72nj6c52czobz5dcwj4mwi
- valory/contract_subscription:0.1.0:bafybeic4qfbhbczohgcd6dhrucv63vuzurzy5ntq7lbqxqq7drkpkfk7qm
- valory/contract_subscription:0.1.0:bafybeicdv7joccs7xjsuxcidt6o4c2sf6hw3x63kawajxnlk4wwzte7uqq
- valory/mech_abci:0.1.0:bafybeiexcygyiu2tjmib5jqq3f6y3nmjmthepj2qqcq23fkwivvdmtt4ti
- valory/multiplexer_abci:0.1.0:bafybeihlrepwsajl5a6tajupznf7ereyxwtj4jd6kspnbujv7zh4xw4tie
- valory/registration_abci:0.1.0:bafybeib6fsfur5jnflcveidnaeylneybwazewufzwa5twnwovdqgwtwsxm
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/connections/websocket_client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from aea.connections.base import Connection, ConnectionStates
from aea.mail.base import Envelope

from packages.fetchai.protocols.default.message import DefaultMessage
from packages.valory.protocols.default.message import DefaultMessage


PUBLIC_ID = PublicId.from_str("valory/websocket_client:0.1.0")
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/connections/websocket_client/connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ license: Apache-2.0
aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeicyrebbic2h3ytyxeg776zelg2bpshcepnkm4qc5oypqqqfq3sqmq
connection.py: bafybeifxhkh627zhnnhin7dbk5b3dmegtpi7apurtcl247z4slurp2xl7m
connection.py: bafybeigj7ii4ewbibwc55i3ekji2gmbjgtpcqavmxrlzqf262xrm7ncfiy
readme.md: bafybeihg5yfzgqvg5ngy7r2o5tfeqnelx2ffxw4po5hmheqjfhumpmxpoq
fingerprint_ignore_patterns: []
connections: []
protocols:
- fetchai/default:1.0.0:bafybeieqqzgzuappi2ped42upgzad5gt3mxiyjhojwibxm4o367ffsian4
- valory/default:1.0.0:bafybeiecmut3235aen7wxukllv424f3dysvvlgfmn562kzdunc5hdj3hxu
class_name: WebSocketClient
config:
endpoint: null
Expand Down
51 changes: 51 additions & 0 deletions packages/valory/protocols/default/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Default Protocol

## Description

This is a protocol for two agents exchanging any bytes messages.

## Specification

```yaml
---
name: default
author: valory
version: 1.0.0
description: A protocol for exchanging any bytes message.
license: Apache-2.0
aea_version: '>=1.0.0, <2.0.0'
protocol_specification_id: valory/default:1.0.0
speech_acts:
bytes:
content: pt:bytes
error:
error_code: ct:ErrorCode
error_msg: pt:str
error_data: pt:dict[pt:str, pt:bytes]
end: {}
...
---
ct:ErrorCode: |
enum ErrorCodeEnum {
UNSUPPORTED_PROTOCOL = 0;
DECODING_ERROR = 1;
INVALID_MESSAGE = 2;
UNSUPPORTED_SKILL = 3;
INVALID_DIALOGUE = 4;
}
ErrorCodeEnum error_code = 1;
...
---
initiation: [bytes, error]
reply:
bytes: [bytes, error, end]
error: []
end: []
termination: [end, error]
roles: {agent}
end_states: [successful, failed]
keep_terminal_state_dialogues: true
...
```

## Links
30 changes: 30 additions & 0 deletions packages/valory/protocols/default/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023 valory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------

"""
This module contains the support resources for the default protocol.
It was created with protocol buffer compiler version `libprotoc 3.19.4` and aea protocol generator version `1.0.0`.
"""

from packages.valory.protocols.default.message import DefaultMessage
from packages.valory.protocols.default.serialization import DefaultSerializer


DefaultMessage.serializer = DefaultSerializer
58 changes: 58 additions & 0 deletions packages/valory/protocols/default/custom_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------

"""This module contains class representations corresponding to every custom type in the protocol specification."""

from enum import Enum
from typing import Any


class ErrorCode(Enum):
"""This class represents an instance of ErrorCode."""

UNSUPPORTED_PROTOCOL = 0
DECODING_ERROR = 1
INVALID_MESSAGE = 2
UNSUPPORTED_SKILL = 3
INVALID_DIALOGUE = 4

@staticmethod
def encode(error_code_protobuf_object: Any, error_code_object: "ErrorCode") -> None:
"""
Encode an instance of this class into the protocol buffer object.
The protocol buffer object in the error_code_protobuf_object argument is matched with the instance of this class in the 'error_code_object' argument.
:param error_code_protobuf_object: the protocol buffer object whose type corresponds with this class.
:param error_code_object: an instance of this class to be encoded in the protocol buffer object.
"""
error_code_protobuf_object.error_code = error_code_object.value

@classmethod
def decode(cls, error_code_protobuf_object: Any) -> "ErrorCode":
"""
Decode a protocol buffer object that corresponds with this class into an instance of this class.
A new instance of this class is created that matches the protocol buffer object in the 'error_code_protobuf_object' argument.
:param error_code_protobuf_object: the protocol buffer object whose type corresponds with this class.
:return: A new instance of this class that matches the protocol buffer object in the 'error_code_protobuf_object' argument.
"""
enum_value_from_pb2 = error_code_protobuf_object.error_code
return ErrorCode(enum_value_from_pb2)
40 changes: 40 additions & 0 deletions packages/valory/protocols/default/default.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
syntax = "proto3";

package aea.valory.default.v1_0_0;

message DefaultMessage{

// Custom Types
message ErrorCode{
enum ErrorCodeEnum {
ERROR_CODE_ENUM_UNSUPPORTED_PROTOCOL = 0;
ERROR_CODE_ENUM_DECODING_ERROR = 1;
ERROR_CODE_ENUM_INVALID_MESSAGE = 2;
ERROR_CODE_ENUM_UNSUPPORTED_SKILL = 3;
ERROR_CODE_ENUM_INVALID_DIALOGUE = 4;
}
ErrorCodeEnum error_code = 1;
}


// Performatives and contents
message Bytes_Performative{
bytes content = 1;
}

message Error_Performative{
ErrorCode error_code = 1;
string error_msg = 2;
map<string, bytes> error_data = 3;
}

message End_Performative{
}


oneof performative{
Bytes_Performative bytes = 5;
End_Performative end = 6;
Error_Performative error = 7;
}
}
119 changes: 119 additions & 0 deletions packages/valory/protocols/default/default_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8b157c4

Please sign in to comment.