aboutsummaryrefslogblamecommitdiff
path: root/src/hotstuff_client.cpp
blob: 8eeb8e5082ef4e24a6f3142a368de3c9bcc89500 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                           
                  
                 
                   

                     



                               



                            
 
                         
 
                          

                             

                           

                             
                              
                          
                         
                          
 
                
                   

                     

                 
                 



                  
                     
                               
                                                 
                                                        

  


                                                 
                                                     
                              
                                                       
                          
 




                                                                 
                                  
                   


                                                                       

 

                                                                   
     
                                                
                                                            
                            
                                                        
                                 

                                                              
      
                                      
                                                      

                             
                    
     
                 

 
                                                                     
                        
                                                               
                                             
                                     


                                    
















                                                                       
                                                                          




                                                            


                                                          
      
                      


                        

 






                                                                                   
                                                                               
                                                               


                                          

                                   
 
                                                
                                                       

                                                           
                                                 
 





                                                  
                                            


                                              

































                                                                                      
                       
                  
 
                                





                                                                                          
     
      

             
/**
 * Copyright 2018 VMware
 * Copyright 2018 Ted Yin
 *
 * 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.
 */

#include <cassert>
#include <random>
#include <signal.h>
#include <sys/time.h>

#include "salticidae/type.h"
#include "salticidae/netaddr.h"
#include "salticidae/network.h"
#include "salticidae/util.h"

#include "hotstuff/util.h"
#include "hotstuff/type.h"
#include "hotstuff/client.h"

using salticidae::Config;

using hotstuff::ReplicaID;
using hotstuff::NetAddr;
using hotstuff::EventContext;
using hotstuff::MsgReqCmd;
using hotstuff::MsgRespCmd;
using hotstuff::CommandDummy;
using hotstuff::Finality;
using hotstuff::HotStuffError;
using hotstuff::uint256_t;
using hotstuff::opcode_t;
using hotstuff::command_t;

EventContext ec;
ReplicaID proposer;
size_t max_async_num;
int max_iter_num;
uint32_t cid;
uint32_t cnt = 0;
uint32_t nfaulty;

struct Request {
    ReplicaID rid;
    command_t cmd;
    size_t confirmed;
    salticidae::ElapsedTime et;
    Request(ReplicaID rid, const command_t &cmd):
        rid(rid), cmd(cmd), confirmed(0) {