Skip to content

refactor: remove native Hyperliquid integration - #130

Open
0xdewy wants to merge 12 commits into
masterfrom
feat/remove-hyperliquid-native
Open

refactor: remove native Hyperliquid integration#130
0xdewy wants to merge 12 commits into
masterfrom
feat/remove-hyperliquid-native

Conversation

@0xdewy

@0xdewy 0xdewy commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes Bloom's native Hyperliquid integration and replaces it with the pinned,
default-installed bloom-petal-hyperliquid package. This mirrors the prior
Polymarket extraction (#107): Bloom no longer mounts a native /hyperliquid
VFS subtree or exposes a bloom hyperliquid CLI, while bloom init now
provisions both external applications under /petals/.

What changed

  • Deleted bloom-hyperliquid — removed the native exchange client,
    signing implementation, HyperCore API surface, CLI, daemon IPC, and VFS
    handler.
  • Removed native-only state and policy models — including the ephemeral
    API-wallet keystore and obsolete Hyperliquid review/session types.
  • Added Hyperliquid to the default Petal catalog — pins the immutable
    v0.1.4 release
    by source commit, release archive, checksum-verified provenance, and package
    hash.
  • Preserved upgrade behavior — compatible legacy HTTPS HyperCore endpoint
    overrides migrate to petals.runtime.hyperliquid.endpoints; explicit new
    endpoint settings win, insecure origins fail with remediation, and explicit
    Petal opt-outs remain persistent.
  • Kept native deposit routing only[hyperliquid] now contains only the
    bridge address and deposit-chain settings used by Bloom's generic DeFi
    handler.
  • Protected legacy sealed keys — startup warns when removed native
    agent-key material remains on disk rather than silently abandoning it.
  • Updated product and agent documentation — README, quickstart, examples,
    VFS guidance, architecture docs, migration notes, and parity records now
    describe Hyperliquid as a default external Petal.

The external package was made release-ready in
Petal PR #1,
PR #2,
PR #3,
PR #4,
and PR #5.
PR #5 fixes large public /info responses by validating and returning the
original JSON bytes instead of materializing and pretty-printing a second tree.
This prevents the current testnet spotMetaAndAssetCtxs payload from trapping
inside the WASM route.

Net: 40 files changed, 1,351 insertions, 12,328 deletions (−10,977 lines).

Verification

  • cargo fmt --all -- --check — OK
  • cargo test -p bloom-proto — 149 passed
  • cargo test -p bloom github_source::tests — 18 passed
  • cargo test -p bloom-daemon legacy_hyperliquid_config_does_not_restore_native_surface — OK
  • cargo test -p bloom --test cli init_respects_persistent_preinstalled_petal_opt_out_without_network — OK
  • cargo clippy -p bloom-proto -p bloom --all-targets -- -D warnings — OK
  • Hyperliquid Petal PR [codex] add VFS agent guidance files #5 CI — OK: formatting, tests, clippy, all 62 route
    components, deterministic release packaging, local install/dispatch, and
    GitHub-source install/dispatch
  • v0.1.4 release verification — checksum OK, provenance bound to commit
    fa722a986c2a0a23977e9e00df54ebd291a686db, archive SHA-256
    22a9757ab07eeeb51340a4c98127d0d237d2533f5b78393bb266f45e2ea6c0bf,
    package hash
    1de2eb50b7ce0f0da03d3ef1ae6554c6f1b89393096d50183fe4f2dbca6b2af7,
    62 packaged routes
  • Fresh-home bloom init against published releases — installed Polymarket and
    Hyperliquid v0.1.4 with catalog provenance/hash validation
  • Published v0.1.4 ceremony-free functional matrix — 100/100 passed across
    both networks, public market/account reads, route discovery, stored-state
    reads, descriptions, invalid inputs, and every safe pre-signing write
    controller path
  • No signing, approval, session creation, exchange submission, or transaction
    broadcast was performed
  • Bloom PR CI on 5c3df49 — all checks passed: formatting, clippy, doctests,
    locked release build, test-archive build, unit tests, local integration
    tests, external E2E tests, and checklist enforcement

Checklist

  • Tests added or updated for default provisioning, persistent opt-out,
    catalog integrity, endpoint migration, and removed native-surface behavior.
  • Architecture docs updated for the external-Petal boundary.
  • Sealed Approval invariants respected: native signing paths are removed,
    and legacy sealed key material is detected.
  • Agent documentation updated for default Hyperliquid discovery and use.

@0xdewy
0xdewy marked this pull request as draft July 23, 2026 01:57
@0xdewy
0xdewy marked this pull request as ready for review July 23, 2026 02:56
0xdewy added 11 commits July 30, 2026 16:38
- Reject legacy mainnet_url/testnet_url keys in HyperliquidConfig
  (deny_unknown_fields) instead of silently swallowing them.
- Warn on startup when legacy sealed agent keys exist on disk
  under home/hyperliquid/.
- Add Enso config to legacy_hyperliquid_config test so the
  DeFi handler mount path is actually exercised.
…l migration

- Replace 5 stale Hyperliquid rows in parity ledger with single petal row.
- Condense GAP_PLAN sections 4/4.1 to note move to bloom-petal-hyperliquid.
- Update Interaction Modes and Sealed Approvals to list Hyperliquid
  as an installed Petal, not a native built-in.
- Update Agent-native Documentation example to reference the installed
  Petal README.
@0xdewy
0xdewy force-pushed the feat/remove-hyperliquid-native branch from 71fd28e to 886952f Compare July 30, 2026 19:46

@violet-agent violet-agent left a comment

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.

Requesting changes for the five blocking/correctness issues documented inline: the migration does not recognize the actual prior default config, stateful Hyperliquid Petal replacement has no session/key continuity boundary, the recommended session overstates safety guarantees, the documented write payloads do not parse against the pinned Petal, and core status retains a misleading native-style Hyperliquid mention. I reproduced the migration, payload, and status failures locally and reviewed the exact pinned v0.1.4 Petal implementation.

Comment thread crates/bloom-proto/src/config.rs Outdated
let had_legacy_hyperliquid_surface = legacy_hyperliquid.is_some_and(|table| {
table.get("mainnet_url").is_some() || table.get("testnet_url").is_some()
});
if had_legacy_hyperliquid_surface && self.petals.preinstalled == ["polymarket"] {

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.

Blocking migration bug: this recognizes the wrong generated legacy shape. At base commit f84f5f7, default_preinstalled_petals() serialized ["polymarket", "near-intents", "enso"], not a Polymarket-only list. I loaded that exact base-shaped config through this PR: the endpoints migrated, but hyperliquid_present=false. Because this PR removes the native surface, ordinary existing users lose Hyperliquid without receiving the replacement Petal. Please migrate the actual prior default while preserving explicit empty/custom lists, and add a regression fixture serialized from the base-version default rather than a hand-built Polymarket-only fixture.

fn preinstalled_petal(name: &str) -> Option<&'static PreinstalledPetal> {
match name {
"polymarket" => Some(&PREINSTALLED_POLYMARKET),
"hyperliquid" => Some(&PREINSTALLED_HYPERLIQUID),

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.

Blocking state-continuity gap: cataloguing Hyperliquid here opts a stateful trading package into the generic Outdated auto-replacement path used by init/serve. Replacement swaps the package owner to a new content hash, while bloom:store reads/writes are namespaced by package hash. The pinned Petal stores both session.json and the secret agent key in that store, so the replacement cannot recover the old package's active sessions/keys even though delegated venue authority and open orders may remain live. Please define an explicit migration/quiescence/revocation boundary (or a safe stable application-state identity) before automatically updating this Petal, and cover an upgrade with persisted active-session state.

Comment thread EXAMPLES.md Outdated

# 2) Create the session (one approveAgent signature)
echo '{}' > /bloom/hyperliquid/mainnet/agent_sessions/<wallet>/new.json
echo '{"id":"bounded-session"}' \

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.

Blocking safety mismatch: this exact request supplies no max_notional_usd, max_leverage, or assets. In pinned v0.1.4 those are optional; empty assets means all assets, and absent caps are not enforced. The Petal also has no background loss/position monitor or automatic breach flattening; expiry only rejects subsequent route writes. That contradicts the immediately preceding claims that this trades inside policy bounds and auto-flattens on risk breach. Please either implement and test those guarantees (including required bounds and cleanup/revocation), or remove the claims and do not recommend this unbounded session shape.

Comment thread EXAMPLES.md Outdated
echo '{"asset":"ETH","is_buy":true,"order_type":"Limit",
"price":"3000","sz":"0.01","reduce_only":false}' \
> /bloom/hyperliquid/mainnet/agent_sessions/<wallet>/<session>/order.json
> /bloom/petals/hyperliquid/mainnet/agent_sessions/<wallet>/<session>/order.json

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.

Blocking documentation/API mismatch: the body above retains the removed native handler's friendly JSON schema. Pinned Petal v0.1.4 expects SignSubmit { action: ExchangeAction, ... }, with a tagged nested action and Hyperliquid wire-order fields/numeric asset IDs. Compiling the documented order and update-leverage bodies against the pinned parser produces missing field 'action' for both. Please update the session and direct-exchange examples to the actual v0.1.4 schema and make them executable documentation tests against the pinned artifact so this cannot drift again.

Comment thread crates/bloom/src/main.rs Outdated
} else {
println!("hyperliquid_vfs: disabled (add [hyperliquid] to config.toml)");
}
println!("hyperliquid_vfs: default Petal (/petals/hyperliquid)");

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.

Please remove hyperliquid_vfs and audit/remove other dangling native-surface Hyperliquid mentions from the core Bloom codebase rather than converting this one into an unconditional Petal advertisement. This line is already incorrect when [petals] preinstalled = [] or installation is absent: I reproduced a fresh home with zero Petal owners that still printed hyperliquid_vfs: default Petal. Core status should either report actual installed Petals generically or omit this line. Retain only deliberately shared protocol/deposit/signing identifiers that the external Petal host boundary still requires.

@0xdewy

0xdewy commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all five review threads in commit 7f1170d:

  • Legacy config migration now recognizes the exact pre-Hyperliquid default list (polymarket, near-intents, enso) from a serialized base-config fixture. Explicit empty and custom install selections remain unchanged, and endpoint overrides are preserved.
  • Hyperliquid package upgrades now fail safe at an explicit state boundary. Bloom keeps the old package active and instructs the operator to quiesce activity, cancel or close live work, revoke venue authority, uninstall, and rerun init. A regression test proves persisted session state and agent secrets are not stranded or replaced.
  • Session documentation now matches v0.1.4: caps are optional, enforcement is per write, and there is no background monitor, automatic flattening, or authority revocation.
  • Hyperliquid examples now use the pinned tagged SignSubmit / ExchangeAction schema with numeric asset IDs. An external CI test extracts the documented JSON and executes it against the exact pinned v0.1.4 package, verifying deserialization through the downstream host boundary.
  • Removed the unconditional hyperliquid_vfs status entry and unreachable native Hyperliquid approval UI branches.

Validation completed successfully: formatting, diff checks, Clippy with warnings denied, bloom-proto, bloom, CLI, keystore, the ignored pinned-package documentation test, and cargo test --workspace --lib.

The pinned test also exposed a separate confirmed defect in the published Hyperliquid Petal v0.1.4 after deserialization: session creation writes pending key material under the public state namespace with the secret flag, so the host rejects it. v0.1.4 is still the newest release and the Petal main branch still contains that behavior. A Petal patch release plus catalog repin is needed for full session creation; this PR does not claim that runtime defect is fixed. No production signing, order submission, or broadcast was performed.

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