Repository navigation
fix: fund identities through DAPI Core, with Insight only as a fallback - #53
Merged
Merged
Conversation
Broadcast, tx status and raw transactions now go to Insight first and fall back to DAPI Core over gRPC-web (broadcastTransaction, getTransaction) on a 5xx, 429 or timeout. Core has no address index, so fund-from-key keeps a funding UTXO ledger next to the key file, serialised by a lock file so parallel mints chain change outputs, and deposits are found from the outpoint this tool paid. Same approach as the QA harness's DAPI-backed Insight shim, made concurrency-safe. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
dg auth new now sees the deposit on a bloom-filtered subscribeToTransactionsWithProofs feed of the address, replayed from the Core height recorded when the creation started, and reads the asset lock's height with getTransaction. Insight is only asked when the feed is idle or unavailable. Values still come from raw transactions whose txid is computed locally. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The browser talks gRPC-web to the evonodes' Core service directly: a bloom-filtered transaction feed watches the deposit address, broadcastTransaction sends the asset lock and getTransaction reads its height. Insight becomes an optional fallback asked when DAPI cannot answer. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… never pay twice Values come from raw transactions that hash to the expected txid (DAPI's and Insight's alike), so an under-reporting source cannot turn a deposit into fees. The ledger lock carries a token and a heartbeat and is broken only when its holder is gone, by renaming it aside; release frees only our own lock. An ambiguous broadcast failure re-sends the same signed bytes and switches inputs only after an explicit rejection. CI now runs the mint-identity tests. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Size the BLOOM_UPDATE_ALL filter for 50 elements so matched outpoints do not saturate it. Record the start height when the journal is created, before the address is shown, and start a few blocks earlier for node lag. Cap an unknown-start rewind at about a week and resume a reconnect past the blocks already replayed. A DAPI-only zero before --restart counts as unknown, since its history leaves out the mempool. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Same fixes as the CLI: a 50-element filter, the start height recorded only when this call created the journal (less a margin), a capped rewind, a timeout on the discard check, a DAPI-only zero treated as unknown, and no unobserved rejection from an in-flight read. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Warning Review limit reachedNext included review available in 24 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (27)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Why
Since 2026-09-27 05:49Z, devnet moutai's Insight explorer (
insight.moutai.networks.dash.org) has answered every request with503 Back-end server is at capacity. Identity funding depended on that one server in all three places:tools/mint-identityfund-from-key;dg auth new;So every mint stopped, and nine QA streams were stuck in retry loops. A single explorer is also a poor fit for a forge meant to have no server to trust.
The evonodes already serve Core over DAPI (dapi-grpc
core.proto:broadcastTransaction,getTransaction,getBlockchainStatus,getBestBlockHeight,subscribeToTransactionsWithProofs). This PR makes those the primary path and leaves Insight as an optional fallback. Every RPC used is incore.protoat the pinnedv4.2.0-beta.4tag, and rs-dapi serves it.What changes
dg auth new(crates/forge-core/src/funding.rs,platform/core_chain.rs,crates/dg/src/auth/new.rs)CoreChain/CoreTxFeedtraits, implemented onPlatformClientthrough the SDK's DAPI client.subscribeToTransactionsWithProofsfeed with a BIP37 filter on the deposit address (BLOOM_UPDATE_ALL, sized for 50 elements so matched outpoints do not saturate it). It replays from the Core height recorded in the journal before the address is shown, less 6 blocks for node lag, then follows the mempool and new blocks.DepositTrackerbuilds the unspent outputs from raw transactions whose txid it computes itself.getTransaction.--restart: the funds check treats a DAPI-only zero as unknown, because history mode leaves out the mempool.Web (
forge-web/lib/auth/dapi-core.ts,asset-lock.ts,create-identity.ts)x-grpc-web, and evo-sdk exposes no Core client.dapi-core.tsadds:subscribeToTransactionsWithProofsreader;startHeight.tools/mint-identityFORGE_FUNDING_BOOTSTRAP_TXIDS.mint-identityjob, because nothing ran these tests before.Tests (fail before, pass after)
crates/forge-corefunding::tests::insight_503_*: a local server answers every Insight request with 503.tools/mint-identity/test/dapi-fallback.test.mjs:forge-web/lib/auth/dapi-core.test.ts:cargo test -p forge-core -p dgandcargo clippy -D warningspass;pnpm testgives 950 passed; typecheck and lint are clean;npm testin mint-identity gives 23 passed.Live verification on moutai, with Insight returning 503 throughout
qa mint harness dapi-test 1, using this branch's mint-identity with no shim: identity6cfpN7yze1fdcKzG5eU11vtUUHo8R8jbZJ7xUeeWk4qY. Funding tx0d9919e8…, asset lock027b62f3…, chain proof at 88861.dg auth new --json: identityEPZW3kHi5m3DMRCY1kHJeeZGLKUcxwVWeoLZcMXhWTe5. Deposit seen on the DAPI bloom feed, asset locke337224d…, chain proof.e2e/v2-auth.spec.tsa2 ("create an identity in the browser"): passed in 3.5 min, identityGn9Cgzx4kxaV….dg auth newran at the same time from the shared ledger. Each spent its own chained change output (84262710…and3e8de4be…).Notes
--funding manualin mint-identity still needs Insight to notice a payment nobody told it about. DAPI has no address index, and the tool has no feed.TESTNEThas no DAPI list, so it stays Insight-only).dgand the web watch through DAPI on every network:dguses the nodes its SDK client is connected to, and the web uses the deployment file'sdapiAddresses. InstantSend proofs on testnet are unchanged.🤖 Generated with Claude Code