Only mark validator sets aggregated for valset proofs#465
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c847f1e7f0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| func (s *EntityProcessor) markValidatorSetAggregatedIfValsetProof(ctx context.Context, aggregationProof symbiotic.AggregationProof) error { | ||
| metadata, err := s.cfg.Repo.GetValidatorSetMetadata(ctx, aggregationProof.Epoch) |
There was a problem hiding this comment.
Look up valset metadata by target epoch
For normal next-valset header proofs, this uses the signing epoch, not the validator-set epoch whose metadata was stored: valset_listener_uc.go builds the signature request with RequiredEpoch: prevValSet.Epoch but stores ValidatorSetMetadata{Epoch: valSet.Epoch, RequestID: extendedSig.RequestID()}. When that aggregation proof is processed, aggregationProof.Epoch is therefore the previous epoch, so this lookup either misses (and is silently ignored as ErrEntityNotFound) or compares against the previous valset's metadata, leaving the new valset status/latest-aggregated epoch unupdated even though the matching proof was saved.
Useful? React with 👍 / 👎.
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
gm @oxsteins , I just pushed some changes based on the suggestions. Mainly moved the valset metadata check before saving the proof, and updated it to use the target valset epoch. |
User description
closes #464
PR Type
Bug fix, Tests
Description
Restrict valset aggregation status updates
Match proofs against valset metadata
Ignore unrelated epoch-bound aggregation proofs
Add regression coverage for both paths
Diagram Walkthrough
File Walkthrough
entity_processor.go
Guard valset aggregation status by request matchinternal/usecase/entity-processor/entity_processor.go
GetValidatorSetMetadatato repository contractRequestIDmatches metadataentity_processor_test.go
Cover matching and non-matching proof behaviorinternal/usecase/entity-processor/entity_processor_test.go
entity_processor.go
Add repository mock for metadata lookupinternal/usecase/entity-processor/mocks/entity_processor.go
GetValidatorSetMetadata