Skip to content

Conversation

@gpevnev
Copy link
Contributor

@gpevnev gpevnev commented Nov 19, 2025

Add Network Readiness Checking

Problem
After all services start and Docker healthchecks pass, the network may not yet be producing blocks. This makes it inconvenient for users who need to wait before deploying contracts or running tests, as they have to manually check when the network is actually ready for transactions.

Solution
Implemented network-level readiness checking that ensures the blockchain is producing blocks, not just that services are responsive.

Closes #204

@gpevnev gpevnev requested a review from avalonche November 19, 2025 20:06
@metachris metachris requested a review from Copilot November 20, 2025 07:53
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 adds network readiness functionality to the builder-playground, allowing users to verify when networks are ready to accept transactions by checking that blocks are being produced. The implementation includes a /readyz HTTP endpoint and a CLI command to wait for network readiness.

Key changes:

  • Introduces NetworkReadyChecker interface for recipes to implement network-level readiness checks
  • Adds /readyz HTTP endpoint that returns network readiness status
  • Implements wait-ready CLI command to poll the readiness endpoint until the network is ready

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
playground/watchers.go Adds helper functions to check if chains are producing blocks and wait for first block
playground/manifest.go Defines NetworkReadyChecker interface for network readiness checks
playground/readyz.go Implements HTTP server for /readyz endpoint
playground/recipe_l1.go Implements NetworkReadyChecker interface for L1 recipe
playground/recipe_opstack.go Implements NetworkReadyChecker interface for OP stack recipe with L1/L2 checks
playground/recipe_buildernet.go Implements NetworkReadyChecker interface by delegating to L1 recipe
playground/cmd/wait_ready.go Adds CLI command to poll readiness endpoint
main.go Integrates readyz server and network readiness wait into main execution flow
README.md Documents the new network readiness features

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

Problem: on Docker on MacOS causes the container to fail
@ferranbt
Copy link
Collaborator

ferranbt commented Nov 20, 2025

How is this different from the watchdog functionality? A component can implement a ready check which can be use to determine whether the whole recipe is ready or not. (here)

@gpevnev
Copy link
Contributor Author

gpevnev commented Nov 20, 2025

How is this different from the watchdog functionality? A component can implement a ready check which can be use to determine whether the whole recipe is ready or not. (here)

Watchdog functionality doesn't have a readiness check as I see, it's more about continuously monitor health of a particular service. But we need one time readiness indicator (basically that the network started producing blocks) in order to delay next CI steps until the block production is started.
Ready check from

type ServiceReady interface {
	Ready(instance *instance) error
}

is one another thing I was looking to implement this feature, but problem it that it is readiness for a specific service, not recipe and generally it makes more sense to me to make it recipe based, so it will be more flexible.

@ferranbt
Copy link
Collaborator

My bad, it was not the watchdog but the service ReadyCheck. Internally this is used to create dependencies between services. You can extend this concept easily and a recipe is not ready until all the ready checks are ok.

it makes more sense to me to make it recipe based, so it will be more flexible.

Do you have any use case in mind for this? I cannot think of any in which it is not enough to validate the readiness of each service and not the recipe as a whole.

@gpevnev
Copy link
Contributor Author

gpevnev commented Nov 20, 2025

The only problem I can think of can be ordering. ex: for opstack it makes sense to first check readiness of L1 and only after that check L2.

I think it won't be critical, bc in the end we need all of readiness checks to pass anyway. I think we can make service level check work for now and redo it later to recipe level if some edge case arises

@ferranbt
Copy link
Collaborator

The only problem I can think of can be ordering. ex: for opstack it makes sense to first check readiness of L1 and only after that check L2.

This can be achieved with the DependsOnHealthy function.

@gpevnev gpevnev force-pushed the feat/add-network-readiness branch from 6399618 to 30e63d5 Compare November 28, 2025 11:26
@gpevnev
Copy link
Contributor Author

gpevnev commented Nov 28, 2025

@ferranbt I implemented ready check as part of ServceReady interface, please take a look and shoot me if you have any other suggestions

"--chain", "/data/genesis.json",
"--datadir", "/data_reth",
"--color", "never",
"--ipcpath", "/data_reth/reth.ipc",
Copy link
Collaborator

@ferranbt ferranbt Nov 28, 2025

Choose a reason for hiding this comment

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

I do not remember why right now, but I think it was important to have this. Sorry for not documenting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, let's leave this then, will revert

@ferranbt
Copy link
Collaborator

ferranbt commented Nov 28, 2025

@ferranbt I implemented ready check as part of ServceReady interface, please take a look and shoot me if you have any other suggestions

LGTM the service ready part. Medium term I think it would be nice to figure out how to do those checks as part of the docker-compose ready checks.

@gpevnev
Copy link
Contributor Author

gpevnev commented Nov 28, 2025

@metachris @ferranbt anything else to take into account here before we can merge it?

@metachris metachris merged commit 66b7dac into main Dec 3, 2025
8 checks passed
@metachris metachris deleted the feat/add-network-readiness branch December 3, 2025 08:29
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.

Support for contract deploys when the network is ready

4 participants