Conversation
Open
6a60f59 to
24d0083
Compare
Adds a property test that verifies `announciness peerMetric` agrees with a standalone pure model at every metric-state snapshot emitted during the simulation. Key design choices: - `runSigSubmissionV2WithMetric` (IOSim-specific, leaves the generic `runSigSubmissionV2` untouched) wires a real `PeerMetric` into each inbound peer and registers a `traceTVarIO` callback on the metric TVar. - Both peer events (`TraceTxInboundReceivedTxIds`, `TraceTxInboundAddedToMempool`) and metric snapshots are emitted as a single `SimTraceEvent = Either SimInboundEvent SimMetricSnapshot` type. A single `selectTraceEventsDynamicWithTime` call then extracts them in their original in-thread order, preserving the `sig_add → snapshot → sig_add → snapshot` interleaving that two separate extraction passes would destroy. - The pure model (`PureModelState`, `updatePureModel`, `expectedAnnounciness`) is decoupled from the implementation and mirrors `reportSigImpl` independently. - `peerMetricVar` (field accessor) exported from `PeerMetric` for testing; constructor remains unexported. - `TraceTxInboundReceivedTxIds` trace added at both sigid-receipt sites in `sigSubmissionInbound`. - `SimPeerAddr ~ Int` enforced via type equality so a type change causes a compile error rather than silently empty traces. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
List of changes
This PR introduces announcyness metric for peer selection which is used to
decide which hot peers we should demote.
For each peer we count how many valid signatures were announced before any
other peer announced it. This is implemented into two steps: first we account
at which time a peer announce a given signature id, then once we receive the
corresponding signature, and it turns out to be valid, we give a score of one
to the peer that announced it first. Each score is kept for an hour (the same
as churn rate).
Checklist