Add Blend v2 integration test suite - #664
Open
aditya1702 wants to merge 14 commits into
Open
Conversation
aditya1702
force-pushed
the
blend/pr6-integration-tests
branch
from
July 15, 2026 20:52
6f67e5f to
39422d7
Compare
aditya1702
force-pushed
the
blend/pr6-integration-tests
branch
from
July 16, 2026 16:56
39422d7 to
a98eef2
Compare
aditya1702
force-pushed
the
blend/pr6-integration-tests
branch
2 times, most recently
from
July 21, 2026 18:45
8cc6a07 to
7cf40f1
Compare
aditya1702
force-pushed
the
blend/pr6-integration-tests
branch
from
July 22, 2026 19:26
d67184b to
e29e695
Compare
aditya1702
force-pushed
the
blend/pr6-integration-tests
branch
from
July 22, 2026 19:36
e29e695 to
930f6ad
Compare
aditya1702
force-pushed
the
blend/pr6-integration-tests
branch
from
July 22, 2026 20:02
930f6ad to
64ce80f
Compare
aditya1702
force-pushed
the
blend/pr6-integration-tests
branch
from
July 22, 2026 22:45
64ce80f to
81c3229
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds comprehensive Blend v2 standalone-network integration coverage across migration and live-ingestion paths, alongside supporting GraphQL, SDK, pricing, and rate-calculation changes.
Changes:
- Deploys and exercises a complete Blend v2 test stack.
- Adds Blend SDK models, queries, state-change decoding, and GraphQL resolvers.
- Refines emission/rate projection, oracle scoping, and complexity accounting.
Reviewed changes
Copilot reviewed 42 out of 50 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
cmd/serve.go |
Wires the Blend LP contract setting. |
internal/data/blend/oracle_prices.go |
Scopes backstop prices to the configured Comet contract. |
internal/data/blend/oracle_prices_test.go |
Tests scoped price retrieval. |
internal/data/blend/readers.go |
Removes the unused all-reserves reader. |
internal/data/blend/readers_test.go |
Removes its reader test. |
internal/integrationtests/main_test.go |
Adds Blend integration phases. |
internal/integrationtests/blend_test.go |
Implements migration and live-ingestion assertions. |
internal/integrationtests/infrastructure/main_setup.go |
Exposes ingestion catch-up waiting. |
internal/integrationtests/infrastructure/contract_deployment.go |
Adds deterministic salted deployment support. |
internal/integrationtests/infrastructure/contract_deployment_test.go |
Tests contract-address precomputation. |
internal/integrationtests/infrastructure/blend_setup.go |
Deploys and configures the Blend stack. |
internal/integrationtests/infrastructure/blend_operations.go |
Adds Soroban value builders and actor execution. |
internal/integrationtests/infrastructure/blend_operations_test.go |
Tests Blend operation infrastructure. |
internal/integrationtests/infrastructure/blend_fixtures.go |
Defines two-phase Blend operations. |
internal/integrationtests/infrastructure/blend_contracts.go |
Adds typed contract wrappers. |
internal/integrationtests/infrastructure/testdata/blend/README.md |
Documents WASM provenance and hashes. |
internal/integrationtests/infrastructure/testdata/blend/comet.wasm |
Provides the pinned Comet contract. |
internal/integrationtests/infrastructure/testdata/blend/comet_factory.wasm |
Provides the Comet factory. |
internal/integrationtests/infrastructure/testdata/blend/emitter.wasm |
Provides the emissions contract. |
internal/integrationtests/infrastructure/testdata/blend/oracle.wasm |
Provides the mock oracle. |
internal/integrationtests/infrastructure/testdata/blend/pool_factory.wasm |
Provides the pool factory. |
internal/services/blend/validator.go |
Pins standalone BLND and backstop addresses. |
internal/services/blend/validator_test.go |
Tests standalone address pins. |
internal/services/blend/rates.go |
Refines rate and emissions projection. |
internal/services/blend/rates_test.go |
Tests projection behavior. |
internal/serve/serve.go |
Wires pricing configuration and complexity rules. |
internal/serve/complexity_test.go |
Tests nested Blend complexity. |
internal/serve/graphql/schema/statechange.graphqls |
Documents lending state changes. |
internal/serve/graphql/schema/queries.graphqls |
Adds Blend pool queries. |
internal/serve/graphql/schema/blend.graphqls |
Revises Blend types and fields. |
internal/serve/graphql/schema/account.graphqls |
Adds account Blend positions. |
internal/serve/graphql/generated/generated.go |
Regenerates GraphQL execution code. |
internal/serve/graphql/generated/models_gen.go |
Regenerates Blend models and enums. |
internal/serve/graphql/resolvers/resolver.go |
Stores the configured Comet contract. |
internal/serve/graphql/resolvers/queries.resolvers.go |
Adds pool query resolvers. |
internal/serve/graphql/resolvers/account.resolvers.go |
Adds the positions resolver. |
internal/serve/graphql/resolvers/blend.resolvers.go |
Removes superseded generated resolvers. |
internal/serve/graphql/resolvers/blend_positions.go |
Updates positions, emissions, and pricing. |
internal/serve/graphql/resolvers/blend_positions_test.go |
Tests position assembly and projection. |
internal/serve/graphql/resolvers/blend_pools.go |
Adds status mapping and projected APRs. |
internal/serve/graphql/resolvers/blend_pools_test.go |
Tests pool catalog behavior. |
internal/serve/graphql/resolvers/blend_earn.go |
Removes the earn-options resolver. |
internal/serve/graphql/resolvers/blend_earn_test.go |
Removes earn-options tests. |
pkg/wbclient/client.go |
Adds Blend client methods. |
pkg/wbclient/client_blend_test.go |
Tests Blend client requests. |
pkg/wbclient/queries.go |
Adds Blend GraphQL selections. |
pkg/wbclient/queries_test.go |
Tests query-field coverage. |
pkg/wbclient/types/blend.go |
Adds Blend SDK response types. |
pkg/wbclient/types/blend_test.go |
Tests Blend decoding. |
pkg/wbclient/types/statechange.go |
Adds lending state-change decoding. |
Files not reviewed (1)
- internal/serve/graphql/resolvers/account.resolvers.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aditya1702
force-pushed
the
blend/pr6-integration-tests
branch
from
July 30, 2026 16:28
6e4e3e3 to
0a45456
Compare
Blend pool/positions/earn-options query builders and client methods, plus client-side DTOs and inline fragments for the eight concrete Blend state-change types, registered through the generic unmarshal dispatch and the schema-validation test.
…or tables Read blend_pool_claimed/blend_backstop_claimed via the new GetByAccount readers after phase-2 live ingestion and assert the supplier's pool claim and whale's backstop claim folded positive totals. Guard that phase-1 (no claims) leaves both accumulator tables empty.
…s survive The canonical-backstop pin resolves to empty on the standalone network, which made the processor drop every backstop-shaped entry and event as a non-canonical impostor — BlendMigrationTestSuite failed on the whale's missing blend_backstop_positions row. The suite deploys the backstop from the master account (keypair.Root of the passphrase) with a fixed salt, so its address is a deterministic function of the passphrase alone. Pin it in canonicalBackstopAddress the same way blndTokenAddress pins the standalone BLND SAC: unit test + a deploy-time assertion in SetupBlendStack.
Absorbs the review-round API changes on blend/pr5-graphql: drops the GetBlendEarnOptions client method, query, and types (the query was removed - earn discovery composes from blendPools); BlendPool.status becomes the BlendPoolStatus enum string; BlendReservePosition's single emissionsApr splits into emissionsSupplyApr/emissionsBorrowApr. Claimable-emission assertions were already sign-based, so the projected-to-now claimable math needs no test changes.
aditya1702
force-pushed
the
blend/pr6-integration-tests
branch
from
July 30, 2026 21:39
0a45456 to
5622e37
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.
Deploys the full Blend v2 protocol stack (Comet BLND:USDC LP, mock SEP-40 oracle, emitter, pool factory, backstop, one pool with USDC/XLM reserves) on the standalone integration-test network — replicating blend-utils'
mock-example.tsdeployment order (pinned commitb05242df, wasm provenance + sha256s ininfrastructure/testdata/blend/README.md) — then executes real Blend operations and asserts DB state and GraphQL responses through both ingestion paths.Coverage
new_auction→ 50% fill; both (BLEND_AUCTION, FILL) counterparty rows withauctionType/counterparty/lot/bidasserted + auction position folds), backstop deposit (BLEND_BACKSTOP, CREDIT), and queue/dequeue withdrawal (BLEND_BACKSTOP_QUEUE, ADD/REMOVE).claimedBlnd,backstopClaimedLp,token_id = -1backstop streams), exactnet_supplied/net_borrowedcost-basis folds, Q4W JSONB with the ~17-day expiration observed live over GraphQL while queued, and lifetime claimed totals (blend_pool_claimed/blend_backstop_claimedfold positive after the phase-2 claims, with a phase-1 both-empty guard).BlendMigrationTestSuiterunsprotocol-setup→protocol-migrate current-state→protocol-migrate history(datastore backend, MinIO-fed by the ledger exporter) with cursor-handoff pre/post assertions — the history mode's first automated coverage.BlendLiveIngestionTestSuiterestarts ingest withBLEND_PRICE_INTERVAL/BLEND_BACKSTOP_LP_CONTRACT_ID— and the API container with the same LP pin (newRestartAPIContainerhelper; the resolvers price backstop USD through it, and the restarted container's fresh host port re-pointsWBClient) — then asserts the full Freighter-facing GraphQL surface (blendPools,blendPool,account.blendPositionsincl.activeAuctionsfor the partially-filled liquidation, Blend state changes incl.fillPercent). Ingest catch-up waits poll the RPC tip vs the ingest cursor (WaitForIngestCatchup) instead of fixed sleeps. The API container pinsGRAPHQL_COMPLEXITY_LIMIT=30000: the SDK's full-selection catalog query costs ~26k under the server's complexity accounting (deliberate — the suite selects every field).Not covered end-to-end (unit tests only)
ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTINGonly accelerates ledger cadence, not close time, so the lockup cannot elapse on standalone.Production changes
blndTokenAddress(internal/services/blend/validator.go) gains a standalone-network case: the suite issues BLND from the network master account (keypair.Rootof the passphrase), so its SAC address is a fixed constant, letting pool emissions-claim rows carry the real BLNDtoken_idon standalone. Pinned by a unit test and asserted at deploy time in the test setup.canonicalBackstopAddress(same file) gains the matching standalone-network case: the processor folds backstop-shaped entries/events only from the canonical backstop, and on an unpinned network that pin resolves to empty and drops all backstop state (which is what failed this suite — the whale'sblend_backstop_positionsrow never materialized). The suite deploys the backstop from the master account with a fixed salt, so its address is deterministic and pinned the same way: unit test + deploy-time assertion.pkg/wbclientgains Blend query methods (GetBlendPools,GetBlendPool,GetAccountBlendPositions) and client-side DTOs + inline fragments for the eight concrete Blend state-change types, registered through the generic unmarshal dispatch and validated against the real schema byschema_validation_test.go, with unit tests. The DTOs mirror the schema completely:BlendPool.admin/inRewardZoneandBlendAccountPositions.activeAuctions(newBlendAuctionDTO), enforced by the struct↔fragment parity test.Test infrastructure added
executeSorobanOperationAs): arbitrary tx source, RPC-fresh sequences, simulation-provided auth nonces (the existing helper hardcodes nonce 0, safe only for the master account's first use).Blend phase adds ~100s to
make integration-test(total run ~4.5 min, well under the 30m timeout). Verified green twice, including aFORCE_REBUILD=truefrom-scratch run.🤖 Generated with Claude Code