fix(rpc): honor requested chain id in RCManager.GetValidatorSet - #585
Closed
ezeike wants to merge 1 commit into
Closed
fix(rpc): honor requested chain id in RCManager.GetValidatorSet#585ezeike wants to merge 1 commit into
ezeike wants to merge 1 commit into
Conversation
The cached fast path always returned sub.Info.ValidatorSet regardless
of the id argument, since sub.Info is only ever populated for the
subscription's own chain. A caller requesting a different chain's
committee at the cached height silently got its own chain's
validators back instead.
Gate the cached path on id == sub.chainId and fall through to a
remote lookup otherwise. Add a committeeCache (mirroring the existing
lottery/dexBatch/orders caches) so repeated lookups of the same
foreign chain id at a fixed height don't repeat the round-trip;
height 0 ('latest') is excluded from the cache since it can move
between calls.
ezeike
force-pushed
the
fix/rc-validator-set-foreign-chain-id
branch
from
September 4, 2026 09:45
8c83fb4 to
775c60b
Compare
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.
What Changed
RCManager.GetValidatorSetno longer serves the cached fast path for a chain id other than the subscription's own — it now checksid == sub.chainIdbefore touchingsub.InfocommitteeCache(mirrors the existinglottery/dexBatch/orderscaches) so repeated lookups of the same foreign chain id at a fixed height skip the remote round-trip; height 0 ("latest") is excluded from caching since it can move between callsWhy
sub.Info.ValidatorSetis only ever populated for the subscription's own chain (set at dial time fromr.c.ChainId). The fast path ignored theidargument entirely, so any caller requesting a different chain's committee at the cached height silently got back its own chain's validators instead — no error, just wrong data. No current caller hits this (LoadCommitteeand theconsensus.gocall site both always pass their own chain id), but it's a live footgun for any future caller that queries another chain's committee.Fixes & How They Work
id: gated the cached path onid == sub.chainId; any otheridnow always falls through to a remote lookup (with its own small cache), never the local subscription cache.