Skip to content

Commit

Permalink
update integration script (#3767)
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es authored Oct 17, 2024
1 parent bb86918 commit 5c9b79a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/auto-integration/run-integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
class ReplicaData:
last_highest_view = 0
last_decided_view = 0
number_of_empty_blocks_proposed = 0
last_synced_block_height = 0
highest_view_updates = 0
decided_view_updates = 0
Expand All @@ -57,6 +58,7 @@ def __init__(self):
self.highest_view_updates = 0
self.decided_view_updates = 0
self.last_decided_view = 0
self.number_of_empty_blocks_proposed = 0
self.synced_block_height_updates = 0
self.tolerance = 5
self.replica_data = {}
Expand All @@ -67,6 +69,7 @@ def table(self):
table.add_column("Port", justify="right", no_wrap=True)
table.add_column("Last Highest View")
table.add_column("Last Decided View")
table.add_column("Num Empty Blocks")
table.add_column("Last Synced Block Height")
table.add_column("Status")

Expand All @@ -75,6 +78,7 @@ def table(self):
str(port),
str(data.last_highest_view),
str(data.last_decided_view),
str(data.number_of_empty_blocks_proposed),
str(data.last_synced_block_height),
"[green]In Sync[/green]"
if data.status
Expand All @@ -87,6 +91,7 @@ def update(self, text: str, port: str):
if port not in self.replica_data:
self.replica_data[port] = ReplicaData()
self.update_last_decided_view(text, port)
self.update_number_of_empty_blocks_proposed(text, port)
self.update_last_highest_view(text, port)
self.update_last_synced_block_height(text, port)

Expand Down Expand Up @@ -118,6 +123,16 @@ def update_last_decided_view(self, text: str, port: str):
self.replica_data[port].status = False
self.failed_views.add(last_decided_view)

def update_number_of_empty_blocks_proposed(self, text: str, port: str):
match = re.search(r"^consensus_number_of_empty_blocks_proposed (\d+)", text, re.MULTILINE)
if match:
number_of_empty_blocks_proposed = int(match.group(1))
if number_of_empty_blocks_proposed > self.replica_data[port].number_of_empty_blocks_proposed:
self.replica_data[port].number_of_empty_blocks_proposed = number_of_empty_blocks_proposed
self.number_of_empty_blocks_proposed = max(
self.number_of_empty_blocks_proposed, self.replica_data[port].number_of_empty_blocks_proposed
)

def update_last_synced_block_height(self, text: str, port: str):
match = re.search(
r"^consensus_last_synced_block_height (\d+)", text, re.MULTILINE
Expand Down

0 comments on commit 5c9b79a

Please sign in to comment.