Skip to content

Fix "One Definition Rule" Violation for Prover::GetForm#306

Merged
hoffmang9 merged 1 commit into
Chia-Network:mainfrom
xchdata:fix-prover-getform-odr
Feb 17, 2026
Merged

Fix "One Definition Rule" Violation for Prover::GetForm#306
hoffmang9 merged 1 commit into
Chia-Network:mainfrom
xchdata:fix-prover-getform-odr

Conversation

@xearl4
Copy link
Copy Markdown
Contributor

@xearl4 xearl4 commented Feb 16, 2026

As discussed in this comment, commit 767a534 changed prover_base.hpp to declare virtual form GetForm(uint64_t iteration) = 0;, but didn't adapt vdf_base.hpp leaving it with virtual form* GetForm(uint64_t iteration) = 0;. This violates the "one definition rule" and causes a double-free crash in hw_proof.cpp (for all "hw" binaries, hw_proof.cpp is compiled using vdf_base.hpp, but linked with vdf_base.cpp which is compiled with prover_base.hpp).

This commit fixes this by adjusting vdf_base.hpp to once again match prover_base.hpp. The changes introduced in #299 will run emu_hw_test during CI, which would have caught that issue.

Ideally, a future change should clean up these headers to share a single defintion of Prover.


Note

Low Risk
Small signature alignment and corresponding call-site adjustment; behavior is unchanged aside from avoiding pointer lifetime/ABI issues that previously caused crashes.

Overview
Fixes a header mismatch by changing Prover::GetForm in vdf_base.hpp from returning form* to returning form, aligning it with prover_base.hpp and preventing ODR/link-time type inconsistencies.

Updates HwProver::GetForm in hw_proof.cpp to return form by value, dereferencing hw_proof_value_at(...) and returning a concrete fallback form when stopping, which avoids the crash/double-free seen in HW proof binaries.

Written by Cursor Bugbot for commit 12dcbf8. This will update automatically on new commits. Configure here.

@hoffmang9
Copy link
Copy Markdown
Member

Apologies for not kicking off the CI earlier - I cherry-picked the change into my hardware branch earlier today. Hopefully this comes up green and I'll merge it in

@hoffmang9
Copy link
Copy Markdown
Member

You can ignore mac-intel failures. Those runners are getting brittle and I will re-run them

Copy link
Copy Markdown
Member

@hoffmang9 hoffmang9 left a comment

Choose a reason for hiding this comment

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

lgtm

@hoffmang9 hoffmang9 merged commit 94e9798 into Chia-Network:main Feb 17, 2026
116 of 119 checks passed
@hoffmang9
Copy link
Copy Markdown
Member

Thanks!

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