-
Notifications
You must be signed in to change notification settings - Fork 0
Tip/astro valset #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: tip/module
Are you sure you want to change the base?
Tip/astro valset #18
Conversation
Pull Request Review: Astro Validator Set ImplementationOverviewThis PR introduces significant changes to the Astro project:
Summary: While the core implementation is solid, there are critical blockers that must be addressed before merging. Critical Issues (Must Fix)1. Broken App Initialization -
|
Pull Request Review: Tip/astro valsetOverviewThis PR introduces significant changes including:
Code Quality & Best Practices✅ Strengths
|
Pull Request Review: Astro Validator Set ImplementationOverviewThis PR introduces significant changes to the Astro project:
Summary: The implementation shows solid design patterns, but there are some important issues to address. Critical Issues (Must Fix Before Merge)1. Missing Astro Keeper Initialization -
|
Pull Request Review: Astro Validator Set ImplementationExecutive SummaryThis PR introduces validator set management to the astro module and migrates from CometBFT to Tendermint proto types. The core implementation is solid, but there are critical blockers that prevent compilation and several important improvements needed before merge. Recommendation: Request Changes Critical Blockers 🚨1. Missing gRPC Gateway Route Registration - Causes PanicLocation: func (b AppModuleBasic) RegisterGRPCGatewayRoutes(context client.Context, mux *runtime.ServeMux) {
// TODO implement me
panic("implement me")
}Impact: Application will panic when trying to register HTTP routes for the module. Fix: Either implement the registration or use a no-op: func (b AppModuleBasic) RegisterGRPCGatewayRoutes(context client.Context, mux *runtime.ServeMux) {
// gRPC gateway routes will be added in future PR
}2. Unimplemented Export Function - Causes PanicLocation: func (app *SimApp) ExportAppStateAndValidators(...) (servertypes.ExportedApp, error) {
// TODO implement me
panic("this function is not used")
}Impact: While marked as "not used", this is a standard interface method that may be called by SDK infrastructure. The panic could cause unexpected failures. Recommendation: Implement basic export or return a proper error instead of panicking. High Priority Issues 🔴3. Insufficient Validator ValidationLocation: The func (k Keeper) SetValidator(ctx sdk.Context, v types.Validator) error {
if v.Moniker == "" {
return fmt.Errorf("validator moniker cannot be empty")
}
return k.Validators.Set(ctx.Context(), v.Moniker, v)
}Missing Validations:
Security Risk: Invalid or malicious validator data could be stored. 4. Incomplete Genesis ValidationLocation: func (gs *GenesisState) Validate() error {
return gs.Params.Validate()
}Issue: Validator list is not validated during genesis import. Risk: Genesis could contain duplicate monikers, empty identities, or nil validators that pass validation but cause runtime issues. Recommended Addition: func (gs *GenesisState) Validate() error {
if err := gs.Params.Validate(); err != nil {
return err
}
seen := make(map[string]bool)
for _, v := range gs.Validators {
if v == nil {
continue
}
if v.Moniker == "" {
return fmt.Errorf("validator moniker cannot be empty")
}
if seen[v.Moniker] {
return fmt.Errorf("duplicate validator moniker: %s", v.Moniker)
}
if len(v.Identity) == 0 {
return fmt.Errorf("validator %s has empty identity", v.Moniker)
}
seen[v.Moniker] = true
}
return nil
}5. No Test CoverageImpact: Zero tests added for new validator management functionality. Required Tests:
Medium Priority Issues 🟡6. Unused Genesis FieldLocation: message GenesisState {
Params params = 1;
bytes identity = 2; // ← Never used in keeper
repeated Validator validators = 3;
}Issue: The Questions:
7. No Validator Update EventsLocation: Issue: Impact: No way to track validator changes through event logs for indexers/explorers. Recommendation: Emit events for validator additions/updates. 8. Performance: Unbounded Validator IterationLocation: func (k Keeper) GetAllValidators(ctx sdk.Context) ([]types.Validator, error) {
var vals []types.Validator
if err := k.Validators.Walk(ctx.Context(), nil, func(_ string, v types.Validator) (bool, error) {
vals = append(vals, v)
return false, nil
}); err != nil {
return nil, err
}
return vals, nil
}Issue: Loads all validators into memory. Could be expensive with large validator sets. Recommendation: Consider adding pagination support for query endpoints. Positive Observations ✅
Code Quality ObservationsWell-Structured Collections KeysLocation: var (
ParamsKey = collections.NewPrefix("AstroParams")
ValidatorsPrefix = collections.NewPrefix("AstroValidators")
)Good use of descriptive prefixes for state storage. Proto Documentation QualityLocation: Excellent inline documentation explaining the Threshold Simplex context and BLS key usage. This level of documentation is exemplary. Protocol Buffer MigrationStructure Simplification ✅The migration from versioned namespaces (e.g., Generated Code Volume
Note: The bulk of changes are auto-generated. Ensure:
Security AnalysisAuthority Pattern ✅The keeper properly stores and exposes authority address (keeper.go:18, 49), following SDK best practices for governance control. Missing Access Control
|
PR Review: Tip/astro valsetOverviewThis is a substantial PR (~12,710 additions, ~1,236 deletions) that makes significant structural changes to the astro module. The main changes include:
Code Quality & Best Practices✅ Positive Aspects
|
Pull Request Review: Tip/astro valsetOverviewThis PR introduces validator set management to the Astro module by adding a Code Quality & Best Practices✅ Strengths
Potential Issues & Concerns🔴 Critical Issues
|
No description provided.