feat: implement SorobanOracle with local RPC integration harness - #108
Open
jiggy-techy wants to merge 3 commits into
Open
feat: implement SorobanOracle with local RPC integration harness#108jiggy-techy wants to merge 3 commits into
jiggy-techy wants to merge 3 commits into
Conversation
Implements the SorobanOracle live client (issue Gryd-lock#92): builds and simulates the risk-oracle contract's get_score invocation via Soroban RPC, decodes the returned 0-100 score, and maps failures to the shared OracleError hierarchy. Adds a self-contained local integration harness (tests/integration) that emulates a Soroban RPC endpoint in-process over HTTP and drives the real get_score boundary - including invalid/unknown destinations, contract reverts, malformed responses, RPC failures, and timeouts - with no external network access. The suite runs via npm run test:integration and as a required CI job separate from the fast unit tests. Closes Gryd-lock#92
Contributor
|
hello good day,please some tests are failing,please rectify |
Contributor
|
please pass failing tests |
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.
Closes #92
Summary
Implements the
SorobanOraclelive client and a self-contained local Soroban integration harness that verifies it against a Soroban-RPC-shaped endpoint with no external network access.SorobanOracle (
src/SorobanOracle.ts)get_score(destination)invocation via Soroban RPC (simulateTransaction); it is never submitted, so no signing keys are required.OracleErrorhierarchy: malformed destination →InvalidDestinationError, unknown/reverted destination →UnrecognizedDestinationError, unreachable/failing RPC →OracleUnavailableError, slow response →OracleTimeoutError, non-numeric or out-of-range return →ContractIncompatibilityError.getScoreDetailedreturns live provenance metadata (source: 'soroban',cacheStatus: 'live').src/index.tsto preserve the bundle-size tree-shaking guarantee (scripts/bundle-size.mjs); typedoc only scanssrc/index.ts.Local integration harness (
tests/integration/)riskOracleFixture.ts— representativeget_score(string) -> u32contract fixture backed by the same vendoredgrydlock-testkitscoresStubOracleuses.sorobanRpcHarness.ts— in-process HTTP Soroban RPC fixture server bound to127.0.0.1emulatingsimulateTransaction/getHealth, with behavior knobs for contract reverts, malformed return values, delays, and HTTP failures.SorobanOracle.integration.test.ts— 11 tests covering valid scores, invalid/unknown destinations, malformed responses, RPC failures, and timeouts.npm run test:integrationand as a requiredintegrationCI job, separate from the fast unit suite (tests/integration/**excluded fromvitest.config.ts).Verification
typecheck,lint,build,docs:checkpasstest:integration: 11/11 passnpm test: 215 passed; 2 pre-existing failures infixtureText.sync.test.ts(Windows CRLF checkout artifact, verified identical on the base commit)bundle-size: "StubOracle only" 9.57 KB under budget; the "full barrel" 14.99 KB exceeds its 14.00 KB budget — pre-existing upstream, verified identical on the base commit