10.1.1.1. dcsim.framework package¶
10.1.1.1.1. Submodules¶
10.1.1.1.2. dcsim.framework.AdversaryControllerBase module¶
-
class
dcsim.framework.AdversaryControllerBase.AdversaryControllerBase¶ Bases:
objectInitalize the Adversary Controller, set the config, get the list of all corrupted nodes
Parameters: config – Configuration of the protocol -
add_honest_node_messages()¶ add messages(messages_to_send) sent from node(sender_id) in designated (round) to adversary controller
Parameters: - round – the round that the messages are in
- sender_id – the id of the sender
- messages_to_send – A list that contains the new messages
-
corrupted_node_list¶
-
get_delivered_messages()¶ get all delivered messages in designated round
Parameters: round – the round that these messages are in
-
round_action(round: int) → None¶ the action of adversary controller in designated round
-
set_honest_node_list()¶
-
set_trusted_third_party()¶
-
10.1.1.1.3. dcsim.framework.ConfigurationBase module¶
-
class
dcsim.framework.ConfigurationBase.ConfigurationBase¶ Bases:
object-
adversary_controller_type¶ Returns: the type of the adversary controller’s type
-
honest_node_type¶ Returns: the type of the hoest node
-
measurement_type¶ Returns: the type of the Measurement(Base)
-
num_corrupted_nodes¶ Returns: number of the corrupted nodes
-
num_honest_nodes¶ Returns: number of honest nodes
-
10.1.1.1.4. dcsim.framework.Context module¶
-
class
dcsim.framework.Context.Context(nodes: typing.Tuple[<function NewType.<locals>.new_type at 0x1087282f0>, ...], round: int, node: dcsim.framework.NodeBase.NodeBase, received_messages: typing.Tuple[dcsim.framework.MessageTuple.MessageTuple, ...]) → None¶ Bases:
objectclass docstring
initialize the Context class
Parameters: - nodes – nodes that will be broadcasted
- node – sender
- received_messages – having the shape of [(sender_id, receiver_id, round, message)] contains all messages that this node has received in this round.
-
broadcast(message: typing.Any) → None¶ broadcast a message to all nodes
Parameters: message – the message to be broadcast
-
messages_to_send¶ return the messages to be sent
Returns: A list contains all the messages to be sent
-
received_messages¶ reture the received messages
Returns: a tuple contains all the received messages
-
round¶
-
send(receiver: <function NewType.<locals>.new_type at 0x1087282f0>, message: typing.Any) → None¶ sends a message to a given node
Parameters: - receiver – the ndoe that will receive the message
- message – the message to be sent
10.1.1.1.5. dcsim.framework.MeasurementBase module¶
-
class
dcsim.framework.MeasurementBase.MeasurementBase¶ Bases:
objectInitialize the MeasurementBase
Parameters: - honest_nodes – the honest nodes
- adversary – the adversary controller is used
- config – the configuration is used
-
report_final() → None¶ report the all the conditions and the result in the end
-
report_round(round: int) → None¶ return the condition of each nodes at this round
Parameters: round – the index of the round
-
should_stop(round: int) → bool¶ determine whether the simulation should stop
Parameters: round – the round the simulation is at
10.1.1.1.6. dcsim.framework.MessageTuple module¶
-
class
dcsim.framework.MessageTuple.MessageTuple¶ Bases:
tuplesend message from sender to receiver in designated round
Create new instance of MessageTuple(sender, receiver, round, message)
-
message¶ Alias for field number 3
-
receiver¶ Alias for field number 1
-
round¶ Alias for field number 2
-
sender¶ Alias for field number 0
-
10.1.1.1.7. dcsim.framework.NodeBase module¶
-
class
dcsim.framework.NodeBase.NodeBase¶ Bases:
objectintitialze a Node, including the configuration
Parameters: config – the configuration of this node -
static
generate_node_id() → <function NewType.<locals>.new_type at 0x1087282f0>¶
-
id¶ Returns: node_id
-
round_action()¶ the action of a node in each round
-
set_node_list(node_ids: typing.Tuple[_ForwardRef('NodeId'), ...]) → None¶ set the node list using a tuple contains all the nodes
Parameters: node_ids –
-
set_trusted_third_party()¶
-
static