Skip to content

Fix ProposalInfo default constructor for zero-address initialization#953

Open
Copilot wants to merge 4 commits into
release-3.9.0from
copilot/fix-proposalinfo-no-arg-constructor
Open

Fix ProposalInfo default constructor for zero-address initialization#953
Copilot wants to merge 4 commits into
release-3.9.0from
copilot/fix-proposalinfo-no-arg-constructor

Conversation

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

ProposalInfo() could not be instantiated because its no-arg constructor built an Address from an empty string, which throws NumberFormatException. The constructor also omitted the second address field from the dynamic struct template, leaving the default ABI shape incomplete.

  • Constructor fix

    • Replace new Address("") with valid zero-address placeholders via Address.DEFAULT
    • Initialize both resourceId and proposer in the no-arg constructor so the default DynamicStruct matches the full 7-field ProposalInfo ABI
  • Regression coverage

    • Add a focused unit test for new ProposalInfo()
    • Assert the default instance:
      • constructs successfully
      • exposes 7 struct components
      • reports the expected ABI type string
      • uses zero addresses for both address fields
public ProposalInfo() {
    super(
            Address.DEFAULT,
            Address.DEFAULT,
            new Uint8(0),
            new Uint256(0),
            new Uint8(0),
            new DynamicArray<>(Address.class),
            new DynamicArray<>(Address.class));
}

Copilot AI and others added 2 commits March 4, 2026 13:34
* Initial plan

* Remove fisco-bcos.org URL, replace with GitHub repo URL in build.gradle

Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ProposalInfo no-arg constructor to avoid NumberFormatException Fix ProposalInfo default constructor for zero-address initialization Jun 16, 2026
Copilot AI requested a review from kyonRay June 16, 2026 03:35
@kyonRay kyonRay marked this pull request as ready for review June 17, 2026 03:59
Copilot AI review requested due to automatic review settings June 17, 2026 03:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes ProposalInfo’s no-arg constructor so it can be instantiated safely and its DynamicStruct ABI shape matches the full 7-field ProposalInfo definition.

Changes:

  • Update ProposalInfo() to use Address.DEFAULT (zero address) and include both address fields in the DynamicStruct template.
  • Add a unit test validating ProposalInfo() constructs, exposes 7 components, reports the expected ABI type string, and uses zero addresses for both address fields.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/main/java/org/fisco/bcos/sdk/v3/contract/auth/po/ProposalInfo.java Fixes default constructor to avoid NumberFormatException and to build a 7-field ABI template (incl. both addresses).
src/test/java/org/fisco/bcos/sdk/v3/test/contract/auth/ProposalInfoTest.java Adds regression test for default constructor ABI shape and zero-address initialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 22 to 26
public ProposalInfo() {
super(
new Address(""),
Address.DEFAULT,
Address.DEFAULT,
new Uint8(0),
@kyonRay kyonRay changed the base branch from master to release-3.9.0 June 22, 2026 09:27
@sonarqubecloud

Copy link
Copy Markdown

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.

3 participants