# Dependable and Secure Voting Mechanism in Edge Computing
## 3 System
### System Model
#### 3.2.3 Edge Node  
The client request is forwarded to the respective cloud instance with the message \(\langle\textsc{REQUST},seq,\sigma,e_{i}\rangle_{pk}\). \(e_{i}\) identifies the edge node that forwarded the request and that will execute the voting mechanism. Requests are signed with session keys \(pk\) created for the operation. The output of the computation performed in the cloud \(c_{i}\) comes in the form of \(\langle c_{i},H(V_{\sigma})_{pk}\). \(c_{i}\in C\) identifies the cloud that performed the computation. Lets refer to \(v_{i}=\langle c_{i},H(V_{\sigma})_{pk}\) as the result of the computation in cloud instance \(c_{i}\). The voting algorithm comprises three phases as depicted in Figure 3, which begin from the moment the first reply is received by an edge node \(e_{i}\) from the cloud instance \(c_{i}\). First, in the propose phase, each edge node will receive \(\langle\textsc{propose},seq,v\rangle\) that represents the result from the computation. propose is the type of message sent from the \(c_{i}\) to \(e_{i}\). \(seq\) is the initial sequence number. \(v_{i}\) is the proposed value that resulted from the computation \(\sigma\) in cloud \(c_{i}\). After an edge node \(e_{i}\) receives \(v_{i}\), it forwards during the prepare phase \(\langle\textsc{prepare},seq,v_{i},e_{i}\rangle\) to \(2f\) peers. \(v_{i}\) is the proposed value from \(c_{i}\). \(e_{i}\) is the edge node that received the value. The commit phase begins when all the values have been broadcast. In the commit phase, the edge nodes apply a simple majority scheme to find a single value \(v\) that identifies the computation. Finally, each node will relay the result to the client with the message \(\langle\textsc{RESPONSE},seq,v,e_{i}\rangle_{pc}\). In the simple use case, the sequence of events on the server-side is the following: (1) Each cloud instance sends the result of the computation to the respective edge node; (2) after all edge nodes receive the proposed value \(v\), it is propagated to every other peer; (3) each edge node will apply a voting scheme for value \(v\); (4) each edge node will send the voted value to the client; (5) the client \(c\) waits for \(f+1\) matching replies with the content \(\langle\textsc{RESPONSE},seq,v,e_{i}\rangle_{pc}\) to know that the computation was performed successfully. From the client perspective, it receives a message from each \(e_{i}\). If the client finds a majority of equal results, it knows that the computation performed successfully. Figure 3: Correct execution of voting mechanism. There is no synchronization between edge nodes. In other words, each edge node can be in different phases at the same time, or have a Byzantine behavior. With this algorithm, the following scenarios are possible: (i) One node already finished the prepare phase, but the other peers did not complete the propose phase yet. The only edge node that has already propagated its value cannot continue execution because it still does not have enough values to vote; (ii) \(e_{i}\) cannot wait indefinitely if it did not receive \(v_{i}\) from a \(c_{i}\), or from its peers. Thus, it is necessary to implement a simple timeout mechanism to guarantee liveness [29]. By using the following inequality in \(|Tc_{j}+Tk_{j}-Tc_{i}+Tk_{i}|<\Delta\), the system calculates the parameter \(\Delta\) that binds processing and communication delays. \(Tc\) refers to the processing time, and \(Tk\) is the latency of a message. After \(e_{i}\in E\) receives \(v_{i}\) from \(c_{i}\in C\), the system expects that any \(e_{j}\in E\) receives a value within a \(\Delta\) interval. Namely, it is expected that the time difference between the first process to finish, \(Tc_{i}+Tk_{i}\), and any other process \(j\), \(Tc_{j}+Tk_{j}\) is less than \(\Delta\). If \(e_{j}\) does not receive any message after \(\Delta\) time, it is considered that \(e_{j}\) failed. We model an attacker from the Byzantine failure model. The cloud and edge nodes are prone to arbitrary and malicious faults.