Fix ProposalInfo default constructor for zero-address initialization#953
Conversation
* 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>
ProposalInfo default constructor for zero-address initialization
There was a problem hiding this comment.
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 useAddress.DEFAULT(zero address) and include both address fields in theDynamicStructtemplate. - 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.
| public ProposalInfo() { | ||
| super( | ||
| new Address(""), | ||
| Address.DEFAULT, | ||
| Address.DEFAULT, | ||
| new Uint8(0), |
|
|
@copilot windows ci failed with: org.fisco.bcos.sdk.v3.test.transaction.DecodeAndPojoCoverageTest > testProposalInfoDefaultConstructorThrowsOnEmptyAddress FAILED |
…racterization test
Fixed in commit The no-arg constructor now delegates to the 7-arg |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-3.9.0 #953 +/- ##
===================================================
+ Coverage 64.05% 64.08% +0.02%
- Complexity 4567 4569 +2
===================================================
Files 430 430
Lines 17628 17632 +4
Branches 1969 1969
===================================================
+ Hits 11292 11299 +7
+ Misses 5576 5574 -2
+ Partials 760 759 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|



ProposalInfo()could not be instantiated because its no-arg constructor built anAddressfrom an empty string, which throwsNumberFormatException. The constructor also omitted the second address field from the dynamic struct template, leaving the default ABI shape incomplete.Constructor fix
new Address("")with valid zero-address placeholders viaAddress.DEFAULTresourceIdandproposerin the no-arg constructor so the defaultDynamicStructmatches the full 7-fieldProposalInfoABIRegression coverage
new ProposalInfo()