fix(demo): read nonce and estimate fees at pre-confirmed block - #907
Open
avi-starkware wants to merge 1 commit into
Open
fix(demo): read nonce and estimate fees at pre-confirmed block#907avi-starkware wants to merge 1 commit into
avi-starkware wants to merge 1 commit into
Conversation
The deposit flow submits dependent account transactions (approve, then the proof invocation) and only waits for PRE_CONFIRMED between them, but the RPC provider used the default `latest` block tag for nonce reads and fee estimation. A pre-confirmed transaction is not yet in `latest`, so the follow-up transaction was built with a stale nonce and sporadically failed estimateFee with "Invalid transaction nonce ... Account nonce: N; got: N-1". Pin the provider's default block tag to PRE_CONFIRMED so nonce reads and fee estimates match the state the flow already waits for. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Deploy preview for starknet-privacy-demo ready! ✅ Preview Built with commit 9ba15e4. |
Yoni-Starkware
approved these changes
Jul 15, 2026
Yoni-Starkware
left a comment
Collaborator
There was a problem hiding this comment.
@Yoni-Starkware reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on avi-starkware).
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.

Problem
The deposit flow submits dependent account transactions (approve, then the proof invocation) and only waits for
PRE_CONFIRMEDbetween them, but the RPC provider used the defaultlatestblock tag for nonce reads and fee estimation. A pre-confirmed transaction is not yet inlatest, so the follow-up transaction was built with a stale nonce and sporadically failedestimateFee:Account.getNonce()and fee estimation both fall back to the provider's default block tag (BlockTag.LATESTin starknet.js v10), which lags a merely pre-confirmed tx — so the next tx reads a nonce that becomes stale the instant the earlier tx is accepted. Intermittent because it depends on when the approve crosses pre-confirmed→accepted relative to the deposit's nonce fetch and estimate.Fix
Pin the provider's default block tag to
PRE_CONFIRMEDincreateProvider(demo/src/starknet.ts) so nonce reads and fee estimates use the same state the flow already waits for (WAIT_OPTIONS→PRE_CONFIRMED).Verification
tsc --noEmit, eslint, and prettier clean on the changed file.🤖 Generated with Claude Code
This change is