| 260 | return self.lastOracle |
| 261 | |
| 262 | class Protocol: |
| 263 | def __init__(self, ldt_params: LDTParameters): |
| 264 | self.params = ldt_params |
| 265 | #msg = Polynomial(ldt_params, ldt_params.degree, ldt_params.rho_bits) |
| 266 | #rnd_init = Round() |
| 267 | #rnd_init.addMessage(msg) |
| 268 | #self.rounds = [rnd_init] |
| 269 | self.stopped = False |
| 270 | #self.lastOracle = msg |
| 271 | self.rounds = [] |
| 272 | self.lastOracle = None |
| 273 | |
| 274 | def addRound(self, rnd : Round): |
| 275 | if self.stopped == False: |
| 276 | self.rounds.append(rnd) |
| 277 | self.stopped = rnd.isStopped() |
| 278 | self.lastOracle = rnd.lastOracle |
| 279 | |
| 280 | def getLastOracle(self): |
| 281 | return self.lastOracle |
| 282 | |
| 283 | def stop(self): |
| 284 | self.stopped = True |
| 285 | |
| 286 | def isStopped(self): |
| 287 | return self.stopped |
| 288 | |
| 289 | def argument_size(self): |
| 290 | len = 0 |
| 291 | for msg in self.rounds: |
| 292 | len += msg.argument_size() |
| 293 | return len |
| 294 | |
| 295 | def proof_length(self): |
| 296 | len = 0 |
| 297 | for msg in self.rounds: |
| 298 | len += msg.proof_length() |
| 299 | return len |
| 300 | |
| 301 | def queries(self): |
| 302 | q = 0 |
| 303 | for rnd in self.rounds: |
| 304 | q += rnd.queries() |
| 305 | return q |
| 306 | |
| 307 | def print_arg(self): |
| 308 | for msg in self.rounds: |
| 309 | print(convert_size(msg.argument_size())) |
| 310 | |
| 311 | def print(self): |
| 312 | c = 1 |
| 313 | for msg in self.rounds: |
| 314 | print("=========") |
| 315 | print("Round " + str(c) + ":") |
| 316 | c+=1 |
| 317 | msg.print() |
| 318 | print("=========") |
no outgoing calls
no test coverage detected