Skip to content

Conversation

@jhkimqd
Copy link
Contributor

@jhkimqd jhkimqd commented Nov 6, 2025

Description

Add feature to observe signers for Bor block production

  • Fetches the AUTHOR column value from the miner value in the block. If it's 0x0 address, the value is fetched from the validator signatures where applicable (e.g. Polygon Chain)
  • Uses caching to store this value to avoid repeated calls, and LRU to clear old caches
  • Small improvement of polycli dockerlogger
image

praetoriansentry and others added 14 commits August 26, 2025 07:14
Add a new AUTHOR column to display block authors:
- Shows miner address for PoW blocks (non-zero miner field)
- Shows validator signer for PoA blocks (extracted from extra data via Ecrecover)
- Falls back to "N/A" if signer extraction fails

Key improvements:
- Add getCachedSigner() method with thread-safe caching to avoid expensive
  repeated Ecrecover operations during table updates
- Refactor updateTable() to use dynamic column rendering via getColumnValue()
  helper instead of hardcoded column assignments
- Replace hardcoded column count (10) with len(t.columns) for maintainability
- Add required imports for hex encoding and polymetrics package

This eliminates UI stuttering on PoA chains by caching signer results per
block hash, ensuring each block's author is computed only once.
The p2p sensor was panicking when processing transactions without an explicit
chain ID (legacy transactions). This fix:

- Adds chainID field to JSONDatabase and Datastore structs
- Uses the network ID as chain ID when creating database instances
- Falls back to the database's chain ID when a transaction doesn't have one
- Prevents panic from calling LatestSignerForChainID with nil

This ensures proper handling of all transaction types during p2p monitoring.
The previous fix didn't fully address the issue when NetworkID is 0.
When NetworkID is 0, we were still creating a chainID of 0 which causes
LatestSignerForChainID to panic.

This fix:
- Checks if chainID is 0 and treats it the same as nil
- Only attempts sender recovery when we have a valid non-zero chainID
- Gracefully handles transactions when chainID cannot be determined

This prevents the panic "invalid chainID 0" in the p2p sensor when
processing pooled transactions.
@jhkimqd jhkimqd marked this pull request as draft November 6, 2025 00:09
Signed-off-by: Ji Hwan <jkim@polygon.technology>
Signed-off-by: Ji Hwan <jkim@polygon.technology>
@jhkimqd jhkimqd marked this pull request as ready for review November 6, 2025 04:28
@jhkimqd jhkimqd requested a review from a team November 6, 2025 04:28
@jhkimqd jhkimqd enabled auto-merge November 6, 2025 23:54
Signed-off-by: Ji Hwan <jkim@polygon.technology>
jhkimqd and others added 2 commits November 10, 2025 12:13
Signed-off-by: Ji Hwan <jkim@polygon.technology>
Copy link
Member

@leovct leovct left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jhkimqd jhkimqd merged commit f3e8ad7 into main Nov 10, 2025
15 checks passed
@jhkimqd jhkimqd deleted the jhilliard/monitorv2-signer-support branch November 10, 2025 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants