Skip to content

Comments

gradle: regenerate blocks.bin when code has changed#9864

Open
macfarla wants to merge 2 commits intohyperledger:mainfrom
macfarla:blocks-bin-regnerate
Open

gradle: regenerate blocks.bin when code has changed#9864
macfarla wants to merge 2 commits intohyperledger:mainfrom
macfarla:blocks-bin-regnerate

Conversation

@macfarla
Copy link
Contributor

PR description

Fixes the issue where sometimes all the trace spec tests fail because blocks.bin doesn't exist or something has changed.

to verify this:
check out main
rm ethereum/api/build/resources/test/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/blocks.bin
touch ethereum/api/build/resources/test/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/blocks.bin
./gradlew :ethereum:api:test --tests "org.hyperledger.besu.ethereum.api.jsonrpc.bonsai.TraceJsonRpcHttpBySpecTest"
tests fail
checkout this pr;
./gradlew :ethereum:api:test --tests "org.hyperledger.besu.ethereum.api.jsonrpc.bonsai.TraceJsonRpcHttpBySpecTest"
tests pass

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • hive tests: Engine or other RPCs modified?

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Copilot AI review requested due to automatic review settings February 23, 2026 01:52
@macfarla macfarla added the dev experience The build system, things that enable easier development etc. label Feb 23, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a Gradle build issue where the blocks.bin test resource file wasn't being regenerated when source code changed, causing trace spec tests to fail with stale or missing data. The fix replaces the onlyIf condition with proper Gradle input/output declarations to enable incremental build tracking.

Changes:

  • Removed onlyIf conditions that prevented task re-execution when blocks.bin already existed
  • Added proper input/output declarations to importTestBlocks and exportTestBlocks tasks for incremental build support
  • Moved input/output declarations from wrapper task generateTestBlockchain to the actual execution tasks
Comments suppressed due to low confidence (1)

ethereum/api/build.gradle:137

  • The importTestBlocks task declares outputs.dir(dataPath) but the downstream exportTestBlocks task uses inputs.dir(dataPath). However, exportTestBlocks likely only needs the database files created in dataPath, not the entire directory. Consider whether outputs.files() with specific database file paths would be more precise, or add a comment explaining why the entire directory is needed as output.
  inputs.dir(srcFiles)
  inputs.files(configurations.testResourceGeneration)
  outputs.dir(dataPath)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev experience The build system, things that enable easier development etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant