Skip to content

Conversation

merolish
Copy link
Contributor

Summary

HIP-3 pusher application draft.

Rationale

Serve as market data provider for HIP-3 deployers.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Copy link

vercel bot commented Sep 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
api-reference Ready Ready Preview Comment Sep 17, 2025 9:17pm
component-library Ready Ready Preview Comment Sep 17, 2025 9:17pm
developer-hub Ready Ready Preview Comment Sep 17, 2025 9:17pm
entropy-explorer Ready Ready Preview Comment Sep 17, 2025 9:17pm
insights Ready Ready Preview Comment Sep 17, 2025 9:17pm
proposals Ready Ready Preview Comment Sep 17, 2025 9:17pm
staking Ready Ready Preview Comment Sep 17, 2025 9:17pm

@merolish merolish merged commit f77e3ed into main Sep 18, 2025
9 checks passed
@merolish merolish deleted the mike/hip-3-pusher branch September 18, 2025 02:22
Copy link
Contributor

Choose a reason for hiding this comment

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

Pls dont forget to add a readme!

Comment on lines +7 to +15
dependencies = [
"asn1crypto>=1.5.1",
"boto3>=1.40.31",
"cryptography>=45.0.7",
"hyperliquid-python-sdk>=0.19.0",
"loguru>=0.7.3",
"toml>=0.10.2",
"websockets>=15.0.1",
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Using >= opens us to to breaking major version changes. Let's use ^ (minor version updates allowed) or ~= (patch version updates allowed).

Comment on lines +19 to +30
# Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=apps/hip-3-pusher/uv.lock,target=uv.lock \
--mount=type=bind,source=apps/hip-3-pusher/pyproject.toml,target=pyproject.toml \
uv sync --locked --no-install-project --no-dev

# Then, add the rest of the project source code and install it
# Installing separately from its dependencies allows optimal layer caching
COPY apps/hip-3-pusher/src/ ./src/
COPY apps/hip-3-pusher/config/ ./config/
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev
Copy link
Contributor

Choose a reason for hiding this comment

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

Great that we have proper layer caching :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that was courtesy of the uv docker example. Astral is crushing it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also add **/config.toml to avoid accidentally pushing secrets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Intent is for the config.toml in git to be an example. Locally I use separately named config files, and of course k8s mounts our deployment configs.

Comment on lines +31 to +32
self.price_state.latest_oracle_price = ctx["oraclePx"]
self.price_state.latest_mark_price = ctx["markPx"]
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also store the timestamp so we know how stale the price is in case the data source disconnects and have to serve stale prices. It could also inform fallback behavior (it can choose the most recent price from the backup data sources.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Nvm, i see you do this in #3061

Copy link
Contributor

Choose a reason for hiding this comment

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

Will hold off on reviewing this file since its WIP

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately yes, hopefully I can get it to match, it's unfortunately a bit of reverse engineering both KMS and the sdk and eth libraries.

hermes_listener = HermesListener(config, price_state)

# TODO: Probably pull this out of the sdk.
hyperliquid_listener.subscribe()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if the HL subscribe() function uses asyncio? Asking because the other components use asyncio which is convenient because its a single-threaded event loop, and there's no locking/synchronization needed on price_state. But if the HL SDK isn't using that, we might have to worry about synchronizing price_state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per other comment, planning to do this myself.

self.enable_kms = True
oracle_account = None
kms_key_path = config["kms"]["key_path"]
kms_key_id = open(kms_key_path, "r").read().strip()
Copy link
Contributor

Choose a reason for hiding this comment

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

use Pathlib's read_text for FS operations like this (it also closes the file for you)

Comment on lines +82 to +85
if feed_id == self.base_feed_id:
self.price_state.lazer_base_price = price
if feed_id == self.quote_feed_id:
self.price_state.lazer_quote_price = price
Copy link
Contributor

Choose a reason for hiding this comment

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

what are we using base_price and quote_price for? i noticed we don't push them anywhere in publisher.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

HL oracle prices are denominated in USDT, so for pyth prices I'm dividing BTCUSD / USDTUSD.

Comment on lines +6 to +8
pull_request:
paths:
- "apps/hip-3-pusher/**"
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably don't want to build and push whenever a PR is opened/updated. Would remove this trigger

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The push part actually doesn't happen on PRs for whatever reason. Somebody on the team explained it to me at some point when I was working on agent.

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