Closed SeanMcOwen closed 3 months ago
if process is None: pass else: if process.phase == SelectionPhase.pending_proposals: remaining_time = max_phase_duration - process.duration_in_current_phase if remaining_time < 0: raw_proposals: dict[TxUUID, Proposal] = proposals_from_tx( state["transactions"] ) proposals = {k: p for k, p in raw_proposals.items() if p.when >= process.current_phase_init_time} if len(proposals) > 0: number_uncles: int = min( len(proposals) - 1, params["uncle_count"]) ranked_proposals: list[Proposal] = sorted( proposals.values(), key=lambda p: p.score, reverse=True ) winner_proposal: Proposal = ranked_proposals[0] if len(ranked_proposals) > 1: uncle_proposals: list[Proposal] = ranked_proposals[ 1: number_uncles + 1 ] else: uncle_proposals = [] updated_process = copy(process) # BUG: do this for all phase evolving logic. # BUG: make sure that this is compatible when the time evolution is dynamical, eg, 1 ts = many blocks updated_process.current_phase_init_time = state["time_l1"] updated_process.phase = SelectionPhase.pending_commit_bond updated_process.duration_in_current_phase = 0 updated_process.leading_sequencer = winner_proposal.who updated_process.uncle_sequencers = [ p.who for p in uncle_proposals] updated_process.tx_winning_proposal = winner_proposal.uuid else: updated_process = copy(process) updated_process.phase = SelectionPhase.skipped updated_process.duration_in_current_phase = 0 else: pass else: pass
Correct, Proposal Phase should never end early.