Skip to content

fix(playground): repair local compose config; prettier test_playground.sh output#4352

Merged
igorroncevic merged 7 commits intomainfrom
fix/playground_startup
Apr 27, 2026
Merged

fix(playground): repair local compose config; prettier test_playground.sh output#4352
igorroncevic merged 7 commits intomainfrom
fix/playground_startup

Conversation

@igorroncevic
Copy link
Copy Markdown
Contributor

@igorroncevic igorroncevic commented Apr 21, 2026

Description

Fix the local playground setup so the Docker stack starts cleanly and playground/test_playground.sh works end to end again.

This was needed because several local-only config mismatches had accumulated:

  • tempo was crashing on startup because playground/tempo.yaml used old config fields that the current grafana/tempo:latest image no longer accepts
  • orderbook was not reachable correctly because wrong config was being loaded
  • autopilot was missing the local database and EthFlow config needed to pick up and process the onchain test order
  • driver was trying to reach orderbook on the wrong internal port

Less importantly, test_playground.sh had rough edges in its output and did not print the settlement transaction hash after a successful run.

Error details seen locally

These are the main errors that showed up while debugging:

1. Tempo / tracing startup failure

driver was logging OpenTelemetry export failures like:

BatchSpanProcessor.ExportError ... error="Operation failed: code: 'The service is currently unavailable', message: \"dns error\", source: tonic::transport::Error(Transport, ConnectError(ConnectError(\"dns error\", Custom { kind: Uncategorized, error: \"failed to lookup address information: Name or service not known\" })))"

This looked like DNS, but the real issue was that tempo never came up because its config was invalid for the current image.

2. Early readiness / connection reset failures

Running the playground test initially failed during readiness checks with:

curl: (56) Recv failure: Connection reset by peer

This came from orderbook not starting correctly and from an incorrect config being passed to it.

3. Autopilot startup crash

Before the local config was fixed, autopilot crashed during startup with a panic around:

thread 'main' panicked at crates/autopilot/src/run.rs:185:6

This was caused by missing database configuration in the local playground config.

4. Driver could not talk to orderbook internally

When orders started reaching the solver path, driver still failed to fetch app data because it was calling orderbook on the wrong internal port due to the wrong config:

failed to fetch app data ... err=Http("error sending request for url (http://orderbook/api/v1/app_data/...)")

5. Solve request timing mismatch

autopilot would submit a solve request, driver would compute and score a valid settlement, but autopilot would still time out waiting for the response. The visible symptom was:

solver didn't provide solutions err=Failure(send
0: error sending request for url (http://driver/baseline/solve)

The root cause was that the default local solve deadline was too long for this playground test flow, so driver kept the solve request open much longer than the script expected.

Changes

  • Docker
    • Update playground/tempo.yaml to the config format accepted by the current Tempo image
    • Remove obsolete Tempo config sections and add the expected local trace storage/WAL paths
    • Add shared node configuration to playground/configs/orderbook.toml
    • Fix the orderbook config being passed to it
    • Add database configuration to playground/configs/autopilot.toml
    • Add local EthFlow contract configuration to playground/configs/autopilot.toml
    • Set a short local solve-deadline in playground/configs/autopilot.toml so the playground test does not wait on production-style timing
  • test_playground.sh
    • Extend playground/test_playground.sh to print the settlement transaction hash after success
    • Extend playground/test_playground.sh to print a ready-to-run cast receipt command and an Otterscan transaction URL
    • Clean up playground/test_playground.sh status output so expected pre-indexing 404 responses are shown as indexing
Screenshot 2026-04-24 at 16 12 03

How to test

  1. Start the local playground stack with the fork compose file:
    docker compose -f playground/docker-compose.fork.yml up -d
  2. Run the smoke test:
    cd playground && ./test_playground.sh
  3. Confirm the status progresses through local indexing / execution states and ends in traded
  4. Confirm the script prints:
    • the settlement transaction hash
    • a cast receipt ... --rpc-url http://localhost:8545 command
    • an Otterscan URL for the transaction
  5. Optionally verify the settlement manually with the printed cast receipt command or by opening the printed Otterscan URL

@igorroncevic igorroncevic self-assigned this Apr 21, 2026
@igorroncevic igorroncevic requested a review from a team as a code owner April 21, 2026 10:52
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@igorroncevic
Copy link
Copy Markdown
Contributor Author

igorroncevic commented Apr 21, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates configurations for autopilot, driver, and orderbook services, including database URLs, ethflow settings, and port adjustments. It also refines the Tempo storage setup and enhances the test_playground.sh script with improved status polling and settlement transaction reporting. Feedback focuses on ensuring shell script portability by replacing echo -e with printf and restoring robustness to curl commands by re-adding retry flags in the polling loop.

Comment thread playground/test_playground.sh Outdated
Comment thread playground/test_playground.sh
github-actions Bot added a commit that referenced this pull request Apr 21, 2026
Copy link
Copy Markdown
Contributor

@jmg-duarte jmg-duarte left a comment

Choose a reason for hiding this comment

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

config changes look ok but i have some questions

Comment thread playground/test_playground.sh Outdated

# Setup parameters
HOST=localhost:8080
OTTERSCAN_URL=${OTTERSCAN_URL:-http://localhost:8003}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isnt this set by default in the dockerfile + docker compose?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Compose defines the port mapping, but it does not export OTTERSCAN_URL into the host shell.

The script runs on the host, so if we want a configurable value here we need to set it in the script or require the user to export it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

but the script doesnt care for otterscan, the test_playground is something one off
and writing it here doesnt export is to the host shell either, scripts spawn they own bash shells so when they finish the variables basically get wipped

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point, I'll simply hardcode it to http://localhost:8003 so it's easier to find

- db-migrations
ports:
- 8080:80 # API
- 8080:8080 # API
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this really necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm seeing that orderbook launches on 8080 internally, so shouldn't it be necessary?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that's the default, the change above maps 8080 on docker to 80 on host, which should allow you to write localhost instead of localhost:8080

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Isn't it viceversa? host:container? so the second 8080 relates to container port which orderbook currently launches on?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

@igorroncevic igorroncevic Apr 22, 2026

Choose a reason for hiding this comment

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

ah, I see the issue. playground/docker-compose.fork.yml:

Looks like that's a leftover from before, so I'd like to just delete playground/orderbook.toml and fix playground/configs/orderbook.toml to use port 80. Sounds good?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, lets make this playground/configs/orderbook.toml be the only one left
You can also delete configs/local/orderbook.toml

write-url = "%DB_WRITE_URL"
read-url = "%DB_READ_URL"

[ethflow]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this change should be necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm seeing here that it's a required value and it gave me errors without it. Perhaps I'm wrong but it seemed like it just didn't have that value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this doesn't hurt being here, but it shouldnt be required, it just wont index ethflow trades

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

test_playground actually creates an EthFlow order, so this should be here because of it.

@igorroncevic igorroncevic force-pushed the fix/playground_startup branch from df44f2a to d679bc7 Compare April 22, 2026 11:17
Comment thread playground/test_playground.sh
@igorroncevic igorroncevic requested a review from jmg-duarte April 24, 2026 14:13
Copy link
Copy Markdown
Contributor

@jmg-duarte jmg-duarte left a comment

Choose a reason for hiding this comment

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

LGTM

@igorroncevic igorroncevic added this pull request to the merge queue Apr 27, 2026
Merged via the queue into main with commit 5ff7b4f Apr 27, 2026
21 checks passed
@igorroncevic igorroncevic deleted the fix/playground_startup branch April 27, 2026 10:53
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants