Skip to content

Ensure OPP CDT models build before contracts#336

Open
huangminghuang wants to merge 1 commit into
masterfrom
feature/protobuf-contract-dependency
Open

Ensure OPP CDT models build before contracts#336
huangminghuang wants to merge 1 commit into
masterfrom
feature/protobuf-contract-dependency

Conversation

@huangminghuang
Copy link
Copy Markdown
Contributor

Summary

This PR makes the contracts_project-build ExternalProject step depend directly on opp_cdt_models.protos.

Why this is necessary

sysio.opreg and other system contracts include the generated CDT protobuf headers from build/<config>/libraries/opp/generated-cdt. The parent build already created an opp_cdt_models.protos target for those headers and attached it to the outer contracts_project target, but contracts_project is an ExternalProject.

With Ninja, depending on the outer ExternalProject target is not enough to order the actual contracts_project-build step. Ninja could schedule the contract sub-build before regenerating stale CDT protobuf headers. That happened locally: attestations.proto contained ACTION_TYPE_WITHDRAW, actor, wire_account, and SlashOperator, but the generated CDT header still had the older ACTION_TYPE_WITHDRAW_REMIT/op_address shape. As a result, sysio.opreg failed to compile even though the proto source was correct.

By adding the dependency to the generated ExternalProject build target itself, contracts_project-build now waits for opp_cdt_models.protos before compiling contracts.

Verification

  • Confirmed Ninja dry-run order changed to generate zpp protobuf headers before contracts_project.
  • Confirmed build/debug/libraries/opp/generated-cdt/sysio/opp/attestations/attestations.pb.hpp regenerated with the current OperatorAction fields.
  • Ran:
cmake -S . -B build/debug -DBUILD_SYSTEM_CONTRACTS=ON
cmake --build build/debug --parallel "$(nproc)"

The full build completed successfully.

@huangminghuang huangminghuang requested a review from heifner May 14, 2026 14:12
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