feat(scenarios): add HumidiFi state preparation - #16
Open
92Infinitus92 wants to merge 2 commits into
Open
Conversation
92Infinitus92
force-pushed
the
wip/humidifi-rebuild
branch
from
September 14, 2026 13:29
dd2c404 to
79e1e95
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HumidiFi markets can now be discovered and prepared through the existing scenario and MCP paths. Adds fair-value, persistent-freshness, stale-quote and liquidity scenarios, with an explicitly selected market and guarded raw-layout writes. Fair-value scenarios fetch the market before Play, then keep its quote fresh locally.
Stacked on #15 (
feat/scenarios/raw-layout). Reuses its raw-layout materializer and registry loader, adding an optional eight-byte XOR mask for HumidiFi account fields.Validation:
cargo fmt --all -- --checkcargo test --offline --workspace --features surfpool-core/ignore_tests_ci -- --test-threads=1: 943 passed, 0 failed, 66 ignored.cargo test --offline -p surfpool-core --features integration-tests tests::humidifi -- --test-threads=1 --nocapture: 10 passed, including deployed-program swap and exact account-byte checks.cargo clippy --offline --workspace --all-targets: exit 0, existing warnings.cargo build --offline --release --features supervisor_ui: exit 0.The live integration tests execute the deployed HumidiFi program in the test VM through the documented DFlow test wrapper.
Greptile Summary
This PR adds HumidiFi market discovery and scenario preparation across the core scenario registry, MCP interface, and supporting HTTP serialization path.
Confidence Score: 5/5
The PR appears safe to merge, with no outstanding previous findings or accepted new defects.
Both previous findings were resolved after Greptile conceded that creation-time Surfnet reads hydrate the targeted accounts and that Play-time refetching would overwrite prepared local state. The subsequent raw-layout validation changes are consistent with the loader and materializer contracts, and no new actionable failure remains.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Client or Studio] --> B[MCP HumidiFi tool] B --> C[Surfnet RPC account reads] C --> D[Validate market owner, layout, schema, mints, and vaults] D --> E{Scenario type} E -->|Fair value| F[Convert human price to masked fixed-point value] E -->|Liquidity| G[Scale hydrated vault balances] F --> H[Build scenario overrides] G --> H H --> I[Register scenario] I --> J[Play through raw-layout materializer] J --> K[Prepared HumidiFi market and vault state] K --> L[Persistent freshness reapplied each slot]Reviews (3): Last reviewed commit: "fix(humidifi): preserve prepared state i..." | Re-trigger Greptile