Skip to content

fix(genesis): reject empty proposer addresses - #3519

Open
guagucai wants to merge 2 commits into
evstack:mainfrom
guagucai:fix/empty-genesis-proposer
Open

guagucai wants to merge 2 commits into
evstack:mainfrom
guagucai:fix/empty-genesis-proposer

Conversation

@guagucai

@guagucai guagucai commented Nov 30, 2026 •

Copy link
Copy Markdown

Overview

Genesis validation rejects nil proposer addresses but accepts a non-nil empty slice, including the empty encoded byte string from a genesis file. Treat both empty representations consistently before node startup. No address encoding or consensus rule changes are introduced.

The test covers both nil and non-nil empty slices, plus a non-empty proposer address. It changes startup validation only.

Validation

Command: go test ./pkg/genesis -run TestGenesisRejectsEmptyProposerAddress -count=1.

Summary by CodeRabbit

  • Bug Fixes
    • Genesis validation now rejects empty proposer addresses, including zero-length values, and reports that the address cannot be empty.

Signed-off-by: guagucai <guagucai@outlook.com>
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 702fc024-deb6-47b5-bf4b-e3b8c5b9a3a6
Commits

Reviewing files that changed from the base of the PR and between f4e1a03 and fa4af43.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Genesis.Validate now rejects proposer addresses with zero length, including non-nil empty slices. A test checks that nil and empty addresses fail validation and a 20-byte address passes.

Changes: Genesis proposer address validation

Layer / File(s) Summary
Proposer address validation
pkg/genesis/genesis.go, pkg/genesis/empty_proposer_test.go
Genesis.Validate rejects proposer addresses with zero length and updates the error message. The test covers nil, empty, and 20-byte addresses.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: tac0turtle

Merge Risk: Minimal · previous review f4e1a

Genesis validation now rejects empty proposer addresses, including non-nil empty ones, before node startup. The change is narrow and has test coverage, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title 'fix(genesis): reject empty proposer addresses' matches the main change. The summary says Genesis.Validate now rejects empty ProposerAddress values, including non-nil zero-length slices, and…
Description check Passed The description states the problem: genesis validation rejects nil proposer addresses but accepts a non-nil empty slice. It states the fix, the test coverage (nil, non-nil empty, and a non-empty addre…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title 'fix(genesis): reject empty proposer addresses' matches the main change. The summary says Genesis.Validate now rejects empty ProposerAddress values, including non-nil zero-length slices, and adds a test for this. The title follows the conventional commit format and is specific.

Full details: Description check

Explanation

The description states the problem: genesis validation rejects nil proposer addresses but accepts a non-nil empty slice. It states the fix, the test coverage (nil, non-nil empty, and a non-empty address), and the scope (startup validation only, with no encoding or consensus changes). It gives the exact command used to validate the change. The template asks for an Overview section, and the description provides one. It does not include an issue link or 'Closes #' reference, which the template suggests when an issue exists.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7cb61991-3978-488e-9760-c3bf3184a701
Commits

Reviewing files that changed from the base of the PR and between e8626b1 and f4e1a03.

Files selected for processing: 2

  • pkg/genesis/empty_proposer_test.go
  • pkg/genesis/genesis.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.69%. Comparing base (12e3e81) to head (fa4af43).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3519      +/-   ##
==========================================
- Coverage   69.95%   69.69%   -0.27%     
==========================================
  Files         122      122              
  Lines       12446    12446              
==========================================
- Hits         8707     8674      -33     
- Misses       3739     3772      +33     
Flag Coverage Δ
combined 69.69% <100.00%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

2 participants